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: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f371e750c9
commit
7472f38b10
@@ -23,9 +23,7 @@
|
|||||||
/*
|
/*
|
||||||
* Gadget Zero only needs two bulk endpoints, and is an example of how you
|
* 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.
|
* can write a hardware-agnostic gadget driver running inside a USB device.
|
||||||
*
|
* Some hardware details are visible, but don't affect most of the driver.
|
||||||
* Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't
|
|
||||||
* affect most of the driver.
|
|
||||||
*
|
*
|
||||||
* Use it with the Linux host/master side "usbtest" driver to get a basic
|
* 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".
|
* functional test of your device-side usb stack, or with "usb-skeleton".
|
||||||
@@ -37,6 +35,7 @@
|
|||||||
* buflen=N default N=4096, buffer size used
|
* buflen=N default N=4096, buffer size used
|
||||||
* qlen=N default N=32, how many buffers in the loopback queue
|
* qlen=N default N=32, how many buffers in the loopback queue
|
||||||
* loopdefault default false, list loopback config first
|
* 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
|
* Many drivers will only have one configuration, letting them be much
|
||||||
* simpler if they also don't support high speed operation (like this
|
* 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 shortname[] = "zero";
|
||||||
static const char longname[] = "Gadget 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.
|
* Or controllers (like superh) that only support one config.
|
||||||
*/
|
*/
|
||||||
static int loopdefault = 0;
|
static int loopdefault = 0;
|
||||||
|
|
||||||
module_param(loopdefault, bool, S_IRUGO|S_IWUSR);
|
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_SOURCE_SINK 3
|
||||||
#define CONFIG_LOOPBACK 2
|
#define CONFIG_LOOPBACK 2
|
||||||
|
|
||||||
static struct usb_device_descriptor
|
static struct usb_device_descriptor device_desc = {
|
||||||
device_desc = {
|
|
||||||
.bLength = sizeof device_desc,
|
.bLength = sizeof device_desc,
|
||||||
.bDescriptorType = USB_DT_DEVICE,
|
.bDescriptorType = USB_DT_DEVICE,
|
||||||
|
|
||||||
@@ -192,8 +189,7 @@ device_desc = {
|
|||||||
.bNumConfigurations = 2,
|
.bNumConfigurations = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_config_descriptor
|
static struct usb_config_descriptor source_sink_config = {
|
||||||
source_sink_config = {
|
|
||||||
.bLength = sizeof source_sink_config,
|
.bLength = sizeof source_sink_config,
|
||||||
.bDescriptorType = USB_DT_CONFIG,
|
.bDescriptorType = USB_DT_CONFIG,
|
||||||
|
|
||||||
@@ -205,8 +201,7 @@ source_sink_config = {
|
|||||||
.bMaxPower = 1, /* self-powered */
|
.bMaxPower = 1, /* self-powered */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_config_descriptor
|
static struct usb_config_descriptor loopback_config = {
|
||||||
loopback_config = {
|
|
||||||
.bLength = sizeof loopback_config,
|
.bLength = sizeof loopback_config,
|
||||||
.bDescriptorType = USB_DT_CONFIG,
|
.bDescriptorType = USB_DT_CONFIG,
|
||||||
|
|
||||||
@@ -218,8 +213,7 @@ loopback_config = {
|
|||||||
.bMaxPower = 1, /* self-powered */
|
.bMaxPower = 1, /* self-powered */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_otg_descriptor
|
static struct usb_otg_descriptor otg_descriptor = {
|
||||||
otg_descriptor = {
|
|
||||||
.bLength = sizeof otg_descriptor,
|
.bLength = sizeof otg_descriptor,
|
||||||
.bDescriptorType = USB_DT_OTG,
|
.bDescriptorType = USB_DT_OTG,
|
||||||
|
|
||||||
@@ -228,8 +222,7 @@ otg_descriptor = {
|
|||||||
|
|
||||||
/* one interface in each configuration */
|
/* one interface in each configuration */
|
||||||
|
|
||||||
static const struct usb_interface_descriptor
|
static const struct usb_interface_descriptor source_sink_intf = {
|
||||||
source_sink_intf = {
|
|
||||||
.bLength = sizeof source_sink_intf,
|
.bLength = sizeof source_sink_intf,
|
||||||
.bDescriptorType = USB_DT_INTERFACE,
|
.bDescriptorType = USB_DT_INTERFACE,
|
||||||
|
|
||||||
@@ -238,8 +231,7 @@ source_sink_intf = {
|
|||||||
.iInterface = STRING_SOURCE_SINK,
|
.iInterface = STRING_SOURCE_SINK,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct usb_interface_descriptor
|
static const struct usb_interface_descriptor loopback_intf = {
|
||||||
loopback_intf = {
|
|
||||||
.bLength = sizeof loopback_intf,
|
.bLength = sizeof loopback_intf,
|
||||||
.bDescriptorType = USB_DT_INTERFACE,
|
.bDescriptorType = USB_DT_INTERFACE,
|
||||||
|
|
||||||
@@ -250,8 +242,7 @@ loopback_intf = {
|
|||||||
|
|
||||||
/* two full speed bulk endpoints; their use is config-dependent */
|
/* two full speed bulk endpoints; their use is config-dependent */
|
||||||
|
|
||||||
static struct usb_endpoint_descriptor
|
static struct usb_endpoint_descriptor fs_source_desc = {
|
||||||
fs_source_desc = {
|
|
||||||
.bLength = USB_DT_ENDPOINT_SIZE,
|
.bLength = USB_DT_ENDPOINT_SIZE,
|
||||||
.bDescriptorType = USB_DT_ENDPOINT,
|
.bDescriptorType = USB_DT_ENDPOINT,
|
||||||
|
|
||||||
@@ -259,8 +250,7 @@ fs_source_desc = {
|
|||||||
.bmAttributes = USB_ENDPOINT_XFER_BULK,
|
.bmAttributes = USB_ENDPOINT_XFER_BULK,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_endpoint_descriptor
|
static struct usb_endpoint_descriptor fs_sink_desc = {
|
||||||
fs_sink_desc = {
|
|
||||||
.bLength = USB_DT_ENDPOINT_SIZE,
|
.bLength = USB_DT_ENDPOINT_SIZE,
|
||||||
.bDescriptorType = USB_DT_ENDPOINT,
|
.bDescriptorType = USB_DT_ENDPOINT,
|
||||||
|
|
||||||
@@ -293,8 +283,7 @@ static const struct usb_descriptor_header *fs_loopback_function [] = {
|
|||||||
* for the config descriptor.
|
* for the config descriptor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct usb_endpoint_descriptor
|
static struct usb_endpoint_descriptor hs_source_desc = {
|
||||||
hs_source_desc = {
|
|
||||||
.bLength = USB_DT_ENDPOINT_SIZE,
|
.bLength = USB_DT_ENDPOINT_SIZE,
|
||||||
.bDescriptorType = USB_DT_ENDPOINT,
|
.bDescriptorType = USB_DT_ENDPOINT,
|
||||||
|
|
||||||
@@ -302,8 +291,7 @@ hs_source_desc = {
|
|||||||
.wMaxPacketSize = __constant_cpu_to_le16(512),
|
.wMaxPacketSize = __constant_cpu_to_le16(512),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_endpoint_descriptor
|
static struct usb_endpoint_descriptor hs_sink_desc = {
|
||||||
hs_sink_desc = {
|
|
||||||
.bLength = USB_DT_ENDPOINT_SIZE,
|
.bLength = USB_DT_ENDPOINT_SIZE,
|
||||||
.bDescriptorType = USB_DT_ENDPOINT,
|
.bDescriptorType = USB_DT_ENDPOINT,
|
||||||
|
|
||||||
@@ -311,8 +299,7 @@ hs_sink_desc = {
|
|||||||
.wMaxPacketSize = __constant_cpu_to_le16(512),
|
.wMaxPacketSize = __constant_cpu_to_le16(512),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_qualifier_descriptor
|
static struct usb_qualifier_descriptor dev_qualifier = {
|
||||||
dev_qualifier = {
|
|
||||||
.bLength = sizeof dev_qualifier,
|
.bLength = sizeof dev_qualifier,
|
||||||
.bDescriptorType = USB_DT_DEVICE_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
|
* high bandwidth modes at high speed. (Maybe work like Intel's test
|
||||||
* device?)
|
* device?)
|
||||||
*/
|
*/
|
||||||
static int
|
static int config_buf(struct usb_gadget *gadget,
|
||||||
config_buf (struct usb_gadget *gadget,
|
|
||||||
u8 *buf, u8 type, unsigned index)
|
u8 *buf, u8 type, unsigned index)
|
||||||
{
|
{
|
||||||
int is_source_sink;
|
int is_source_sink;
|
||||||
@@ -431,8 +417,7 @@ config_buf (struct usb_gadget *gadget,
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static struct usb_request *
|
static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length)
|
||||||
alloc_ep_req (struct usb_ep *ep, unsigned length)
|
|
||||||
{
|
{
|
||||||
struct usb_request *req;
|
struct usb_request *req;
|
||||||
|
|
||||||
@@ -1040,8 +1025,7 @@ unknown:
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void zero_disconnect(struct usb_gadget *gadget)
|
||||||
zero_disconnect (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
struct zero_dev *dev = get_gadget_data(gadget);
|
struct zero_dev *dev = get_gadget_data(gadget);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@@ -1060,8 +1044,7 @@ zero_disconnect (struct usb_gadget *gadget)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void zero_autoresume(unsigned long _dev)
|
||||||
zero_autoresume (unsigned long _dev)
|
|
||||||
{
|
{
|
||||||
struct zero_dev *dev = (struct zero_dev *) _dev;
|
struct zero_dev *dev = (struct zero_dev *) _dev;
|
||||||
int status;
|
int status;
|
||||||
@@ -1077,8 +1060,7 @@ zero_autoresume (unsigned long _dev)
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void /* __init_or_exit */
|
static void zero_unbind(struct usb_gadget *gadget)
|
||||||
zero_unbind (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
struct zero_dev *dev = get_gadget_data(gadget);
|
struct zero_dev *dev = get_gadget_data(gadget);
|
||||||
|
|
||||||
@@ -1094,8 +1076,7 @@ zero_unbind (struct usb_gadget *gadget)
|
|||||||
set_gadget_data(gadget, NULL);
|
set_gadget_data(gadget, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init zero_bind(struct usb_gadget *gadget)
|
||||||
zero_bind (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
struct zero_dev *dev;
|
struct zero_dev *dev;
|
||||||
struct usb_ep *ep;
|
struct usb_ep *ep;
|
||||||
@@ -1211,8 +1192,7 @@ enomem:
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void
|
static void zero_suspend(struct usb_gadget *gadget)
|
||||||
zero_suspend (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
struct zero_dev *dev = get_gadget_data(gadget);
|
struct zero_dev *dev = get_gadget_data(gadget);
|
||||||
|
|
||||||
@@ -1226,8 +1206,7 @@ zero_suspend (struct usb_gadget *gadget)
|
|||||||
DBG(dev, "suspend\n");
|
DBG(dev, "suspend\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void zero_resume(struct usb_gadget *gadget)
|
||||||
zero_resume (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
struct zero_dev *dev = get_gadget_data(gadget);
|
struct zero_dev *dev = get_gadget_data(gadget);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user