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

Commit 2c044a48 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: fix codingstyle issues in drivers/usb/core/*.c



Fixes a number of coding style issues in the remaining .c files in
drivers/usb/core/

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3e35bf39
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -58,7 +58,8 @@ int hcd_buffer_create(struct usb_hcd *hcd)
		return 0;

	for (i = 0; i < HCD_BUFFER_POOLS; i++) {
		if (!(size = pool_max [i]))
		size = pool_max[i];
		if (!size)
			continue;
		snprintf(name, sizeof name, "buffer-%d", size);
		hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
+8 −6
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno,

	/* Allocate space for the right(?) number of endpoints */
	num_ep = num_ep_orig = alt->desc.bNumEndpoints;
	alt->desc.bNumEndpoints = 0;		// Use as a counter
	alt->desc.bNumEndpoints = 0;		/* Use as a counter */
	if (num_ep > USB_MAXENDPOINTS) {
		dev_warn(ddev, "too many endpoints for config %d interface %d "
		    "altsetting %d: %d, using maximum allowed: %d\n",
@@ -246,7 +246,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
		num_ep = USB_MAXENDPOINTS;
	}

	if (num_ep > 0) {	/* Can't allocate 0 bytes */
	if (num_ep > 0) {
		/* Can't allocate 0 bytes */
		len = sizeof(struct usb_host_endpoint) * num_ep;
		alt->endpoint = kzalloc(len, GFP_KERNEL);
		if (!alt->endpoint)
@@ -475,8 +476,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx,
	return 0;
}

// hub-only!! ... and only exported for reset/reinit path.
// otherwise used internally on disconnect/destroy path
/* hub-only!! ... and only exported for reset/reinit path.
 * otherwise used internally on disconnect/destroy path
 */
void usb_destroy_configuration(struct usb_device *dev)
{
	int c, i;
+16 −14
Original line number Diff line number Diff line
@@ -854,8 +854,10 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
			dev_err(&intf->dev, "%s error %d\n",
					"suspend", status);
	} else {
		// FIXME else if there's no suspend method, disconnect...
		// Not possible if auto_pm is set...
		/*
		 * FIXME else if there's no suspend method, disconnect...
		 * Not possible if auto_pm is set...
		 */
		dev_warn(&intf->dev, "no suspend for driver %s?\n",
				driver->name);
		mark_quiesced(intf);
@@ -894,7 +896,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume)
				dev_err(&intf->dev, "%s error %d\n",
						"reset_resume", status);
		} else {
			// status = -EOPNOTSUPP;
			/* status = -EOPNOTSUPP; */
			dev_warn(&intf->dev, "no %s for driver %s?\n",
					"reset_resume", driver->name);
		}
@@ -905,7 +907,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume)
				dev_err(&intf->dev, "%s error %d\n",
						"resume", status);
		} else {
			// status = -EOPNOTSUPP;
			/* status = -EOPNOTSUPP; */
			dev_warn(&intf->dev, "no %s for driver %s?\n",
					"resume", driver->name);
		}
+12 −10
Original line number Diff line number Diff line
@@ -288,7 +288,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)

	if (!urb || urb->hcpriv || !urb->complete)
		return -EINVAL;
	if (!(dev = urb->dev) || dev->state < USB_STATE_DEFAULT)
	dev = urb->dev;
	if ((!dev) || (dev->state < USB_STATE_DEFAULT))
		return -ENODEV;

	/* For now, get the endpoint from the pipe.  Eventually drivers
@@ -420,7 +421,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
		/* too big? */
		switch (dev->speed) {
		case USB_SPEED_HIGH:	/* units are microframes */
			// NOTE usb handles 2^15
			/* NOTE usb handles 2^15 */
			if (urb->interval > (1024 * 8))
				urb->interval = 1024 * 8;
			max = 1024 * 8;
@@ -430,12 +431,12 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
			if (xfertype == USB_ENDPOINT_XFER_INT) {
				if (urb->interval > 255)
					return -EINVAL;
				// NOTE ohci only handles up to 32
				/* NOTE ohci only handles up to 32 */
				max = 128;
			} else {
				if (urb->interval > 1024)
					urb->interval = 1024;
				// NOTE usb and ohci handle up to 2^15
				/* NOTE usb and ohci handle up to 2^15 */
				max = 1024;
			}
			break;
@@ -574,7 +575,8 @@ void usb_kill_anchored_urbs(struct usb_anchor *anchor)

	spin_lock_irq(&anchor->lock);
	while (!list_empty(&anchor->urb_list)) {
		victim = list_entry(anchor->urb_list.prev, struct urb, anchor_list);
		victim = list_entry(anchor->urb_list.prev, struct urb,
				    anchor_list);
		/* we must make sure the URB isn't freed before we kill it*/
		usb_get_urb(victim);
		spin_unlock_irq(&anchor->lock);
+22 −29
Original line number Diff line number Diff line
@@ -116,7 +116,8 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if);
 * Don't call this function unless you are bound to the intf interface
 * or you have locked the device!
 */
struct usb_host_interface *usb_altnum_to_altsetting(const struct usb_interface *intf,
struct usb_host_interface *usb_altnum_to_altsetting(
					const struct usb_interface *intf,
					unsigned int altnum)
{
	int i;
@@ -272,8 +273,8 @@ static unsigned usb_bus_is_wusb(struct usb_bus *bus)
 *
 * This call may not be used in a non-sleeping context.
 */
struct usb_device *
usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)
struct usb_device *usb_alloc_dev(struct usb_device *parent,
				 struct usb_bus *bus, unsigned port1)
{
	struct usb_device *dev;
	struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self);
@@ -643,12 +644,8 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
 *
 * When the buffer is no longer used, free it with usb_buffer_free().
 */
void *usb_buffer_alloc(
	struct usb_device *dev,
	size_t size,
	gfp_t mem_flags,
	dma_addr_t *dma
)
void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags,
		       dma_addr_t *dma)
{
	if (!dev || !dev->bus)
		return NULL;
@@ -667,12 +664,8 @@ EXPORT_SYMBOL_GPL(usb_buffer_alloc);
 * been allocated using usb_buffer_alloc(), and the parameters must match
 * those provided in that allocation request.
 */
void usb_buffer_free(
	struct usb_device *dev,
	size_t size,
	void *addr,
	dma_addr_t dma
)
void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
		     dma_addr_t dma)
{
	if (!dev || !dev->bus)
		return;
@@ -720,8 +713,8 @@ struct urb *usb_buffer_map(struct urb *urb)
					urb->setup_packet,
					sizeof(struct usb_ctrlrequest),
					DMA_TO_DEVICE);
	// FIXME generic api broken like pci, can't report errors
	// if (urb->transfer_dma == DMA_ADDR_INVALID) return 0;
	/* FIXME generic api broken like pci, can't report errors */
	/* if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; */
	} else
		urb->transfer_dma = ~0;
	urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP
@@ -843,7 +836,7 @@ int usb_buffer_map_sg(const struct usb_device *dev, int is_in,
			|| !controller->dma_mask)
		return -1;

	// FIXME generic api broken like pci, can't report errors
	/* FIXME generic api broken like pci, can't report errors */
	return dma_map_sg(controller, sg, nents,
			is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
}
+10 −10

File changed.

Contains only whitespace changes.

Loading