USB: possible cleanups
Subsystems (2)
PATCH 1/1 USB: possible cleanups
Before I'm getting flamed to death:
This patch contains possible cleanups. If parts of this patch conflict with pending changes these parts of my patch have to be dropped.
This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global functions:
- core/usb.c: usb_buffer_map
- core/usb.c: usb_buffer_unmap
- remove the following unneeded EXPORT_SYMBOL's:
- core/hcd.c: usb_bus_init
- core/hcd.c: usb_alloc_bus
- core/hcd.c: usb_register_bus
- core/hcd.c: usb_deregister_bus
- core/hcd.c: usb_hcd_irq
- core/usb.c: usb_buffer_map
- core/usb.c: usb_buffer_unmap
- core/buffer.c: hcd_buffer_create
- core/buffer.c: hcd_buffer_destroy
---
drivers/usb/core/buffer.c | 2 -- drivers/usb/core/config.c | 2 +- drivers/usb/core/hcd.c | 7 +------ drivers/usb/core/hcd.h | 1 - drivers/usb/core/hub.c | 3 ++- drivers/usb/core/message.c | 10 ++++++---- drivers/usb/core/usb.c | 14 +++++++++----- drivers/usb/core/usb.h | 5 ----- drivers/usb/input/aiptek.c | 2 +- drivers/usb/media/ibmcam.c | 3 ++- drivers/usb/misc/sisusbvga/sisusb.c | 8 ++++---- drivers/usb/net/catc.c | 3 ++- drivers/usb/net/kawethfw.h | 8 ++++---- include/linux/usb.h | 4 ++-- 14 files changed, 34 insertions(+), 38 deletions(-)
drivers/usb/core/config.c renamed from drivers/usb/core/config.c.old +1 -1
@@ -221,7 +221,7 @@return buffer - buffer0 + i; } -int usb_parse_configuration (struct device *ddev,int cfgidx, +static int usb_parse_configuration (struct device *ddev,int cfgidx,struct usb_host_config *config,unsigned char *buffer,int size) {unsigned char *buffer0 = buffer;
drivers/usb/core/hcd.h renamed from drivers/usb/core/hcd.h.old +0 -1
@@ -208,7 +208,6 @@ };extern void usb_hcd_giveback_urb (struct usb_hcd *hcd,struct urb *urb,struct pt_regs *regs); -extern void usb_bus_init (struct usb_bus *bus);extern struct usb_hcd *usb_create_hcd (const struct hc_driver *driver,struct device *dev,char *bus_name);
drivers/usb/core/hcd.c renamed from drivers/usb/core/hcd.c.old +1 -6
@@ -701,7 +701,7 @@* This code is used to initialize a usb_bus structure, memory for which is * separately managed. */ -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 ));
@@ -719,7 +719,6 @@class_device_initialize (&bus->class_dev); bus->class_dev.class = &usb_host_class; } -EXPORT_SYMBOL (usb_bus_init);/** * usb_alloc_bus - creates a new USB host controller structure
@@ -745,7 +744,6 @@ bus->op = op;return bus; } -EXPORT_SYMBOL (usb_alloc_bus);/*-------------------------------------------------------------------------*/
@@ -792,7 +790,6 @@dev_info (bus->controller,"new USB bus registered, assigned bus number %d\n" , bus->busnum);return 0 ; } -EXPORT_SYMBOL (usb_register_bus);/** * usb_deregister_bus - deregisters the USB host controller
@@ -822,7 +819,6 @@class_device_del (&bus->class_dev); } -EXPORT_SYMBOL (usb_deregister_bus);/** * usb_register_root_hub - called by HCD to register its root hub
@@ -1557,7 +1553,6 @@usb_hc_died (hcd);return IRQ_HANDLED ; } -EXPORT_SYMBOL (usb_hcd_irq);/*-------------------------------------------------------------------------*/
drivers/usb/core/hub.c renamed from drivers/usb/core/hub.c.old +2 -1
@@ -1525,7 +1525,8 @@* Linux (2.6) currently has NO mechanisms to initiate that: no khubd * timer, no SRP, no requests through sysfs. */ -int __usb_suspend_device (struct usb_device *udev,int port1,pm_message_t state) +static int __usb_suspend_device (struct usb_device *udev,int port1, +pm_message_t state) {int status;
drivers/usb/core/usb.h renamed from drivers/usb/core/usb.h.old +0 -5
@@ -4,8 +4,6 @@extern void usb_remove_sysfs_dev_files (struct usb_device *dev);extern void usb_create_sysfs_intf_files (struct usb_interface *intf);extern void usb_remove_sysfs_intf_files (struct usb_interface *intf); -extern int usb_probe_interface (struct device *dev); -extern int usb_unbind_interface (struct device *dev);extern void usb_disable_endpoint (struct usb_device *dev,unsigned int epaddr); extern void usb_disable_interface (struct usb_device *dev,
@@ -13,9 +11,6 @@extern void usb_release_interface_cache (struct kref *ref);extern void usb_disable_device (struct usb_device *dev,int skip_ep0); -extern void usb_enable_interface (struct usb_device *dev, -struct usb_interface *intf); -extern int usb_get_device_descriptor (struct usb_device *dev,unsigned int size);extern int usb_set_configuration (struct usb_device *dev,int configuration);
drivers/usb/core/message.c renamed from drivers/usb/core/message.c.old +6 -4
@@ -90,8 +90,10 @@/*-------------------------------------------------------------------*/ // returns status (negative) or length (positive) -int usb_internal_control_msg (struct usb_device *usb_dev,unsigned int pipe, -struct usb_ctrlrequest *cmd,void *data,int len,int timeout) +static int usb_internal_control_msg (struct usb_device *usb_dev, +unsigned int pipe, +struct usb_ctrlrequest *cmd, +void *data,int len,int timeout) {struct urb *urb;int retv;
@@ -1039,8 +1041,8 @@* * Enables all the endpoints for the interface's current altsetting. */ -void usb_enable_interface (struct usb_device *dev, -struct usb_interface *intf) +static void usb_enable_interface (struct usb_device *dev, +struct usb_interface *intf) {struct usb_host_interface *alt = intf->cur_altsetting;int i;
include/linux/usb.h renamed from include/linux/usb.h.old +2 -2
@@ -942,11 +942,11 @@void usb_buffer_free (struct usb_device *dev,size_t size,void *addr,dma_addr_t dma); -struct urb *usb_buffer_map (struct urb *urb);#if 0 +struct urb *usb_buffer_map (struct urb *urb);void usb_buffer_dmasync (struct urb *urb); -#endif void usb_buffer_unmap (struct urb *urb); +#endif struct scatterlist ; int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe,
drivers/usb/core/usb.c renamed from drivers/usb/core/usb.c.old +9 -5
@@ -60,7 +60,7 @@const char *usbcore_name ="usbcore" ; -int nousb;/* Disable USB when built into kernel image */ +static int nousb;/* Disable USB when built into kernel image */ /* Not honored on modular build */ static DECLARE_RWSEM (usb_all_devices_rwsem);
@@ -86,7 +86,7 @@static int usb_generic_driver_data;/* called from driver core with usb_bus_type.subsys writelock */ -int usb_probe_interface (struct device *dev) +static int usb_probe_interface (struct device *dev) {struct usb_interface * intf =to_usb_interface (dev);struct usb_driver * driver =to_usb_driver (dev->driver);
@@ -114,7 +114,7 @@ }/* called from driver core with usb_bus_type.subsys writelock */ -int usb_unbind_interface (struct device *dev) +static int usb_unbind_interface (struct device *dev) {struct usb_interface *intf =to_usb_interface (dev);struct usb_driver *driver =to_usb_driver (intf->dev.driver);
@@ -1145,6 +1145,7 @@* * Reverse the effect of this call with usb_buffer_unmap(). */ +#if 0 struct urb *usb_buffer_map (struct urb *urb) {struct usb_bus *bus;
@@ -1174,6 +1175,7 @@ | URB_NO_SETUP_DMA_MAP); return urb; } +#endif /* 0 */ /* XXX DISABLED, no users currently. If you wish to re-enable this * XXX please determine whether the sync is to transfer ownership of
@@ -1218,6 +1220,7 @@* * Reverses the effect of usb_buffer_map(). */ +#if 0 void usb_buffer_unmap (struct urb *urb) {struct usb_bus *bus;
@@ -1244,6 +1247,7 @@ urb->transfer_flags &= ~(URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); } +#endif /* 0 */ /** * usb_buffer_map_sg - create scatterlist DMA mapping(s) for an endpoint
@@ -1524,11 +1528,11 @@EXPORT_SYMBOL (usb_buffer_alloc);EXPORT_SYMBOL (usb_buffer_free); -EXPORT_SYMBOL (usb_buffer_map);#if 0 +EXPORT_SYMBOL (usb_buffer_map);EXPORT_SYMBOL (usb_buffer_dmasync); -#endif EXPORT_SYMBOL (usb_buffer_unmap); +#endif EXPORT_SYMBOL (usb_buffer_map_sg);#if 0
drivers/usb/input/aiptek.c renamed from drivers/usb/input/aiptek.c.old +1 -1
@@ -796,7 +796,7 @@* manufacturing revisions. In any event, we consider these * IDs to not be model-specific nor unique. */ -struct usb_device_id aiptek_ids[] = { +static const struct usb_device_id aiptek_ids[] = { {USB_DEVICE (USB_VENDOR_ID_AIPTEK ,0x01 )}, {USB_DEVICE (USB_VENDOR_ID_AIPTEK ,0x10 )}, {USB_DEVICE (USB_VENDOR_ID_AIPTEK ,0x20 )},
drivers/usb/media/ibmcam.c renamed from drivers/usb/media/ibmcam.c.old +2 -1
@@ -1036,7 +1036,8 @@* History: * 1/21/00 Created. */ -void ibmcam_ProcessIsocData (struct uvd *uvd,struct usbvideo_frame *frame) +static void ibmcam_ProcessIsocData (struct uvd *uvd, +struct usbvideo_frame *frame) {enum ParseState newstate;long copylen =0 ;
drivers/usb/misc/sisusbvga/sisusb.c renamed from drivers/usb/misc/sisusbvga/sisusb.c.old +4 -4
@@ -2271,7 +2271,7 @@/* fops */ -int +static int sisusb_open (struct inode *inode,struct file *file) {struct sisusb_usb_data *sisusb;
@@ -2361,7 +2361,7 @@kfree (sisusb); } -int +static int sisusb_release (struct inode *inode,struct file *file) {struct sisusb_usb_data *sisusb;
@@ -2399,7 +2399,7 @@return 0 ; } -ssize_t +static ssize_t sisusb_read (struct file *file,char __user *buffer,size_t count,loff_t *ppos) {struct sisusb_usb_data *sisusb;
@@ -2540,7 +2540,7 @@return errno ? errno : bytes_read; } -ssize_t +static ssize_t sisusb_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) {
drivers/usb/net/catc.c renamed from drivers/usb/net/catc.c.old +2 -1
@@ -664,7 +664,8 @@ } } -void catc_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info) +static void catc_get_drvinfo (struct net_device *dev, +struct ethtool_drvinfo *info) {struct catc *catc =netdev_priv (dev);strncpy (info->driver, driver_name,ETHTOOL_BUSINFO_LEN );
drivers/usb/net/kawethfw.h renamed from drivers/usb/net/kawethfw.h.old +4 -4
@@ -551,7 +551,7 @@ }; -const int len_kaweth_trigger_code =sizeof (kaweth_trigger_code); -const int len_kaweth_trigger_code_fix =sizeof (kaweth_trigger_code_fix); -const int len_kaweth_new_code =sizeof (kaweth_new_code); -const int len_kaweth_new_code_fix =sizeof (kaweth_new_code_fix); +static const int len_kaweth_trigger_code =sizeof (kaweth_trigger_code); +static const int len_kaweth_trigger_code_fix =sizeof (kaweth_trigger_code_fix); +static const int len_kaweth_new_code =sizeof (kaweth_new_code); +static const int len_kaweth_new_code_fix =sizeof (kaweth_new_code_fix);
drivers/usb/core/buffer.c renamed from drivers/usb/core/buffer.c.old +0 -2
@@ -76,7 +76,6 @@ }return 0 ; } -EXPORT_SYMBOL (hcd_buffer_create);/**
@@ -98,7 +97,6 @@ } } } -EXPORT_SYMBOL (hcd_buffer_destroy);/* sometimes alloc/free could use kmalloc with SLAB_DMA, for
Quoted 20 lines · Adrian Bunk
Before I'm getting flamed to death:
This patch contains possible cleanups. If parts of this patch conflict with pending changes these parts of my patch have to be dropped.This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global functions:
-core/usb.c:usb_buffer_map
-core/usb.c:usb_buffer_unmap
- remove the following unneeded EXPORT_SYMBOL's:
-core/hcd.c:usb_bus_init
-core/hcd.c:usb_alloc_bus
-core/hcd.c:usb_register_bus
-core/hcd.c:usb_deregister_bus
-core/hcd.c:usb_hcd_irq
-core/usb.c:usb_buffer_map
-core/usb.c:usb_buffer_unmap
-core/buffer.c:hcd_buffer_create
-core/buffer.c:hcd_buffer_destroy
Quoted 1 line
Signed-off-by Adrian Bunk <[email protected]>
Looks good to me, thanks for the patch. Applied.
greg k-h