drivers/usb/core: hcd.c: Removed all space warnings from checkpatch.pl
PATCH 1/1 drivers/usb/core: hcd.c: Removed all space warnings from checkpatch.pl
Removed all(except false positives, from calculations) space prohibited warnings generated by checkpatch.pl.
Signed-off-by Chase Metzger <[email protected]>
--- drivers/usb/core/hcd.c | 168 ++++++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 84 deletions(-)
drivers/usb/core/hcd.c +84 -84
@@ -90,8 +90,8 @@ unsigned long usb_hcds_loaded;EXPORT_SYMBOL_GPL (usb_hcds_loaded);/* host controllers we manage */ -LIST_HEAD (usb_bus_list); -EXPORT_SYMBOL_GPL (usb_bus_list); +LIST_HEAD (usb_bus_list); +EXPORT_SYMBOL_GPL (usb_bus_list);/* used when allocating bus numbers */ #define USB_MAXBUS 64
@@ -99,7 +99,7 @@ static DECLARE_BITMAP(busmap, USB_MAXBUS);/* used when updating list of hcds */ DEFINE_MUTEX (usb_bus_list_lock);/* exported only for usbfs */ -EXPORT_SYMBOL_GPL (usb_bus_list_lock); +EXPORT_SYMBOL_GPL (usb_bus_list_lock);/* used for controlling access to virtual root hubs */ static DEFINE_SPINLOCK (hcd_root_hub_lock);
@@ -447,7 +447,7 @@ rh_string(int id, struct usb_hcd const *hcd, u8 *data, unsigned len)break ;case 3 :/* Manufacturer */ -snprintf (buf,sizeof buf,"%s %s %s" ,init_utsname ()->sysname, +snprintf (buf,sizeof buf,"%s %s %s" ,init_utsname ()->sysname,init_utsname ()->release, hcd->driver->description); s = buf;break ;
@@ -461,7 +461,7 @@ rh_string(int id, struct usb_hcd const *hcd, u8 *data, unsigned len)/* Root hub control transfers execute synchronously */ -static int rh_call_control (struct usb_hcd *hcd,struct urb *urb) +static int rh_call_control (struct usb_hcd *hcd,struct urb *urb) {struct usb_ctrlrequest *cmd;u16 typeReq, wValue, wIndex, wLength;
@@ -485,9 +485,9 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) cmd = (struct usb_ctrlrequest *) urb->setup_packet; typeReq = (cmd->bRequestType <<8 ) | cmd->bRequest; - wValue =le16_to_cpu (cmd->wValue); - wIndex =le16_to_cpu (cmd->wIndex); - wLength =le16_to_cpu (cmd->wLength); + wValue =le16_to_cpu (cmd->wValue); + wIndex =le16_to_cpu (cmd->wIndex); + wLength =le16_to_cpu (cmd->wLength);if (wLength > urb->transfer_buffer_length) goto error;
@@ -616,7 +616,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)break ;case DeviceOutRequest |USB_REQ_SET_ADDRESS :/* wValue == urb->dev->devaddr */ -dev_dbg (hcd->self.controller,"root hub device address %d\n" , +dev_dbg (hcd->self.controller,"root hub device address %d\n" , wValue);break ;
@@ -632,7 +632,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)/* FALLTHROUGH */ case EndpointOutRequest |USB_REQ_CLEAR_FEATURE :case EndpointOutRequest |USB_REQ_SET_FEATURE : -dev_dbg (hcd->self.controller,"no endpoint features yet\n" ); +dev_dbg (hcd->self.controller,"no endpoint features yet\n" );break ;/* CLASS REQUESTS (and errors) */
@@ -646,13 +646,13 @@ nongeneric: len =4 ;break ;case GetHubDescriptor: - len =sizeof (struct usb_hub_descriptor ); + len =sizeof (struct usb_hub_descriptor );break ;case DeviceRequest |USB_REQ_GET_DESCRIPTOR :/* len is returned by hub_control */ break ; } - status = hcd->driver->hub_control (hcd, + status = hcd->driver->hub_control (hcd, typeReq, wValue, wIndex, tbuf, wLength);
@@ -668,7 +668,7 @@ error:if (status <0 ) { len =0 ;if (status != -EPIPE ) { - dev_dbg (hcd->self.controller, + dev_dbg(hcd->self.controller, "CTRL: TypeReq=0x%x val=0x%x " "idx=0x%x len=%d ==> %d\n", typeReq, wValue, wIndex,
@@ -684,11 +684,11 @@ error: len = urb->transfer_buffer_length; urb->actual_length = len;/* always USB_DIR_IN, toward host */ -memcpy (ubuf, bufp, len); +memcpy (ubuf, bufp, len);/* report whether RH hardware supports remote wakeup */ if (patch_wakeup && - len > offsetof (struct usb_config_descriptor , + len > offsetof(struct usb_config_descriptor , bmAttributes)) ((struct usb_config_descriptor *)ubuf)->bmAttributes |=USB_CONFIG_ATT_WAKEUP ;
@@ -760,27 +760,27 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd)* fire at the same time to give the CPU a break in between */ if (hcd->uses_new_polling ?HCD_POLL_RH (hcd) : (length ==0 && hcd->status_urb !=NULL )) -mod_timer (&hcd->rh_timer, (jiffies/(HZ /4 ) +1 ) * (HZ /4 )); +mod_timer (&hcd->rh_timer, (jiffies/(HZ /4 ) +1 ) * (HZ /4 )); }EXPORT_SYMBOL_GPL (usb_hcd_poll_rh_status);/* timer callback */ -static void rh_timer_func (unsigned long _hcd) +static void rh_timer_func (unsigned long _hcd) {usb_hcd_poll_rh_status ((struct usb_hcd *) _hcd); }/*-------------------------------------------------------------------------*/ -static int rh_queue_status (struct usb_hcd *hcd,struct urb *urb) +static int rh_queue_status (struct usb_hcd *hcd,struct urb *urb) {int retval;unsigned long flags;unsigned len =1 + (urb->dev->maxchild /8 ); -spin_lock_irqsave (&hcd_root_hub_lock, flags); +spin_lock_irqsave (&hcd_root_hub_lock, flags);if (hcd->status_urb || urb->transfer_buffer_length < len) { -dev_dbg (hcd->self.controller,"not queuing rh status urb\n" ); +dev_dbg (hcd->self.controller,"not queuing rh status urb\n" ); retval = -EINVAL ; goto done; }
@@ -799,16 +799,16 @@ static int rh_queue_status (struct usb_hcd *hcd, struct urb *urb)mod_timer (&hcd->rh_timer, jiffies); retval =0 ; done: -spin_unlock_irqrestore (&hcd_root_hub_lock, flags); +spin_unlock_irqrestore (&hcd_root_hub_lock, flags);return retval; } -static int rh_urb_enqueue (struct usb_hcd *hcd,struct urb *urb) +static int rh_urb_enqueue (struct usb_hcd *hcd,struct urb *urb) {if (usb_endpoint_xfer_int (&urb->ep->desc)) -return rh_queue_status (hcd, urb); +return rh_queue_status (hcd, urb);if (usb_endpoint_xfer_control (&urb->ep->desc)) -return rh_call_control (hcd, urb); +return rh_call_control (hcd, urb);return -EINVAL ; }
@@ -832,7 +832,7 @@ static int usb_rh_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) }else {/* Status URB */ if (!hcd->uses_new_polling) -del_timer (&hcd->rh_timer); +del_timer (&hcd->rh_timer);if (urb == hcd->status_urb) { hcd->status_urb =NULL ;usb_hcd_unlink_urb_from_ep (hcd, urb);
@@ -904,9 +904,9 @@ static struct attribute_group usb_bus_attr_group = {* This code is used to initialize a usb_bus structure, memory for which is * separately managed. */ -static void usb_bus_init (struct usb_bus *bus) +static void usb_bus_init (struct usb_bus *bus) { -memset (&bus->devmap,0 ,sizeof (struct usb_devmap )); +memset (&bus->devmap,0 ,sizeof (struct usb_devmap )); bus->devnum_next =1 ;
@@ -917,7 +917,7 @@ static void usb_bus_init (struct usb_bus *bus) bus->bandwidth_isoc_reqs =0 ;mutex_init (&bus->usb_address0_mutex); -INIT_LIST_HEAD (&bus->bus_list); +INIT_LIST_HEAD (&bus->bus_list); }/*-------------------------------------------------------------------------*/
@@ -940,19 +940,19 @@ static int usb_register_bus(struct usb_bus *bus)mutex_lock (&usb_bus_list_lock); busnum =find_next_zero_bit (busmap,USB_MAXBUS ,1 );if (busnum >=USB_MAXBUS ) { -printk (KERN_ERR "%s: too many buses\n" , usbcore_name); +printk (KERN_ERR "%s: too many buses\n" , usbcore_name); goto error_find_busnum; }set_bit (busnum, busmap); bus->busnum = busnum;/* Add it to the local list of buses */ -list_add (&bus->bus_list, &usb_bus_list); +list_add (&bus->bus_list, &usb_bus_list);mutex_unlock (&usb_bus_list_lock);usb_notify_add_bus (bus); -dev_info (bus->controller,"new USB bus registered, assigned bus " +dev_info (bus->controller,"new USB bus registered, assigned bus " "number %d\n" , bus->busnum);return 0 ;
@@ -969,9 +969,9 @@ error_find_busnum:* Recycles the bus number, and unlinks the controller from usbcore data * structures so that it won't be seen by scanning the bus list. */ -static void usb_deregister_bus (struct usb_bus *bus) +static void usb_deregister_bus (struct usb_bus *bus) { -dev_info (bus->controller,"USB bus %d deregistered\n" , bus->busnum); +dev_info (bus->controller,"USB bus %d deregistered\n" , bus->busnum);/* * NOTE: make sure that all the devices are removed by the
@@ -979,7 +979,7 @@ static void usb_deregister_bus (struct usb_bus *bus)* itself up */ mutex_lock (&usb_bus_list_lock); -list_del (&bus->bus_list); +list_del (&bus->bus_list);mutex_unlock (&usb_bus_list_lock);usb_notify_remove_bus (bus);
@@ -1007,9 +1007,9 @@ static int register_root_hub(struct usb_hcd *hcd) usb_dev->devnum = devnum; usb_dev->bus->devnum_next = devnum +1 ; -memset (&usb_dev->bus->devmap.devicemap,0 , +memset (&usb_dev->bus->devmap.devicemap,0 ,sizeof usb_dev->bus->devmap.devicemap); -set_bit (devnum, usb_dev->bus->devmap.devicemap); +set_bit (devnum, usb_dev->bus->devmap.devicemap);usb_set_device_state (usb_dev,USB_STATE_ADDRESS );mutex_lock (&usb_bus_list_lock);
@@ -1018,7 +1018,7 @@ static int register_root_hub(struct usb_hcd *hcd) retval =usb_get_device_descriptor (usb_dev,USB_DT_DEVICE_SIZE );if (retval !=sizeof usb_dev->descriptor) {mutex_unlock (&usb_bus_list_lock); -dev_dbg (parent_dev,"can't read %s device descriptor %d\n" , +dev_dbg (parent_dev,"can't read %s device descriptor %d\n" ,dev_name (&usb_dev->dev), retval);return (retval <0 ) ? retval : -EMSGSIZE ; }
@@ -1032,18 +1032,18 @@ static int register_root_hub(struct usb_hcd *hcd) } } - retval =usb_new_device (usb_dev); + retval =usb_new_device (usb_dev);if (retval) { -dev_err (parent_dev,"can't register root hub for %s, %d\n" , +dev_err (parent_dev,"can't register root hub for %s, %d\n" ,dev_name (&usb_dev->dev), retval); }else { -spin_lock_irq (&hcd_root_hub_lock); +spin_lock_irq (&hcd_root_hub_lock); hcd->rh_registered =1 ; -spin_unlock_irq (&hcd_root_hub_lock); +spin_unlock_irq (&hcd_root_hub_lock);/* Did the HC die before the root hub was registered? */ if (HCD_DEAD (hcd)) -usb_hc_died (hcd);/* This time clean up */ +usb_hc_died (hcd);/* This time clean up */ }mutex_unlock (&usb_bus_list_lock);
@@ -1109,7 +1109,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_end_port_resume);* See USB 2.0 spec section 5.11.3; only periodic transfers need to be * scheduled in software, this function is only used for such scheduling. */ -long usb_calc_bus_time (int speed,int is_input,int isoc,int bytecount) +long usb_calc_bus_time (int speed,int is_input,int isoc,int bytecount) {unsigned long tmp;
@@ -1133,12 +1133,12 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount)case USB_SPEED_HIGH :/* ISOC or INTR */ /* FIXME adjust for input vs output */ if (isoc) - tmp =HS_NSECS_ISO (bytecount); + tmp =HS_NSECS_ISO (bytecount);else - tmp =HS_NSECS (bytecount); + tmp =HS_NSECS (bytecount);return tmp;default : -pr_debug ("%s: bogus device speed!\n" , usbcore_name); +pr_debug ("%s: bogus device speed!\n" , usbcore_name);return -1 ; } }
@@ -1540,7 +1540,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_map_urb_for_dma);* expects usb_submit_urb() to have sanity checked and conditioned all * inputs in the urb */ -int usb_hcd_submit_urb (struct urb *urb,gfp_t mem_flags) +int usb_hcd_submit_urb (struct urb *urb,gfp_t mem_flags) {int status;struct usb_hcd *hcd =bus_to_hcd (urb->dev->bus);
@@ -1615,7 +1615,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)* caller guarantees urb won't be recycled till both unlink() * and the urb's completion function return */ -int usb_hcd_unlink_urb (struct urb *urb,int status) +int usb_hcd_unlink_urb (struct urb *urb,int status) {struct usb_hcd *hcd;struct usb_device *udev = urb->dev;
@@ -1794,18 +1794,18 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,/* No more submits can occur */ spin_lock_irq (&hcd_urb_list_lock); rescan: - list_for_each_entry (urb, &ep->urb_list, urb_list) { +list_for_each_entry (urb, &ep->urb_list, urb_list) {int is_in;if (urb->unlinked)continue ; -usb_get_urb (urb); +usb_get_urb (urb); is_in =usb_urb_dir_in (urb);spin_unlock (&hcd_urb_list_lock);/* kick hcd */ unlink1 (hcd, urb, -ESHUTDOWN ); - dev_dbg (hcd->self.controller, + dev_dbg(hcd->self.controller, "shutdown urb %p ep%d%s%s\n", urb, usb_endpoint_num(&ep->desc), is_in ? "in" : "out",
@@ -1823,7 +1823,7 @@ rescan: }; s; })); -usb_put_urb (urb); +usb_put_urb (urb);/* list contents may have changed */ spin_lock (&hcd_urb_list_lock);
@@ -1832,21 +1832,21 @@ rescan:spin_unlock_irq (&hcd_urb_list_lock);/* Wait until the endpoint queue is completely empty */ -while (!list_empty (&ep->urb_list)) { +while (!list_empty (&ep->urb_list)) {spin_lock_irq (&hcd_urb_list_lock);/* The list may have changed while we acquired the spinlock */ urb =NULL ; -if (!list_empty (&ep->urb_list)) { - urb = list_entry (ep->urb_list.prev, struct urb, +if (!list_empty (&ep->urb_list)) { + urb = list_entry(ep->urb_list.prev, struct urb, urb_list); -usb_get_urb (urb); +usb_get_urb (urb); }spin_unlock_irq (&hcd_urb_list_lock);if (urb) { -usb_kill_urb (urb); -usb_put_urb (urb); +usb_kill_urb (urb); +usb_put_urb (urb); } } }
@@ -2139,13 +2139,13 @@ void usb_hcd_synchronize_unlinks(struct usb_device *udev)/*-------------------------------------------------------------------------*/ /* called in any context */ -int usb_hcd_get_frame_number (struct usb_device *udev) +int usb_hcd_get_frame_number (struct usb_device *udev) {struct usb_hcd *hcd =bus_to_hcd (udev->bus);if (!HCD_RH_RUNNING (hcd))return -ESHUTDOWN ; -return hcd->driver->get_frame_number (hcd); +return hcd->driver->get_frame_number (hcd); }/*-------------------------------------------------------------------------*/
@@ -2276,16 +2276,16 @@ static void hcd_resume_work(struct work_struct *work)* wakeup request is received. The routine submits a workqueue request * to resume the root hub (that is, manage its downstream ports again). */ -void usb_hcd_resume_root_hub (struct usb_hcd *hcd) +void usb_hcd_resume_root_hub (struct usb_hcd *hcd) {unsigned long flags; -spin_lock_irqsave (&hcd_root_hub_lock, flags); +spin_lock_irqsave (&hcd_root_hub_lock, flags);if (hcd->rh_registered) {set_bit (HCD_FLAG_WAKEUP_PENDING , &hcd->flags);queue_work (pm_wq, &hcd->wakeup_work); } -spin_unlock_irqrestore (&hcd_root_hub_lock, flags); +spin_unlock_irqrestore (&hcd_root_hub_lock, flags); }EXPORT_SYMBOL_GPL (usb_hcd_resume_root_hub);
@@ -2317,7 +2317,7 @@ int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num)* boards with root hubs hooked up to internal devices (instead of * just the OTG port) may need more attention to resetting... */ - hcd = container_of (bus, struct usb_hcd, self); + hcd = container_of(bus, struct usb_hcd, self);if (port_num && hcd->driver->start_port_reset) status = hcd->driver->start_port_reset (hcd, port_num);
@@ -2344,7 +2344,7 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum);* * Return: %IRQ_HANDLED if the IRQ was handled. %IRQ_NONE otherwise. */ -irqreturn_t usb_hcd_irq (int irq,void *__hcd) +irqreturn_t usb_hcd_irq (int irq,void *__hcd) {struct usb_hcd *hcd = __hcd;irqreturn_t rc;
@@ -2372,20 +2372,20 @@ EXPORT_SYMBOL_GPL(usb_hcd_irq);* * Only call this function with the primary HCD. */ -void usb_hc_died (struct usb_hcd *hcd) +void usb_hc_died (struct usb_hcd *hcd) {unsigned long flags; -dev_err (hcd->self.controller,"HC died; cleaning up\n" ); +dev_err (hcd->self.controller,"HC died; cleaning up\n" ); -spin_lock_irqsave (&hcd_root_hub_lock, flags); +spin_lock_irqsave (&hcd_root_hub_lock, flags);clear_bit (HCD_FLAG_RH_RUNNING , &hcd->flags);set_bit (HCD_FLAG_DEAD , &hcd->flags);if (hcd->rh_registered) {clear_bit (HCD_FLAG_POLL_RH , &hcd->flags);/* make hub_wq clean up old urbs and devices */ -usb_set_device_state (hcd->self.root_hub, +usb_set_device_state (hcd->self.root_hub,USB_STATE_NOTATTACHED );usb_kick_hub_wq (hcd->self.root_hub); }
@@ -2400,10 +2400,10 @@ void usb_hc_died (struct usb_hcd *hcd)usb_kick_hub_wq (hcd->self.root_hub); } } -spin_unlock_irqrestore (&hcd_root_hub_lock, flags); +spin_unlock_irqrestore (&hcd_root_hub_lock, flags);/* Make sure that the other roothub is also deallocated. */ } -EXPORT_SYMBOL_GPL (usb_hc_died); +EXPORT_SYMBOL_GPL (usb_hc_died);/*-------------------------------------------------------------------------*/
@@ -2439,7 +2439,7 @@ struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, hcd =kzalloc (sizeof (*hcd) + driver->hcd_priv_size,GFP_KERNEL );if (!hcd) { -dev_dbg (dev,"hcd alloc failed\n" ); +dev_dbg (dev,"hcd alloc failed\n" );return NULL ; }if (primary_hcd ==NULL ) {
@@ -2517,7 +2517,7 @@ EXPORT_SYMBOL_GPL(usb_create_hcd);*/ static void hcd_release (struct kref *kref) { - struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); + struct usb_hcd *hcd = container_of(kref, struct usb_hcd, kref);mutex_lock (&usb_port_peer_mutex);if (usb_hcd_is_primary_hcd (hcd))
@@ -2533,18 +2533,18 @@ static void hcd_release(struct kref *kref)kfree (hcd); } -struct usb_hcd *usb_get_hcd (struct usb_hcd *hcd) +struct usb_hcd *usb_get_hcd (struct usb_hcd *hcd) {if (hcd) -kref_get (&hcd->kref); +kref_get (&hcd->kref);return hcd; }EXPORT_SYMBOL_GPL (usb_get_hcd); -void usb_put_hcd (struct usb_hcd *hcd) +void usb_put_hcd (struct usb_hcd *hcd) {if (hcd) -kref_put (&hcd->kref, hcd_release); +kref_put (&hcd->kref, hcd_release); }EXPORT_SYMBOL_GPL (usb_put_hcd);
@@ -2847,13 +2847,13 @@ void usb_remove_hcd(struct usb_hcd *hcd)sysfs_remove_group (&rhdev->dev.kobj, &usb_bus_attr_group);clear_bit (HCD_FLAG_RH_RUNNING , &hcd->flags); -if (HC_IS_RUNNING (hcd->state)) +if (HC_IS_RUNNING (hcd->state)) hcd->state =HC_STATE_QUIESCING ;dev_dbg (hcd->self.controller,"roothub graceful disconnect\n" ); -spin_lock_irq (&hcd_root_hub_lock); +spin_lock_irq (&hcd_root_hub_lock); hcd->rh_registered =0 ; -spin_unlock_irq (&hcd_root_hub_lock); +spin_unlock_irq (&hcd_root_hub_lock);#ifdef CONFIG_PM cancel_work_sync (&hcd->wakeup_work);
@@ -2937,7 +2937,7 @@ struct usb_mon_operations *mon_ops;* symbols from usbcore, usbcore gets referenced and cannot be unloaded first. */ -int usb_mon_register (struct usb_mon_operations *ops) +int usb_mon_register (struct usb_mon_operations *ops) {if (mon_ops)
@@ -2947,9 +2947,9 @@ int usb_mon_register (struct usb_mon_operations *ops)mb ();return 0 ; } -EXPORT_SYMBOL_GPL (usb_mon_register); +EXPORT_SYMBOL_GPL (usb_mon_register); -void usb_mon_deregister (void ) +void usb_mon_deregister (void ) {if (mon_ops ==NULL ) {
@@ -2959,6 +2959,6 @@ void usb_mon_deregister (void) mon_ops =NULL ; mb(); } -EXPORT_SYMBOL_GPL (usb_mon_deregister); +EXPORT_SYMBOL_GPL (usb_mon_deregister);#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
Signature · 1 line
1.9.1
Quoted 2 lines · Chase Metzger
Removed
all(except false positives, from calculations)space prohibited warnings generated by checkpatch.pl.
False positives? Please describe them.
The only thing I believe you elided was the
use of a BitTime macro which in my opinion
should be used as a function.
drivers/usb/core/hcd.c: tmp = (67667L * (31L + 10L * BitTime (bytecount))) / 1000L;
as it is in the include file:
include/linux/usb/hcd.h: + (2083UL * (3 + BitTime(bytes))))/1000 \