Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41dceed5 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: fix codingstyle issues in include/linux/usb/



Fixes a number of coding style issues in the USB public header files.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 969ab2ee
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -27,13 +27,13 @@

/* 4.3.2  Class-Specific AC Interface Descriptor */
struct usb_ac_header_descriptor {
	__u8  bLength;			// 8+n
	__u8  bDescriptorType;		// USB_DT_CS_INTERFACE
	__u8  bDescriptorSubtype;	// USB_MS_HEADER
	__le16 bcdADC;			// 0x0100
	__le16 wTotalLength;		// includes Unit and Terminal desc.
	__u8  bInCollection;		// n
	__u8  baInterfaceNr[];		// [n]
	__u8  bLength;			/* 8+n */
	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
	__u8  bDescriptorSubtype;	/* USB_MS_HEADER */
	__le16 bcdADC;			/* 0x0100 */
	__le16 wTotalLength;		/* includes Unit and Terminal desc. */
	__u8  bInCollection;		/* n */
	__u8  baInterfaceNr[];		/* [n] */
} __attribute__ ((packed));

#define USB_DT_AC_HEADER_SIZE(n)	(8+(n))
+55 −68
Original line number Diff line number Diff line
@@ -70,9 +70,10 @@ struct usb_ep;
 *
 * Bulk endpoints can use any size buffers, and can also be used for interrupt
 * transfers. interrupt-only endpoints can be much less functional.
 *
 * NOTE:  this is analagous to 'struct urb' on the host side, except that
 * it's thinner and promotes more pre-allocation.
 */
	// NOTE this is analagous to 'struct urb' on the host side,
	// except that it's thinner and promotes more pre-allocation.

struct usb_request {
	void			*buf;
@@ -168,8 +169,8 @@ struct usb_ep {
 *
 * returns zero, or a negative error code.
 */
static inline int
usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
static inline int usb_ep_enable(struct usb_ep *ep,
				const struct usb_endpoint_descriptor *desc)
{
	return ep->ops->enable(ep, desc);
}
@@ -186,8 +187,7 @@ usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
 *
 * returns zero, or a negative error code.
 */
static inline int
usb_ep_disable (struct usb_ep *ep)
static inline int usb_ep_disable(struct usb_ep *ep)
{
	return ep->ops->disable(ep);
}
@@ -206,8 +206,8 @@ usb_ep_disable (struct usb_ep *ep)
 *
 * Returns the request, or null if one could not be allocated.
 */
static inline struct usb_request *
usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
						       gfp_t gfp_flags)
{
	return ep->ops->alloc_request(ep, gfp_flags);
}
@@ -221,8 +221,8 @@ usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
 * Caller guarantees the request is not queued, and that it will
 * no longer be requeued (or otherwise used).
 */
static inline void
usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
static inline void usb_ep_free_request(struct usb_ep *ep,
				       struct usb_request *req)
{
	ep->ops->free_request(ep, req);
}
@@ -281,8 +281,8 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
 * report errors; errors will also be
 * reported when the usb peripheral is disconnected.
 */
static inline int
usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags)
static inline int usb_ep_queue(struct usb_ep *ep,
			       struct usb_request *req, gfp_t gfp_flags)
{
	return ep->ops->queue(ep, req, gfp_flags);
}
@@ -327,8 +327,7 @@ static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req)
 * transfer requests are still queued, or if the controller hardware
 * (usually a FIFO) still holds bytes that the host hasn't collected.
 */
static inline int
usb_ep_set_halt (struct usb_ep *ep)
static inline int usb_ep_set_halt(struct usb_ep *ep)
{
	return ep->ops->set_halt(ep, 1);
}
@@ -346,8 +345,7 @@ usb_ep_set_halt (struct usb_ep *ep)
 * Note that some hardware can't support this request (like pxa2xx_udc),
 * and accordingly can't correctly implement interface altsettings.
 */
static inline int
usb_ep_clear_halt (struct usb_ep *ep)
static inline int usb_ep_clear_halt(struct usb_ep *ep)
{
	return ep->ops->set_halt(ep, 0);
}
@@ -367,8 +365,7 @@ usb_ep_clear_halt (struct usb_ep *ep)
 * errno if the endpoint doesn't use a FIFO or doesn't support such
 * precise handling.
 */
static inline int
usb_ep_fifo_status (struct usb_ep *ep)
static inline int usb_ep_fifo_status(struct usb_ep *ep)
{
	if (ep->ops->fifo_status)
		return ep->ops->fifo_status(ep);
@@ -385,8 +382,7 @@ usb_ep_fifo_status (struct usb_ep *ep)
 * must never be used except when endpoint is not being used for any
 * protocol translation.
 */
static inline void
usb_ep_fifo_flush (struct usb_ep *ep)
static inline void usb_ep_fifo_flush(struct usb_ep *ep)
{
	if (ep->ops->fifo_flush)
		ep->ops->fifo_flush(ep);
@@ -511,7 +507,6 @@ static inline int gadget_is_otg(struct usb_gadget *g)
#endif
}


/**
 * usb_gadget_frame_number - returns the current frame number
 * @gadget: controller that reports the frame number
@@ -553,8 +548,7 @@ static inline int usb_gadget_wakeup (struct usb_gadget *gadget)
 *
 * returns zero on success, else negative errno.
 */
static inline int
usb_gadget_set_selfpowered (struct usb_gadget *gadget)
static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
{
	if (!gadget->ops->set_selfpowered)
		return -EOPNOTSUPP;
@@ -571,8 +565,7 @@ usb_gadget_set_selfpowered (struct usb_gadget *gadget)
 *
 * returns zero on success, else negative errno.
 */
static inline int
usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
{
	if (!gadget->ops->set_selfpowered)
		return -EOPNOTSUPP;
@@ -591,8 +584,7 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
 *
 * Returns zero on success, else negative errno.
 */
static inline int
usb_gadget_vbus_connect(struct usb_gadget *gadget)
static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
{
	if (!gadget->ops->vbus_session)
		return -EOPNOTSUPP;
@@ -611,8 +603,7 @@ usb_gadget_vbus_connect(struct usb_gadget *gadget)
 *
 * Returns zero on success, else negative errno.
 */
static inline int
usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
{
	if (!gadget->ops->vbus_draw)
		return -EOPNOTSUPP;
@@ -629,8 +620,7 @@ usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 *
 * Returns zero on success, else negative errno.
 */
static inline int
usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
{
	if (!gadget->ops->vbus_session)
		return -EOPNOTSUPP;
@@ -648,8 +638,7 @@ usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
 *
 * Returns zero on success, else negative errno.
 */
static inline int
usb_gadget_connect (struct usb_gadget *gadget)
static inline int usb_gadget_connect(struct usb_gadget *gadget)
{
	if (!gadget->ops->pullup)
		return -EOPNOTSUPP;
@@ -671,8 +660,7 @@ usb_gadget_connect (struct usb_gadget *gadget)
 *
 * Returns zero on success, else negative errno.
 */
static inline int
usb_gadget_disconnect (struct usb_gadget *gadget)
static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
{
	if (!gadget->ops->pullup)
		return -EOPNOTSUPP;
@@ -680,7 +668,6 @@ usb_gadget_disconnect (struct usb_gadget *gadget)
}



/*-------------------------------------------------------------------------*/

/**
@@ -764,7 +751,7 @@ struct usb_gadget_driver {
	void			(*suspend)(struct usb_gadget *);
	void			(*resume)(struct usb_gadget *);

	// FIXME support safe rmmod
	/* FIXME support safe rmmod */
	struct device_driver	driver;
};

+12 −10
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ enum usb_gadgetfs_event_type {
	GADGETFS_DISCONNECT,
	GADGETFS_SETUP,
	GADGETFS_SUSPEND,
	// and likely more !
	/* and likely more ! */
};

/* NOTE:  this structure must stay the same size and layout on
@@ -44,15 +44,17 @@ enum usb_gadgetfs_event_type {
 */
struct usb_gadgetfs_event {
	union {
		// NOP, DISCONNECT, SUSPEND: nothing
		// ... some hardware can't report disconnection
		/* NOP, DISCONNECT, SUSPEND: nothing
		 * ... some hardware can't report disconnection
		 */

		// CONNECT: just the speed
		/* CONNECT: just the speed */
		enum usb_device_speed	speed;

		// SETUP: packet; DATA phase i/o precedes next event
		// (setup.bmRequestType & USB_DIR_IN) flags direction
		// ... includes SET_CONFIGURATION, SET_INTERFACE
		/* SETUP: packet; DATA phase i/o precedes next event
		 *(setup.bmRequestType & USB_DIR_IN) flags direction
		 * ... includes SET_CONFIGURATION, SET_INTERFACE
		 */
		struct usb_ctrlrequest	setup;
	} u;
	enum usb_gadgetfs_event_type	type;
+17 −8
Original line number Diff line number Diff line
@@ -14,14 +14,23 @@
   this information.
*/
struct iowarrior_info {
	__u32 vendor;		/* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
	__u32 product;		/* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */
	__u8 serial[9];		/* the serial number of our chip (if a serial-number is not available this is empty string) */
	__u32 revision;		/* revision number of the chip */
	__u32 speed;		/* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
	__u32 power;		/* power consumption of the device in mA */
	__u32 if_num;		/* the number of the endpoint */
	__u32 report_size;	/* size of the data-packets on this interface */
	/* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
	__u32 vendor;
	/* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */
	__u32 product;
	/* the serial number of our chip (if a serial-number is not available
	 * this is empty string) */
	__u8 serial[9];
	/* revision number of the chip */
	__u32 revision;
	/* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
	__u32 speed;
	/* power consumption of the device in mA */
	__u32 power;
	/* the number of the endpoint */
	__u32 if_num;
	/* size of the data-packets on this interface */
	__u32 report_size;
};

/*
+13 −13
Original line number Diff line number Diff line
@@ -47,9 +47,9 @@ struct usb_ms_header_descriptor {
/* 6.1.2.2  MIDI IN Jack Descriptor */
struct usb_midi_in_jack_descriptor {
	__u8  bLength;
	__u8  bDescriptorType;		// USB_DT_CS_INTERFACE
	__u8  bDescriptorSubtype;	// USB_MS_MIDI_IN_JACK
	__u8  bJackType;		// USB_MS_EMBEDDED/EXTERNAL
	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
	__u8  bDescriptorSubtype;	/* USB_MS_MIDI_IN_JACK */
	__u8  bJackType;		/* USB_MS_EMBEDDED/EXTERNAL */
	__u8  bJackID;
	__u8  iJack;
} __attribute__ ((packed));
@@ -64,12 +64,12 @@ struct usb_midi_source_pin {
/* 6.1.2.3  MIDI OUT Jack Descriptor */
struct usb_midi_out_jack_descriptor {
	__u8  bLength;
	__u8  bDescriptorType;		// USB_DT_CS_INTERFACE
	__u8  bDescriptorSubtype;	// USB_MS_MIDI_OUT_JACK
	__u8  bJackType;		// USB_MS_EMBEDDED/EXTERNAL
	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
	__u8  bDescriptorSubtype;	/* USB_MS_MIDI_OUT_JACK */
	__u8  bJackType;		/* USB_MS_EMBEDDED/EXTERNAL */
	__u8  bJackID;
	__u8  bNrInputPins;		// p
	struct usb_midi_source_pin pins[]; // [p]
	__u8  bNrInputPins;		/* p */
	struct usb_midi_source_pin pins[]; /* [p] */
	/*__u8  iJack;  -- ommitted due to variable-sized pins[] */
} __attribute__ ((packed));

@@ -90,11 +90,11 @@ struct usb_midi_out_jack_descriptor_##p { \

/* 6.2.2  Class-Specific MS Bulk Data Endpoint Descriptor */
struct usb_ms_endpoint_descriptor {
	__u8  bLength;			// 4+n
	__u8  bDescriptorType;		// USB_DT_CS_ENDPOINT
	__u8  bDescriptorSubtype;	// USB_MS_GENERAL
	__u8  bNumEmbMIDIJack;		// n
	__u8  baAssocJackID[];		// [n]
	__u8  bLength;			/* 4+n */
	__u8  bDescriptorType;		/* USB_DT_CS_ENDPOINT */
	__u8  bDescriptorSubtype;	/* USB_MS_GENERAL */
	__u8  bNumEmbMIDIJack;		/* n */
	__u8  baAssocJackID[];		/* [n] */
} __attribute__ ((packed));

#define USB_DT_MS_ENDPOINT_SIZE(n)	(4 + (n))
Loading