Commit 4980d968 authored by matt mooney's avatar matt mooney Committed by Greg Kroah-Hartman

staging: usbip: usbip_common.h: coding style cleanup

Use the compiler macro __packed, fix a few alignment issues, and
remove extraneous lines.
Signed-off-by: default avatarmatt mooney <mfm@muteddisk.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c6956c97
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#ifndef __VHCI_COMMON_H #ifndef __VHCI_COMMON_H
#define __VHCI_COMMON_H #define __VHCI_COMMON_H
#include <linux/version.h> #include <linux/version.h>
#include <linux/compiler.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
* @fmt: * @fmt:
* @args: * @args:
*/ */
#ifdef CONFIG_USB_IP_DEBUG_ENABLE #ifdef CONFIG_USB_IP_DEBUG_ENABLE
#define usbip_udbg(fmt, args...) \ #define usbip_udbg(fmt, args...) \
...@@ -53,7 +52,6 @@ ...@@ -53,7 +52,6 @@
#endif /* CONFIG_USB_IP_DEBUG_ENABLE */ #endif /* CONFIG_USB_IP_DEBUG_ENABLE */
enum { enum {
usbip_debug_xmit = (1 << 0), usbip_debug_xmit = (1 << 0),
usbip_debug_sysfs = (1 << 1), usbip_debug_sysfs = (1 << 1),
...@@ -117,7 +115,6 @@ extern struct device_attribute dev_attr_usbip_debug; ...@@ -117,7 +115,6 @@ extern struct device_attribute dev_attr_usbip_debug;
#define usbip_dbg_stub_tx(fmt, args...) \ #define usbip_dbg_stub_tx(fmt, args...) \
usbip_dbg_with_flag(usbip_debug_stub_tx, fmt , ##args) usbip_dbg_with_flag(usbip_debug_stub_tx, fmt , ##args)
/** /**
* usbip_uerr - print error messages * usbip_uerr - print error messages
* @fmt: * @fmt:
...@@ -140,7 +137,6 @@ extern struct device_attribute dev_attr_usbip_debug; ...@@ -140,7 +137,6 @@ extern struct device_attribute dev_attr_usbip_debug;
printk(KERN_INFO "usbip: " fmt , ## args); \ printk(KERN_INFO "usbip: " fmt , ## args); \
} while (0) } while (0)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* /*
...@@ -185,7 +181,7 @@ struct usbip_header_basic { ...@@ -185,7 +181,7 @@ struct usbip_header_basic {
#define USBIP_DIR_IN 1 #define USBIP_DIR_IN 1
__u32 direction; __u32 direction;
__u32 ep; /* endpoint number */ __u32 ep; /* endpoint number */
} __attribute__ ((packed)); } __packed;
/* /*
* An additional header for a CMD_SUBMIT packet. * An additional header for a CMD_SUBMIT packet.
...@@ -212,7 +208,7 @@ struct usbip_header_cmd_submit { ...@@ -212,7 +208,7 @@ struct usbip_header_cmd_submit {
/* set setup packet data for a CTRL request */ /* set setup packet data for a CTRL request */
unsigned char setup[8]; unsigned char setup[8];
} __attribute__ ((packed)); } __packed;
/* /*
* An additional header for a RET_SUBMIT packet. * An additional header for a RET_SUBMIT packet.
...@@ -223,23 +219,21 @@ struct usbip_header_ret_submit { ...@@ -223,23 +219,21 @@ struct usbip_header_ret_submit {
__s32 start_frame; /* ISO and INT */ __s32 start_frame; /* ISO and INT */
__s32 number_of_packets; /* ISO only */ __s32 number_of_packets; /* ISO only */
__s32 error_count; /* ISO only */ __s32 error_count; /* ISO only */
} __attribute__ ((packed)); } __packed;
/* /*
* An additional header for a CMD_UNLINK packet. * An additional header for a CMD_UNLINK packet.
*/ */
struct usbip_header_cmd_unlink { struct usbip_header_cmd_unlink {
__u32 seqnum; /* URB's seqnum which will be unlinked */ __u32 seqnum; /* URB's seqnum that will be unlinked */
} __attribute__ ((packed)); } __packed;
/* /*
* An additional header for a RET_UNLINK packet. * An additional header for a RET_UNLINK packet.
*/ */
struct usbip_header_ret_unlink { struct usbip_header_ret_unlink {
__s32 status; __s32 status;
} __attribute__ ((packed)); } __packed;
/* the same as usb_iso_packet_descriptor but packed for pdu */ /* the same as usb_iso_packet_descriptor but packed for pdu */
struct usbip_iso_packet_descriptor { struct usbip_iso_packet_descriptor {
...@@ -247,8 +241,7 @@ struct usbip_iso_packet_descriptor { ...@@ -247,8 +241,7 @@ struct usbip_iso_packet_descriptor {
__u32 length; /* expected length */ __u32 length; /* expected length */
__u32 actual_length; __u32 actual_length;
__u32 status; __u32 status;
} __attribute__ ((packed)); } __packed;
/* /*
* All usbip packets use a common header to keep code simple. * All usbip packets use a common header to keep code simple.
...@@ -262,18 +255,13 @@ struct usbip_header { ...@@ -262,18 +255,13 @@ struct usbip_header {
struct usbip_header_cmd_unlink cmd_unlink; struct usbip_header_cmd_unlink cmd_unlink;
struct usbip_header_ret_unlink ret_unlink; struct usbip_header_ret_unlink ret_unlink;
} u; } u;
} __attribute__ ((packed)); } __packed;
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
int usbip_xmit(int, struct socket *, char *, int, int); int usbip_xmit(int, struct socket *, char *, int, int);
int usbip_sendmsg(struct socket *, struct msghdr *, int); int usbip_sendmsg(struct socket *, struct msghdr *, int);
static inline int interface_to_busnum(struct usb_interface *interface) static inline int interface_to_busnum(struct usb_interface *interface)
{ {
struct usb_device *udev = interface_to_usbdev(interface); struct usb_device *udev = interface_to_usbdev(interface);
...@@ -304,7 +292,6 @@ int set_sockaddr(struct socket *socket, struct sockaddr_storage *ss); ...@@ -304,7 +292,6 @@ int set_sockaddr(struct socket *socket, struct sockaddr_storage *ss);
void usbip_dump_urb(struct urb *purb); void usbip_dump_urb(struct urb *purb);
void usbip_dump_header(struct usbip_header *pdu); void usbip_dump_header(struct usbip_header *pdu);
struct usbip_device; struct usbip_device;
enum usbip_side { enum usbip_side {
...@@ -331,7 +318,6 @@ enum usbip_status { ...@@ -331,7 +318,6 @@ enum usbip_status {
/* a common structure for stub_device and vhci_device */ /* a common structure for stub_device and vhci_device */
struct usbip_device { struct usbip_device {
enum usbip_side side; enum usbip_side side;
enum usbip_status status; enum usbip_status status;
/* lock for status */ /* lock for status */
...@@ -370,7 +356,6 @@ struct usbip_device { ...@@ -370,7 +356,6 @@ struct usbip_device {
} eh_ops; } eh_ops;
}; };
void usbip_pack_pdu(struct usbip_header *pdu, struct urb *urb, int cmd, void usbip_pack_pdu(struct usbip_header *pdu, struct urb *urb, int cmd,
int pack); int pack);
...@@ -383,12 +368,10 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb); ...@@ -383,12 +368,10 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb);
int usbip_pad_iso(struct usbip_device *ud, struct urb *urb); int usbip_pad_iso(struct usbip_device *ud, struct urb *urb);
void *usbip_alloc_iso_desc_pdu(struct urb *urb, ssize_t *bufflen); void *usbip_alloc_iso_desc_pdu(struct urb *urb, ssize_t *bufflen);
/* usbip_event.c */ /* usbip_event.c */
int usbip_start_eh(struct usbip_device *ud); int usbip_start_eh(struct usbip_device *ud);
void usbip_stop_eh(struct usbip_device *ud); void usbip_stop_eh(struct usbip_device *ud);
void usbip_event_add(struct usbip_device *ud, unsigned long event); void usbip_event_add(struct usbip_device *ud, unsigned long event);
int usbip_event_happened(struct usbip_device *ud); int usbip_event_happened(struct usbip_device *ud);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment