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

Commit 7472f38b authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman
Browse files

usb: gadget zero style fixups (mostly whitespace)



Minor updates to "Gadget Zero".

 - Primarily these are whitespace updates to address the fact that since
   this was written, Documentation/CodingStyle was changed to disapprove
   of parts of the original coding style.

 - Update a few comments that weren't quite correct, notably mentioning
   the "autoresume" module parameter.

Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f371e750
Loading
Loading
Loading
Loading
+172 −193
Original line number Diff line number Diff line
@@ -23,9 +23,7 @@
/*
 * Gadget Zero only needs two bulk endpoints, and is an example of how you
 * can write a hardware-agnostic gadget driver running inside a USB device.
 *
 * Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't
 * affect most of the driver.
 * Some hardware details are visible, but don't affect most of the driver.
 *
 * Use it with the Linux host/master side "usbtest" driver to get a basic
 * functional test of your device-side usb stack, or with "usb-skeleton".
@@ -37,6 +35,7 @@
 *   buflen=N		default N=4096, buffer size used
 *   qlen=N		default N=32, how many buffers in the loopback queue
 *   loopdefault	default false, list loopback config first
 *   autoresume=N	default N=0, seconds before triggering remote wakeup
 *
 * Many drivers will only have one configuration, letting them be much
 * simpler if they also don't support high speed operation (like this
@@ -62,7 +61,7 @@

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

#define DRIVER_VERSION		"Lughnasadh, 2007"
#define DRIVER_VERSION		"Earth Day 2008"

static const char shortname[] = "zero";
static const char longname[] = "Gadget Zero";
@@ -138,7 +137,6 @@ module_param (autoresume, uint, 0);
 * Or controllers (like superh) that only support one config.
 */
static int loopdefault = 0;

module_param(loopdefault, bool, S_IRUGO|S_IWUSR);

/*-------------------------------------------------------------------------*/
@@ -176,8 +174,7 @@ module_param (loopdefault, bool, S_IRUGO|S_IWUSR);
#define	CONFIG_SOURCE_SINK	3
#define	CONFIG_LOOPBACK		2

static struct usb_device_descriptor
device_desc = {
static struct usb_device_descriptor device_desc = {
	.bLength =		sizeof device_desc,
	.bDescriptorType =	USB_DT_DEVICE,

@@ -192,8 +189,7 @@ device_desc = {
	.bNumConfigurations =	2,
};

static struct usb_config_descriptor
source_sink_config = {
static struct usb_config_descriptor source_sink_config = {
	.bLength =		sizeof source_sink_config,
	.bDescriptorType =	USB_DT_CONFIG,

@@ -205,8 +201,7 @@ source_sink_config = {
	.bMaxPower =		1,	/* self-powered */
};

static struct usb_config_descriptor
loopback_config = {
static struct usb_config_descriptor loopback_config = {
	.bLength =		sizeof loopback_config,
	.bDescriptorType =	USB_DT_CONFIG,

@@ -218,8 +213,7 @@ loopback_config = {
	.bMaxPower =		1,	/* self-powered */
};

static struct usb_otg_descriptor
otg_descriptor = {
static struct usb_otg_descriptor otg_descriptor = {
	.bLength =		sizeof otg_descriptor,
	.bDescriptorType =	USB_DT_OTG,

@@ -228,8 +222,7 @@ otg_descriptor = {

/* one interface in each configuration */

static const struct usb_interface_descriptor
source_sink_intf = {
static const struct usb_interface_descriptor source_sink_intf = {
	.bLength =		sizeof source_sink_intf,
	.bDescriptorType =	USB_DT_INTERFACE,

@@ -238,8 +231,7 @@ source_sink_intf = {
	.iInterface =		STRING_SOURCE_SINK,
};

static const struct usb_interface_descriptor
loopback_intf = {
static const struct usb_interface_descriptor loopback_intf = {
	.bLength =		sizeof loopback_intf,
	.bDescriptorType =	USB_DT_INTERFACE,

@@ -250,8 +242,7 @@ loopback_intf = {

/* two full speed bulk endpoints; their use is config-dependent */

static struct usb_endpoint_descriptor
fs_source_desc = {
static struct usb_endpoint_descriptor fs_source_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

@@ -259,8 +250,7 @@ fs_source_desc = {
	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
};

static struct usb_endpoint_descriptor
fs_sink_desc = {
static struct usb_endpoint_descriptor fs_sink_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

@@ -293,8 +283,7 @@ static const struct usb_descriptor_header *fs_loopback_function [] = {
 * for the config descriptor.
 */

static struct usb_endpoint_descriptor
hs_source_desc = {
static struct usb_endpoint_descriptor hs_source_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

@@ -302,8 +291,7 @@ hs_source_desc = {
	.wMaxPacketSize =	__constant_cpu_to_le16(512),
};

static struct usb_endpoint_descriptor
hs_sink_desc = {
static struct usb_endpoint_descriptor hs_sink_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

@@ -311,8 +299,7 @@ hs_sink_desc = {
	.wMaxPacketSize =	__constant_cpu_to_le16(512),
};

static struct usb_qualifier_descriptor
dev_qualifier = {
static struct usb_qualifier_descriptor dev_qualifier = {
	.bLength =		sizeof dev_qualifier,
	.bDescriptorType =	USB_DT_DEVICE_QUALIFIER,

@@ -387,8 +374,7 @@ static struct usb_gadget_strings stringtab = {
 * high bandwidth modes at high speed.  (Maybe work like Intel's test
 * device?)
 */
static int
config_buf (struct usb_gadget *gadget,
static int config_buf(struct usb_gadget *gadget,
		u8 *buf, u8 type, unsigned index)
{
	int				is_source_sink;
@@ -431,8 +417,7 @@ config_buf (struct usb_gadget *gadget,

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

static struct usb_request *
alloc_ep_req (struct usb_ep *ep, unsigned length)
static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length)
{
	struct usb_request	*req;

@@ -1040,8 +1025,7 @@ zero_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
	return value;
}

static void
zero_disconnect (struct usb_gadget *gadget)
static void zero_disconnect(struct usb_gadget *gadget)
{
	struct zero_dev		*dev = get_gadget_data(gadget);
	unsigned long		flags;
@@ -1060,8 +1044,7 @@ zero_disconnect (struct usb_gadget *gadget)
	 */
}

static void
zero_autoresume (unsigned long _dev)
static void zero_autoresume(unsigned long _dev)
{
	struct zero_dev	*dev = (struct zero_dev *) _dev;
	int		status;
@@ -1077,8 +1060,7 @@ zero_autoresume (unsigned long _dev)

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

static void /* __init_or_exit */
zero_unbind (struct usb_gadget *gadget)
static void zero_unbind(struct usb_gadget *gadget)
{
	struct zero_dev		*dev = get_gadget_data(gadget);

@@ -1094,8 +1076,7 @@ zero_unbind (struct usb_gadget *gadget)
	set_gadget_data(gadget, NULL);
}

static int __init
zero_bind (struct usb_gadget *gadget)
static int __init zero_bind(struct usb_gadget *gadget)
{
	struct zero_dev		*dev;
	struct usb_ep		*ep;
@@ -1211,8 +1192,7 @@ zero_bind (struct usb_gadget *gadget)

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

static void
zero_suspend (struct usb_gadget *gadget)
static void zero_suspend(struct usb_gadget *gadget)
{
	struct zero_dev		*dev = get_gadget_data(gadget);

@@ -1226,8 +1206,7 @@ zero_suspend (struct usb_gadget *gadget)
		DBG(dev, "suspend\n");
}

static void
zero_resume (struct usb_gadget *gadget)
static void zero_resume(struct usb_gadget *gadget)
{
	struct zero_dev		*dev = get_gadget_data(gadget);