From 59fba744daadaaa85e07a5db96ac3618bc45a9ad Mon Sep 17 00:00:00 2001 From: Craig Shelley Date: Sat, 12 Apr 2008 16:15:54 +0100 Subject: USB: CP2101 Add new device IDs Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cp2101.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index 324bb61d68f..3b4fa94ecf2 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c @@ -53,9 +53,11 @@ static void cp2101_shutdown(struct usb_serial*); static int debug; static struct usb_device_id id_table [] = { + { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ + { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */ { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ @@ -71,6 +73,7 @@ static struct usb_device_id id_table [] = { { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ + { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */ { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ -- cgit v1.2.3 From d4062fcb9e6164cbbcef773f6b6602e30c4b6007 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Mon, 14 Apr 2008 21:27:00 +0800 Subject: USB: Fix memory leak in mon_stat_release Fix the leak of the snap structure allocated in mon_stat_open(). Signed-off-by: Ming Lei Acked-by: Pete Zaitcev Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mon/mon_stat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c index f6d1491256c..c7a595cd648 100644 --- a/drivers/usb/mon/mon_stat.c +++ b/drivers/usb/mon/mon_stat.c @@ -59,6 +59,9 @@ static ssize_t mon_stat_read(struct file *file, char __user *buf, static int mon_stat_release(struct inode *inode, struct file *file) { + struct snap *sp = file->private_data; + file->private_data = NULL; + kfree(sp); return 0; } -- cgit v1.2.3 From 8f7f85e9f9561507b009d26395c53e70758695ec Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Thu, 17 Apr 2008 07:47:34 +0200 Subject: USB: Add HP hs2300 Broadband Wireless Module to sierra.c Add the HP hs2300 Broadband Wireless Module (relabeled MC8775) USB IDs Signed-off-by: Stefan Seyfried Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ed678811e6a..7b02a4ae1da 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -164,6 +164,7 @@ static struct usb_device_id id_table [] = { { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ + { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */ { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ -- cgit v1.2.3 From 3bb1af5243d41af9518728445e9c9bd30dd47237 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 3 Mar 2008 15:15:36 -0500 Subject: USB: EHCI: carry out port handover during each root-hub resume This patch (as1044) causes EHCI port handover for non-high-speed devices to occur during every root-hub resume, not just in cases where the controller lost power or was reset. This is necessary because: When some machines go into suspend, they remove power from on-board USB devices while retaining suspend current for USB controllers. The user might well unplug a USB device while the system is suspended and then plug it back in before resuming. A corresponding change is made to the core resume routine; now high-speed root hubs will always be resumed when the system wakes up, even if they were suspended before the system went to sleep. If this weren't done then EHCI port handover wouldn't work, since it is called when the EHCI root hub is resumed. Finally, a comment is added to the hub driver explaining the khubd has to be freezable; if it weren't frozen then it could interfere with port handover. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/driver.c | 9 +++++++-- drivers/usb/core/hub.c | 6 ++++++ drivers/usb/host/ehci-hub.c | 4 +--- drivers/usb/host/ehci-pci.c | 1 - 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 801b6f142fa..ebccdefcc6f 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1523,9 +1523,14 @@ static int usb_suspend(struct device *dev, pm_message_t message) udev = to_usb_device(dev); /* If udev is already suspended, we can skip this suspend and - * we should also skip the upcoming system resume. */ + * we should also skip the upcoming system resume. High-speed + * root hubs are an exception; they need to resume whenever the + * system wakes up in order for USB-PERSIST port handover to work + * properly. + */ if (udev->state == USB_STATE_SUSPENDED) { - udev->skip_sys_resume = 1; + if (udev->parent || udev->speed != USB_SPEED_HIGH) + udev->skip_sys_resume = 1; return 0; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 57aeca160f3..a42db75c233 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2890,7 +2890,13 @@ loop: static int hub_thread(void *__unused) { + /* khubd needs to be freezable to avoid intefering with USB-PERSIST + * port handover. Otherwise it might see that a full-speed device + * was gone before the EHCI controller had handed its port over to + * the companion full-speed controller. + */ set_freezable(); + do { hub_events(); wait_event_freezable(khubd_wait, diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4e065e556e4..8d513a15d0c 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -281,9 +281,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable); spin_unlock_irq (&ehci->lock); - - if (!power_okay) - ehci_handover_companion_ports(ehci); + ehci_handover_companion_ports(ehci); return 0; } diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 72ccd56e36d..040bd8632eb 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -329,7 +329,6 @@ static int ehci_pci_resume(struct usb_hcd *hcd) /* here we "know" root ports should always stay powered */ ehci_port_power(ehci, 1); - ehci_handover_companion_ports(ehci); hcd->state = HC_STATE_SUSPENDED; return 0; -- cgit v1.2.3 From 3eb14915a300f539f271e3716f2421bb0697ed48 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 3 Mar 2008 15:15:43 -0500 Subject: USB: reorganize code in hub.c This patch (as1045) reorganizes some code in the hub driver. hub_port_status() is moved earlier in the file, and a new hub_stop() routine is created to do the work currently in hub_preset() (i.e., disconnect all child devices and quiesce the hub). There are no functional changes. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 58 ++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a42db75c233..087e3bb70e0 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -333,6 +333,27 @@ static int get_port_status(struct usb_device *hdev, int port1, return status; } +static int hub_port_status(struct usb_hub *hub, int port1, + u16 *status, u16 *change) +{ + int ret; + + mutex_lock(&hub->status_mutex); + ret = get_port_status(hub->hdev, port1, &hub->status->port); + if (ret < 4) { + dev_err(hub->intfdev, + "%s failed (err = %d)\n", __func__, ret); + if (ret >= 0) + ret = -EIO; + } else { + *status = le16_to_cpu(hub->status->port.wPortStatus); + *change = le16_to_cpu(hub->status->port.wPortChange); + ret = 0; + } + mutex_unlock(&hub->status_mutex); + return ret; +} + static void kick_khubd(struct usb_hub *hub) { unsigned long flags; @@ -610,9 +631,8 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1) } /* caller has locked the hub device */ -static int hub_pre_reset(struct usb_interface *intf) +static void hub_stop(struct usb_hub *hub) { - struct usb_hub *hub = usb_get_intfdata(intf); struct usb_device *hdev = hub->hdev; int i; @@ -622,6 +642,14 @@ static int hub_pre_reset(struct usb_interface *intf) usb_disconnect(&hdev->children[i]); } hub_quiesce(hub); +} + +/* caller has locked the hub device */ +static int hub_pre_reset(struct usb_interface *intf) +{ + struct usb_hub *hub = usb_get_intfdata(intf); + + hub_stop(hub); return 0; } @@ -910,7 +938,7 @@ static void hub_disconnect(struct usb_interface *intf) /* Disconnect all children and quiesce the hub */ hub->error = 0; - hub_pre_reset(intf); + hub_stop(hub); usb_set_intfdata (intf, NULL); @@ -1510,28 +1538,6 @@ out_authorized: } -static int hub_port_status(struct usb_hub *hub, int port1, - u16 *status, u16 *change) -{ - int ret; - - mutex_lock(&hub->status_mutex); - ret = get_port_status(hub->hdev, port1, &hub->status->port); - if (ret < 4) { - dev_err (hub->intfdev, - "%s failed (err = %d)\n", __FUNCTION__, ret); - if (ret >= 0) - ret = -EIO; - } else { - *status = le16_to_cpu(hub->status->port.wPortStatus); - *change = le16_to_cpu(hub->status->port.wPortChange); - ret = 0; - } - mutex_unlock(&hub->status_mutex); - return ret; -} - - /* Returns 1 if @hub is a WUSB root hub, 0 otherwise */ static unsigned hub_is_wusb(struct usb_hub *hub) { @@ -2726,7 +2732,7 @@ static void hub_events(void) /* If the hub has died, clean up after it */ if (hdev->state == USB_STATE_NOTATTACHED) { hub->error = -ENODEV; - hub_pre_reset(intf); + hub_stop(hub); goto loop; } -- cgit v1.2.3 From 5e6effaed6da94e727cd45f945ad2489af8570b3 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 3 Mar 2008 15:15:51 -0500 Subject: USB: make USB-PERSIST work after every system sleep This patch (as1046) makes USB-PERSIST work more in accordance with the documentation. Currently it takes effect only in cases where the root hub has lost power or been reset, but it is supposed to operate whenever a power session was dropped during a system sleep. A new hub_restart() routine carries out the duties required during a reset or a reset-resume. It checks to see whether occupied ports are still enabled, and if they aren't then it clears the enable-change and connect-change features (to prevent interference by khubd) and sets the child device's reset_resume flag. It also checks ports that are supposed to be unoccupied to verify that the firmware hasn't left the port in an enabled state. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 114 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 34 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 087e3bb70e0..df68e256258 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -644,6 +644,81 @@ static void hub_stop(struct usb_hub *hub) hub_quiesce(hub); } +#define HUB_RESET 1 +#define HUB_RESUME 2 +#define HUB_RESET_RESUME 3 + +#ifdef CONFIG_PM + +static void hub_restart(struct usb_hub *hub, int type) +{ + struct usb_device *hdev = hub->hdev; + int port1; + + /* Check each of the children to see if they require + * USB-PERSIST handling or disconnection. Also check + * each unoccupied port to make sure it is still disabled. + */ + for (port1 = 1; port1 <= hdev->maxchild; ++port1) { + struct usb_device *udev = hdev->children[port1-1]; + int status = 0; + u16 portstatus, portchange; + + if (!udev || udev->state == USB_STATE_NOTATTACHED) { + if (type != HUB_RESET) { + status = hub_port_status(hub, port1, + &portstatus, &portchange); + if (status == 0 && (portstatus & + USB_PORT_STAT_ENABLE)) + clear_port_feature(hdev, port1, + USB_PORT_FEAT_ENABLE); + } + continue; + } + + /* Was the power session lost while we were suspended? */ + switch (type) { + case HUB_RESET_RESUME: + portstatus = 0; + portchange = USB_PORT_STAT_C_CONNECTION; + break; + + case HUB_RESET: + case HUB_RESUME: + status = hub_port_status(hub, port1, + &portstatus, &portchange); + break; + } + + /* For "USB_PERSIST"-enabled children we must + * mark the child device for reset-resume and + * turn off the various status changes to prevent + * khubd from disconnecting it later. + */ + if (USB_PERSIST && udev->persist_enabled && status == 0 && + !(portstatus & USB_PORT_STAT_ENABLE)) { + if (portchange & USB_PORT_STAT_C_ENABLE) + clear_port_feature(hub->hdev, port1, + USB_PORT_FEAT_C_ENABLE); + if (portchange & USB_PORT_STAT_C_CONNECTION) + clear_port_feature(hub->hdev, port1, + USB_PORT_FEAT_C_CONNECTION); + udev->reset_resume = 1; + } + + /* Otherwise for a reset_resume we must disconnect the child, + * but as we may not lock the child device here + * we have to do a "logical" disconnect. + */ + else if (type == HUB_RESET_RESUME) + hub_port_logical_disconnect(hub, port1); + } + + hub_activate(hub); +} + +#endif /* CONFIG_PM */ + /* caller has locked the hub device */ static int hub_pre_reset(struct usb_interface *intf) { @@ -2015,49 +2090,20 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) static int hub_resume(struct usb_interface *intf) { - struct usb_hub *hub = usb_get_intfdata (intf); - - dev_dbg(&intf->dev, "%s\n", __FUNCTION__); + struct usb_hub *hub = usb_get_intfdata(intf); - /* tell khubd to look for changes on this hub */ - hub_activate(hub); + dev_dbg(&intf->dev, "%s\n", __func__); + hub_restart(hub, HUB_RESUME); return 0; } static int hub_reset_resume(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); - struct usb_device *hdev = hub->hdev; - int port1; + dev_dbg(&intf->dev, "%s\n", __func__); hub_power_on(hub); - - for (port1 = 1; port1 <= hdev->maxchild; ++port1) { - struct usb_device *child = hdev->children[port1-1]; - - if (child) { - - /* For "USB_PERSIST"-enabled children we must - * mark the child device for reset-resume and - * turn off the connect-change status to prevent - * khubd from disconnecting it later. - */ - if (USB_PERSIST && child->persist_enabled) { - child->reset_resume = 1; - clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_CONNECTION); - - /* Otherwise we must disconnect the child, - * but as we may not lock the child device here - * we have to do a "logical" disconnect. - */ - } else { - hub_port_logical_disconnect(hub, port1); - } - } - } - - hub_activate(hub); + hub_restart(hub, HUB_RESET_RESUME); return 0; } -- cgit v1.2.3 From feccc30d90155bcbc937f87643182a43d25873eb Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 3 Mar 2008 15:15:59 -0500 Subject: USB: remove CONFIG_USB_PERSIST setting This patch (as1047) removes the USB_PERSIST Kconfig option, enabling it permanently. It also prevents the power/persist attribute from being created for hub devices; there's no point in having it since USB-PERSIST is always turned on for hubs. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- Documentation/usb/persist.txt | 35 +++++++++++++++++++---------------- drivers/usb/core/Kconfig | 25 ------------------------- drivers/usb/core/hub.c | 27 ++++++++++----------------- drivers/usb/core/quirks.c | 12 ++++++++++++ drivers/usb/core/sysfs.c | 22 ++++++++++------------ drivers/usb/host/ehci-hub.c | 11 +---------- include/linux/usb.h | 2 +- 7 files changed, 53 insertions(+), 81 deletions(-) diff --git a/Documentation/usb/persist.txt b/Documentation/usb/persist.txt index df54d645cbb..bea58dbd30f 100644 --- a/Documentation/usb/persist.txt +++ b/Documentation/usb/persist.txt @@ -2,7 +2,7 @@ Alan Stern - September 2, 2006 (Updated May 29, 2007) + September 2, 2006 (Updated February 25, 2008) What is the problem? @@ -65,9 +65,10 @@ much better.) What is the solution? -Setting CONFIG_USB_PERSIST will cause the kernel to work around these -issues. It enables a mode in which the core USB device data -structures are allowed to persist across a power-session disruption. +The kernel includes a feature called USB-persist. It tries to work +around these issues by allowing the core USB device data structures to +persist across a power-session disruption. + It works like this. If the kernel sees that a USB host controller is not in the expected state during resume (i.e., if the controller was reset or otherwise had lost power) then it applies a persistence check @@ -80,28 +81,30 @@ re-enumeration shows that the device now attached to that port has the same descriptors as before, including the Vendor and Product IDs, then the kernel continues to use the same device structure. In effect, the kernel treats the device as though it had merely been reset instead of -unplugged. +unplugged. The same thing happens if the host controller is in the +expected state but a USB device was unplugged and then replugged. If no device is now attached to the port, or if the descriptors are different from what the kernel remembers, then the treatment is what you would expect. The kernel destroys the old device structure and behaves as though the old device had been unplugged and a new device -plugged in, just as it would without the CONFIG_USB_PERSIST option. +plugged in. The end result is that the USB device remains available and usable. Filesystem mounts and memory mappings are unaffected, and the world is now a good and happy place. -Note that even when CONFIG_USB_PERSIST is set, the "persist" feature -will be applied only to those devices for which it is enabled. You -can enable the feature by doing (as root): +Note that the "USB-persist" feature will be applied only to those +devices for which it is enabled. You can enable the feature by doing +(as root): echo 1 >/sys/bus/usb/devices/.../power/persist where the "..." should be filled in the with the device's ID. Disable the feature by writing 0 instead of 1. For hubs the feature is -automatically and permanently enabled, so you only have to worry about -setting it for devices where it really matters. +automatically and permanently enabled and the power/persist file +doesn't even exist, so you only have to worry about setting it for +devices where it really matters. Is this the best solution? @@ -112,19 +115,19 @@ centralized Logical Volume Manager. Such a solution would allow you to plug in a USB flash device, create a persistent volume associated with it, unplug the flash device, plug it back in later, and still have the same persistent volume associated with the device. As such -it would be more far-reaching than CONFIG_USB_PERSIST. +it would be more far-reaching than USB-persist. On the other hand, writing a persistent volume manager would be a big job and using it would require significant input from the user. This solution is much quicker and easier -- and it exists now, a giant point in its favor! -Furthermore, the USB_PERSIST option applies to _all_ USB devices, not +Furthermore, the USB-persist feature applies to _all_ USB devices, not just mass-storage devices. It might turn out to be equally useful for other device types, such as network interfaces. - WARNING: Using CONFIG_USB_PERSIST can be dangerous!! + WARNING: USB-persist can be dangerous!! When recovering an interrupted power session the kernel does its best to make sure the USB device hasn't been changed; that is, the same @@ -152,5 +155,5 @@ but yourself. YOU HAVE BEEN WARNED! USE AT YOUR OWN RISK! That having been said, most of the time there shouldn't be any trouble -at all. The "persist" feature can be extremely useful. Make the most -of it. +at all. The USB-persist feature can be extremely useful. Make the +most of it. diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index a2b0aa48b8e..c15621d6457 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig @@ -102,31 +102,6 @@ config USB_SUSPEND If you are unsure about this, say N here. -config USB_PERSIST - bool "USB device persistence during system suspend (DANGEROUS)" - depends on USB && PM && EXPERIMENTAL - default n - help - - If you say Y here and enable the "power/persist" attribute - for a USB device, the device's data structures will remain - persistent across system suspend, even if the USB bus loses - power. (This includes hibernation, also known as swsusp or - suspend-to-disk.) The devices will reappear as if by magic - when the system wakes up, with no need to unmount USB - filesystems, rmmod host-controller drivers, or do anything - else. - - WARNING: This option can be dangerous! - - If a USB device is replaced by another of the same type while - the system is asleep, there's a good chance the kernel won't - detect the change. Likewise if the media in a USB storage - device is replaced. When this happens it's almost certain to - cause data corruption and maybe even crash your system. - - If you are unsure, say N here. - config USB_OTG bool depends on USB && EXPERIMENTAL diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index df68e256258..6dc589955d7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -30,12 +30,6 @@ #include "hcd.h" #include "hub.h" -#ifdef CONFIG_USB_PERSIST -#define USB_PERSIST 1 -#else -#define USB_PERSIST 0 -#endif - /* if we are in debug mode, always announce new devices */ #ifdef DEBUG #ifndef CONFIG_USB_ANNOUNCE_NEW_DEVICES @@ -695,7 +689,7 @@ static void hub_restart(struct usb_hub *hub, int type) * turn off the various status changes to prevent * khubd from disconnecting it later. */ - if (USB_PERSIST && udev->persist_enabled && status == 0 && + if (udev->persist_enabled && status == 0 && !(portstatus & USB_PORT_STAT_ENABLE)) { if (portchange & USB_PORT_STAT_C_ENABLE) clear_port_feature(hub->hdev, port1, @@ -1923,9 +1917,8 @@ static int finish_port_resume(struct usb_device *udev) * the host and the device is the same as it was when the device * suspended. * - * If CONFIG_USB_PERSIST and @udev->reset_resume are both set then this - * routine won't check that the port is still enabled. Furthermore, - * if @udev->reset_resume is set then finish_port_resume() above will + * If @udev->reset_resume is set then this routine won't check that the + * port is still enabled. Furthermore, finish_port_resume() above will * reset @udev. The end result is that a broken power session can be * recovered and @udev will appear to persist across a loss of VBUS power. * @@ -1937,8 +1930,8 @@ static int finish_port_resume(struct usb_device *udev) * to it will be lost. Using the USB_PERSIST facility, the device can be * made to appear as if it had not disconnected. * - * This facility is inherently dangerous. Although usb_reset_device() - * makes every effort to insure that the same device is present after the + * This facility can be dangerous. Although usb_reset_device() makes + * every effort to insure that the same device is present after the * reset as before, it cannot provide a 100% guarantee. Furthermore it's * quite possible for a device to remain unaltered but its media to be * changed. If the user replaces a flash memory card while the system is @@ -1983,7 +1976,7 @@ int usb_port_resume(struct usb_device *udev) status = hub_port_status(hub, port1, &portstatus, &portchange); SuspendCleared: - if (USB_PERSIST && udev->reset_resume) + if (udev->reset_resume) want_flags = USB_PORT_STAT_POWER | USB_PORT_STAT_CONNECTION; else @@ -2113,10 +2106,10 @@ static int hub_reset_resume(struct usb_interface *intf) * * The USB host controller driver calls this function when its root hub * is resumed and Vbus power has been interrupted or the controller - * has been reset. The routine marks @rhdev as having lost power. When - * the hub driver is resumed it will take notice; if CONFIG_USB_PERSIST - * is enabled then it will carry out power-session recovery, otherwise - * it will disconnect all the child devices. + * has been reset. The routine marks @rhdev as having lost power. + * When the hub driver is resumed it will take notice and carry out + * power-session recovery for all the "USB-PERSIST"-enabled child devices; + * the others will be disconnected. */ void usb_root_hub_lost_power(struct usb_device *rhdev) { diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index dfc5418ea10..f384edf35b4 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -97,4 +97,16 @@ void usb_detect_quirks(struct usb_device *udev) if (udev->descriptor.bDeviceClass != USB_CLASS_HUB) udev->autosuspend_disabled = 1; #endif + +#ifdef CONFIG_PM + /* Hubs are automatically enabled for USB-PERSIST */ + if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) + udev->persist_enabled = 1; +#else + /* In the absense of PM, we can safely enable USB-PERSIST + * for all devices. It will affect things like hub resets + * and EMF-related port disables. + */ + udev->persist_enabled = 1; +#endif /* CONFIG_PM */ } diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index a37ccbd1e00..5b20a60de8b 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -180,11 +180,9 @@ show_urbnum(struct device *dev, struct device_attribute *attr, char *buf) static DEVICE_ATTR(urbnum, S_IRUGO, show_urbnum, NULL); -#if defined(CONFIG_USB_PERSIST) || defined(CONFIG_USB_SUSPEND) -static const char power_group[] = "power"; -#endif +#ifdef CONFIG_PM -#ifdef CONFIG_USB_PERSIST +static const char power_group[] = "power"; static ssize_t show_persist(struct device *dev, struct device_attribute *attr, char *buf) @@ -222,12 +220,13 @@ static int add_persist_attributes(struct device *dev) if (is_usb_device(dev)) { struct usb_device *udev = to_usb_device(dev); - /* Hubs are automatically enabled for USB_PERSIST */ - if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) - udev->persist_enabled = 1; - rc = sysfs_add_file_to_group(&dev->kobj, - &dev_attr_persist.attr, - power_group); + /* Hubs are automatically enabled for USB_PERSIST, + * no point in creating the attribute file. + */ + if (udev->descriptor.bDeviceClass != USB_CLASS_HUB) + rc = sysfs_add_file_to_group(&dev->kobj, + &dev_attr_persist.attr, + power_group); } return rc; } @@ -238,13 +237,12 @@ static void remove_persist_attributes(struct device *dev) &dev_attr_persist.attr, power_group); } - #else #define add_persist_attributes(dev) 0 #define remove_persist_attributes(dev) do {} while (0) -#endif /* CONFIG_USB_PERSIST */ +#endif /* CONFIG_PM */ #ifdef CONFIG_USB_SUSPEND diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 8d513a15d0c..fea9e47192d 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -28,7 +28,7 @@ /*-------------------------------------------------------------------------*/ -#ifdef CONFIG_USB_PERSIST +#ifdef CONFIG_PM static int ehci_hub_control( struct usb_hcd *hcd, @@ -104,15 +104,6 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci) ehci->owned_ports = 0; } -#else /* CONFIG_USB_PERSIST */ - -static inline void ehci_handover_companion_ports(struct ehci_hcd *ehci) -{ } - -#endif - -#ifdef CONFIG_PM - static int ehci_bus_suspend (struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); diff --git a/include/linux/usb.h b/include/linux/usb.h index 583e0481dfa..7e31cacfe69 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -387,6 +387,7 @@ struct usb_device { unsigned can_submit:1; /* URBs may be submitted */ unsigned discon_suspended:1; /* Disconnected while suspended */ + unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ unsigned have_langid:1; /* whether string_langid is valid */ unsigned authorized:1; /* Policy has said we can use it */ unsigned wusb:1; /* Device is Wireless USB */ @@ -433,7 +434,6 @@ struct usb_device { unsigned auto_pm:1; /* autosuspend/resume in progress */ unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ unsigned reset_resume:1; /* needs reset instead of resume */ - unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ unsigned autoresume_disabled:1; /* disabled by the user */ unsigned skip_sys_resume:1; /* skip the next system resume */ -- cgit v1.2.3 From eb764c4be1e5db3ee34df5745e98cf2f148c7320 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 3 Mar 2008 15:16:04 -0500 Subject: USB: check serial-number string after device reset This patch (as1048) extends the descriptor checking after a device is reset. Now the SerialNumber string descriptor is compared to its old value, in addition to the device and configuration descriptors. As a consequence, the kmalloc() call in usb_string() is now on the error-handling pathway for usb-storage. Hence its allocation type is changed to GFO_NOIO. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- Documentation/usb/persist.txt | 8 +++--- drivers/usb/core/hub.c | 65 +++++++++++++++++++++++++++++++++---------- drivers/usb/core/message.c | 2 +- 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/Documentation/usb/persist.txt b/Documentation/usb/persist.txt index bea58dbd30f..d56cb1a1155 100644 --- a/Documentation/usb/persist.txt +++ b/Documentation/usb/persist.txt @@ -136,10 +136,10 @@ aren't guaranteed to be 100% accurate. If you replace one USB device with another of the same type (same manufacturer, same IDs, and so on) there's an excellent chance the -kernel won't detect the change. Serial numbers and other strings are -not compared. In many cases it wouldn't help if they were, because -manufacturers frequently omit serial numbers entirely in their -devices. +kernel won't detect the change. The serial number string and other +descriptors are compared with the kernel's stored values, but this +might not help since manufacturers frequently omit serial numbers +entirely in their devices. Furthermore it's quite possible to leave a USB device exactly the same while changing its media. If you replace the flash memory card in a diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 6dc589955d7..9fc5179dfc6 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3010,16 +3010,36 @@ void usb_hub_cleanup(void) usb_deregister(&hub_driver); } /* usb_hub_cleanup() */ -static int config_descriptors_changed(struct usb_device *udev) -{ - unsigned index; - unsigned len = 0; - struct usb_config_descriptor *buf; +static int descriptors_changed(struct usb_device *udev, + struct usb_device_descriptor *old_device_descriptor) +{ + int changed = 0; + unsigned index; + unsigned serial_len = 0; + unsigned len; + unsigned old_length; + int length; + char *buf; + + if (memcmp(&udev->descriptor, old_device_descriptor, + sizeof(*old_device_descriptor)) != 0) + return 1; + + /* Since the idVendor, idProduct, and bcdDevice values in the + * device descriptor haven't changed, we will assume the + * Manufacturer and Product strings haven't changed either. + * But the SerialNumber string could be different (e.g., a + * different flash card of the same brand). + */ + if (udev->serial) + serial_len = strlen(udev->serial) + 1; + len = serial_len; for (index = 0; index < udev->descriptor.bNumConfigurations; index++) { - if (len < le16_to_cpu(udev->config[index].desc.wTotalLength)) - len = le16_to_cpu(udev->config[index].desc.wTotalLength); + old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); + len = max(len, old_length); } + buf = kmalloc(len, GFP_NOIO); if (buf == NULL) { dev_err(&udev->dev, "no mem to re-read configs after reset\n"); @@ -3027,25 +3047,41 @@ static int config_descriptors_changed(struct usb_device *udev) return 1; } for (index = 0; index < udev->descriptor.bNumConfigurations; index++) { - int length; - int old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); - + old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf, old_length); - if (length < old_length) { + if (length != old_length) { dev_dbg(&udev->dev, "config index %d, error %d\n", index, length); + changed = 1; break; } if (memcmp (buf, udev->rawdescriptors[index], old_length) != 0) { dev_dbg(&udev->dev, "config index %d changed (#%d)\n", - index, buf->bConfigurationValue); + index, + ((struct usb_config_descriptor *) buf)-> + bConfigurationValue); + changed = 1; break; } } + + if (!changed && serial_len) { + length = usb_string(udev, udev->descriptor.iSerialNumber, + buf, serial_len); + if (length + 1 != serial_len) { + dev_dbg(&udev->dev, "serial string error %d\n", + length); + changed = 1; + } else if (memcmp(buf, udev->serial, length) != 0) { + dev_dbg(&udev->dev, "serial string changed\n"); + changed = 1; + } + } + kfree(buf); - return index != udev->descriptor.bNumConfigurations; + return changed; } /** @@ -3118,8 +3154,7 @@ int usb_reset_device(struct usb_device *udev) goto re_enumerate; /* Device might have changed firmware (DFU or similar) */ - if (memcmp(&udev->descriptor, &descriptor, sizeof descriptor) - || config_descriptors_changed (udev)) { + if (descriptors_changed(udev, &descriptor)) { dev_info(&udev->dev, "device firmware changed\n"); udev->descriptor = descriptor; /* for disconnect() calls */ goto re_enumerate; diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index c311f67b7f0..a3695b5115f 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -784,7 +784,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) if (size <= 0 || !buf || !index) return -EINVAL; buf[0] = 0; - tbuf = kmalloc(256, GFP_KERNEL); + tbuf = kmalloc(256, GFP_NOIO); if (!tbuf) return -ENOMEM; -- cgit v1.2.3 From 9214d1d80c19016172e685ce7bde0ea757c49097 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 6 Mar 2008 11:04:13 -0500 Subject: USB: enable USB-PERSIST by default This patch (as1052) enables USB-PERSIST for all devices by default. The user won't have to remember to enable it explicitly for devices containing mounted filesystems. Eventually userspace tools like hal may be able to set the persist attribute automatically when a filesystem is mounted on a USB device. When that time comes this patch can be reverted, if people think it matters. This approach has the advantage of giving the user the ability to turn off USB-PERSIST for devices with mounted filesystems, rather than making the kernel always assume it should be on. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/quirks.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index f384edf35b4..2e201939029 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -98,12 +98,14 @@ void usb_detect_quirks(struct usb_device *udev) udev->autosuspend_disabled = 1; #endif -#ifdef CONFIG_PM + /* For the present, all devices default to USB-PERSIST enabled */ +#if 0 /* was: #ifdef CONFIG_PM */ /* Hubs are automatically enabled for USB-PERSIST */ if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) udev->persist_enabled = 1; + #else - /* In the absense of PM, we can safely enable USB-PERSIST + /* In the absence of PM, we can safely enable USB-PERSIST * for all devices. It will affect things like hub resets * and EMF-related port disables. */ -- cgit v1.2.3 From c2010a3b9e5e98efb7f70d4d73ce4f15508ffa7b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 14 Apr 2008 14:17:29 -0700 Subject: checkpatch: usb_free_urb() can take NULL usb_free_urb() can take a NULL, so let's check and warn about that. Signed-off-by: Greg Kroah-Hartman --- scripts/checkpatch.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 58a94947d65..64ec4b8a51b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1889,6 +1889,13 @@ sub process { WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev); } } +# check for needless usb_free_urb() checks + if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { + my $expr = $1; + if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) { + WARN("usb_free_urb(NULL) is safe this check is probabally not required\n" . $hereprev); + } + } # warn about #ifdefs in C files # if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { -- cgit v1.2.3 From c27a4b717cfb597e2e383350c152ed0781041052 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: USB: add USB_DT_CS_RADIO_CONTROL define to ch9.h This is needed by the wireless usb developers, and is part of the USB spec. Cc: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch9.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 6169438ec5a..7e1da17ca7c 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -180,6 +180,7 @@ struct usb_ctrlrequest { #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 #define USB_DT_WIRE_ADAPTER 0x21 #define USB_DT_RPIPE 0x22 +#define USB_DT_CS_RADIO_CONTROL 0x23 /* Conventional codes for class-specific descriptors. The convention is * defined in the USB "Common Class" Spec (3.11). Individual class specs -- cgit v1.2.3 From f476fbaba7b2051bafdb527eea1a8bed649187d4 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 13 Feb 2008 18:33:15 -0800 Subject: USB: convert usb.h struct usb_device to kernel-doc Convert struct usb_device to use kernel-doc notation. Please especially check the @filelist and @usb_classdev descriptions. Signed-off-by: Randy Dunlap Cc: Alan Stern Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 168 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 104 insertions(+), 64 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 7e31cacfe69..285011d9af1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -341,102 +341,142 @@ struct usb_bus { struct usb_tt; -/* +/** * struct usb_device - kernel's representation of a USB device - * - * FIXME: Write the kerneldoc! - * + * @devnum: device number; address on a USB bus + * @devpath: device ID string for use in messages (e.g., /port/...) + * @state: device state: configured, not attached, etc. + * @speed: device speed: high/full/low (or error) + * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub + * @ttport: device port on that tt hub + * @toggle: one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints + * @parent: our hub, unless we're the root + * @bus: bus we're part of + * @ep0: endpoint 0 data (default control pipe) + * @dev: generic device interface + * @descriptor: USB device descriptor + * @config: all of the device's configs + * @actconfig: the active configuration + * @ep_in: array of IN endpoints + * @ep_out: array of OUT endpoints + * @rawdescriptors: raw descriptors for each config + * @bus_mA: Current available from the bus + * @portnum: parent port number (origin 1) + * @level: number of USB hub ancestors + * @can_submit: URBs may be submitted + * @discon_suspended: disconnected while suspended + * @persist_enabled: USB_PERSIST enabled for this device + * @have_langid: whether string_langid is valid + * @authorized: policy has said we can use it; + * (user space) policy determines if we authorize this device to be + * used or not. By default, wired USB devices are authorized. + * WUSB devices are not, until we authorize them from user space. + * FIXME -- complete doc + * @wusb: device is Wireless USB + * @string_langid: language ID for strings + * @product: iProduct string, if present (static) + * @manufacturer: iManufacturer string, if present (static) + * @serial: iSerialNumber string, if present (static) + * @filelist: usbfs files that are open to this device + * @usb_classdev: USB class device that was created for usbfs device + * access from userspace + * @usbfs_dentry: usbfs dentry entry for the device + * @maxchild: number of ports if hub + * @children: child devices - USB devices that are attached to this hub + * @pm_usage_cnt: usage counter for autosuspend + * @quirks: quirks of the whole device + * @urbnum: number of URBs submitted for the whole device + * @active_duration: total time device is not suspended + * @autosuspend: for delayed autosuspends + * @pm_mutex: protects PM operations + * @last_busy: time of last use + * @autosuspend_delay: in jiffies + * @connect_time: time device was first connected + * @auto_pm: autosuspend/resume in progress + * @do_remote_wakeup: remote wakeup should be enabled + * @reset_resume: needs reset instead of resume + * @autosuspend_disabled: autosuspend disabled by the user + * @autoresume_disabled: autoresume disabled by the user + * @skip_sys_resume: skip the next system resume + * + * Notes: * Usbcore drivers should not set usbdev->state directly. Instead use * usb_set_device_state(). - * - * @authorized: (user space) policy determines if we authorize this - * device to be used or not. By default, wired USB - * devices are authorized. WUSB devices are not, until we - * authorize them from user space. FIXME -- complete doc */ struct usb_device { - int devnum; /* Address on USB bus */ - char devpath [16]; /* Use in messages: /port/port/... */ - enum usb_device_state state; /* configured, not attached, etc */ - enum usb_device_speed speed; /* high/full/low (or error) */ + int devnum; + char devpath [16]; + enum usb_device_state state; + enum usb_device_speed speed; - struct usb_tt *tt; /* low/full speed dev, highspeed hub */ - int ttport; /* device port on that tt hub */ + struct usb_tt *tt; + int ttport; - unsigned int toggle[2]; /* one bit for each endpoint - * ([0] = IN, [1] = OUT) */ + unsigned int toggle[2]; - struct usb_device *parent; /* our hub, unless we're the root */ - struct usb_bus *bus; /* Bus we're part of */ + struct usb_device *parent; + struct usb_bus *bus; struct usb_host_endpoint ep0; - struct device dev; /* Generic device interface */ + struct device dev; - struct usb_device_descriptor descriptor;/* Descriptor */ - struct usb_host_config *config; /* All of the configs */ + struct usb_device_descriptor descriptor; + struct usb_host_config *config; - struct usb_host_config *actconfig;/* the active configuration */ + struct usb_host_config *actconfig; struct usb_host_endpoint *ep_in[16]; struct usb_host_endpoint *ep_out[16]; - char **rawdescriptors; /* Raw descriptors for each config */ + char **rawdescriptors; - unsigned short bus_mA; /* Current available from the bus */ - u8 portnum; /* Parent port number (origin 1) */ - u8 level; /* Number of USB hub ancestors */ + unsigned short bus_mA; + u8 portnum; + u8 level; - unsigned can_submit:1; /* URBs may be submitted */ - unsigned discon_suspended:1; /* Disconnected while suspended */ - unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ - unsigned have_langid:1; /* whether string_langid is valid */ - unsigned authorized:1; /* Policy has said we can use it */ - unsigned wusb:1; /* Device is Wireless USB */ - int string_langid; /* language ID for strings */ + unsigned can_submit:1; + unsigned discon_suspended:1; + unsigned persist_enabled:1; + unsigned have_langid:1; + unsigned authorized:1; + unsigned wusb:1; + int string_langid; /* static strings from the device */ - char *product; /* iProduct string, if present */ - char *manufacturer; /* iManufacturer string, if present */ - char *serial; /* iSerialNumber string, if present */ + char *product; + char *manufacturer; + char *serial; struct list_head filelist; #ifdef CONFIG_USB_DEVICE_CLASS struct device *usb_classdev; #endif #ifdef CONFIG_USB_DEVICEFS - struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ + struct dentry *usbfs_dentry; #endif - /* - * Child devices - these can be either new devices - * (if this is a hub device), or different instances - * of this same device. - * - * Each instance needs its own set of data structures. - */ - int maxchild; /* Number of ports if hub */ + int maxchild; struct usb_device *children[USB_MAXCHILDREN]; - int pm_usage_cnt; /* usage counter for autosuspend */ - u32 quirks; /* quirks of the whole device */ - atomic_t urbnum; /* number of URBs submitted for - the whole device */ + int pm_usage_cnt; + u32 quirks; + atomic_t urbnum; - unsigned long active_duration; /* total time device is not suspended */ + unsigned long active_duration; #ifdef CONFIG_PM - struct delayed_work autosuspend; /* for delayed autosuspends */ - struct mutex pm_mutex; /* protects PM operations */ - - unsigned long last_busy; /* time of last use */ - int autosuspend_delay; /* in jiffies */ - unsigned long connect_time; /* time device was first connected */ - - unsigned auto_pm:1; /* autosuspend/resume in progress */ - unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ - unsigned reset_resume:1; /* needs reset instead of resume */ - unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ - unsigned autoresume_disabled:1; /* disabled by the user */ - unsigned skip_sys_resume:1; /* skip the next system resume */ + struct delayed_work autosuspend; + struct mutex pm_mutex; + + unsigned long last_busy; + int autosuspend_delay; + unsigned long connect_time; + + unsigned auto_pm:1; + unsigned do_remote_wakeup:1; + unsigned reset_resume:1; + unsigned autosuspend_disabled:1; + unsigned autoresume_disabled:1; + unsigned skip_sys_resume:1; #endif }; #define to_usb_device(d) container_of(d, struct usb_device, dev) -- cgit v1.2.3 From d99388aa0a504f69532db353a976ec133361bb4f Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Mon, 4 Feb 2008 23:57:42 -0800 Subject: USB: microtek: remove unused semaphore No current references, so removing it. Signed-off-by: Daniel Walker Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/image/microtek.c | 1 - drivers/usb/image/microtek.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index bc207e3c21f..0badbbe2fd2 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -794,7 +794,6 @@ static int mts_usb_probe(struct usb_interface *intf, new_desc->usb_dev = dev; new_desc->usb_intf = intf; - init_MUTEX(&new_desc->lock); /* endpoints */ new_desc->ep_out = ep_out; diff --git a/drivers/usb/image/microtek.h b/drivers/usb/image/microtek.h index d5d62a93905..ccce318f20a 100644 --- a/drivers/usb/image/microtek.h +++ b/drivers/usb/image/microtek.h @@ -39,7 +39,6 @@ struct mts_desc { u8 ep_image; struct Scsi_Host * host; - struct semaphore lock; struct urb *urb; struct mts_transfer_context context; -- cgit v1.2.3 From 75c43b6ec6eb114e875e43fb151987c1a558e4f4 Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Mon, 4 Feb 2008 23:57:42 -0800 Subject: USB: libusual: locking cleanup I converted the usu_init_notify semaphore to normal mutex usage, and it should still prevent the request_module before the init routine is complete. Before it acted more like a complete, now the mutex protects two distinct section from running at the same time. Signed-off-by: Daniel Walker Cc: Pete Zaitcev Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/libusual.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c index 55b952084f0..a28d49122e7 100644 --- a/drivers/usb/storage/libusual.c +++ b/drivers/usb/storage/libusual.c @@ -9,6 +9,7 @@ #include #include #include +#include /* */ @@ -30,7 +31,7 @@ static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS); #define BIAS_NAME_SIZE (sizeof("usb-storage")) static const char *bias_names[3] = { "none", "usb-storage", "ub" }; -static struct semaphore usu_init_notify; +static DEFINE_MUTEX(usu_probe_mutex); static DECLARE_COMPLETION(usu_end_notify); static atomic_t total_threads = ATOMIC_INIT(0); @@ -178,10 +179,7 @@ static int usu_probe_thread(void *arg) int rc; unsigned long flags; - /* A completion does not work here because it's counted. */ - down(&usu_init_notify); - up(&usu_init_notify); - + mutex_lock(&usu_probe_mutex); rc = request_module(bias_names[type]); spin_lock_irqsave(&usu_lock, flags); if (rc == 0 && (st->fls & USU_MOD_FL_PRESENT) == 0) { @@ -194,6 +192,7 @@ static int usu_probe_thread(void *arg) } st->fls &= ~USU_MOD_FL_THREAD; spin_unlock_irqrestore(&usu_lock, flags); + mutex_unlock(&usu_probe_mutex); complete_and_exit(&usu_end_notify, 0); } @@ -204,10 +203,9 @@ static int __init usb_usual_init(void) { int rc; - sema_init(&usu_init_notify, 0); - + mutex_lock(&usu_probe_mutex); rc = usb_register(&usu_driver); - up(&usu_init_notify); + mutex_unlock(&usu_probe_mutex); return rc; } -- cgit v1.2.3 From 5ddeac117f869c0da85e41e89dd5ed1199dab7dd Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 4 Feb 2008 23:57:45 -0800 Subject: USB: make USB_STORAGE_ONETOUCH available with PM As Torsten Kaiser pointed out, it seems the dependency of USB_STORAGE_ONETOUCH on !PM should have been removed in commit 7931e1c6f8007d5fef8a0bb2dc71bd97315eeae9. Signed-off-by: Adrian Bunk Cc: Matthew Dharm Cc: Alan Stern Cc: Greg Kroah-Hartman Cc: Torsten Kaiser Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 7e53333be01..05cfc8473bd 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig @@ -123,7 +123,7 @@ config USB_STORAGE_ALAUDA config USB_STORAGE_ONETOUCH bool "Support OneTouch Button on Maxtor Hard Drives (EXPERIMENTAL)" - depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL && !PM + depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL help Say Y here to include additional code to support the Maxtor OneTouch USB hard drive's onetouch button. -- cgit v1.2.3 From 1409e8e0e4dae15735727d7e2814b62aff609d31 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 4 Feb 2008 23:57:48 -0800 Subject: USB: usb-ohci-sm501-driver: use the conventional convention for suspend and resume Cc: Alan Stern Cc: Magnus Damm Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-sm501.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 4ea92762fb2..8ffcd3e5f56 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -242,6 +242,9 @@ static int ohci_sm501_resume(struct platform_device *pdev) usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); return 0; } +#else +#define ohci_sm501_suspend NULL +#define ohci_sm501_resume NULL #endif /*-------------------------------------------------------------------------*/ @@ -253,10 +256,8 @@ static struct platform_driver ohci_hcd_sm501_driver = { .probe = ohci_hcd_sm501_drv_probe, .remove = ohci_hcd_sm501_drv_remove, .shutdown = usb_hcd_platform_shutdown, -#ifdef CONFIG_PM .suspend = ohci_sm501_suspend, .resume = ohci_sm501_resume, -#endif .driver = { .owner = THIS_MODULE, .name = "sm501-usb", -- cgit v1.2.3 From c4504a7eb9c4c491e6f31b28169dd49e9bacc8ec Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 11 Feb 2008 15:26:09 +0300 Subject: USB: usbatm: convert heavy init dances to kthread API This is an attempt to kill two birds with one stone. First, we kill one more user of kernel_thread, which is scheduled for removal. Second - we kill one of the last users of kill_proc - the function which is also to be removed, because it uses a pid_t which is not safe now. Signed-off-by: Pavel Emelyanov Signed-off-by: Duncan Sands Signed-off-by: Greg Kroah-Hartman --- drivers/usb/atm/usbatm.c | 27 +++++++++++++++------------ drivers/usb/atm/usbatm.h | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index e717f5b1cae..07228721caf 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -80,6 +80,7 @@ #include #include #include +#include #ifdef VERBOSE_DEBUG static int usbatm_print_packet(const unsigned char *data, int len); @@ -1014,10 +1015,7 @@ static int usbatm_do_heavy_init(void *arg) struct usbatm_data *instance = arg; int ret; - daemonize(instance->driver->driver_name); allow_signal(SIGTERM); - instance->thread_pid = current->pid; - complete(&instance->thread_started); ret = instance->driver->heavy_init(instance, instance->usb_intf); @@ -1026,7 +1024,7 @@ static int usbatm_do_heavy_init(void *arg) ret = usbatm_atm_init(instance); mutex_lock(&instance->serialize); - instance->thread_pid = -1; + instance->thread = NULL; mutex_unlock(&instance->serialize); complete_and_exit(&instance->thread_exited, ret); @@ -1034,13 +1032,18 @@ static int usbatm_do_heavy_init(void *arg) static int usbatm_heavy_init(struct usbatm_data *instance) { - int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_FS | CLONE_FILES); - - if (ret < 0) { - usb_err(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); - return ret; + struct task_struct *t; + + t = kthread_create(usbatm_do_heavy_init, instance, + instance->driver->driver_name); + if (IS_ERR(t)) { + usb_err(instance, "%s: failed to create kernel_thread (%ld)!\n", + __func__, PTR_ERR(t)); + return PTR_ERR(t); } + instance->thread = t; + wake_up_process(t); wait_for_completion(&instance->thread_started); return 0; @@ -1124,7 +1127,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ mutex_init(&instance->serialize); - instance->thread_pid = -1; + instance->thread = NULL; init_completion(&instance->thread_started); init_completion(&instance->thread_exited); @@ -1287,8 +1290,8 @@ void usbatm_usb_disconnect(struct usb_interface *intf) mutex_lock(&instance->serialize); instance->disconnected = 1; - if (instance->thread_pid >= 0) - kill_proc(instance->thread_pid, SIGTERM, 1); + if (instance->thread != NULL) + send_sig(SIGTERM, instance->thread, 1); mutex_unlock(&instance->serialize); wait_for_completion(&instance->thread_exited); diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index fc6c2be5999..e6887c6cf3c 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h @@ -175,7 +175,7 @@ struct usbatm_data { int disconnected; /* heavy init */ - int thread_pid; + struct task_struct *thread; struct completion thread_started; struct completion thread_exited; -- cgit v1.2.3 From dbe0dbb7dfda52140d3469d7035a08dfa874fca2 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 10 Feb 2008 12:24:00 -0800 Subject: USB: defines for USB "Link Power Management" (LPM) ECN There's a new PM-related change notice for the USB 2.0 specification called "Link Power Management" (LPM). It defines a new "L1 Suspend" state which resembles the current (L2) suspend state, except that it can be entered and exited much more quickly. It should thus be more useful for runtime PM, even though it doesn't mandate reduced power draw from VBUS. This patch provides the relevant #defines for usbcore. Actually implementing these mechanisms requires host silicon that can generate new USB packets, plus hubs handling some new requests and peripherals which understand the new packets. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd.h | 2 +- drivers/usb/core/hub.h | 8 ++++++-- include/linux/usb/ch9.h | 14 +++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 2d1c3d5e47b..2c086b8460b 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h @@ -28,7 +28,7 @@ /* * USB Packet IDs (PIDs) */ -#define USB_PID_UNDEF_0 0xf0 +#define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */ #define USB_PID_OUT 0xe1 #define USB_PID_ACK 0xd2 #define USB_PID_DATA0 0xc3 diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 1551aed65e0..d672cd81a3e 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -41,9 +41,10 @@ */ #define USB_PORT_FEAT_CONNECTION 0 #define USB_PORT_FEAT_ENABLE 1 -#define USB_PORT_FEAT_SUSPEND 2 +#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */ #define USB_PORT_FEAT_OVER_CURRENT 3 #define USB_PORT_FEAT_RESET 4 +#define USB_PORT_FEAT_L1 5 /* L1 suspend */ #define USB_PORT_FEAT_POWER 8 #define USB_PORT_FEAT_LOWSPEED 9 #define USB_PORT_FEAT_HIGHSPEED 10 @@ -54,6 +55,7 @@ #define USB_PORT_FEAT_C_RESET 20 #define USB_PORT_FEAT_TEST 21 #define USB_PORT_FEAT_INDICATOR 22 +#define USB_PORT_FEAT_C_PORT_L1 23 /* * Hub Status and Hub Change results @@ -73,7 +75,8 @@ struct usb_port_status { #define USB_PORT_STAT_SUSPEND 0x0004 #define USB_PORT_STAT_OVERCURRENT 0x0008 #define USB_PORT_STAT_RESET 0x0010 -/* bits 5 to 7 are reserved */ +#define USB_PORT_STAT_L1 0x0020 +/* bits 6 to 7 are reserved */ #define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_LOW_SPEED 0x0200 #define USB_PORT_STAT_HIGH_SPEED 0x0400 @@ -91,6 +94,7 @@ struct usb_port_status { #define USB_PORT_STAT_C_SUSPEND 0x0004 #define USB_PORT_STAT_C_OVERCURRENT 0x0008 #define USB_PORT_STAT_C_RESET 0x0010 +#define USB_PORT_STAT_C_L1 0x0020 /* * wHubCharacteristics (masks) diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 7e1da17ca7c..61fcbc2b97d 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -66,8 +66,8 @@ #define USB_RECIP_ENDPOINT 0x02 #define USB_RECIP_OTHER 0x03 /* From Wireless USB 1.0 */ -#define USB_RECIP_PORT 0x04 -#define USB_RECIP_RPIPE 0x05 +#define USB_RECIP_PORT 0x04 +#define USB_RECIP_RPIPE 0x05 /* * Standard requests, for the bRequest field of a SETUP packet. @@ -102,10 +102,16 @@ #define USB_REQ_LOOPBACK_DATA_READ 0x16 #define USB_REQ_SET_INTERFACE_DS 0x17 +/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command, + * used by hubs to put ports into a new L1 suspend state, except that it + * forgot to define its number ... + */ + /* * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and * are read as a bit array returned by USB_REQ_GET_STATUS. (So there - * are at most sixteen features of each type.) + * are at most sixteen features of each type.) Hubs may also support a + * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend. */ #define USB_DEVICE_SELF_POWERED 0 /* (read only) */ #define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ @@ -575,6 +581,8 @@ enum usb_device_state { /* NOTE: there are actually four different SUSPENDED * states, returning to POWERED, DEFAULT, ADDRESS, or * CONFIGURED respectively when SOF tokens flow again. + * At this level there's no difference between L1 and L2 + * suspend states. (L2 being original USB 1.1 suspend.) */ }; -- cgit v1.2.3 From 9776afc8b3dc487557f3f576002520f59be334e6 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Fri, 1 Feb 2008 11:42:05 -0800 Subject: USB: ehci: minor cleanups Minor cleanups to the EHCI code: revision history is what source code repositories should have. Switch to a more standard way to kick in verbose debugging -- don't be EHCI-specific. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-dbg.c | 2 +- drivers/usb/host/ehci-hcd.c | 33 ++------------------------------- drivers/usb/host/ehci-hub.c | 2 +- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 64ebfc5548a..38eb92e5dc4 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c @@ -27,7 +27,7 @@ #define ehci_warn(ehci, fmt, args...) \ dev_warn (ehci_to_hcd(ehci)->self.controller , fmt , ## args ) -#ifdef EHCI_VERBOSE_DEBUG +#ifdef VERBOSE_DEBUG # define vdbg dbg # define ehci_vdbg ehci_dbg #else diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 85074cb36f3..36071220726 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -57,35 +57,6 @@ * Special thanks to Intel and VIA for providing host controllers to * test this driver on, and Cypress (including In-System Design) for * providing early devices for those host controllers to talk to! - * - * HISTORY: - * - * 2004-05-10 Root hub and PCI suspend/resume support; remote wakeup. (db) - * 2004-02-24 Replace pci_* with generic dma_* API calls (dsaxena@plexity.net) - * 2003-12-29 Rewritten high speed iso transfer support (by Michal Sojka, - * , updates by DB). - * - * 2002-11-29 Correct handling for hw async_next register. - * 2002-08-06 Handling for bulk and interrupt transfers is mostly shared; - * only scheduling is different, no arbitrary limitations. - * 2002-07-25 Sanity check PCI reads, mostly for better cardbus support, - * clean up HC run state handshaking. - * 2002-05-24 Preliminary FS/LS interrupts, using scheduling shortcuts - * 2002-05-11 Clear TT errors for FS/LS ctrl/bulk. Fill in some other - * missing pieces: enabling 64bit dma, handoff from BIOS/SMM. - * 2002-05-07 Some error path cleanups to report better errors; wmb(); - * use non-CVS version id; better iso bandwidth claim. - * 2002-04-19 Control/bulk/interrupt submit no longer uses giveback() on - * errors in submit path. Bugfixes to interrupt scheduling/processing. - * 2002-03-05 Initial high-speed ISO support; reduce ITD memory; shift - * more checking to generic hcd framework (db). Make it work with - * Philips EHCI; reduce PCI traffic; shorten IRQ path (Rory Bolt). - * 2002-01-14 Minor cleanup; version synch. - * 2002-01-08 Fix roothub handoff of FS/LS to companion controllers. - * 2002-01-04 Control/Bulk queuing behaves. - * - * 2001-12-12 Initial patch version for Linux 2.5.1 kernel. - * 2001-June Works with usb-storage and NEC EHCI on 2.4 */ #define DRIVER_VERSION "10 Dec 2004" @@ -95,7 +66,7 @@ static const char hcd_name [] = "ehci_hcd"; -#undef EHCI_VERBOSE_DEBUG +#undef VERBOSE_DEBUG #undef EHCI_URB_TRACE #ifdef DEBUG @@ -676,7 +647,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) cmd = ehci_readl(ehci, &ehci->regs->command); bh = 0; -#ifdef EHCI_VERBOSE_DEBUG +#ifdef VERBOSE_DEBUG /* unrequested/ignored: Frame List Rollover */ dbg_status (ehci, "irq", status); #endif diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index fea9e47192d..21ac3781f21 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -767,7 +767,7 @@ static int ehci_hub_control ( if (temp & PORT_POWER) status |= 1 << USB_PORT_FEAT_POWER; -#ifndef EHCI_VERBOSE_DEBUG +#ifndef VERBOSE_DEBUG if (status & ~0xffff) /* only if wPortChange is interesting */ #endif dbg_port (ehci, "GetStatus", wIndex + 1, temp); -- cgit v1.2.3 From e01e7fe3886715f083313da409c5850472455d06 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 2 Feb 2008 02:42:52 -0800 Subject: USB: ohci: port reset paranoia timeout This limits how long the OHCI port reset loop waits for the hardware to do its job, if the controller either (a) dies, or (b) can't finish the reset. Such limits are always a good idea. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-hub.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 48e4b11f4d3..c638e6b33c4 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -564,14 +564,18 @@ static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) u32 temp; u16 now = ohci_readl(ohci, &ohci->regs->fmnumber); u16 reset_done = now + PORT_RESET_MSEC; + int limit_1 = DIV_ROUND_UP(PORT_RESET_MSEC, PORT_RESET_HW_MSEC); /* build a "continuous enough" reset signal, with up to * 3msec gap between pulses. scheduler HZ==100 must work; * this might need to be deadline-scheduled. */ do { + int limit_2; + /* spin until any current reset finishes */ - for (;;) { + limit_2 = PORT_RESET_HW_MSEC * 2; + while (--limit_2 >= 0) { temp = ohci_readl (ohci, portstat); /* handle e.g. CardBus eject */ if (temp == ~(u32)0) @@ -581,6 +585,17 @@ static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) udelay (500); } + /* timeout (a hardware error) has been observed when + * EHCI sets CF while this driver is resetting a port; + * presumably other disconnect paths might do it too. + */ + if (limit_2 < 0) { + ohci_dbg(ohci, + "port[%d] reset timeout, stat %08x\n", + port, temp); + break; + } + if (!(temp & RH_PS_CCS)) break; if (temp & RH_PS_PRSC) @@ -590,8 +605,11 @@ static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) ohci_writel (ohci, RH_PS_PRS, portstat); msleep(PORT_RESET_HW_MSEC); now = ohci_readl(ohci, &ohci->regs->fmnumber); - } while (tick_before(now, reset_done)); - /* caller synchronizes using PRSC */ + } while (tick_before(now, reset_done) && --limit_1 >= 0); + + /* caller synchronizes using PRSC ... and handles PRS + * still being set when this returns. + */ return 0; } -- cgit v1.2.3 From caa9ef672a045ba0b19184cd3f872b583f066771 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Fri, 8 Feb 2008 15:08:44 -0800 Subject: USB: ehci tolerates some buggy devices This teaches EHCI how to to work around bugs in certain high speed devices, by accomodating "bulk" packets that exceed the 512 byte constant value required by the USB 2.0 specification. (Have a look at section 5.8.3, paragraphs 1 and 3.) It also makes the descriptor parsing code warn when it encounters such bugs. (We've had reports of maybe two or three such devices, all pretty recent.) Such devices are nonconformant. The proper fix is have the vendors of those devices do the simple, obvious, and correct thing ... which will let them be used with USB hosts that don't have workarounds for this particular vendor bug. But unless/until they do, we can at least have one of the high speed HCDs work with such buggy devices. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/config.c | 17 +++++++++++++++++ drivers/usb/host/ehci-q.c | 16 +++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index a92122a216b..568244c99bd 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -145,6 +145,23 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, endpoint->desc.wMaxPacketSize = cpu_to_le16(8); } + /* + * Some buggy high speed devices have bulk endpoints using + * maxpacket sizes other than 512. High speed HCDs may not + * be able to handle that particular bug, so let's warn... + */ + if (to_usb_device(ddev)->speed == USB_SPEED_HIGH + && usb_endpoint_xfer_bulk(d)) { + unsigned maxp; + + maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize) & 0x07ff; + if (maxp != 512) + dev_warn(ddev, "config %d interface %d altsetting %d " + "bulk endpoint 0x%X has invalid maxpacket %d\n", + cfgno, inum, asnum, d->bEndpointAddress, + maxp); + } + /* Skip over any Class Specific or Vendor Specific descriptors; * find the next endpoint or interface descriptor */ endpoint->extra = buffer; diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 2e49de820b1..c0e752cffc6 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -657,6 +657,14 @@ qh_make ( type = usb_pipetype (urb->pipe); maxp = usb_maxpacket (urb->dev, urb->pipe, !is_input); + /* 1024 byte maxpacket is a hardware ceiling. High bandwidth + * acts like up to 3KB, but is built from smaller packets. + */ + if (max_packet(maxp) > 1024) { + ehci_dbg(ehci, "bogus qh maxpacket %d\n", max_packet(maxp)); + goto done; + } + /* Compute interrupt scheduling parameters just once, and save. * - allowing for high bandwidth, how many nsec/uframe are used? * - split transactions need a second CSPLIT uframe; same question @@ -757,7 +765,13 @@ qh_make ( info2 |= (EHCI_TUNE_MULT_HS << 30); } else if (type == PIPE_BULK) { info1 |= (EHCI_TUNE_RL_HS << 28); - info1 |= 512 << 16; /* usb2 fixed maxpacket */ + /* The USB spec says that high speed bulk endpoints + * always use 512 byte maxpacket. But some device + * vendors decided to ignore that, and MSFT is happy + * to help them do so. So now people expect to use + * such nonconformant devices with Linux too; sigh. + */ + info1 |= max_packet(maxp) << 16; info2 |= (EHCI_TUNE_MULT_HS << 30); } else { /* PIPE_INTERRUPT */ info1 |= max_packet (maxp) << 16; -- cgit v1.2.3 From 135db0485cdfa808d69420889ca4a2fad8aed9df Mon Sep 17 00:00:00 2001 From: David Brownell Date: Mon, 11 Feb 2008 18:40:46 -0800 Subject: USB: ehci minor SOC bus glue fixes Various minor fixes to some SOC bus glue for EHCI: - Remove a bogus copyright (by "me"!) which someone added to the FSL driver, and an irrelevant comment. - Un-break MODULE_ALIAS() directives after platform_bus hotplugging acquired a backwards-incompatible change. (Which didn't fix ANY of the in-tree drivers it prevented from hotplugging -- sigh.) - Remove some bogus assignments of platform_bus_type; that's done by the platform_bus code. - Add some FIXMEs for drivers with that pointless two-level idiom for probe() and remove() routines. ("Obfuscation" is a non-goal.) That should help avoid future bus glue which copies that idiom. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-au1xxx.c | 5 +++-- drivers/usb/host/ehci-fsl.c | 9 ++++----- drivers/usb/host/ehci-ixp4xx.c | 3 +-- drivers/usb/host/ehci-ppc-soc.c | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index da7532d38bf..8b5f991e949 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c @@ -237,6 +237,7 @@ static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) if (usb_disabled()) return -ENODEV; + /* FIXME we only want one one probe() not two */ ret = usb_ehci_au1xxx_probe(&ehci_au1xxx_hc_driver, &hcd, pdev); return ret; } @@ -245,6 +246,7 @@ static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) { struct usb_hcd *hcd = platform_get_drvdata(pdev); + /* FIXME we only want one one remove() not two */ usb_ehci_au1xxx_remove(hcd, pdev); return 0; } @@ -265,7 +267,7 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev) return 0; } */ -MODULE_ALIAS("au1xxx-ehci"); +MODULE_ALIAS("platform:au1xxx-ehci"); static struct platform_driver ehci_hcd_au1xxx_driver = { .probe = ehci_hcd_au1xxx_drv_probe, .remove = ehci_hcd_au1xxx_drv_remove, @@ -274,6 +276,5 @@ static struct platform_driver ehci_hcd_au1xxx_driver = { /*.resume = ehci_hcd_au1xxx_drv_resume, */ .driver = { .name = "au1xxx-ehci", - .bus = &platform_bus_type } }; diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index adb0defa163..6d9bed6c1f4 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -1,5 +1,4 @@ /* - * (C) Copyright David Brownell 2000-2002 * Copyright (c) 2005 MontaVista Software * * This program is free software; you can redistribute it and/or modify it @@ -28,7 +27,6 @@ /* FIXME: Power Management is un-ported so temporarily disable it */ #undef CONFIG_PM -/* PCI-based HCs are common, but plenty of non-PCI HCs are used too */ /* configure so an HC device and id are always provided */ /* always called with process context; sleeping is OK */ @@ -331,6 +329,7 @@ static int ehci_fsl_drv_probe(struct platform_device *pdev) if (usb_disabled()) return -ENODEV; + /* FIXME we only want one one probe() not two */ return usb_hcd_fsl_probe(&ehci_fsl_hc_driver, pdev); } @@ -338,12 +337,12 @@ static int ehci_fsl_drv_remove(struct platform_device *pdev) { struct usb_hcd *hcd = platform_get_drvdata(pdev); + /* FIXME we only want one one remove() not two */ usb_hcd_fsl_remove(hcd, pdev); - return 0; } -MODULE_ALIAS("fsl-ehci"); +MODULE_ALIAS("platform:fsl-ehci"); static struct platform_driver ehci_fsl_driver = { .probe = ehci_fsl_drv_probe, @@ -351,5 +350,5 @@ static struct platform_driver ehci_fsl_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "fsl-ehci", - }, + }, }; diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index 3041d8f055f..601c8795a85 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c @@ -140,13 +140,12 @@ static int ixp4xx_ehci_remove(struct platform_device *pdev) return 0; } -MODULE_ALIAS("ixp4xx-ehci"); +MODULE_ALIAS("platform:ixp4xx-ehci"); static struct platform_driver ixp4xx_ehci_driver = { .probe = ixp4xx_ehci_probe, .remove = ixp4xx_ehci_remove, .driver = { .name = "ixp4xx-ehci", - .bus = &platform_bus_type }, }; diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c index a3249078c80..6c76036783a 100644 --- a/drivers/usb/host/ehci-ppc-soc.c +++ b/drivers/usb/host/ehci-ppc-soc.c @@ -175,6 +175,7 @@ static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) if (usb_disabled()) return -ENODEV; + /* FIXME we only want one one probe() not two */ ret = usb_ehci_ppc_soc_probe(&ehci_ppc_soc_hc_driver, &hcd, pdev); return ret; } @@ -183,17 +184,17 @@ static int ehci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) { struct usb_hcd *hcd = platform_get_drvdata(pdev); + /* FIXME we only want one one remove() not two */ usb_ehci_ppc_soc_remove(hcd, pdev); return 0; } -MODULE_ALIAS("ppc-soc-ehci"); +MODULE_ALIAS("platform:ppc-soc-ehci"); static struct platform_driver ehci_ppc_soc_driver = { .probe = ehci_hcd_ppc_soc_drv_probe, .remove = ehci_hcd_ppc_soc_drv_remove, .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "ppc-soc-ehci", - .bus = &platform_bus_type } }; -- cgit v1.2.3 From 96f9bc373c83a67922dc32f358e8a3b3dd4e18a0 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Wed, 13 Feb 2008 17:02:33 +0900 Subject: USB: m66592-udc: reduce size of data structure. Poking around with pahole, we see that m66592 handily shoves a u16 in between larger types on 2 separate occasions leaving us with 2 2-byte holes: struct m66592 { ... /* size: 1196, cachelines: 38 */ /* sum members: 1192, holes: 2, sum holes: 4 */ /* last cacheline: 12 bytes */ }; /* definitions: 1 */ Pairing them gets back 4-bytes: struct m66592 { ... /* size: 1192, cachelines: 38 */ /* last cacheline: 8 bytes */ }; /* definitions: 1 */ Unfortunately it's not enough to save a cacheline with this massive structure, but every byte helps. Signed-off-by: Paul Mundt Signed-off-by: Yoshihiro Shimoda Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/m66592-udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h index 17b792b7f6b..be0a4c1f80a 100644 --- a/drivers/usb/gadget/m66592-udc.h +++ b/drivers/usb/gadget/m66592-udc.h @@ -486,10 +486,10 @@ struct m66592 { struct usb_request *ep0_req; /* for internal request */ u16 ep0_data; /* for internal request */ + u16 old_vbus; struct timer_list timer; - u16 old_vbus; int scount; int old_dvsq; -- cgit v1.2.3 From c765d4cad977f7e454a53d5bca5a942156b2d94c Mon Sep 17 00:00:00 2001 From: Karsten Wiese Date: Sat, 16 Feb 2008 13:44:42 -0800 Subject: USB: EHCI: Refactor "if (handshake()) state = HC_STATE_HALT" Refactor the EHCI "if (handshake()) state = HC_STATE_HALT" idiom, which appears 4 times, by replacing it with calls to a new function called handshake_on_error_set_halt(). Saves a few bytes too. Signed-off-by: Karsten Wiese Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-hcd.c | 23 ++++++++++++++--------- drivers/usb/host/ehci-sched.c | 14 ++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 36071220726..40f7391bf2a 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -145,6 +145,16 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr, return -ETIMEDOUT; } +static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, + u32 mask, u32 done, int usec) +{ + int error = handshake(ehci, ptr, mask, done, usec); + if (error) + ehci_to_hcd(ehci)->state = HC_STATE_HALT; + + return error; +} + /* force HC to halt state from unknown (EHCI spec section 2.3) */ static int ehci_halt (struct ehci_hcd *ehci) { @@ -217,11 +227,9 @@ static void ehci_quiesce (struct ehci_hcd *ehci) /* wait for any schedule enables/disables to take effect */ temp = ehci_readl(ehci, &ehci->regs->command) << 10; temp &= STS_ASS | STS_PSS; - if (handshake (ehci, &ehci->regs->status, STS_ASS | STS_PSS, - temp, 16 * 125) != 0) { - ehci_to_hcd(ehci)->state = HC_STATE_HALT; + if (handshake_on_error_set_halt(ehci, &ehci->regs->status, + STS_ASS | STS_PSS, temp, 16 * 125)) return; - } /* then disable anything that's still active */ temp = ehci_readl(ehci, &ehci->regs->command); @@ -229,11 +237,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci) ehci_writel(ehci, temp, &ehci->regs->command); /* hardware can take 16 microframes to turn off ... */ - if (handshake (ehci, &ehci->regs->status, STS_ASS | STS_PSS, - 0, 16 * 125) != 0) { - ehci_to_hcd(ehci)->state = HC_STATE_HALT; - return; - } + handshake_on_error_set_halt(ehci, &ehci->regs->status, + STS_ASS | STS_PSS, 0, 16 * 125); } /*-------------------------------------------------------------------------*/ diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 8a8e08a51ba..38c606c13db 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -440,11 +440,10 @@ static int enable_periodic (struct ehci_hcd *ehci) /* did clearing PSE did take effect yet? * takes effect only at frame boundaries... */ - status = handshake(ehci, &ehci->regs->status, STS_PSS, 0, 9 * 125); - if (status != 0) { - ehci_to_hcd(ehci)->state = HC_STATE_HALT; + status = handshake_on_error_set_halt(ehci, &ehci->regs->status, + STS_PSS, 0, 9 * 125); + if (status) return status; - } cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; ehci_writel(ehci, cmd, &ehci->regs->command); @@ -465,11 +464,10 @@ static int disable_periodic (struct ehci_hcd *ehci) /* did setting PSE not take effect yet? * takes effect only at frame boundaries... */ - status = handshake(ehci, &ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); - if (status != 0) { - ehci_to_hcd(ehci)->state = HC_STATE_HALT; + status = handshake_on_error_set_halt(ehci, &ehci->regs->status, + STS_PSS, STS_PSS, 9 * 125); + if (status) return status; - } cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; ehci_writel(ehci, cmd, &ehci->regs->command); -- cgit v1.2.3 From 4208978ec4f0d6001facf95be9defccf1a0bf313 Mon Sep 17 00:00:00 2001 From: Savin Zlobec Date: Fri, 15 Feb 2008 13:42:01 +0100 Subject: USB: gadget: Hangup tty on g_serial disconnect On USB cable disconnect g_serial doesn't hangup the port tty, which results in an endless read on the tty device. With the following patch the read and select behave correctly when the cable is unplugged. Tested on at91rm9200 Signed-off-by: Savin Zlobec Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/serial.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index f5c3896b1d9..433b3f44f42 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c @@ -2163,8 +2163,7 @@ static void gs_free_ports(struct gs_dev *dev) port->port_dev = NULL; wake_up_interruptible(&port->port_write_wait); if (port->port_tty) { - wake_up_interruptible(&port->port_tty->read_wait); - wake_up_interruptible(&port->port_tty->write_wait); + tty_hangup(port->port_tty); } spin_unlock_irqrestore(&port->port_lock, flags); } else { -- cgit v1.2.3 From 9544e833f977d1d3e102a070718d613cd234ce8d Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 4 Feb 2008 23:57:50 -0800 Subject: USB: io_ti.c: remove pointless eye-candy in debug statements These strings always come up as false positives whenever I'm doing git-conflict fixups (ie: about 1000 times/day). I don't think the zillion "<" and ">" characters are very useful and removing them makes my life that little bit easier. Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_ti.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index e5ea5ef6335..63e044adc19 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -1086,12 +1086,11 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { struct ti_i2c_desc *rom_desc; - dbg ("%s - <<<<<<<<<<<<<<>>>>>>>>>", __FUNCTION__); + dbg("%s - RUNNING IN DOWNLOAD MODE", __func__); status = TiValidateI2cImage (serial); if (status) { - dbg ("%s - <<<<<<<<<<<<<<>>>>>>>>>", - __FUNCTION__); + dbg("%s - DOWNLOAD MODE -- BAD I2C", __func__); return status; } @@ -1345,8 +1344,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) /********************************************************************/ /* Boot Mode */ /********************************************************************/ - dbg ("%s - <<<<<<<<<<<<<<>>>>>>>>>>>>>>", - __FUNCTION__); + dbg("%s - RUNNING IN BOOT MODE", __func__); // Configure the TI device so we can use the BULK pipes for download status = TIConfigureBootDevice (serial->serial->dev); @@ -1461,7 +1459,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) StayInBootMode: // Eprom is invalid or blank stay in boot mode - dbg ("%s - <<<<<<<<<<<<<<>>>>>>>>>>>", __FUNCTION__); + dbg("%s - STAYING IN BOOT MODE", __func__); serial->product_info.TiMode = TI_MODE_BOOT; return 0; -- cgit v1.2.3 From 93075544d6c6e9aaa14c44edb6eb3f71144bdeeb Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 10 Feb 2008 20:23:14 -0600 Subject: USB: cypress_m8: Feature buffer fixes cypress_m8: Feature buffer fixes From: Mike Isely Don't hardcode the feature buffer size; use sizeof() instead. That way we can easily specify the size in a single spot. Speaking of the feature buffer size, the Cypress app note (and further testing with a DeLorme Earthmate) suggests that this size should be 5 not 8 bytes. Signed-off-by: Mike Isely Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cypress_m8.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 779d07851a4..155b82a25d1 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -290,7 +290,7 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m { int new_baudrate = 0, retval = 0, tries = 0; struct cypress_private *priv; - __u8 feature_buffer[8]; + __u8 feature_buffer[5]; unsigned long flags; dbg("%s", __FUNCTION__); @@ -353,7 +353,7 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m } dbg("%s - baud rate is being sent as %d", __FUNCTION__, new_baudrate); - memset(feature_buffer, 0, 8); + memset(feature_buffer, 0, sizeof(feature_buffer)); /* fill the feature_buffer with new configuration */ *((u_int32_t *)feature_buffer) = new_baudrate; @@ -370,16 +370,20 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m feature_buffer[2], feature_buffer[3], feature_buffer[4]); do { - retval = usb_control_msg (port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), - HID_REQ_SET_REPORT, USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS, - 0x0300, 0, feature_buffer, 8, 500); + retval = usb_control_msg(port->serial->dev, + usb_sndctrlpipe(port->serial->dev, 0), + HID_REQ_SET_REPORT, + USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS, + 0x0300, 0, feature_buffer, + sizeof(feature_buffer), 500); if (tries++ >= 3) break; - } while (retval != 8 && retval != -ENODEV); + } while (retval != sizeof(feature_buffer) && + retval != -ENODEV); - if (retval != 8) { + if (retval != sizeof(feature_buffer)) { err("%s - failed sending serial line settings - %d", __FUNCTION__, retval); cypress_set_dead(port); } else { @@ -393,19 +397,23 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m case CYPRESS_GET_CONFIG: dbg("%s - retreiving serial line settings", __FUNCTION__); /* set initial values in feature buffer */ - memset(feature_buffer, 0, 8); + memset(feature_buffer, 0, sizeof(feature_buffer)); do { - retval = usb_control_msg (port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0), - HID_REQ_GET_REPORT, USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS, - 0x0300, 0, feature_buffer, 8, 500); - + retval = usb_control_msg(port->serial->dev, + usb_rcvctrlpipe(port->serial->dev, 0), + HID_REQ_GET_REPORT, + USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS, + 0x0300, 0, feature_buffer, + sizeof(feature_buffer), 500); + if (tries++ >= 3) break; - } while (retval != 5 && retval != -ENODEV); + } while (retval != sizeof(feature_buffer) && + retval != -ENODEV); - if (retval != 5) { + if (retval != sizeof(feature_buffer)) { err("%s - failed to retrieve serial line settings - %d", __FUNCTION__, retval); cypress_set_dead(port); return retval; -- cgit v1.2.3 From 3416eaa1f8f8d516b77de514e14cf8da256d28fb Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 10 Feb 2008 20:23:19 -0600 Subject: USB: cypress_m8: Packet format is separate from characteristic size cypress_m8: Packet format is separate from characteristic size The Cypress app note states that when using an 8 byte packet buffer size that the packet format is modified (to be more compact). However I have since discovered that newer DeLorme Earthmate LT-20 devices (those that are low speed USB with 8 byte packet size) STILL use the format that is really supposed to correspond to 32 byte packets. Further confusing things is the subsequent discovery that there are actually two different types of LT-20 - older LT-20's use 32 byte packets which is probably why this issue wasn't originally encountered. The solution here is to flag the packet format separately from the buffer size. Then at initialization time, identify the correct combination and set it up. This is a critical fix for anyone with a newer LT-20. Older devices and non-Earthmate devices should remain unaffected by this change. (If other devices behave in this, uh, unexpected manner, it's now just a simple 1 line change to fix them as well (change the pkt_fmt member for that device). Default behavior with this patch is still to drive the format as per the app-note; of course for Earthmate devices this is overridden. Signed-off-by: Mike Isely Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cypress_m8.c | 111 ++++++++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 45 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 155b82a25d1..c42d3bdbe98 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -122,6 +122,11 @@ static struct usb_driver cypress_driver = { .no_dynamic_id = 1, }; +enum packet_format { + packet_format_1, /* b0:status, b1:payload count */ + packet_format_2 /* b0[7:3]:status, b0[2:0]:payload count */ +}; + struct cypress_private { spinlock_t lock; /* private lock */ int chiptype; /* identifier of device, for quirks/etc */ @@ -139,6 +144,7 @@ struct cypress_private { __u8 current_status; /* received from last read - info on dsr,cts,cd,ri,etc */ __u8 current_config; /* stores the current configuration byte */ __u8 rx_flags; /* throttling - used from whiteheat/ftdi_sio */ + enum packet_format pkt_fmt; /* format to use for packet send / receive */ int baud_rate; /* stores current baud rate in integer form */ int cbr_mask; /* stores current baud rate in masked form */ int isthrottled; /* if throttled, discard reads */ @@ -532,6 +538,17 @@ static int generic_startup (struct usb_serial *serial) priv->termios_initialized = 0; priv->rx_flags = 0; priv->cbr_mask = B300; + /* Default packet format setting is determined by packet size. + Anything with a size larger then 9 must have a separate + count field since the 3 bit count field is otherwise too + small. Otherwise we can use the slightly more compact + format. This is in accordance with the cypress_m8 serial + converter app note. */ + if (port->interrupt_out_size > 9) { + priv->pkt_fmt = packet_format_1; + } else { + priv->pkt_fmt = packet_format_2; + } if (interval > 0) { priv->write_urb_interval = interval; priv->read_urb_interval = interval; @@ -564,6 +581,9 @@ static int cypress_earthmate_startup (struct usb_serial *serial) priv = usb_get_serial_port_data(serial->port[0]); priv->chiptype = CT_EARTHMATE; + /* All Earthmate devices use the separated-count packet + format! Idiotic. */ + priv->pkt_fmt = packet_format_1; return 0; } /* cypress_earthmate_startup */ @@ -811,21 +831,18 @@ static void cypress_send(struct usb_serial_port *port) memset(port->interrupt_out_urb->transfer_buffer, 0, port->interrupt_out_size); spin_lock_irqsave(&priv->lock, flags); - switch (port->interrupt_out_size) { - case 32: - /* this is for the CY7C64013... */ - offset = 2; - port->interrupt_out_buffer[0] = priv->line_control; - break; - case 8: - /* this is for the CY7C63743... */ - offset = 1; - port->interrupt_out_buffer[0] = priv->line_control; - break; - default: - dbg("%s - wrong packet size", __FUNCTION__); - spin_unlock_irqrestore(&priv->lock, flags); - return; + switch (priv->pkt_fmt) { + default: + case packet_format_1: + /* this is for the CY7C64013... */ + offset = 2; + port->interrupt_out_buffer[0] = priv->line_control; + break; + case packet_format_2: + /* this is for the CY7C63743... */ + offset = 1; + port->interrupt_out_buffer[0] = priv->line_control; + break; } if (priv->line_control & CONTROL_RESET) @@ -846,12 +863,13 @@ static void cypress_send(struct usb_serial_port *port) return; } - switch (port->interrupt_out_size) { - case 32: - port->interrupt_out_buffer[1] = count; - break; - case 8: - port->interrupt_out_buffer[0] |= count; + switch (priv->pkt_fmt) { + default: + case packet_format_1: + port->interrupt_out_buffer[1] = count; + break; + case packet_format_2: + port->interrupt_out_buffer[0] |= count; } dbg("%s - count is %d", __FUNCTION__, count); @@ -864,8 +882,9 @@ send: if (priv->cmd_ctrl) actual_size = 1; else - actual_size = count + (port->interrupt_out_size == 32 ? 2 : 1); - + actual_size = count + + (priv->pkt_fmt == packet_format_1 ? 2 : 1); + usb_serial_debug_data(debug, &port->dev, __FUNCTION__, port->interrupt_out_size, port->interrupt_out_urb->transfer_buffer); @@ -1331,30 +1350,32 @@ static void cypress_read_int_callback(struct urb *urb) } spin_lock_irqsave(&priv->lock, flags); - switch(urb->actual_length) { - case 32: - /* This is for the CY7C64013... */ - priv->current_status = data[0] & 0xF8; - bytes = data[1] + 2; - i = 2; - if (bytes > 2) - havedata = 1; - break; - case 8: - /* This is for the CY7C63743... */ - priv->current_status = data[0] & 0xF8; - bytes = (data[0] & 0x07) + 1; - i = 1; - if (bytes > 1) - havedata = 1; - break; - default: - dbg("%s - wrong packet size - received %d bytes", - __FUNCTION__, urb->actual_length); - spin_unlock_irqrestore(&priv->lock, flags); - goto continue_read; + result = urb->actual_length; + switch (priv->pkt_fmt) { + default: + case packet_format_1: + /* This is for the CY7C64013... */ + priv->current_status = data[0] & 0xF8; + bytes = data[1] + 2; + i = 2; + if (bytes > 2) + havedata = 1; + break; + case packet_format_2: + /* This is for the CY7C63743... */ + priv->current_status = data[0] & 0xF8; + bytes = (data[0] & 0x07) + 1; + i = 1; + if (bytes > 1) + havedata = 1; + break; } spin_unlock_irqrestore(&priv->lock, flags); + if (result < bytes) { + dbg("%s - wrong packet size - received %d bytes but packet " + "said %d bytes", __func__, result, bytes); + goto continue_read; + } usb_serial_debug_data (debug, &port->dev, __FUNCTION__, urb->actual_length, data); -- cgit v1.2.3 From 3d6aa3206540e1e68bda9e8ea11ec71444f1ac71 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 10 Feb 2008 20:23:24 -0600 Subject: USB: cypress_m8: Don't issue GET_CONFIG for certain devices Earthmate LT-20 devices (both "old" and "new" versions) can't tolerate a GET_CONFIG command. The original Earthmate has no trouble with this. Presumably other non-Earthmate devices are still OK as well. This change disables the use of GET_CONFIG for cases where it is known not to work. Signed-off-by: Mike Isely Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cypress_m8.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index c42d3bdbe98..f0c5d2a7ab9 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -145,6 +145,7 @@ struct cypress_private { __u8 current_config; /* stores the current configuration byte */ __u8 rx_flags; /* throttling - used from whiteheat/ftdi_sio */ enum packet_format pkt_fmt; /* format to use for packet send / receive */ + int get_cfg_unsafe; /* If true, the CYPRESS_GET_CONFIG is unsafe */ int baud_rate; /* stores current baud rate in integer form */ int cbr_mask; /* stores current baud rate in masked form */ int isthrottled; /* if throttled, discard reads */ @@ -401,6 +402,12 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m } break; case CYPRESS_GET_CONFIG: + if (priv->get_cfg_unsafe) { + /* Not implemented for this device, + and if we try to do it we're likely + to crash the hardware. */ + return -ENOTTY; + } dbg("%s - retreiving serial line settings", __FUNCTION__); /* set initial values in feature buffer */ memset(feature_buffer, 0, sizeof(feature_buffer)); @@ -570,20 +577,30 @@ static int generic_startup (struct usb_serial *serial) static int cypress_earthmate_startup (struct usb_serial *serial) { struct cypress_private *priv; + struct usb_serial_port *port = serial->port[0]; dbg("%s", __FUNCTION__); if (generic_startup(serial)) { dbg("%s - Failed setting up port %d", __FUNCTION__, - serial->port[0]->number); + port->number); return 1; } - priv = usb_get_serial_port_data(serial->port[0]); + priv = usb_get_serial_port_data(port); priv->chiptype = CT_EARTHMATE; /* All Earthmate devices use the separated-count packet format! Idiotic. */ priv->pkt_fmt = packet_format_1; + if (serial->dev->descriptor.idProduct != PRODUCT_ID_EARTHMATEUSB) { + /* The old original USB Earthmate seemed able to + handle GET_CONFIG requests; everything they've + produced since that time crashes if this command is + attempted :-( */ + dbg("%s - Marking this device as unsafe for GET_CONFIG " + "commands", __func__); + priv->get_cfg_unsafe = !0; + } return 0; } /* cypress_earthmate_startup */ -- cgit v1.2.3 From 6768306c3d9568bc66dc22f8b863bfbda3e7c4d2 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 10 Feb 2008 20:23:28 -0600 Subject: USB: cypress_m8: Get rid of pointless NULL check Remove a NULL check in cypress_m8; the check is useless in this context because it is referenced earlier in the same code path thus the kernel would be oops'ed before reaching this point anyway. (And it's really pointless here anyway; if this pointer somehow is NULL the driver is going to have serious problems in many other places.) Signed-off-by: Mike Isely Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cypress_m8.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index f0c5d2a7ab9..bdeda093695 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -1399,13 +1399,11 @@ static void cypress_read_int_callback(struct urb *urb) spin_lock_irqsave(&priv->lock, flags); /* check to see if status has changed */ - if (priv != NULL) { - if (priv->current_status != priv->prev_status) { - priv->diff_status |= priv->current_status ^ - priv->prev_status; - wake_up_interruptible(&priv->delta_msr_wait); - priv->prev_status = priv->current_status; - } + if (priv->current_status != priv->prev_status) { + priv->diff_status |= priv->current_status ^ + priv->prev_status; + wake_up_interruptible(&priv->delta_msr_wait); + priv->prev_status = priv->current_status; } spin_unlock_irqrestore(&priv->lock, flags); -- cgit v1.2.3 From 92983c2121fb46f234add1c36b5e596779899d56 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 10 Feb 2008 20:23:32 -0600 Subject: USB: cypress_m8: Limit baud rate to <=4800 for USB low speed devices The cypress app note for the M8 states that for the USB low speed version of the part, throughput is effectively limited to 800 bytes/sec. So if we were to try a faster baud rate in such cases then we risk overrun errors on receive. Best to just identify this case and limit the rate to 4800 baud or less (by ignoring any request to set a faster rate). The old baud rate setting code was somewhat fragile; this change also hopefully makes it easier in the future to better checking / limiting. Signed-off-by: Mike Isely Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cypress_m8.c | 104 +++++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index bdeda093695..4bf45c711b9 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -291,6 +291,59 @@ static struct usb_serial_driver cypress_ca42v2_device = { *****************************************************************************/ +static int analyze_baud_rate(struct usb_serial_port *port, unsigned baud_mask) +{ + int new_rate; + struct cypress_private *priv; + priv = usb_get_serial_port_data(port); + + /* + * The general purpose firmware for the Cypress M8 allows for + * a maximum speed of 57600bps (I have no idea whether DeLorme + * chose to use the general purpose firmware or not), if you + * need to modify this speed setting for your own project + * please add your own chiptype and modify the code likewise. + * The Cypress HID->COM device will work successfully up to + * 115200bps (but the actual throughput is around 3kBps). + */ + new_rate = mask_to_rate(baud_mask); + if (new_rate < 0) { + dbg("%s - failed setting baud rate, untranslatable speed", + __func__); + return -1; + } + if (port->serial->dev->speed == USB_SPEED_LOW) { + /* + * Mike Isely 2-Feb-2008: The + * Cypress app note that describes this mechanism + * states the the low-speed part can't handle more + * than 800 bytes/sec, in which case 4800 baud is the + * safest speed for a part like that. + */ + if (new_rate > 4800) { + dbg("%s - failed setting baud rate, device incapable " + "speed %d", __func__, new_rate); + return -1; + } + } + switch (priv->chiptype) { + case CT_EARTHMATE: + if (new_rate <= 600) { + /* 300 and 600 baud rates are supported under + * the generic firmware, but are not used with + * NMEA and SiRF protocols */ + dbg("%s - failed setting baud rate, unsupported speed " + "of %d on Earthmate GPS", __func__, new_rate); + return -1; + } + break; + default: + break; + } + return new_rate; +} + + /* This function can either set or retrieve the current serial line settings */ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_mask, int data_bits, int stop_bits, int parity_enable, int parity_type, int reset, int cypress_request_type) @@ -309,54 +362,15 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m switch(cypress_request_type) { case CYPRESS_SET_CONFIG: - - /* - * The general purpose firmware for the Cypress M8 allows for a maximum speed - * of 57600bps (I have no idea whether DeLorme chose to use the general purpose - * firmware or not), if you need to modify this speed setting for your own - * project please add your own chiptype and modify the code likewise. The - * Cypress HID->COM device will work successfully up to 115200bps (but the - * actual throughput is around 3kBps). - */ + new_baudrate = priv->baud_rate; if (baud_mask != priv->cbr_mask) { dbg("%s - baud rate is changing", __FUNCTION__); - if ( priv->chiptype == CT_EARTHMATE ) { - /* 300 and 600 baud rates are supported under the generic firmware, - * but are not used with NMEA and SiRF protocols */ - - if ( (baud_mask == B300) || (baud_mask == B600) ) { - err("%s - failed setting baud rate, unsupported speed", - __FUNCTION__); - new_baudrate = priv->baud_rate; - } else if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", - __FUNCTION__); - new_baudrate = priv->baud_rate; - } - } else if (priv->chiptype == CT_CYPHIDCOM) { - if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", - __FUNCTION__); - new_baudrate = priv->baud_rate; - } - } else if (priv->chiptype == CT_CA42V2) { - if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", - __FUNCTION__); - new_baudrate = priv->baud_rate; - } - } else if (priv->chiptype == CT_GENERIC) { - if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", - __FUNCTION__); - new_baudrate = priv->baud_rate; - } - } else { - info("%s - please define your chiptype", __FUNCTION__); - new_baudrate = priv->baud_rate; + retval = analyze_baud_rate(port, baud_mask); + if (retval >= 0) { + new_baudrate = retval; + dbg("%s - New baud rate set to %d", + __func__, new_baudrate); } - } else { /* baud rate not changing, keep the old */ - new_baudrate = priv->baud_rate; } dbg("%s - baud rate is being sent as %d", __FUNCTION__, new_baudrate); -- cgit v1.2.3 From b994d7f70ae59b874843fa2bc9a28b17b41febd5 Mon Sep 17 00:00:00 2001 From: "matthias@kaehlcke.net" Date: Mon, 18 Feb 2008 20:45:34 +0100 Subject: USB: auerswald: Convert stats_sem in a mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The semaphore cp->mutex is used as mutex, convert it to the mutex API Signed-off-by: Matthias Kaehlcke Cc: Wolfgang Mües Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/auerswald.c | 45 +++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index df7e1ecc810..498fd478992 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -31,6 +31,7 @@ #include #include #include +#include /*-------------------------------------------------------------------*/ /* Debug support */ @@ -232,7 +233,7 @@ typedef struct auerscon /* USB device context */ typedef struct { - struct semaphore mutex; /* protection in user context */ + struct mutex mutex; /* protection in user context */ char name[20]; /* name of the /dev/usb entry */ unsigned int dtindex; /* index in the device table */ struct usb_device * usbdev; /* USB device handle */ @@ -1376,7 +1377,7 @@ static int auerchar_open (struct inode *inode, struct file *file) if (cp == NULL) { return -ENODEV; } - if (down_interruptible (&cp->mutex)) { + if (mutex_lock_interruptible(&cp->mutex)) { return -ERESTARTSYS; } @@ -1405,7 +1406,7 @@ static int auerchar_open (struct inode *inode, struct file *file) cp->open_count++; ccp->auerdev = cp; dbg("open %s as /dev/%s", cp->dev_desc, cp->name); - up (&cp->mutex); + mutex_unlock(&cp->mutex); /* file IO stuff */ file->f_pos = 0; @@ -1413,7 +1414,7 @@ static int auerchar_open (struct inode *inode, struct file *file) return nonseekable_open(inode, file); /* Error exit */ -ofail: up (&cp->mutex); +ofail: mutex_unlock(&cp->mutex); auerchar_delete (ccp); return ret; } @@ -1440,14 +1441,14 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int up (&ccp->mutex); return -ENODEV; } - if (down_interruptible (&cp->mutex)) { + if (mutex_lock_interruptible(&cp->mutex)) { up(&ccp->mutex); return -ERESTARTSYS; } /* Check for removal */ if (!cp->usbdev) { - up(&cp->mutex); + mutex_unlock(&cp->mutex); up(&ccp->mutex); return -ENODEV; } @@ -1550,7 +1551,7 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int break; } /* release the mutexes */ - up(&cp->mutex); + mutex_unlock(&cp->mutex); up(&ccp->mutex); return ret; } @@ -1721,12 +1722,12 @@ write_again: up (&ccp->mutex); return -ERESTARTSYS; } - if (down_interruptible (&cp->mutex)) { + if (mutex_lock_interruptible(&cp->mutex)) { up (&ccp->mutex); return -ERESTARTSYS; } if (!cp->usbdev) { - up (&cp->mutex); + mutex_unlock(&cp->mutex); up (&ccp->mutex); return -EIO; } @@ -1750,7 +1751,7 @@ write_again: /* are there any buffers left? */ if (!bp) { - up (&cp->mutex); + mutex_unlock(&cp->mutex); up (&ccp->mutex); /* NONBLOCK: don't wait */ @@ -1783,7 +1784,7 @@ write_again: auerbuf_releasebuf (bp); /* Wake up all processes waiting for a buffer */ wake_up (&cp->bufferwait); - up (&cp->mutex); + mutex_unlock(&cp->mutex); up (&ccp->mutex); return -EFAULT; } @@ -1803,7 +1804,7 @@ write_again: auerchar_ctrlwrite_complete, bp); /* up we go */ ret = auerchain_submit_urb (&cp->controlchain, bp->urbp); - up (&cp->mutex); + mutex_unlock(&cp->mutex); if (ret) { dbg ("auerchar_write: nonzero result of auerchain_submit_urb %d", ret); auerbuf_releasebuf (bp); @@ -1830,16 +1831,16 @@ static int auerchar_release (struct inode *inode, struct file *file) down(&ccp->mutex); cp = ccp->auerdev; if (cp) { - down(&cp->mutex); + mutex_lock(&cp->mutex); /* remove an open service */ auerswald_removeservice (cp, &ccp->scontext); /* detach from device */ if ((--cp->open_count <= 0) && (cp->usbdev == NULL)) { /* usb device waits for removal */ - up (&cp->mutex); + mutex_unlock(&cp->mutex); auerswald_delete (cp); } else { - up (&cp->mutex); + mutex_unlock(&cp->mutex); } cp = NULL; ccp->auerdev = NULL; @@ -1917,7 +1918,7 @@ static int auerswald_probe (struct usb_interface *intf, } /* Initialize device descriptor */ - init_MUTEX (&cp->mutex); + mutex_init(&cp->mutex); cp->usbdev = usbdev; auerchain_init (&cp->controlchain); auerbuf_init (&cp->bufctl); @@ -2042,7 +2043,7 @@ static void auerswald_disconnect (struct usb_interface *intf) /* give back our USB minor number */ usb_deregister_dev(intf, &auerswald_class); - down (&cp->mutex); + mutex_lock(&cp->mutex); info ("device /dev/%s now disconnecting", cp->name); /* Stop the interrupt endpoint */ @@ -2057,16 +2058,18 @@ static void auerswald_disconnect (struct usb_interface *intf) if (cp->open_count == 0) { /* nobody is using this device. So we can clean up now */ - up (&cp->mutex);/* up() is possible here because no other task - can open the device (see above). I don't want - to kfree() a locked mutex. */ + mutex_unlock(&cp->mutex); + /* mutex_unlock() is possible here because no other task + can open the device (see above). I don't want + to kfree() a locked mutex. */ + auerswald_delete (cp); } else { /* device is used. Remove the pointer to the usb device (it's not valid any more). The last release() will do the clean up */ cp->usbdev = NULL; - up (&cp->mutex); + mutex_unlock(&cp->mutex); /* Terminate waiting writers */ wake_up (&cp->bufferwait); /* Inform all waiting readers */ -- cgit v1.2.3 From 8a0f46b92fcab6652b8e62c006d015d562302d08 Mon Sep 17 00:00:00 2001 From: "matthias@kaehlcke.net" Date: Mon, 18 Feb 2008 20:45:35 +0100 Subject: USB: auerswald: Convert ccp->readmutex in a mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The semaphore ccp->readmutex is used as mutex, convert it to the mutex API Signed-off-by: Matthias Kaehlcke Cc: Wolfgang Mües Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/auerswald.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 498fd478992..46dfbac0f6f 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -259,7 +259,7 @@ typedef struct auerbufctl_t bufctl; /* controls the buffer chain */ auerscon_t scontext; /* service context */ wait_queue_head_t readwait; /* for synchronous reading */ - struct semaphore readmutex; /* protection against multiple reads */ + struct mutex readmutex; /* protection against multiple reads */ pauerbuf_t readbuf; /* buffer held for partial reading */ unsigned int readoffset; /* current offset in readbuf */ unsigned int removed; /* is != 0 if device is removed */ @@ -1391,7 +1391,7 @@ static int auerchar_open (struct inode *inode, struct file *file) /* Initialize device descriptor */ init_MUTEX( &ccp->mutex); - init_MUTEX( &ccp->readmutex); + mutex_init(&ccp->readmutex); auerbuf_init (&ccp->bufctl); ccp->scontext.id = AUH_UNASSIGNED; ccp->scontext.dispatch = auerchar_ctrlread_dispatch; @@ -1585,7 +1585,7 @@ static ssize_t auerchar_read (struct file *file, char __user *buf, size_t count, } /* only one reader per device allowed */ - if (down_interruptible (&ccp->readmutex)) { + if (mutex_lock_interruptible(&ccp->readmutex)) { up (&ccp->mutex); return -ERESTARTSYS; } @@ -1603,7 +1603,7 @@ doreadbuf: if (count) { if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) { dbg ("auerswald_read: copy_to_user failed"); - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); up (&ccp->mutex); return -EFAULT; } @@ -1618,7 +1618,7 @@ doreadbuf: } /* return with number of bytes read */ if (count) { - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); up (&ccp->mutex); return count; } @@ -1655,7 +1655,7 @@ doreadlist: dbg ("No read buffer available, returning -EAGAIN"); set_current_state (TASK_RUNNING); remove_wait_queue (&ccp->readwait, &wait); - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); up (&ccp->mutex); return -EAGAIN; /* nonblocking, no data available */ } @@ -1666,18 +1666,18 @@ doreadlist: remove_wait_queue (&ccp->readwait, &wait); if (signal_pending (current)) { /* waked up by a signal */ - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); return -ERESTARTSYS; } /* Anything left to read? */ if ((ccp->scontext.id == AUH_UNASSIGNED) || ccp->removed) { - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); return -EIO; } if (down_interruptible (&ccp->mutex)) { - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); return -ERESTARTSYS; } -- cgit v1.2.3 From fadec78bd93ede132c34ab94dce0e65a5ae56054 Mon Sep 17 00:00:00 2001 From: "matthias@kaehlcke.net" Date: Mon, 18 Feb 2008 20:45:36 +0100 Subject: USB: auerswald: Convert ccp->mutex in a mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The semaphore ccp->mutex is used as mutex, convert it to the mutex API Signed-off-by: Matthias Kaehlcke Cc: Wolfgang Mües Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/auerswald.c | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 46dfbac0f6f..81d051ca229 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -254,7 +254,7 @@ typedef struct /* character device context */ typedef struct { - struct semaphore mutex; /* protection in user context */ + struct mutex mutex; /* protection in user context */ pauerswald_t auerdev; /* context pointer of assigned device */ auerbufctl_t bufctl; /* controls the buffer chain */ auerscon_t scontext; /* service context */ @@ -1390,7 +1390,7 @@ static int auerchar_open (struct inode *inode, struct file *file) } /* Initialize device descriptor */ - init_MUTEX( &ccp->mutex); + mutex_init(&ccp->mutex); mutex_init(&ccp->readmutex); auerbuf_init (&ccp->bufctl); ccp->scontext.id = AUH_UNASSIGNED; @@ -1433,23 +1433,23 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int dbg ("ioctl"); /* get the mutexes */ - if (down_interruptible (&ccp->mutex)) { + if (mutex_lock_interruptible(&ccp->mutex)) { return -ERESTARTSYS; } cp = ccp->auerdev; if (!cp) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ENODEV; } if (mutex_lock_interruptible(&cp->mutex)) { - up(&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } /* Check for removal */ if (!cp->usbdev) { mutex_unlock(&cp->mutex); - up(&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ENODEV; } @@ -1552,7 +1552,7 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int } /* release the mutexes */ mutex_unlock(&cp->mutex); - up(&ccp->mutex); + mutex_unlock(&ccp->mutex); return ret; } @@ -1575,18 +1575,18 @@ static ssize_t auerchar_read (struct file *file, char __user *buf, size_t count, return 0; /* get the mutex */ - if (down_interruptible (&ccp->mutex)) + if (mutex_lock_interruptible(&ccp->mutex)) return -ERESTARTSYS; /* Can we expect to read something? */ if (ccp->scontext.id == AUH_UNASSIGNED) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } /* only one reader per device allowed */ if (mutex_lock_interruptible(&ccp->readmutex)) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } @@ -1604,7 +1604,7 @@ doreadbuf: if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) { dbg ("auerswald_read: copy_to_user failed"); mutex_unlock(&ccp->readmutex); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EFAULT; } } @@ -1619,7 +1619,7 @@ doreadbuf: /* return with number of bytes read */ if (count) { mutex_unlock(&ccp->readmutex); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return count; } } @@ -1656,12 +1656,12 @@ doreadlist: set_current_state (TASK_RUNNING); remove_wait_queue (&ccp->readwait, &wait); mutex_unlock(&ccp->readmutex); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EAGAIN; /* nonblocking, no data available */ } /* yes, we should wait! */ - up (&ccp->mutex); /* allow other operations while we wait */ + mutex_unlock(&ccp->mutex); /* allow other operations while we wait */ schedule(); remove_wait_queue (&ccp->readwait, &wait); if (signal_pending (current)) { @@ -1676,7 +1676,7 @@ doreadlist: return -EIO; } - if (down_interruptible (&ccp->mutex)) { + if (mutex_lock_interruptible(&ccp->mutex)) { mutex_unlock(&ccp->readmutex); return -ERESTARTSYS; } @@ -1708,27 +1708,27 @@ static ssize_t auerchar_write (struct file *file, const char __user *buf, size_t write_again: /* get the mutex */ - if (down_interruptible (&ccp->mutex)) + if (mutex_lock_interruptible(&ccp->mutex)) return -ERESTARTSYS; /* Can we expect to write something? */ if (ccp->scontext.id == AUH_UNASSIGNED) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } cp = ccp->auerdev; if (!cp) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } if (mutex_lock_interruptible(&cp->mutex)) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } if (!cp->usbdev) { mutex_unlock(&cp->mutex); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } /* Prepare for sleep */ @@ -1752,7 +1752,7 @@ write_again: /* are there any buffers left? */ if (!bp) { mutex_unlock(&cp->mutex); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); /* NONBLOCK: don't wait */ if (file->f_flags & O_NONBLOCK) { @@ -1785,7 +1785,7 @@ write_again: /* Wake up all processes waiting for a buffer */ wake_up (&cp->bufferwait); mutex_unlock(&cp->mutex); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EFAULT; } @@ -1810,12 +1810,12 @@ write_again: auerbuf_releasebuf (bp); /* Wake up all processes waiting for a buffer */ wake_up (&cp->bufferwait); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } else { dbg ("auerchar_write: Write OK"); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return len; } } @@ -1828,7 +1828,7 @@ static int auerchar_release (struct inode *inode, struct file *file) pauerswald_t cp; dbg("release"); - down(&ccp->mutex); + mutex_lock(&ccp->mutex); cp = ccp->auerdev; if (cp) { mutex_lock(&cp->mutex); @@ -1845,7 +1845,7 @@ static int auerchar_release (struct inode *inode, struct file *file) cp = NULL; ccp->auerdev = NULL; } - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); auerchar_delete (ccp); return 0; -- cgit v1.2.3 From 3d01f0fe6b66dd34511eaf35e06764b8997187bc Mon Sep 17 00:00:00 2001 From: Karsten Wiese Date: Tue, 19 Feb 2008 12:31:49 -0800 Subject: USB: minor ehci xITD simplifications Remove two (or one) conditional tests in per-urb isochronous transfer setup code paths. Signed-off-by: Karsten Wiese Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-sched.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 38c606c13db..e3cfe0a0355 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -1181,21 +1181,18 @@ itd_urb_transaction ( struct ehci_itd, itd_list); list_del (&itd->itd_list); itd_dma = itd->itd_dma; - } else - itd = NULL; - - if (!itd) { + } else { spin_unlock_irqrestore (&ehci->lock, flags); itd = dma_pool_alloc (ehci->itd_pool, mem_flags, &itd_dma); spin_lock_irqsave (&ehci->lock, flags); + if (!itd) { + iso_sched_free(stream, sched); + spin_unlock_irqrestore(&ehci->lock, flags); + return -ENOMEM; + } } - if (unlikely (NULL == itd)) { - iso_sched_free (stream, sched); - spin_unlock_irqrestore (&ehci->lock, flags); - return -ENOMEM; - } memset (itd, 0, sizeof *itd); itd->itd_dma = itd_dma; list_add (&itd->itd_list, &sched->td_list); @@ -1814,21 +1811,18 @@ sitd_urb_transaction ( struct ehci_sitd, sitd_list); list_del (&sitd->sitd_list); sitd_dma = sitd->sitd_dma; - } else - sitd = NULL; - - if (!sitd) { + } else { spin_unlock_irqrestore (&ehci->lock, flags); sitd = dma_pool_alloc (ehci->sitd_pool, mem_flags, &sitd_dma); spin_lock_irqsave (&ehci->lock, flags); + if (!sitd) { + iso_sched_free(stream, iso_sched); + spin_unlock_irqrestore(&ehci->lock, flags); + return -ENOMEM; + } } - if (!sitd) { - iso_sched_free (stream, iso_sched); - spin_unlock_irqrestore (&ehci->lock, flags); - return -ENOMEM; - } memset (sitd, 0, sizeof *sitd); sitd->sitd_dma = sitd_dma; list_add (&sitd->sitd_list, &iso_sched->td_list); -- cgit v1.2.3 From 2097890c43a8fe90763f31b0010fd6963f5512c8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 20:47:56 +0000 Subject: USB: usb-serial: Prepare for BKL push down Take the lock in usb-serial instead. As it relies on the BKL internally we can't push it any deeper yet. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb-serial.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 2138ba8aeb6..aea861e9173 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -401,11 +401,13 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in struct usb_serial_port *port = tty->driver_data; int retval = -ENODEV; + lock_kernel(); if (!port) goto exit; dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); + /* Caution - port->open_count is BKL protected */ if (!port->open_count) { dbg ("%s - port not open", __FUNCTION__); goto exit; @@ -416,8 +418,8 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in retval = port->serial->type->ioctl(port, file, cmd, arg); else retval = -ENOIOCTLCMD; - exit: + unlock_kernel(); return retval; } @@ -446,19 +448,24 @@ static void serial_break (struct tty_struct *tty, int break_state) { struct usb_serial_port *port = tty->driver_data; - if (!port) + lock_kernel(); + if (!port) { + unlock_kernel(); return; + } dbg("%s - port %d", __FUNCTION__, port->number); if (!port->open_count) { dbg("%s - port not open", __FUNCTION__); + unlock_kernel(); return; } /* pass on to the driver specific version of this function if it is available */ if (port->serial->type->break_ctl) port->serial->type->break_ctl(port, break_state); + unlock_kernel(); } static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) -- cgit v1.2.3 From 9b0f2582d57d4c9081307c86e11afc9169de7d3e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 20:49:53 +0000 Subject: USB: ftdi_sio: Note missing locking The ftdi_sio driver has no internal locking on the dtr/rts state. Flag that up for someone to fix. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ftdi_sio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 3abb3c86364..4643212eb95 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -533,9 +533,8 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned } buf = kmalloc(1, GFP_NOIO); - if (!buf) { + if (!buf) return -ENOMEM; - } clear &= ~set; /* 'set' takes precedence over 'clear' */ urb_value = 0; @@ -568,6 +567,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned (clear & TIOCM_DTR) ? "LOW" : "unchanged", (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged"); + /* FIXME: locking on last_dtr_rts */ priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set; } return rv; -- cgit v1.2.3 From e298449401463dd18f24a87c48f9b0ec62bad936 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 20:51:45 +0000 Subject: USB: serial: Note mos7480 and option don't lock modem status Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/mos7840.c | 1 + drivers/usb/serial/option.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index aeeb9cb2099..0b29c5383dc 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1722,6 +1722,7 @@ static int mos7840_tiocmset(struct usb_serial_port *port, struct file *file, if (mos7840_port == NULL) return -ENODEV; + /* FIXME: What locks the port registers ? */ mcr = mos7840_port->shadowMCR; if (clear & TIOCM_RTS) mcr &= ~MCR_RTS; diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index d101025a4c6..0e7eeb2820e 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -458,6 +458,7 @@ static int option_tiocmset(struct usb_serial_port *port, struct file *file, portdata = usb_get_serial_port_data(port); + /* FIXME: what locks portdata fields ? */ if (set & TIOCM_RTS) portdata->rts_state = 1; if (set & TIOCM_DTR) -- cgit v1.2.3 From 7b1fc8bc6d6881ff7f8876cbe665b3ad5271bc03 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 21:39:25 +0000 Subject: USB: iuu_phoenix: lock priv->tiostatus properly Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/iuu_phoenix.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index fde188e23ce..a09b9a85b16 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -148,20 +148,21 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear) { struct iuu_private *priv = usb_get_serial_port_data(port); - struct tty_struct *tty; - tty = port->tty; + unsigned long flags; + /* FIXME: locking on tiomstatus */ dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __FUNCTION__, port->number, set, clear); + + spin_lock_irqsave(&priv->lock, flags); if (set & TIOCM_RTS) priv->tiostatus = TIOCM_RTS; if (!(set & TIOCM_RTS) && priv->tiostatus == TIOCM_RTS) { dbg("%s TIOCMSET RESET called !!!", __FUNCTION__); priv->reset = 1; - return 0; } - + spin_unlock_irqrestore(&priv->lock, flags); return 0; } @@ -173,7 +174,14 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, static int iuu_tiocmget(struct usb_serial_port *port, struct file *file) { struct iuu_private *priv = usb_get_serial_port_data(port); - return priv->tiostatus; + unsigned long flags; + int rc; + + spin_lock_irqsave(&priv->lock, flags); + rc = priv->tiostatus; + spin_unlock_irqrestore(&priv->lock, flags); + + return rc; } static void iuu_rxcmd(struct urb *urb) -- cgit v1.2.3 From a40d8540f4b7874ef674428cf757e8f466d271ca Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 21:40:34 +0000 Subject: USB: kobil_sct: Get rid of unneeded priv->line_state Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/kobil_sct.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 17b3baead4a..03cb5dd8cbe 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -139,7 +139,6 @@ struct kobil_private { int filled; // index of the last char in buf int cur_pos; // index of the next char to send in buf __u16 device_type; - int line_state; }; @@ -161,7 +160,6 @@ static int kobil_startup (struct usb_serial *serial) priv->filled = 0; priv->cur_pos = 0; priv->device_type = le16_to_cpu(serial->dev->descriptor.idProduct); - priv->line_state = 0; switch (priv->device_type){ case KOBIL_ADAPTER_B_PRODUCT_ID: @@ -226,7 +224,6 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) dbg("%s - port %d", __FUNCTION__, port->number); priv = usb_get_serial_port_data(port); - priv->line_state = 0; // someone sets the dev to 0 if the close method has been called port->interrupt_in_urb->dev = port->serial->dev; @@ -524,14 +521,11 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file) dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x", __FUNCTION__, port->number, result, transfer_buffer[0]); - if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) { - priv->line_state |= TIOCM_DSR; - } else { - priv->line_state &= ~TIOCM_DSR; - } - + result = 0; + if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) + result = TIOCM_DSR; kfree(transfer_buffer); - return priv->line_state; + return result; } static int kobil_tiocmset(struct usb_serial_port *port, struct file *file, @@ -544,6 +538,7 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file, unsigned char *transfer_buffer; int transfer_buffer_length = 8; + /* FIXME: locking ? */ priv = usb_get_serial_port_data(port); if ((priv->device_type == KOBIL_USBTWIN_PRODUCT_ID) || (priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)) { // This device doesn't support ioctl calls -- cgit v1.2.3 From 04ca89d4948ad4b6ec3b33e9588ae1885643148c Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 21:41:40 +0000 Subject: USB: ti_usb_3410_5052: Extend locking to msr and shadow mcr Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ti_usb_3410_5052.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 3a377667733..5b470f76e91 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -1021,14 +1021,17 @@ static int ti_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int result; unsigned int msr; unsigned int mcr; + unsigned long flags; dbg("%s - port %d", __FUNCTION__, port->number); if (tport == NULL) return -ENODEV; + spin_lock_irqsave(&tport->tp_lock, flags); msr = tport->tp_msr; mcr = tport->tp_shadow_mcr; + spin_unlock_irqrestore(&tport->tp_lock, flags); result = ((mcr & TI_MCR_DTR) ? TIOCM_DTR : 0) | ((mcr & TI_MCR_RTS) ? TIOCM_RTS : 0) @@ -1049,12 +1052,14 @@ static int ti_tiocmset(struct usb_serial_port *port, struct file *file, { struct ti_port *tport = usb_get_serial_port_data(port); unsigned int mcr; + unsigned long flags; dbg("%s - port %d", __FUNCTION__, port->number); if (tport == NULL) return -ENODEV; + spin_lock_irqsave(&tport->tp_lock, flags); mcr = tport->tp_shadow_mcr; if (set & TIOCM_RTS) @@ -1070,6 +1075,7 @@ static int ti_tiocmset(struct usb_serial_port *port, struct file *file, mcr &= ~TI_MCR_DTR; if (clear & TIOCM_LOOP) mcr &= ~TI_MCR_LOOP; + spin_unlock_irqrestore(&tport->tp_lock, flags); return ti_set_mcr(tport, mcr); } @@ -1357,14 +1363,17 @@ static void ti_send(struct ti_port *tport) static int ti_set_mcr(struct ti_port *tport, unsigned int mcr) { + unsigned long flags; int status; status = ti_write_byte(tport->tp_tdev, tport->tp_uart_base_addr + TI_UART_OFFSET_MCR, TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr); + spin_lock_irqsave(&tport->tp_lock, flags); if (!status) tport->tp_shadow_mcr = mcr; + spin_unlock_irqrestore(&tport->tp_lock, flags); return status; } -- cgit v1.2.3 From 3d71fe0bb29a3fbffdbe69dd0696927b6a23dd4e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Feb 2008 21:38:32 +0000 Subject: USB: io_ti: lock mcr and msr shadows properly Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_ti.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 63e044adc19..39d71fdb507 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2559,9 +2559,11 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig { struct edgeport_port *edge_port = usb_get_serial_port_data(port); unsigned int mcr; + unsigned long flags; dbg("%s - port %d", __FUNCTION__, port->number); + spin_lock_irqsave(&edge_port->ep_lock, flags); mcr = edge_port->shadow_mcr; if (set & TIOCM_RTS) mcr |= MCR_RTS; @@ -2578,6 +2580,7 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig mcr &= ~MCR_LOOPBACK; edge_port->shadow_mcr = mcr; + spin_unlock_irqrestore(&edge_port->ep_lock, flags); TIRestoreMCR (edge_port, mcr); @@ -2590,9 +2593,12 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int result = 0; unsigned int msr; unsigned int mcr; + unsigned long flags; dbg("%s - port %d", __FUNCTION__, port->number); + spin_lock_irqsave(&edge_port->ep_lock, flags); + msr = edge_port->shadow_msr; mcr = edge_port->shadow_mcr; result = ((mcr & MCR_DTR) ? TIOCM_DTR: 0) /* 0x002 */ @@ -2604,6 +2610,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) dbg("%s -- %x", __FUNCTION__, result); + spin_unlock_irqrestore(&edge_port->ep_lock, flags); return result; } -- cgit v1.2.3 From dfa5ec79d28300b0d1fdeafbeebf0a6b721edc38 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 4 Mar 2008 15:25:11 -0800 Subject: USB: use DIV_ROUND_UP The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @haskernel@ @@ #include @depends on haskernel@ expression n,d; @@ ( - (n + d - 1) / d + DIV_ROUND_UP(n,d) | - (n + (d - 1)) / d + DIV_ROUND_UP(n,d) ) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP((n),d) + DIV_ROUND_UP(n,d) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP(n,(d)) + DIV_ROUND_UP(n,d) // Signed-off-by: Julia Lawall Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/r8a66597-hcd.c | 6 +++--- drivers/usb/misc/usbtest.c | 2 +- drivers/usb/serial/ftdi_sio.c | 4 ++-- drivers/usb/serial/io_ti.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 9f80e528557..afd4fbe7713 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -960,9 +960,9 @@ static void prepare_packet_read(struct r8a66597 *r8a66597, r8a66597_write(r8a66597, TRCLR, td->pipe->pipetre); r8a66597_write(r8a66597, - (urb->transfer_buffer_length - + td->maxpacket - 1) - / td->maxpacket, + DIV_ROUND_UP + (urb->transfer_buffer_length, + td->maxpacket), td->pipe->pipetrn); r8a66597_bset(r8a66597, TRENB, td->pipe->pipetre); diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index b6b5b2affad..17100471e46 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1404,7 +1404,7 @@ static struct urb *iso_alloc_urb ( return NULL; maxp = 0x7ff & le16_to_cpu(desc->wMaxPacketSize); maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11)); - packets = (bytes + maxp - 1) / maxp; + packets = DIV_ROUND_UP(bytes, maxp); urb = usb_alloc_urb (packets, GFP_KERNEL); if (!urb) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 4643212eb95..496c0c93ad8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1406,7 +1406,7 @@ static void ftdi_write_bulk_callback (struct urb *urb) data_offset = priv->write_offset; if (data_offset > 0) { /* Subtract the control bytes */ - countback -= (data_offset * ((countback + (PKTSZ - 1)) / PKTSZ)); + countback -= (data_offset * DIV_ROUND_UP(countback, PKTSZ)); } spin_lock_irqsave(&priv->tx_lock, flags); --priv->tx_outstanding_urbs; @@ -1506,7 +1506,7 @@ static void ftdi_read_bulk_callback (struct urb *urb) /* count data bytes, but not status bytes */ countread = urb->actual_length; - countread -= 2 * ((countread + (PKTSZ - 1)) / PKTSZ); + countread -= 2 * DIV_ROUND_UP(countread, PKTSZ); spin_lock_irqsave(&priv->rx_lock, flags); priv->rx_bytes += countread; spin_unlock_irqrestore(&priv->rx_lock, flags); diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 39d71fdb507..6afee30a6a5 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -654,7 +654,7 @@ static void TIChasePort(struct edgeport_port *port, unsigned long timeout, int f /* (TIIsTxActive doesn't seem to wait for the last byte) */ if ((baud_rate=port->baud_rate) == 0) baud_rate = 50; - msleep(max(1,(10000+baud_rate-1)/baud_rate)); + msleep(max(1, DIV_ROUND_UP(10000, baud_rate))); } static int TIChooseConfiguration (struct usb_device *dev) -- cgit v1.2.3 From b56394bf325820e9f338eaef2941f18b17b98098 Mon Sep 17 00:00:00 2001 From: Ray Lee Date: Tue, 4 Mar 2008 15:25:12 -0800 Subject: USB: io_ti.c: remove unneeded null tty check The Coverity checker (and Adrian Bunk) spotted an inconsistent NULL check of port->tty (it's blindly dereferenced later without the check). Alan Cox confirmed the check can go. Signed-off-by: Ray Lee Cc: Adrian Bunk Cc: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_ti.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 6afee30a6a5..316467ecd77 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -1941,8 +1941,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) if (edge_port == NULL) return -ENODEV; - if (port->tty) - port->tty->low_latency = low_latency; + port->tty->low_latency = low_latency; port_number = port->number - port->serial->minor; switch (port_number) { -- cgit v1.2.3 From 22552b286b44b8988e08fb74379507a9b32521b0 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 5 Mar 2008 23:17:38 -0800 Subject: USB: partial USB embedded host support This provides better support for USB "Embedded Host" functionality, which is a subset of the USB OTG options: * External hub support can be disabled; * USB peripherals not whitelisted in "otg_whitelist.h" will be rejected during enumeration. These options can allow some savings in software and support. Signed-off-by: Robin Getz Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/Kconfig | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index c15621d6457..fee864c9e62 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig @@ -111,14 +111,16 @@ config USB_OTG config USB_OTG_WHITELIST bool "Rely on OTG Targeted Peripherals List" - depends on USB_OTG - default y + depends on USB_OTG || EMBEDDED + default y if USB_OTG + default n if EMBEDDED help If you say Y here, the "otg_whitelist.h" file will be used as a product whitelist, so USB peripherals not listed there will be rejected during enumeration. This behavior is required by the USB OTG specification for all devices not on your product's - "Targeted Peripherals List". + "Targeted Peripherals List". "Embedded Hosts" are likewise + allowed to support only a limited number of peripherals. Otherwise, peripherals not listed there will only generate a warning and enumeration will continue. That's more like what @@ -127,9 +129,10 @@ config USB_OTG_WHITELIST config USB_OTG_BLACKLIST_HUB bool "Disable external hubs" - depends on USB_OTG + depends on USB_OTG || EMBEDDED help If you say Y here, then Linux will refuse to enumerate external hubs. OTG hosts are allowed to reduce hardware - and software costs by not supporting external hubs. + and software costs by not supporting external hubs. So + are "Emedded Hosts" that don't offer OTG support. -- cgit v1.2.3 From d1b1842c393cf322712b669ec887397b89ed2312 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Wed, 5 Mar 2008 23:37:52 -0800 Subject: USB: ehci: remove obsolete workaround for bogus IRQs It was pointed out that we found and fixed the cause of the "bogus" fatal IRQ reports some time ago ... this patch removes the code which was working around that bug ("status" got clobbered), and a comment which needlessly confused folk reading this code. This also includes a minor cleanup to the code which fixed that bug. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-hcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 40f7391bf2a..8c3e860bfce 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -686,6 +686,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) /* remote wakeup [4.3.1] */ if (status & STS_PCD) { unsigned i = HCS_N_PORTS (ehci->hcs_params); + + /* kick root hub later */ pcd_status = status; /* resume root hub? */ @@ -714,8 +716,6 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) /* PCI errors [4.15.2.4] */ if (unlikely ((status & STS_FATAL) != 0)) { - /* bogus "fatal" IRQs appear on some chips... why? */ - status = ehci_readl(ehci, &ehci->regs->status); dbg_cmd (ehci, "fatal", ehci_readl(ehci, &ehci->regs->command)); dbg_status (ehci, "fatal", status); @@ -734,7 +734,7 @@ dead: if (bh) ehci_work (ehci); spin_unlock (&ehci->lock); - if (pcd_status & STS_PCD) + if (pcd_status) usb_hcd_poll_rh_status(hcd); return IRQ_HANDLED; } -- cgit v1.2.3 From e1879b19b0abdb387e4aeb0b935a486cc75042fb Mon Sep 17 00:00:00 2001 From: Matthias Geissert Date: Thu, 6 Mar 2008 22:00:33 +0100 Subject: USB: ipaq: fix devices having more than one endpoint The ipaq module supports devices with one endpoint only. Some devices, e.g. Yakumo Delta 300, have more than one endpoint. This patch fixes support for devices having up to 2 endpoints which used to work on older kernel versions. Signed-off-by: Matthias Geissert Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ipaq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 9b38a08ac83..17f2a53b8ba 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -571,9 +571,9 @@ static struct usb_serial_driver ipaq_device = { .usb_driver = &ipaq_driver, .id_table = ipaq_id_table, .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, - .num_ports = 1, + .num_bulk_in = NUM_DONT_CARE, + .num_bulk_out = NUM_DONT_CARE, + .num_ports = 2, .open = ipaq_open, .close = ipaq_close, .attach = ipaq_startup, -- cgit v1.2.3 From 70a1c9e086c2e267fbc4533cb870f34999b531d6 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 6 Mar 2008 17:00:58 -0500 Subject: USB: remove dev->power.power_state power.power_state is scheduled for removal. This patch (as1053) removes all uses of that field from drivers/usb. Almost all of them were write-only, the most significant exceptions being sl811-hcd.c and u132-hcd.c. Part of this patch was written by Pavel Machek. Signed-off-by: Alan Stern Cc: David Brownell Acked-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/driver.c | 12 ++++-------- drivers/usb/core/hcd-pci.c | 5 ----- drivers/usb/core/usb.h | 2 -- drivers/usb/gadget/dummy_hcd.c | 2 -- drivers/usb/gadget/omap_udc.c | 4 ---- drivers/usb/host/ehci-dbg.c | 2 +- drivers/usb/host/ehci-ps3.c | 1 - drivers/usb/host/isp116x-hcd.c | 12 +----------- drivers/usb/host/ohci-dbg.c | 2 +- drivers/usb/host/ohci-ep93xx.c | 2 -- drivers/usb/host/ohci-omap.c | 2 -- drivers/usb/host/ohci-ps3.c | 1 - drivers/usb/host/ohci-pxa27x.c | 2 -- drivers/usb/host/ohci-sm501.c | 2 -- drivers/usb/host/r8a66597-hcd.c | 2 -- drivers/usb/host/sl811-hcd.c | 8 +------- drivers/usb/host/u132-hcd.c | 7 +------ drivers/usb/misc/usbtest.c | 3 ++- 18 files changed, 11 insertions(+), 60 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index ebccdefcc6f..2ea333a43d6 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -794,8 +794,6 @@ static int usb_suspend_device(struct usb_device *udev, pm_message_t msg) done: dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); - if (status == 0) - udev->dev.power.power_state.event = msg.event; return status; } @@ -824,10 +822,8 @@ static int usb_resume_device(struct usb_device *udev) done: dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); - if (status == 0) { + if (status == 0) udev->autoresume_disabled = 0; - udev->dev.power.power_state.event = PM_EVENT_ON; - } return status; } @@ -1180,8 +1176,7 @@ static int usb_resume_both(struct usb_device *udev) } } else { - /* Needed for setting udev->dev.power.power_state.event, - * for possible debugging message, and for reset_resume. */ + /* Needed for reset-resume */ status = usb_resume_device(udev); } @@ -1194,7 +1189,8 @@ static int usb_resume_both(struct usb_device *udev) done: dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); - udev->reset_resume = 0; + if (!status) + udev->reset_resume = 0; return status; } diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 84760ddbc33..739407bb849 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -73,7 +73,6 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) if (pci_enable_device(dev) < 0) return -ENODEV; dev->current_state = PCI_D0; - dev->dev.power.power_state = PMSG_ON; if (!dev->irq) { dev_err(&dev->dev, @@ -302,8 +301,6 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) done: if (retval == 0) { - dev->dev.power.power_state = PMSG_SUSPEND; - #ifdef CONFIG_PPC_PMAC /* Disable ASIC clocks for USB */ if (machine_is(powermac)) { @@ -406,8 +403,6 @@ int usb_hcd_pci_resume(struct pci_dev *dev) pci_set_master(dev); pci_restore_state(dev); - dev->dev.power.power_state = PMSG_ON; - clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); if (hcd->driver->resume) { diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 2375194a9d4..1bf8ccb9c58 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -114,13 +114,11 @@ static inline int is_usb_device_driver(struct device_driver *drv) static inline void mark_active(struct usb_interface *f) { f->is_active = 1; - f->dev.power.power_state.event = PM_EVENT_ON; } static inline void mark_quiesced(struct usb_interface *f) { f->is_active = 0; - f->dev.power.power_state.event = PM_EVENT_SUSPEND; } static inline int is_active(const struct usb_interface *f) diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index cbe44535c0f..e454775c2ff 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -900,7 +900,6 @@ static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state) set_link_state (dum); spin_unlock_irq (&dum->lock); - pdev->dev.power.power_state = state; usb_hcd_poll_rh_status (dummy_to_hcd (dum)); return 0; } @@ -915,7 +914,6 @@ static int dummy_udc_resume (struct platform_device *pdev) set_link_state (dum); spin_unlock_irq (&dum->lock); - pdev->dev.power.power_state = PMSG_ON; usb_hcd_poll_rh_status (dummy_to_hcd (dum)); return 0; } diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index ee1e9a314cd..56277d24f04 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c @@ -1265,8 +1265,6 @@ static int can_pullup(struct omap_udc *udc) static void pullup_enable(struct omap_udc *udc) { - udc->gadget.dev.parent->power.power_state = PMSG_ON; - udc->gadget.dev.power.power_state = PMSG_ON; UDC_SYSCON1_REG |= UDC_PULLUP_EN; if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) OTG_CTRL_REG |= OTG_BSESSVLD; @@ -3061,8 +3059,6 @@ static int omap_udc_suspend(struct platform_device *dev, pm_message_t message) omap_pullup(&udc->gadget, 0); } - udc->gadget.dev.power.power_state = PMSG_SUSPEND; - udc->gadget.dev.parent->power.power_state = PMSG_SUSPEND; return 0; } diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 38eb92e5dc4..4af90df8e7d 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c @@ -670,7 +670,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) spin_lock_irqsave (&ehci->lock, flags); - if (buf->bus->controller->power.power_state.event) { + if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { size = scnprintf (next, size, "bus %s, device %s (driver " DRIVER_VERSION ")\n" "%s\n" diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index bbda58eb881..69782221bcf 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c @@ -125,7 +125,6 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev) goto fail_irq; } - dev->core.power.power_state = PMSG_ON; dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev->core.bus_id); diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 203a3359a64..66d773c726f 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c @@ -1442,11 +1442,6 @@ static int isp116x_bus_resume(struct usb_hcd *hcd) break; case HCCONTROL_USB_OPER: spin_unlock_irq(&isp116x->lock); - /* Without setting power_state here the - SUSPENDED state won't be removed from - sysfs/usbN/power.state as a response to remote - wakeup. Maybe in the future. */ - hcd->self.root_hub->dev.power.power_state = PMSG_ON; return 0; default: /* HCCONTROL_USB_RESET: this may happen, when during @@ -1460,7 +1455,6 @@ static int isp116x_bus_resume(struct usb_hcd *hcd) if ((isp116x->rhdesca & RH_A_NDP) == 2) isp116x_hub_control(hcd, SetPortFeature, USB_PORT_FEAT_POWER, 2, NULL, 0); - hcd->self.root_hub->dev.power.power_state = PMSG_ON; return 0; } @@ -1486,8 +1480,6 @@ static int isp116x_bus_resume(struct usb_hcd *hcd) isp116x_write_reg32(isp116x, HCCONTROL, (val & ~HCCONTROL_HCFS) | HCCONTROL_USB_OPER); spin_unlock_irq(&isp116x->lock); - /* see analogous comment above */ - hcd->self.root_hub->dev.power.power_state = PMSG_ON; hcd->state = HC_STATE_RUNNING; return 0; @@ -1663,7 +1655,6 @@ static int __devinit isp116x_probe(struct platform_device *pdev) static int isp116x_suspend(struct platform_device *dev, pm_message_t state) { VDBG("%s: state %x\n", __func__, state.event); - dev->dev.power.power_state = state; return 0; } @@ -1672,8 +1663,7 @@ static int isp116x_suspend(struct platform_device *dev, pm_message_t state) */ static int isp116x_resume(struct platform_device *dev) { - VDBG("%s: state %x\n", __func__, dev->power.power_state.event); - dev->dev.power.power_state = PMSG_ON; + VDBG("%s\n", __func__); return 0; } diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index a22c30aa745..e06bfaebec5 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c @@ -655,7 +655,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) hcd->product_desc, hcd_name); - if (bus->controller->power.power_state.event) { + if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { size -= scnprintf (next, size, "SUSPENDED (no register access)\n"); goto done; diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 156e93a9d0d..40c683f8987 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -177,7 +177,6 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ ep93xx_stop_hc(&pdev->dev); hcd->state = HC_STATE_SUSPENDED; - pdev->dev.power.power_state = PMSG_SUSPEND; return 0; } @@ -193,7 +192,6 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) ohci->next_statechange = jiffies; ep93xx_start_hc(&pdev->dev); - pdev->dev.power.power_state = PMSG_ON; usb_hcd_resume_root_hub(hcd); return 0; diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 7bfca1ed1b5..2aafa7b6c81 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -505,7 +505,6 @@ static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) omap_ohci_clock_power(0); ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; - dev->dev.power.power_state = PMSG_SUSPEND; return 0; } @@ -518,7 +517,6 @@ static int ohci_omap_resume(struct platform_device *dev) ohci->next_statechange = jiffies; omap_ohci_clock_power(1); - dev->dev.power.power_state = PMSG_ON; usb_hcd_resume_root_hub(platform_get_drvdata(dev)); return 0; } diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index 01a0caeaa6b..c1935ae537f 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c @@ -127,7 +127,6 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev) goto fail_irq; } - dev->core.power.power_state = PMSG_ON; dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev->core.bus_id); diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 8ad9b3b604b..5d470263eed 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -339,7 +339,6 @@ static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_ pxa27x_stop_hc(&pdev->dev); hcd->state = HC_STATE_SUSPENDED; - pdev->dev.power.power_state = PMSG_SUSPEND; return 0; } @@ -357,7 +356,6 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) if ((status = pxa27x_start_hc(&pdev->dev)) < 0) return status; - pdev->dev.power.power_state = PMSG_ON; usb_hcd_resume_root_hub(hcd); return 0; diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 8ffcd3e5f56..ab1e366d779 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -224,7 +224,6 @@ static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg) sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; - dev->power.power_state = PMSG_SUSPEND; return 0; } @@ -238,7 +237,6 @@ static int ohci_sm501_resume(struct platform_device *pdev) ohci->next_statechange = jiffies; sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1); - dev->power.power_state = PMSG_ON; usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); return 0; } diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index afd4fbe7713..b46ff9a80b6 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -2107,13 +2107,11 @@ static struct hc_driver r8a66597_hc_driver = { #if defined(CONFIG_PM) static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state) { - pdev->dev.power.power_state = state; return 0; } static int r8a66597_resume(struct platform_device *pdev) { - pdev->dev.power.power_state = PMSG_ON; return 0; } #else /* if defined(CONFIG_PM) */ diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 629bca0ebe8..df256d61e2c 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c @@ -94,12 +94,10 @@ static void port_power(struct sl811 *sl811, int is_on) sl811->port1 = (1 << USB_PORT_FEAT_POWER); sl811->irq_enable = SL11H_INTMASK_INSRMV; - hcd->self.controller->power.power_state = PMSG_ON; } else { sl811->port1 = 0; sl811->irq_enable = 0; hcd->state = HC_STATE_HALT; - hcd->self.controller->power.power_state = PMSG_SUSPEND; } sl811->ctrl1 = 0; sl811_write(sl811, SL11H_IRQ_ENABLE, 0); @@ -1772,8 +1770,6 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state) port_power(sl811, 0); break; } - if (retval == 0) - dev->dev.power.power_state = state; return retval; } @@ -1786,15 +1782,13 @@ sl811h_resume(struct platform_device *dev) /* with no "check to see if VBUS is still powered" board hook, * let's assume it'd only be powered to enable remote wakeup. */ - if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND - || !device_can_wakeup(&hcd->self.root_hub->dev)) { + if (!sl811->port1 || !device_can_wakeup(&hcd->self.root_hub->dev)) { sl811->port1 = 0; port_power(sl811, 1); usb_root_hub_lost_power(hcd->self.root_hub); return 0; } - dev->dev.power.power_state = PMSG_ON; return sl811h_bus_resume(hcd); } diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 8e117a795e9..6e9b7edff52 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -1534,11 +1534,9 @@ static void u132_power(struct u132 *u132, int is_on) if (u132->power) return; u132->power = 1; - hcd->self.controller->power.power_state = PMSG_ON; } else { u132->power = 0; hcd->state = HC_STATE_HALT; - hcd->self.controller->power.power_state = PMSG_SUSPEND; } } @@ -3227,8 +3225,6 @@ static int u132_suspend(struct platform_device *pdev, pm_message_t state) } break; } - if (retval == 0) - pdev->dev.power.power_state = state; return retval; } } @@ -3246,14 +3242,13 @@ static int u132_resume(struct platform_device *pdev) return -ESHUTDOWN; } else { int retval = 0; - if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { + if (!u132->port[0].power) { int ports = MAX_U132_PORTS; while (ports-- > 0) { port_power(u132, ports, 1); } retval = 0; } else { - pdev->dev.power.power_state = PMSG_ON; retval = u132_bus_resume(hcd); } return retval; diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 17100471e46..2c4fd4d6df9 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1564,7 +1564,8 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf) if (mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; - if (intf->dev.power.power_state.event != PM_EVENT_ON) { + /* FIXME: What if a system sleep starts while a test is running? */ + if (!intf->is_active) { mutex_unlock(&dev->lock); return -EHOSTUNREACH; } -- cgit v1.2.3 From 25b70a8665e9854504b9196c3098dadd37c721aa Mon Sep 17 00:00:00 2001 From: David Brownell Date: Tue, 4 Mar 2008 15:11:07 -0800 Subject: USB: ehci: paranoia, reject large control transfers Some EHCI fault paths with large control transfers aren't coded. Avoid problems by rejecting transfers that may need two qTDs (16+ KB). This is mostly paranoia; even 4 KB transfers are rare, and most HCDs use lower limits (so it's unlikely anyone would ever try such a thing). Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-hcd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 8c3e860bfce..a02dcff5eb2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -764,8 +764,14 @@ static int ehci_urb_enqueue ( INIT_LIST_HEAD (&qtd_list); switch (usb_pipetype (urb->pipe)) { - // case PIPE_CONTROL: - // case PIPE_BULK: + case PIPE_CONTROL: + /* qh_completions() code doesn't handle all the fault cases + * in multi-TD control transfers. Even 1KB is rare anyway. + */ + if (urb->transfer_buffer_length > (16 * 1024)) + return -EMSGSIZE; + /* FALLTHROUGH */ + /* case PIPE_BULK: */ default: if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags)) return -ENOMEM; -- cgit v1.2.3 From 8873aaa6e574d85c020a1c472d6d159cd1ec8aef Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 10 Mar 2008 21:59:28 +0000 Subject: USB: cypress_m8: Speed handling The recent changes to this driver cleaned it up a lot, follow that up by sorting the speed side of things out as well Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cypress_m8.c | 169 +++++++--------------------------------- 1 file changed, 29 insertions(+), 140 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 4bf45c711b9..36f8ef07947 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -147,7 +147,6 @@ struct cypress_private { enum packet_format pkt_fmt; /* format to use for packet send / receive */ int get_cfg_unsafe; /* If true, the CYPRESS_GET_CONFIG is unsafe */ int baud_rate; /* stores current baud rate in integer form */ - int cbr_mask; /* stores current baud rate in masked form */ int isthrottled; /* if throttled, discard reads */ wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */ char prev_status, diff_status; /* used for TIOCMIWAIT */ @@ -183,9 +182,6 @@ static void cypress_unthrottle (struct usb_serial_port *port); static void cypress_set_dead (struct usb_serial_port *port); static void cypress_read_int_callback (struct urb *urb); static void cypress_write_int_callback (struct urb *urb); -/* baud helper functions */ -static int mask_to_rate (unsigned mask); -static unsigned rate_to_mask (int rate); /* write buffer functions */ static struct cypress_buf *cypress_buf_alloc(unsigned int size); static void cypress_buf_free(struct cypress_buf *cb); @@ -291,9 +287,8 @@ static struct usb_serial_driver cypress_ca42v2_device = { *****************************************************************************/ -static int analyze_baud_rate(struct usb_serial_port *port, unsigned baud_mask) +static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) { - int new_rate; struct cypress_private *priv; priv = usb_get_serial_port_data(port); @@ -306,12 +301,6 @@ static int analyze_baud_rate(struct usb_serial_port *port, unsigned baud_mask) * The Cypress HID->COM device will work successfully up to * 115200bps (but the actual throughput is around 3kBps). */ - new_rate = mask_to_rate(baud_mask); - if (new_rate < 0) { - dbg("%s - failed setting baud rate, untranslatable speed", - __func__); - return -1; - } if (port->serial->dev->speed == USB_SPEED_LOW) { /* * Mike Isely 2-Feb-2008: The @@ -345,7 +334,7 @@ static int analyze_baud_rate(struct usb_serial_port *port, unsigned baud_mask) /* This function can either set or retrieve the current serial line settings */ -static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_mask, int data_bits, int stop_bits, +static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_rate, int data_bits, int stop_bits, int parity_enable, int parity_type, int reset, int cypress_request_type) { int new_baudrate = 0, retval = 0, tries = 0; @@ -363,9 +352,13 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m switch(cypress_request_type) { case CYPRESS_SET_CONFIG: new_baudrate = priv->baud_rate; - if (baud_mask != priv->cbr_mask) { + /* 0 means 'Hang up' so doesn't change the true bit rate */ + if (baud_rate == 0) + new_baudrate = priv->baud_rate; + /* Change of speed ? */ + else if (baud_rate != priv->baud_rate) { dbg("%s - baud rate is changing", __FUNCTION__); - retval = analyze_baud_rate(port, baud_mask); + retval = analyze_baud_rate(port, baud_rate); if (retval >= 0) { new_baudrate = retval; dbg("%s - New baud rate set to %d", @@ -410,9 +403,12 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m } else { spin_lock_irqsave(&priv->lock, flags); priv->baud_rate = new_baudrate; - priv->cbr_mask = baud_mask; priv->current_config = feature_buffer[4]; spin_unlock_irqrestore(&priv->lock, flags); + /* If we asked for a speed change encode it */ + if (baud_rate) + tty_encode_baud_rate(port->tty, + new_baudrate, new_baudrate); } break; case CYPRESS_GET_CONFIG: @@ -450,9 +446,6 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m /* store the config in one byte, and later use bit masks to check values */ priv->current_config = feature_buffer[4]; priv->baud_rate = *((u_int32_t *)feature_buffer); - - if ( (priv->cbr_mask = rate_to_mask(priv->baud_rate)) == 0x40) - dbg("%s - failed setting the baud mask (not defined)", __FUNCTION__); spin_unlock_irqrestore(&priv->lock, flags); } } @@ -482,51 +475,6 @@ static void cypress_set_dead(struct usb_serial_port *port) } -/* given a baud mask, it will return integer baud on success */ -static int mask_to_rate (unsigned mask) -{ - int rate; - - switch (mask) { - case B0: rate = 0; break; - case B300: rate = 300; break; - case B600: rate = 600; break; - case B1200: rate = 1200; break; - case B2400: rate = 2400; break; - case B4800: rate = 4800; break; - case B9600: rate = 9600; break; - case B19200: rate = 19200; break; - case B38400: rate = 38400; break; - case B57600: rate = 57600; break; - case B115200: rate = 115200; break; - default: rate = -1; - } - - return rate; -} - - -static unsigned rate_to_mask (int rate) -{ - unsigned mask; - - switch (rate) { - case 0: mask = B0; break; - case 300: mask = B300; break; - case 600: mask = B600; break; - case 1200: mask = B1200; break; - case 2400: mask = B2400; break; - case 4800: mask = B4800; break; - case 9600: mask = B9600; break; - case 19200: mask = B19200; break; - case 38400: mask = B38400; break; - case 57600: mask = B57600; break; - case 115200: mask = B115200; break; - default: mask = 0x40; - } - - return mask; -} /***************************************************************************** * Cypress serial driver functions *****************************************************************************/ @@ -558,7 +506,6 @@ static int generic_startup (struct usb_serial *serial) priv->line_control = 0; priv->termios_initialized = 0; priv->rx_flags = 0; - priv->cbr_mask = B300; /* Default packet format setting is determined by packet size. Anything with a size larger then 9 must have a separate count field since the 3 bit count field is otherwise too @@ -1004,9 +951,9 @@ static int cypress_tiocmset (struct usb_serial_port *port, struct file *file, priv->line_control &= ~CONTROL_RTS; if (clear & TIOCM_DTR) priv->line_control &= ~CONTROL_DTR; + priv->cmd_ctrl = 1; spin_unlock_irqrestore(&priv->lock, flags); - priv->cmd_ctrl = 1; return cypress_write(port, NULL, 0); } @@ -1018,20 +965,6 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); switch (cmd) { - case TIOCGSERIAL: - if (copy_to_user((void __user *)arg, port->tty->termios, sizeof(struct ktermios))) { - return -EFAULT; - } - return (0); - break; - case TIOCSSERIAL: - if (copy_from_user(port->tty->termios, (void __user *)arg, sizeof(struct ktermios))) { - return -EFAULT; - } - /* here we need to call cypress_set_termios to invoke the new settings */ - cypress_set_termios(port, &priv->tmp_termios); - return (0); - break; /* This code comes from drivers/char/serial.c and ftdi_sio.c */ case TIOCMIWAIT: while (priv != NULL) { @@ -1079,7 +1012,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct cypress_private *priv = usb_get_serial_port_data(port); struct tty_struct *tty; int data_bits, stop_bits, parity_type, parity_enable; - unsigned cflag, iflag, baud_mask; + unsigned cflag, iflag; unsigned long flags; __u8 oldlines; int linechange = 0; @@ -1087,10 +1020,6 @@ static void cypress_set_termios (struct usb_serial_port *port, dbg("%s - port %d", __FUNCTION__, port->number); tty = port->tty; - if ((!tty) || (!tty->termios)) { - dbg("%s - no tty structures", __FUNCTION__); - return; - } spin_lock_irqsave(&priv->lock, flags); if (!priv->termios_initialized) { @@ -1098,40 +1027,37 @@ static void cypress_set_termios (struct usb_serial_port *port, *(tty->termios) = tty_std_termios; tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL | CLOCAL; + tty->termios->c_ispeed = 4800; + tty->termios->c_ospeed = 4800; } else if (priv->chiptype == CT_CYPHIDCOM) { *(tty->termios) = tty_std_termios; tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; + tty->termios->c_ispeed = 9600; + tty->termios->c_ospeed = 9600; } else if (priv->chiptype == CT_CA42V2) { *(tty->termios) = tty_std_termios; tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; + tty->termios->c_ispeed = 9600; + tty->termios->c_ospeed = 9600; } priv->termios_initialized = 1; } spin_unlock_irqrestore(&priv->lock, flags); + /* Unsupported features need clearing */ + tty->termios->c_cflag &= ~(CMSPAR|CRTSCTS); + cflag = tty->termios->c_cflag; iflag = tty->termios->c_iflag; /* check if there are new settings */ if (old_termios) { - if ((cflag != old_termios->c_cflag) || - (RELEVANT_IFLAG(iflag) != - RELEVANT_IFLAG(old_termios->c_iflag))) { - dbg("%s - attempting to set new termios settings", - __FUNCTION__); - /* should make a copy of this in case something goes - * wrong in the function, we can restore it */ - spin_lock_irqsave(&priv->lock, flags); - priv->tmp_termios = *(tty->termios); - spin_unlock_irqrestore(&priv->lock, flags); - } else { - dbg("%s - nothing to do, exiting", __FUNCTION__); - return; - } - } else - return; + spin_lock_irqsave(&priv->lock, flags); + priv->tmp_termios = *(tty->termios); + spin_unlock_irqrestore(&priv->lock, flags); + } /* set number of data bits, parity, stop bits */ /* when parity is disabled the parity type bit is ignored */ @@ -1173,53 +1099,16 @@ static void cypress_set_termios (struct usb_serial_port *port, if ((cflag & CBAUD) == B0) { /* drop dtr and rts */ dbg("%s - dropping the lines, baud rate 0bps", __FUNCTION__); - baud_mask = B0; priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); - } else { - baud_mask = (cflag & CBAUD); - switch(baud_mask) { - case B300: - dbg("%s - setting baud 300bps", __FUNCTION__); - break; - case B600: - dbg("%s - setting baud 600bps", __FUNCTION__); - break; - case B1200: - dbg("%s - setting baud 1200bps", __FUNCTION__); - break; - case B2400: - dbg("%s - setting baud 2400bps", __FUNCTION__); - break; - case B4800: - dbg("%s - setting baud 4800bps", __FUNCTION__); - break; - case B9600: - dbg("%s - setting baud 9600bps", __FUNCTION__); - break; - case B19200: - dbg("%s - setting baud 19200bps", __FUNCTION__); - break; - case B38400: - dbg("%s - setting baud 38400bps", __FUNCTION__); - break; - case B57600: - dbg("%s - setting baud 57600bps", __FUNCTION__); - break; - case B115200: - dbg("%s - setting baud 115200bps", __FUNCTION__); - break; - default: - dbg("%s - unknown masked baud rate", __FUNCTION__); - } + } else priv->line_control = (CONTROL_DTR | CONTROL_RTS); - } spin_unlock_irqrestore(&priv->lock, flags); dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, " "%d data_bits (+5)", __FUNCTION__, stop_bits, parity_enable, parity_type, data_bits); - cypress_serial_control(port, baud_mask, data_bits, stop_bits, + cypress_serial_control(port, tty_get_baud_rate(tty), data_bits, stop_bits, parity_enable, parity_type, 0, CYPRESS_SET_CONFIG); /* we perform a CYPRESS_GET_CONFIG so that the current settings are -- cgit v1.2.3 From ff66e3ce3524125106be3ff18104ecde0849b85c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 12 Mar 2008 13:32:24 -0700 Subject: drivers/usb/core/devio.c: suppress warning with 64k PAGE_SIZE drivers/usb/core/devio.c: In function 'proc_control': drivers/usb/core/devio.c:657: warning: comparison is always false due to limited range of data type Cc: Alan Stern Cc: Pete Zaitcev Cc: Oliver Neukum Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/devio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index ae94176c64e..039ba23cc8b 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -647,6 +647,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) struct usbdevfs_ctrltransfer ctrl; unsigned int tmo; unsigned char *tbuf; + unsigned wLength; int i, j, ret; if (copy_from_user(&ctrl, arg, sizeof(ctrl))) @@ -654,7 +655,8 @@ static int proc_control(struct dev_state *ps, void __user *arg) ret = check_ctrlrecip(ps, ctrl.bRequestType, ctrl.wIndex); if (ret) return ret; - if (ctrl.wLength > PAGE_SIZE) + wLength = ctrl.wLength; /* To suppress 64k PAGE_SIZE warning */ + if (wLength > PAGE_SIZE) return -EINVAL; tbuf = (unsigned char *)__get_free_page(GFP_KERNEL); if (!tbuf) -- cgit v1.2.3 From f66396b55d4016bdc7a5298db7a681c63b649bf4 Mon Sep 17 00:00:00 2001 From: Tilman Schmidt Date: Thu, 13 Mar 2008 19:51:42 +0100 Subject: USB: usb.h: reduce syslog clutter [v3] The the err() / info() / warn() macros in usb.h inserted __FILE__ at the beginning of the message, which expands to the complete pathname of the source file within the kernel tree, frequently taking up half of an 80 character screen line before the actual message even begins. Use the module name instead. Signed-off-by: Tilman Schmidt Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 285011d9af1..dd9733cc0ac 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1701,13 +1701,12 @@ extern void usb_unregister_notify(struct notifier_block *nb); #define dbg(format, arg...) do {} while (0) #endif -#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ - __FILE__ , ## arg) -#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \ - __FILE__ , ## arg) -#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \ - __FILE__ , ## arg) - +#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ + format "\n" , ## arg) +#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \ + format "\n" , ## arg) +#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \ + format "\n" , ## arg) #endif /* __KERNEL__ */ -- cgit v1.2.3 From dda43a0e03a33dd716fb34f812b1af614f74daff Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Fri, 7 Mar 2008 13:45:32 -0500 Subject: USB: Standardize inclusion protection and add where missing. For the header files in include/linux/usb, add missing multiple inclusion protection and standardize what's already there. The apparent standards: * macro name of __LINUX_USB_headerfile_H * inclusion protection placed after leading comment block * macro name added as a comment on the final #endif * any obvious trivial whitespace cleanup associated with the above Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/audio.h | 2 +- include/linux/usb/cdc.h | 4 ++++ include/linux/usb/ch9.h | 2 +- include/linux/usb/g_printer.h | 4 ++++ include/linux/usb/gadget.h | 2 +- include/linux/usb/gadgetfs.h | 16 ++++++++-------- include/linux/usb/input.h | 8 ++++---- include/linux/usb/iowarrior.h | 6 +++--- include/linux/usb/isp116x.h | 6 +++++- include/linux/usb/midi.h | 2 +- include/linux/usb/net2280.h | 9 ++++----- include/linux/usb/otg.h | 6 +++++- include/linux/usb/quirks.h | 5 +++++ include/linux/usb/rndis_host.h | 9 +++------ include/linux/usb/serial.h | 3 +-- include/linux/usb/sl811.h | 5 ++++- include/linux/usb/usbnet.h | 8 +++----- 17 files changed, 57 insertions(+), 40 deletions(-) diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index 2dfeef16b22..8cb025fef63 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h @@ -50,4 +50,4 @@ struct usb_ac_header_descriptor_##n { \ __u8 baInterfaceNr[n]; \ } __attribute__ ((packed)) -#endif +#endif /* __LINUX_USB_AUDIO_H */ diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index 94ee4ecf056..71e52f2f6a3 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h @@ -6,6 +6,9 @@ * firmware based USB peripherals. */ +#ifndef __LINUX_USB_CDC_H +#define __LINUX_USB_CDC_H + #define USB_CDC_SUBCLASS_ACM 0x02 #define USB_CDC_SUBCLASS_ETHERNET 0x06 #define USB_CDC_SUBCLASS_WHCM 0x08 @@ -221,3 +224,4 @@ struct usb_cdc_notification { __le16 wLength; } __attribute__ ((packed)); +#endif /* __LINUX_USB_CDC_H */ diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 61fcbc2b97d..7e0d3084f76 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -586,4 +586,4 @@ enum usb_device_state { */ }; -#endif /* __LINUX_USB_CH9_H */ +#endif /* __LINUX_USB_CH9_H */ diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h index 0c5ea1e3eb9..6178fde50f7 100644 --- a/include/linux/usb/g_printer.h +++ b/include/linux/usb/g_printer.h @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef __LINUX_USB_G_PRINTER_H +#define __LINUX_USB_G_PRINTER_H #define PRINTER_NOT_ERROR 0x08 #define PRINTER_SELECTED 0x10 @@ -29,3 +31,5 @@ */ #define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) #define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) + +#endif /* __LINUX_USB_G_PRINTER_H */ diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index f3295296b43..d8128f7102c 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -846,4 +846,4 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit; -#endif /* __LINUX_USB_GADGET_H */ +#endif /* __LINUX_USB_GADGET_H */ diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h index c291ab1af74..ea45f265ec0 100644 --- a/include/linux/usb/gadgetfs.h +++ b/include/linux/usb/gadgetfs.h @@ -1,11 +1,3 @@ -#ifndef __LINUX_USB_GADGETFS_H -#define __LINUX_USB_GADGETFS_H - -#include -#include - -#include - /* * Filesystem based user-mode API to USB Gadget controller hardware * @@ -23,6 +15,14 @@ * then performing data transfers by reading or writing. */ +#ifndef __LINUX_USB_GADGETFS_H +#define __LINUX_USB_GADGETFS_H + +#include +#include + +#include + /* * Events are delivered on the ep0 file descriptor, when the user mode driver * reads from this file descriptor after writing the descriptors. Don't diff --git a/include/linux/usb/input.h b/include/linux/usb/input.h index 716e0cc1604..0e010b220e8 100644 --- a/include/linux/usb/input.h +++ b/include/linux/usb/input.h @@ -1,6 +1,3 @@ -#ifndef __USB_INPUT_H -#define __USB_INPUT_H - /* * Copyright (C) 2005 Dmitry Torokhov * @@ -9,6 +6,9 @@ * the Free Software Foundation. */ +#ifndef __LINUX_USB_INPUT_H +#define __LINUX_USB_INPUT_H + #include #include #include @@ -22,4 +22,4 @@ usb_to_input_id(const struct usb_device *dev, struct input_id *id) id->version = le16_to_cpu(dev->descriptor.bcdDevice); } -#endif +#endif /* __LINUX_USB_INPUT_H */ diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h index de6f380e17a..4fd6513d564 100644 --- a/include/linux/usb/iowarrior.h +++ b/include/linux/usb/iowarrior.h @@ -1,5 +1,5 @@ -#ifndef _IOWARRIOR_H_ -#define _IOWARRIOR_H_ +#ifndef __LINUX_USB_IOWARRIOR_H +#define __LINUX_USB_IOWARRIOR_H #define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */ @@ -39,4 +39,4 @@ struct iowarrior_info { */ #define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info) -#endif /* _IOWARRIOR_H_ */ +#endif /* __LINUX_USB_IOWARRIOR_H */ diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h index 67d2826f34f..96ca114e88d 100644 --- a/include/linux/usb/isp116x.h +++ b/include/linux/usb/isp116x.h @@ -1,9 +1,11 @@ - /* * Board initialization code should put one of these into dev->platform_data * and place the isp116x onto platform_bus. */ +#ifndef __LINUX_USB_ISP116X_H +#define __LINUX_USB_ISP116X_H + struct isp116x_platform_data { /* Enable internal resistors on downstream ports */ unsigned sel15Kres:1; @@ -27,3 +29,5 @@ struct isp116x_platform_data { */ void (*delay) (struct device *dev, int delay); }; + +#endif /* __LINUX_USB_ISP116X_H */ diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h index 80624c56292..1d104086566 100644 --- a/include/linux/usb/midi.h +++ b/include/linux/usb/midi.h @@ -109,4 +109,4 @@ struct usb_ms_endpoint_descriptor_##n { \ __u8 baAssocJackID[n]; \ } __attribute__ ((packed)) -#endif +#endif /* __LINUX_USB_MIDI_H */ diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h index ec897cb844a..96ca549a778 100644 --- a/include/linux/usb/net2280.h +++ b/include/linux/usb/net2280.h @@ -1,11 +1,7 @@ /* * NetChip 2280 high/full speed USB device controller. * Unlike many such controllers, this one talks PCI. - */ -#ifndef __LINUX_USB_NET2280_H -#define __LINUX_USB_NET2280_H - -/* + * * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) * Copyright (C) 2003 David Brownell * @@ -24,6 +20,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef __LINUX_USB_NET2280_H +#define __LINUX_USB_NET2280_H + /*-------------------------------------------------------------------------*/ /* NET2280 MEMORY MAPPED REGISTERS diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index e007074ebe4..1db25d152ad 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -1,11 +1,13 @@ /* USB OTG (On The Go) defines */ - /* + * * These APIs may be used between USB controllers. USB device drivers * (for either host or peripheral roles) don't use these calls; they * continue to use just usb_device and usb_gadget. */ +#ifndef __LINUX_USB_OTG_H +#define __LINUX_USB_OTG_H /* OTG defines lots of enumeration states before device reset */ enum usb_otg_state { @@ -129,3 +131,5 @@ otg_start_srp(struct otg_transceiver *otg) /* for OTG controller drivers (and maybe other stuff) */ extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); + +#endif /* __LINUX_USB_OTG_H */ diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 1f999ec8d08..7f6c603db65 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -4,6 +4,9 @@ * belong here. */ +#ifndef __LINUX_USB_QUIRKS_H +#define __LINUX_USB_QUIRKS_H + /* string descriptors must not be fetched using a 255-byte read */ #define USB_QUIRK_STRING_FETCH_255 0x00000001 @@ -12,3 +15,5 @@ /* device can't handle Set-Interface requests */ #define USB_QUIRK_NO_SET_INTF 0x00000004 + +#endif /* __LINUX_USB_QUIRKS_H */ diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h index edc1d4a0e27..29d6458ecb8 100644 --- a/include/linux/usb/rndis_host.h +++ b/include/linux/usb/rndis_host.h @@ -17,10 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef __RNDIS_HOST_H -#define __RNDIS_HOST_H - +#ifndef __LINUX_USB_RNDIS_HOST_H +#define __LINUX_USB_RNDIS_HOST_H /* * CONTROL uses CDC "encapsulated commands" with funky notifications. @@ -270,5 +268,4 @@ extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb); extern struct sk_buff * rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); -#endif /* __RNDIS_HOST_H */ - +#endif /* __LINUX_USB_RNDIS_HOST_H */ diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 21b4a1c6f58..f1b7434a96b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -10,7 +10,6 @@ * */ - #ifndef __LINUX_USB_SERIAL_H #define __LINUX_USB_SERIAL_H @@ -340,5 +339,5 @@ static inline void usb_serial_debug_data(int debug, -#endif /* ifdef __LINUX_USB_SERIAL_H */ +#endif /* __LINUX_USB_SERIAL_H */ diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h index 877373da410..3afe4d16fce 100644 --- a/include/linux/usb/sl811.h +++ b/include/linux/usb/sl811.h @@ -1,9 +1,11 @@ - /* * board initialization should put one of these into dev->platform_data * and place the sl811hs onto platform_bus named "sl811-hcd". */ +#ifndef __LINUX_USB_SL811_H +#define __LINUX_USB_SL811_H + struct sl811_platform_data { unsigned can_wakeup:1; @@ -24,3 +26,4 @@ struct sl811_platform_data { /* void (*clock_enable)(struct device *dev, int is_on); */ }; +#endif /* __LINUX_USB_SL811_H */ diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index e0501da3dd1..ba09fe88add 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -19,10 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef __USBNET_H -#define __USBNET_H - +#ifndef __LINUX_USB_USBNET_H +#define __LINUX_USB_USBNET_H /* interface from usbnet core to each USB networking link we handle */ struct usbnet { @@ -211,4 +209,4 @@ extern int usbnet_nway_reset(struct net_device *net); printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \ -#endif /* __USBNET_H */ +#endif /* __LINUX_USB_USBNET_H */ -- cgit v1.2.3 From d277064e7e16d02e0078a6bc1820764ae00dea87 Mon Sep 17 00:00:00 2001 From: matthieu castet Date: Wed, 19 Mar 2008 19:40:52 +0100 Subject: USB: mass storage: emulation of sat scsi_pass_thru with ATACB I have got a cypress usb-ide bridge and I would like to tune or monitor my disk with tools like hdparm, hddtemp or smartctl. My controller support a way to send raw ATA command to the disk with something call atacb (see http://download.cypress.com.edgesuite.net/design_resources/datasheets/contents/cy7c68300c_8.pdf). Atacb support can be added for each application, but there is some disadvantages : - all application need to be patched - A race is possible if there other accesses, because the emulation can be split in 2 atacb scsi transactions. One for sending the command, one for reading the register (if ck_cond is set). I have implemented the emulation in usb-storage with a special proto_handler, and an unsual entry. Signed-off-by: Matthieu CASTET Signed-off-by: Matthew Dharm Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/Kconfig | 11 ++ drivers/usb/storage/Makefile | 1 + drivers/usb/storage/cypress_atacb.c | 200 ++++++++++++++++++++++++++++++++++++ drivers/usb/storage/cypress_atacb.h | 25 +++++ drivers/usb/storage/scsiglue.c | 2 +- drivers/usb/storage/transport.c | 3 +- drivers/usb/storage/unusual_devs.h | 8 ++ drivers/usb/storage/usb.c | 10 ++ include/linux/usb_usual.h | 1 + 9 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/storage/cypress_atacb.c create mode 100644 drivers/usb/storage/cypress_atacb.h diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 05cfc8473bd..d3e5f889f68 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig @@ -145,6 +145,17 @@ config USB_STORAGE_KARMA on the resulting scsi device node returns the Karma to normal operation. +config USB_STORAGE_CYPRESS_ATACB + bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" + depends on USB_STORAGE + ---help--- + Say Y here if you want to use SAT (ata pass through) on devices based + on the Cypress USB/ATA bridge supporting ATACB. This will allow you + to use tools to tune and monitor your drive (like hdparm or smartctl). + + If you say no here your device will still work with the standard usb + mass storage class. + config USB_LIBUSUAL bool "The shared table of common (or usual) storage devices" depends on USB diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile index 023969b4385..4c596c766c5 100644 --- a/drivers/usb/storage/Makefile +++ b/drivers/usb/storage/Makefile @@ -21,6 +21,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o +usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ initializers.o $(usb-storage-obj-y) diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c new file mode 100644 index 00000000000..d88824b3511 --- /dev/null +++ b/drivers/usb/storage/cypress_atacb.c @@ -0,0 +1,200 @@ +/* + * Support for emulating SAT (ata pass through) on devices based + * on the Cypress USB/ATA bridge supporting ATACB. + * + * Copyright (c) 2008 Matthieu Castet (castet.matthieu@free.fr) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +#include "usb.h" +#include "protocol.h" +#include "scsiglue.h" +#include "debug.h" + +/* + * ATACB is a protocol used on cypress usb<->ata bridge to + * send raw ATA command over mass storage + * There is a ATACB2 protocol that support LBA48 on newer chip. + * More info that be found on cy7c68310_8.pdf and cy7c68300c_8.pdf + * datasheet from cypress.com. + */ +void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) +{ + unsigned char save_cmnd[MAX_COMMAND_SIZE]; + + if (likely(srb->cmnd[0] != ATA_16 && srb->cmnd[0] != ATA_12)) { + usb_stor_transparent_scsi_command(srb, us); + return; + } + + memcpy(save_cmnd, srb->cmnd, sizeof(save_cmnd)); + memset(srb->cmnd, 0, sizeof(srb->cmnd)); + + /* check if we support the command */ + if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */ + goto invalid_fld; + /* check protocol */ + switch((save_cmnd[1] >> 1) & 0xf) { + case 3: /*no DATA */ + case 4: /* PIO in */ + case 5: /* PIO out */ + break; + default: + goto invalid_fld; + } + + /* first build the ATACB command */ + srb->cmd_len = 16; + + srb->cmnd[0] = 0x24; /* bVSCBSignature : vendor-specific command + this value can change, but most(all ?) manufacturers + keep the cypress default : 0x24 */ + srb->cmnd[1] = 0x24; /* bVSCBSubCommand : 0x24 for ATACB */ + + srb->cmnd[3] = 0xff - 1; /* features, sector count, lba low, lba med + lba high, device, command are valid */ + srb->cmnd[4] = 1; /* TransferBlockCount : 512 */ + + if (save_cmnd[0] == ATA_16) { + srb->cmnd[ 6] = save_cmnd[ 4]; /* features */ + srb->cmnd[ 7] = save_cmnd[ 6]; /* sector count */ + srb->cmnd[ 8] = save_cmnd[ 8]; /* lba low */ + srb->cmnd[ 9] = save_cmnd[10]; /* lba med */ + srb->cmnd[10] = save_cmnd[12]; /* lba high */ + srb->cmnd[11] = save_cmnd[13]; /* device */ + srb->cmnd[12] = save_cmnd[14]; /* command */ + + if (save_cmnd[1] & 0x01) {/* extended bit set for LBA48 */ + /* this could be supported by atacb2 */ + if (save_cmnd[3] || save_cmnd[5] || save_cmnd[7] || save_cmnd[9] + || save_cmnd[11]) + goto invalid_fld; + } + } + else { /* ATA12 */ + srb->cmnd[ 6] = save_cmnd[3]; /* features */ + srb->cmnd[ 7] = save_cmnd[4]; /* sector count */ + srb->cmnd[ 8] = save_cmnd[5]; /* lba low */ + srb->cmnd[ 9] = save_cmnd[6]; /* lba med */ + srb->cmnd[10] = save_cmnd[7]; /* lba high */ + srb->cmnd[11] = save_cmnd[8]; /* device */ + srb->cmnd[12] = save_cmnd[9]; /* command */ + + } + /* Filter SET_FEATURES - XFER MODE command */ + if ((srb->cmnd[12] == ATA_CMD_SET_FEATURES) + && (srb->cmnd[6] == SETFEATURES_XFER)) + goto invalid_fld; + + if (srb->cmnd[12] == ATA_CMD_ID_ATA || srb->cmnd[12] == ATA_CMD_ID_ATAPI) + srb->cmnd[2] |= (1<<7); /* set IdentifyPacketDevice for these cmds */ + + + usb_stor_transparent_scsi_command(srb, us); + + /* if the device doesn't support ATACB + */ + if (srb->result == SAM_STAT_CHECK_CONDITION && + memcmp(srb->sense_buffer, usb_stor_sense_invalidCDB, + sizeof(usb_stor_sense_invalidCDB)) == 0) { + US_DEBUGP("cypress atacb not supported ???\n"); + goto end; + } + + /* if ck_cond flags is set, and there wasn't critical error, + * build the special sense + */ + if ((srb->result != (DID_ERROR << 16) && + srb->result != (DID_ABORT << 16)) && + save_cmnd[2] & 0x20) { + struct scsi_eh_save ses; + unsigned char regs[8]; + unsigned char *sb = srb->sense_buffer; + unsigned char *desc = sb + 8; + int tmp_result; + + /* build the command for + * reading the ATA registers */ + scsi_eh_prep_cmnd(srb, &ses, NULL, 0, 0); + srb->sdb.length = sizeof(regs); + sg_init_one(&ses.sense_sgl, regs, srb->sdb.length); + srb->sdb.table.sgl = &ses.sense_sgl; + srb->sc_data_direction = DMA_FROM_DEVICE; + srb->sdb.table.nents = 1; + /* we use the same command as before, but we set + * the read taskfile bit, for not executing atacb command, + * but reading register selected in srb->cmnd[4] + */ + srb->cmnd[2] = 1; + + usb_stor_transparent_scsi_command(srb, us); + tmp_result = srb->result; + scsi_eh_restore_cmnd(srb, &ses); + /* we fail to get registers, report invalid command */ + if (tmp_result != SAM_STAT_GOOD) + goto invalid_fld; + + /* build the sense */ + memset(sb, 0, SCSI_SENSE_BUFFERSIZE); + + /* set sk, asc for a good command */ + sb[1] = RECOVERED_ERROR; + sb[2] = 0; /* ATA PASS THROUGH INFORMATION AVAILABLE */ + sb[3] = 0x1D; + + /* XXX we should generate sk, asc, ascq from status and error + * regs + * (see 11.1 Error translation ­ ATA device error to SCSI error map) + * and ata_to_sense_error from libata. + */ + + /* Sense data is current and format is descriptor. */ + sb[0] = 0x72; + desc[0] = 0x09; /* ATA_RETURN_DESCRIPTOR */ + + /* set length of additional sense data */ + sb[7] = 14; + desc[1] = 12; + + /* Copy registers into sense buffer. */ + desc[ 2] = 0x00; + desc[ 3] = regs[1]; /* features */ + desc[ 5] = regs[2]; /* sector count */ + desc[ 7] = regs[3]; /* lba low */ + desc[ 9] = regs[4]; /* lba med */ + desc[11] = regs[5]; /* lba high */ + desc[12] = regs[6]; /* device */ + desc[13] = regs[7]; /* command */ + + srb->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; + } + goto end; +invalid_fld: + srb->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; + + memcpy(srb->sense_buffer, + usb_stor_sense_invalidCDB, + sizeof(usb_stor_sense_invalidCDB)); +end: + memcpy(srb->cmnd, save_cmnd, sizeof(save_cmnd)); + if (srb->cmnd[0] == ATA_12) + srb->cmd_len = 12; +} diff --git a/drivers/usb/storage/cypress_atacb.h b/drivers/usb/storage/cypress_atacb.h new file mode 100644 index 00000000000..fbada898d56 --- /dev/null +++ b/drivers/usb/storage/cypress_atacb.h @@ -0,0 +1,25 @@ +/* + * Support for emulating SAT (ata pass through) on devices based + * on the Cypress USB/ATA bridge supporting ATACB. + * + * Copyright (c) 2008 Matthieu Castet (castet.matthieu@free.fr) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _CYPRESS_ATACB_H_ +#define _CYPRESS_ATACB_H_ +extern void cypress_atacb_passthrough(struct scsi_cmnd*, struct us_data*); +#endif diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 8c1e2954f3b..5405ba8cd9d 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -132,7 +132,7 @@ static int slave_configure(struct scsi_device *sdev) /* Disk-type devices use MODE SENSE(6) if the protocol * (SubClass) is Transparent SCSI, otherwise they use * MODE SENSE(10). */ - if (us->subclass != US_SC_SCSI) + if (us->subclass != US_SC_SCSI && us->subclass != US_SC_CYP_ATACB) sdev->use_10_for_ms = 1; /* Many disks only accept MODE SENSE transfer lengths of diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index bdd4334bed5..4628f03b13b 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -603,7 +603,8 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) scsi_eh_prep_cmnd(srb, &ses, NULL, 0, US_SENSE_SIZE); /* FIXME: we must do the protocol translation here */ - if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI) + if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI || + us->subclass == US_SC_CYP_ATACB) srb->cmd_len = 6; else srb->cmd_len = 12; diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 91252075e6e..732bf52a775 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1719,6 +1719,14 @@ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_CAPACITY_HEURISTICS), +#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB +UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, + "Cypress", + "Cypress AT2LP", + US_SC_CYP_ATACB, US_PR_BULK, NULL, + 0), +#endif + /* Control/Bulk transport for all SubClass values */ USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR), USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR), diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index ac6114eea0c..f59593de3b8 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -101,6 +101,9 @@ #ifdef CONFIG_USB_STORAGE_KARMA #include "karma.h" #endif +#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB +#include "cypress_atacb.h" +#endif /* Some informational data */ MODULE_AUTHOR("Matthew Dharm "); @@ -708,6 +711,13 @@ static int get_protocol(struct us_data *us) break; #endif +#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB + case US_SC_CYP_ATACB: + us->protocol_name = "Transparent SCSI with Cypress ATACB"; + us->proto_handler = cypress_atacb_passthrough; + break; +#endif + default: return -EIO; } diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 0a40dfa44c9..d9a3bbe38e6 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h @@ -85,6 +85,7 @@ enum { US_DO_ALL_FLAGS }; #define US_SC_LOCKABLE 0x07 /* Password-protected */ #define US_SC_ISD200 0xf0 /* ISD200 ATA */ +#define US_SC_CYP_ATACB 0xf1 /* Cypress ATACB */ #define US_SC_DEVICE 0xff /* Use device's value */ /* Protocols */ -- cgit v1.2.3 From 726627f341beeedba948643c766a6786d75bbf9d Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 8 Mar 2008 02:17:55 -0500 Subject: USB: Remove EXPERIMENTAL designation from USB storage Kconfig entries. Since there seems to be little reason to mark the current USB storage features as "EXPERIMENTAL," remove that dependency. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/Kconfig | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index d3e5f889f68..0f6d234d699 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig @@ -32,8 +32,8 @@ config USB_STORAGE_DEBUG verbose debugging messages. config USB_STORAGE_DATAFAB - bool "Datafab Compact Flash Reader support (EXPERIMENTAL)" - depends on USB_STORAGE && EXPERIMENTAL + bool "Datafab Compact Flash Reader support" + depends on USB_STORAGE help Support for certain Datafab CompactFlash readers. Datafab has a web page at . @@ -69,8 +69,8 @@ config USB_STORAGE_DPCM There is a web page at . config USB_STORAGE_USBAT - bool "USBAT/USBAT02-based storage support (EXPERIMENTAL)" - depends on USB_STORAGE && EXPERIMENTAL + bool "USBAT/USBAT02-based storage support" + depends on USB_STORAGE help Say Y here to include additional code to support storage devices based on the SCM/Shuttle USBAT/USBAT02 processors. @@ -90,30 +90,30 @@ config USB_STORAGE_USBAT - Sandisk ImageMate SDDR-05b config USB_STORAGE_SDDR09 - bool "SanDisk SDDR-09 (and other SmartMedia) support (EXPERIMENTAL)" - depends on USB_STORAGE && EXPERIMENTAL + bool "SanDisk SDDR-09 (and other SmartMedia) support" + depends on USB_STORAGE help Say Y here to include additional code to support the Sandisk SDDR-09 SmartMedia reader in the USB Mass Storage driver. Also works for the Microtech Zio! SmartMedia reader. config USB_STORAGE_SDDR55 - bool "SanDisk SDDR-55 SmartMedia support (EXPERIMENTAL)" - depends on USB_STORAGE && EXPERIMENTAL + bool "SanDisk SDDR-55 SmartMedia support" + depends on USB_STORAGE help Say Y here to include additional code to support the Sandisk SDDR-55 SmartMedia reader in the USB Mass Storage driver. config USB_STORAGE_JUMPSHOT - bool "Lexar Jumpshot Compact Flash Reader (EXPERIMENTAL)" - depends on USB_STORAGE && EXPERIMENTAL + bool "Lexar Jumpshot Compact Flash Reader" + depends on USB_STORAGE help Say Y here to include additional code to support the Lexar Jumpshot USB CompactFlash reader. config USB_STORAGE_ALAUDA - bool "Olympus MAUSB-10/Fuji DPC-R1 support (EXPERIMENTAL)" - depends on USB_STORAGE && EXPERIMENTAL + bool "Olympus MAUSB-10/Fuji DPC-R1 support" + depends on USB_STORAGE help Say Y here to include additional code to support the Olympus MAUSB-10 and Fujifilm DPC-R1 USB Card reader/writer devices. @@ -122,8 +122,8 @@ config USB_STORAGE_ALAUDA XD and SmartMedia cards. config USB_STORAGE_ONETOUCH - bool "Support OneTouch Button on Maxtor Hard Drives (EXPERIMENTAL)" - depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL + bool "Support OneTouch Button on Maxtor Hard Drives" + depends on USB_STORAGE && INPUT_EVDEV help Say Y here to include additional code to support the Maxtor OneTouch USB hard drive's onetouch button. -- cgit v1.2.3 From afd0e0f2d499a832c3ef17a6872d6244d65cbe17 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Mon, 10 Mar 2008 15:09:51 -0400 Subject: USB: Remove EXPERIMENTAL tags from some USB gadget Kconfig entries. Based on a recent discussion on the Linux USB mailing list, remove the designation of EXPERIMENTAL from some USB gadget entries, and tag some of them as DEVELOPMENT. just for fun, i added a bit of help for gadgetfs, explaining the race condition. Signed-off-by: Robert P. J. Day Acked-by: David Brownell --- drivers/usb/gadget/Kconfig | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index d681bb27fa5..f7b54651dd4 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -44,8 +44,8 @@ menuconfig USB_GADGET if USB_GADGET config USB_GADGET_DEBUG - boolean "Debugging messages" - depends on USB_GADGET && DEBUG_KERNEL && EXPERIMENTAL + boolean "Debugging messages (DEVELOPMENT)" + depends on USB_GADGET && DEBUG_KERNEL help Many controller and gadget drivers will print some debugging messages if you use this option to ask for those messages. @@ -58,7 +58,7 @@ config USB_GADGET_DEBUG production build. config USB_GADGET_DEBUG_FILES - boolean "Debugging information files" + boolean "Debugging information files (DEVELOPMENT)" depends on USB_GADGET && PROC_FS help Some of the drivers in the "gadget" framework can expose @@ -69,7 +69,7 @@ config USB_GADGET_DEBUG_FILES here. If in doubt, or to conserve kernel memory, say "N". config USB_GADGET_DEBUG_FS - boolean "Debugging information files in debugfs" + boolean "Debugging information files in debugfs (DEVELOPMENT)" depends on USB_GADGET && DEBUG_FS help Some of the drivers in the "gadget" framework can expose @@ -337,7 +337,7 @@ config USB_AT91 config USB_GADGET_DUMMY_HCD boolean "Dummy HCD (DEVELOPMENT)" - depends on (USB=y || (USB=m && USB_GADGET=m)) && EXPERIMENTAL + depends on USB=y || (USB=m && USB_GADGET=m) select USB_GADGET_DUALSPEED help This host controller driver emulates USB, looping all data transfer @@ -404,7 +404,6 @@ choice config USB_ZERO tristate "Gadget Zero (DEVELOPMENT)" - depends on EXPERIMENTAL help Gadget Zero is a two-configuration device. It either sinks and sources bulk data; or it loops back a configurable number of @@ -468,8 +467,8 @@ config USB_ETH dynamically linked module called "g_ether". config USB_ETH_RNDIS - bool "RNDIS support (EXPERIMENTAL)" - depends on USB_ETH && EXPERIMENTAL + bool "RNDIS support" + depends on USB_ETH default y help Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, @@ -495,6 +494,9 @@ config USB_GADGETFS All endpoints, transfer speeds, and transfer types supported by the hardware are available, through read() and write() calls. + Currently, this option is still labelled as EXPERIMENTAL because + of existing race conditions in the underlying in-kernel AIO core. + Say "y" to link the driver statically, or "m" to build a dynamically linked module called "gadgetfs". -- cgit v1.2.3 From bce62c263ab3742365dc1ac919cef732379e354a Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 8 Mar 2008 02:46:57 -0500 Subject: USB: Remove EXPERIMENTAL designation from USB misc/ Kconfig entries Since nothing under the USB misc/ seems to be obviously experimental, remove the EXPERIMENTAL dependency from those Kconfig entries. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/Kconfig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index 9c7eb6144d0..a53db1d4e07 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig @@ -33,8 +33,8 @@ config USB_EMI26 module will be called emi26. config USB_ADUTUX - tristate "ADU devices from Ontrak Control Systems (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "ADU devices from Ontrak Control Systems" + depends on USB help Say Y if you want to use an ADU device from Ontrak Control Systems. @@ -43,8 +43,8 @@ config USB_ADUTUX will be called adutux. config USB_AUERSWALD - tristate "USB Auerswald ISDN support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Auerswald ISDN support" + depends on USB help Say Y here if you want to connect an Auerswald USB ISDN Device to your computer's USB port. @@ -53,8 +53,8 @@ config USB_AUERSWALD module will be called auerswald. config USB_RIO500 - tristate "USB Diamond Rio500 support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Diamond Rio500 support" + depends on USB help Say Y here if you want to connect a USB Rio500 mp3 player to your computer's USB port. Please read @@ -64,8 +64,8 @@ config USB_RIO500 module will be called rio500. config USB_LEGOTOWER - tristate "USB Lego Infrared Tower support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Lego Infrared Tower support" + depends on USB help Say Y here if you want to connect a USB Lego Infrared Tower to your computer's USB port. @@ -259,8 +259,8 @@ config USB_IOWARRIOR module will be called iowarrior. config USB_TEST - tristate "USB testing driver (DEVELOPMENT)" - depends on USB && USB_DEVICEFS && EXPERIMENTAL + tristate "USB testing driver" + depends on USB && USB_DEVICEFS help This driver is for testing host controller software. It is used with specialized device firmware for regression and stress testing, -- cgit v1.2.3 From 1b75dc4de94e4e11ab22e284fc0853e21d1ac07a Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 8 Mar 2008 03:00:04 -0500 Subject: USB: Remove EXPERIMENTAL designation from USB serial/ Kconfig entries Since nothing under the USB serial/ directory seems to be obviously experimental, remove the EXPERIMENTAL dependency from all of those Kconfig entries. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/Kconfig | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index c1e65dfd935..a769f6a5d7f 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -20,8 +20,8 @@ menuconfig USB_SERIAL if USB_SERIAL config USB_SERIAL_CONSOLE - bool "USB Serial Console device support (EXPERIMENTAL)" - depends on USB_SERIAL=y && EXPERIMENTAL + bool "USB Serial Console device support" + depends on USB_SERIAL=y ---help--- If you say Y here, it will be possible to use a USB to serial converter port as the system console (the system console is the @@ -59,8 +59,8 @@ config USB_SERIAL_GENERIC properly. config USB_SERIAL_AIRCABLE - tristate "USB AIRcable Bluetooth Dongle Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB AIRcable Bluetooth Dongle Driver" + depends on USB_SERIAL help Say Y here if you want to use USB AIRcable Bluetooth Dongle. @@ -77,8 +77,8 @@ config USB_SERIAL_AIRPRIME module will be called airprime. config USB_SERIAL_ARK3116 - tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB ARK Micro 3116 USB Serial Driver" + depends on USB_SERIAL help Say Y here if you want to use a ARK Micro 3116 USB to Serial device. @@ -135,7 +135,7 @@ config USB_SERIAL_DIGI_ACCELEPORT config USB_SERIAL_CP2101 tristate "USB CP2101 UART Bridge Controller" - depends on USB_SERIAL && EXPERIMENTAL + depends on USB_SERIAL help Say Y here if you want to use a CP2101/CP2102 based USB to RS232 converter. @@ -145,7 +145,7 @@ config USB_SERIAL_CP2101 config USB_SERIAL_CYPRESS_M8 tristate "USB Cypress M8 USB Serial Driver" - depends on USB_SERIAL && EXPERIMENTAL + depends on USB_SERIAL help Say Y here if you want to use a device that contains the Cypress USB to Serial microcontroller, such as the DeLorme Earthmate GPS. @@ -171,8 +171,8 @@ config USB_SERIAL_EMPEG module will be called empeg. config USB_SERIAL_FTDI_SIO - tristate "USB FTDI Single Port Serial Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB FTDI Single Port Serial Driver" + depends on USB_SERIAL ---help--- Say Y here if you want to use a FTDI SIO single port USB to serial converter device. The implementation I have is called the USC-1000. @@ -218,8 +218,8 @@ config USB_SERIAL_IPAQ module will be called ipaq. config USB_SERIAL_IR - tristate "USB IR Dongle Serial Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB IR Dongle Serial Driver" + depends on USB_SERIAL help Say Y here if you want to enable simple serial support for USB IrDA devices. This is useful if you do not want to use the full IrDA @@ -279,8 +279,8 @@ config USB_SERIAL_GARMIN module will be called garmin_gps. config USB_SERIAL_IPW - tristate "USB IPWireless (3G UMTS TDD) Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB IPWireless (3G UMTS TDD) Driver" + depends on USB_SERIAL help Say Y here if you want to use a IPWireless USB modem such as the ones supplied by Axity3G/Sentech South Africa. @@ -289,8 +289,8 @@ config USB_SERIAL_IPW module will be called ipw. config USB_SERIAL_IUU - tristate "USB Infinity USB Unlimited Phoenix Driver (Experimental)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB Infinity USB Unlimited Phoenix Driver" + depends on USB_SERIAL help Say Y here if you want to use a IUU in phoenix mode and get an extra ttyUSBx device. More information available on @@ -405,8 +405,8 @@ config USB_SERIAL_KEYSPAN_USA49WLC Say Y here to include firmware for the USA-49WLC converter. config USB_SERIAL_KLSI - tristate "USB KL5KUSB105 (Palmconnect) Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB KL5KUSB105 (Palmconnect) Driver" + depends on USB_SERIAL ---help--- Say Y here if you want to use a KL5KUSB105 - based single port serial adapter. The most widely known -- and currently the only @@ -494,7 +494,7 @@ config USB_SERIAL_PL2303 module will be called pl2303. config USB_SERIAL_OTI6858 - tristate "USB Ours Technology Inc. OTi-6858 USB To RS232 Bridge Controller (EXPERIMENTAL)" + tristate "USB Ours Technology Inc. OTi-6858 USB To RS232 Bridge Controller" depends on USB_SERIAL help Say Y here if you want to use the OTi-6858 single port USB to serial @@ -513,8 +513,8 @@ config USB_SERIAL_HP4X module will be called hp4x. config USB_SERIAL_SAFE - tristate "USB Safe Serial (Encapsulated) Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB Safe Serial (Encapsulated) Driver" + depends on USB_SERIAL config USB_SERIAL_SAFE_PADDED bool "USB Secure Encapsulated Driver - Padded" @@ -542,8 +542,8 @@ config USB_SERIAL_TI module will be called ti_usb_3410_5052. config USB_SERIAL_CYBERJACK - tristate "USB REINER SCT cyberJack pinpad/e-com chipcard reader (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB REINER SCT cyberJack pinpad/e-com chipcard reader" + depends on USB_SERIAL ---help--- Say Y here if you want to use a cyberJack pinpad/e-com USB chipcard reader. This is an interface to ISO 7816 compatible contact-based @@ -586,8 +586,8 @@ config USB_SERIAL_OPTION it might be accessible via the FTDI_SIO driver. config USB_SERIAL_OMNINET - tristate "USB ZyXEL omni.net LCD Plus Driver (EXPERIMENTAL)" - depends on USB_SERIAL && EXPERIMENTAL + tristate "USB ZyXEL omni.net LCD Plus Driver" + depends on USB_SERIAL help Say Y here if you want to use a ZyXEL omni.net LCD ISDN TA. -- cgit v1.2.3 From 528e4c12a7c141ce46641537fe7e3d7c29f68b8c Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 8 Mar 2008 03:04:05 -0500 Subject: USB: Remove EXPERIMENTAL designation from USB MDC800 support. Since support for the USB Mustek MDC800 Digital Camera has apparently been around since the beginning of the git repository, it's safe to assume it's no longer experimental. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/image/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/image/Kconfig b/drivers/usb/image/Kconfig index 7595dfb38e3..33350f9dd34 100644 --- a/drivers/usb/image/Kconfig +++ b/drivers/usb/image/Kconfig @@ -5,8 +5,8 @@ comment "USB Imaging devices" depends on USB config USB_MDC800 - tristate "USB Mustek MDC800 Digital Camera support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Mustek MDC800 Digital Camera support" + depends on USB ---help--- Say Y here if you want to connect this type of still camera to your computer's USB port. This driver can be used with gphoto 0.4.3 -- cgit v1.2.3 From b67199967c777cf1aa42949f2bda00a7b937243e Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 8 Mar 2008 03:12:44 -0500 Subject: USB: Remove EXPERIMENTAL from dynamic USB minor allocation. Since this USB feature seems non-experimental, remove that dependency. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index fee864c9e62..cc9f397e839 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig @@ -76,8 +76,8 @@ config USB_DEVICE_CLASS NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" config USB_DYNAMIC_MINORS - bool "Dynamic USB minor allocation (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + bool "Dynamic USB minor allocation" + depends on USB help If you say Y here, the USB subsystem will use dynamic minor allocation for any device that uses the USB major number. -- cgit v1.2.3 From 9ec249a658e85fbb3e510c6208fb0c1a1d19c059 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 8 Mar 2008 03:27:44 -0500 Subject: USB: Remove EXPERIMENTAL designation from USB_EHCI_ROOT_HUB_TT. According to David Brownell, this feature doesn't require an experimental designation any longer. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index bf8be2a41a4..27f295b7805 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -30,8 +30,8 @@ config USB_EHCI_HCD module will be called ehci-hcd. config USB_EHCI_ROOT_HUB_TT - bool "Root Hub Transaction Translators (EXPERIMENTAL)" - depends on USB_EHCI_HCD && EXPERIMENTAL + bool "Root Hub Transaction Translators" + depends on USB_EHCI_HCD ---help--- Some EHCI chips have vendor-specific extensions to integrate transaction translators, so that no OHCI or UHCI companion -- cgit v1.2.3 From d43a05fdc2b5675efc45c32d427ff987a10b617a Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sun, 9 Mar 2008 13:55:01 -0400 Subject: USB: Fix "cut and paste" booboo in usbmon Makefile. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mon/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/mon/Makefile b/drivers/usb/mon/Makefile index 90c59535778..0f76ed5e161 100644 --- a/drivers/usb/mon/Makefile +++ b/drivers/usb/mon/Makefile @@ -1,5 +1,5 @@ # -# Makefile for USB Core files and filesystem +# Makefile for USB monitor # usbmon-objs := mon_main.o mon_stat.o mon_text.o mon_bin.o mon_dma.o -- cgit v1.2.3 From 454459b02ea9c8e850fd0b4e770037daf9a7b758 Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Wed, 19 Mar 2008 22:29:51 -0700 Subject: usbmon: restore mmap Paolo asked to enable the mmap. I kept it off because I'm do not entirely understand how it workse these days after ->nopage etc. But it seems like working somewhat at least. Signed-Off-By: Pete Zaitcev Cc: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mon/mon_bin.c | 9 +++------ drivers/usb/mon/mon_main.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index 1774ba5c4c3..49145534e06 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c @@ -1026,8 +1026,6 @@ mon_bin_poll(struct file *file, struct poll_table_struct *wait) return mask; } -#if 0 - /* * open and close: just keep track of how many times the device is * mapped, to use the proper memory allocation function. @@ -1063,13 +1061,13 @@ static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) return 0; } -struct vm_operations_struct mon_bin_vm_ops = { +static struct vm_operations_struct mon_bin_vm_ops = { .open = mon_bin_vma_open, .close = mon_bin_vma_close, .fault = mon_bin_vma_fault, }; -int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) +static int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) { /* don't do anything here: "fault" will set up page table entries */ vma->vm_ops = &mon_bin_vm_ops; @@ -1079,8 +1077,6 @@ int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) return 0; } -#endif /* 0 */ - static const struct file_operations mon_fops_binary = { .owner = THIS_MODULE, .open = mon_bin_open, @@ -1090,6 +1086,7 @@ static const struct file_operations mon_fops_binary = { .poll = mon_bin_poll, .ioctl = mon_bin_ioctl, .release = mon_bin_release, + .mmap = mon_bin_mmap, }; static int mon_bin_wait_event(struct file *file, struct mon_reader_bin *rp) diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c index b371ffd39d3..442d8076b20 100644 --- a/drivers/usb/mon/mon_main.c +++ b/drivers/usb/mon/mon_main.c @@ -129,8 +129,7 @@ static void mon_submit_error(struct usb_bus *ubus, struct urb *urb, int error) /* */ -static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb, - int status) +static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb, int status) { unsigned long flags; struct list_head *pos; -- cgit v1.2.3 From 28d1dfadd3ca07e7ec1c3de4f82ac2b8ece4be91 Mon Sep 17 00:00:00 2001 From: David Engraf Date: Thu, 20 Mar 2008 10:53:52 +0100 Subject: USB: cdc-acm tell tty layer not to split things up. It ensures that the tty level do not split the send buffer into 2KB blocks. Signed-off-by: David Engraf Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/cdc-acm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 0147ea39340..1ded83b66af 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -489,6 +489,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) else rv = 0; + set_bit(TTY_NO_WRITE_SPLIT, &tty->flags); tty->driver_data = acm; acm->tty = tty; -- cgit v1.2.3 From e4cf3aa8f9cd6ee4d583b5d445b5c152acefcde4 Mon Sep 17 00:00:00 2001 From: David Engraf Date: Thu, 20 Mar 2008 10:01:34 +0100 Subject: USB: increase cdc-acm write throughput the following patch uses 16 write urbs and a writsize of wMaxPacketSize * 20. With this patch I get the maximum througput from my linux system with 20MB/sec read and 15 MB/sec write (full speed 1 MB/sec both) I also deleted the flag URB_NO_FSBR for the writeurbs, because this makes my full speed devices significant slower. Signed-off-by: David Engraf Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/cdc-acm.c | 81 +++++++++++++++++++++++---------------------- drivers/usb/class/cdc-acm.h | 7 ++-- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 1ded83b66af..d9b40811392 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -31,6 +31,7 @@ * v0.23 - use softirq for rx processing, as needed by tty layer * v0.24 - change probe method to evaluate CDC union descriptor * v0.25 - downstream tasks paralelized to maximize throughput + * v0.26 - multiple write urbs, writesize increased */ /* @@ -72,7 +73,7 @@ /* * Version Information */ -#define DRIVER_VERSION "v0.25" +#define DRIVER_VERSION "v0.26" #define DRIVER_AUTHOR "Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik, David Kubicek" #define DRIVER_DESC "USB Abstract Control Model driver for USB modems and ISDN adapters" @@ -118,7 +119,7 @@ static int acm_wb_alloc(struct acm *acm) int i, wbn; struct acm_wb *wb; - wbn = acm->write_current; + wbn = 0; i = 0; for (;;) { wb = &acm->wb[wbn]; @@ -132,11 +133,6 @@ static int acm_wb_alloc(struct acm *acm) } } -static void acm_wb_free(struct acm *acm, int wbn) -{ - acm->wb[wbn].use = 0; -} - static int acm_wb_is_avail(struct acm *acm) { int i, n; @@ -156,26 +152,22 @@ static inline int acm_wb_is_used(struct acm *acm, int wbn) /* * Finish write. */ -static void acm_write_done(struct acm *acm) +static void acm_write_done(struct acm *acm, struct acm_wb *wb) { unsigned long flags; - int wbn; spin_lock_irqsave(&acm->write_lock, flags); acm->write_ready = 1; - wbn = acm->write_current; - acm_wb_free(acm, wbn); - acm->write_current = (wbn + 1) % ACM_NW; + wb->use = 0; spin_unlock_irqrestore(&acm->write_lock, flags); } /* * Poke write. */ -static int acm_write_start(struct acm *acm) +static int acm_write_start(struct acm *acm, int wbn) { unsigned long flags; - int wbn; struct acm_wb *wb; int rc; @@ -190,24 +182,24 @@ static int acm_write_start(struct acm *acm) return 0; /* A white lie */ } - wbn = acm->write_current; if (!acm_wb_is_used(acm, wbn)) { spin_unlock_irqrestore(&acm->write_lock, flags); return 0; } wb = &acm->wb[wbn]; - acm->write_ready = 0; + if(acm_wb_is_avail(acm) <= 1) + acm->write_ready = 0; spin_unlock_irqrestore(&acm->write_lock, flags); - acm->writeurb->transfer_buffer = wb->buf; - acm->writeurb->transfer_dma = wb->dmah; - acm->writeurb->transfer_buffer_length = wb->len; - acm->writeurb->dev = acm->dev; + wb->urb->transfer_buffer = wb->buf; + wb->urb->transfer_dma = wb->dmah; + wb->urb->transfer_buffer_length = wb->len; + wb->urb->dev = acm->dev; - if ((rc = usb_submit_urb(acm->writeurb, GFP_ATOMIC)) < 0) { + if ((rc = usb_submit_urb(wb->urb, GFP_ATOMIC)) < 0) { dbg("usb_submit_urb(write bulk) failed: %d", rc); - acm_write_done(acm); + acm_write_done(acm, wb); } return rc; } @@ -450,12 +442,13 @@ urbs: /* data interface wrote those outgoing bytes */ static void acm_write_bulk(struct urb *urb) { - struct acm *acm = (struct acm *)urb->context; + struct acm *acm; + struct acm_wb *wb = (struct acm_wb *)urb->context; dbg("Entering acm_write_bulk with status %d", urb->status); - acm_write_done(acm); - acm_write_start(acm); + acm = wb->instance; + acm_write_done(acm, wb); if (ACM_READY(acm)) schedule_work(&acm->work); } @@ -557,7 +550,8 @@ static void acm_tty_unregister(struct acm *acm) usb_put_intf(acm->control); acm_table[acm->minor] = NULL; usb_free_urb(acm->ctrlurb); - usb_free_urb(acm->writeurb); + for (i = 0; i < ACM_NW; i++) + usb_free_urb(acm->wb[i].urb); for (i = 0; i < nr; i++) usb_free_urb(acm->ru[i].urb); kfree(acm->country_codes); @@ -578,7 +572,8 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) if (acm->dev) { acm_set_control(acm, acm->ctrlout = 0); usb_kill_urb(acm->ctrlurb); - usb_kill_urb(acm->writeurb); + for (i = 0; i < ACM_NW; i++) + usb_kill_urb(acm->wb[i].urb); for (i = 0; i < nr; i++) usb_kill_urb(acm->ru[i].urb); usb_autopm_put_interface(acm->control); @@ -606,7 +601,6 @@ static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int c spin_lock_irqsave(&acm->write_lock, flags); if ((wbn = acm_wb_alloc(acm)) < 0) { spin_unlock_irqrestore(&acm->write_lock, flags); - acm_write_start(acm); return 0; } wb = &acm->wb[wbn]; @@ -617,7 +611,7 @@ static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int c wb->len = count; spin_unlock_irqrestore(&acm->write_lock, flags); - if ((stat = acm_write_start(acm)) < 0) + if ((stat = acm_write_start(acm, wbn)) < 0) return stat; return count; } @@ -977,7 +971,7 @@ skip_normal_probe: ctrlsize = le16_to_cpu(epctrl->wMaxPacketSize); readsize = le16_to_cpu(epread->wMaxPacketSize)* ( quirks == SINGLE_RX_URB ? 1 : 2); - acm->writesize = le16_to_cpu(epwrite->wMaxPacketSize); + acm->writesize = le16_to_cpu(epwrite->wMaxPacketSize) * 20; acm->control = control_interface; acm->data = data_interface; acm->minor = minor; @@ -1032,10 +1026,19 @@ skip_normal_probe: goto alloc_fail7; } } - acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); - if (!acm->writeurb) { - dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n"); - goto alloc_fail7; + for(i = 0; i < ACM_NW; i++) + { + struct acm_wb *snd = &(acm->wb[i]); + + if (!(snd->urb = usb_alloc_urb(0, GFP_KERNEL))) { + dev_dbg(&intf->dev, "out of memory (write urbs usb_alloc_urb)"); + goto alloc_fail7; + } + + usb_fill_bulk_urb(snd->urb, usb_dev, usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), + NULL, acm->writesize, acm_write_bulk, snd); + snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + snd->instance = acm; } usb_set_intfdata (intf, acm); @@ -1071,10 +1074,6 @@ skip_countries: acm->ctrlurb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; acm->ctrlurb->transfer_dma = acm->ctrl_dma; - usb_fill_bulk_urb(acm->writeurb, usb_dev, usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), - NULL, acm->writesize, acm_write_bulk, acm); - acm->writeurb->transfer_flags |= URB_NO_FSBR | URB_NO_TRANSFER_DMA_MAP; - dev_info(&intf->dev, "ttyACM%d: USB ACM device\n", minor); acm_set_control(acm, acm->ctrlout); @@ -1092,7 +1091,8 @@ skip_countries: return 0; alloc_fail8: - usb_free_urb(acm->writeurb); + for (i = 0; i < ACM_NW; i++) + usb_free_urb(acm->wb[i].urb); alloc_fail7: for (i = 0; i < num_rx_buf; i++) usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma); @@ -1116,7 +1116,8 @@ static void stop_data_traffic(struct acm *acm) tasklet_disable(&acm->urb_task); usb_kill_urb(acm->ctrlurb); - usb_kill_urb(acm->writeurb); + for(i = 0; i < ACM_NW; i++) + usb_kill_urb(acm->wb[i].urb); for (i = 0; i < acm->rx_buflimit; i++) usb_kill_urb(acm->ru[i].urb); diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index 8df6a57dcf9..046e064b033 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h @@ -59,7 +59,7 @@ * when processing onlcr, so we only need 2 buffers. These values must be * powers of 2. */ -#define ACM_NW 2 +#define ACM_NW 16 #define ACM_NR 16 struct acm_wb { @@ -67,6 +67,8 @@ struct acm_wb { dma_addr_t dmah; int len; int use; + struct urb *urb; + struct acm *instance; }; struct acm_rb { @@ -88,7 +90,7 @@ struct acm { struct usb_interface *control; /* control interface */ struct usb_interface *data; /* data interface */ struct tty_struct *tty; /* the corresponding tty */ - struct urb *ctrlurb, *writeurb; /* urbs */ + struct urb *ctrlurb; /* urbs */ u8 *ctrl_buffer; /* buffers of urbs */ dma_addr_t ctrl_dma; /* dma handles of buffers */ u8 *country_codes; /* country codes from device */ @@ -103,7 +105,6 @@ struct acm { struct list_head spare_read_urbs; struct list_head spare_read_bufs; struct list_head filled_read_bufs; - int write_current; /* current write buffer */ int write_used; /* number of non-empty write buffers */ int write_ready; /* write urb is not running */ spinlock_t write_lock; -- cgit v1.2.3 From f3564de4f5ee3e205227691401d875a57b76906d Mon Sep 17 00:00:00 2001 From: Kevin Lloyd Date: Fri, 28 Mar 2008 10:05:08 -0700 Subject: USB: Serial: Sierra: Clean up This patch cleans up some of the sierra driver code. Please package this with the other patches in this group as I would like the driver version to reflect their changes as well. Signed-off-by: Kevin Lloyd Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 7b02a4ae1da..5e55959daaa 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -1,7 +1,7 @@ /* USB Driver for Sierra Wireless - Copyright (C) 2006, 2007, 2008 Kevin Lloyd + Copyright (C) 2006, 2007, 2008 Kevin Lloyd IMPORTANT DISCLAIMER: This driver is not commercially supported by Sierra Wireless. Use at your own risk. @@ -14,8 +14,8 @@ Whom based his on the Keyspan driver by Hugh Blemings */ -#define DRIVER_VERSION "v.1.2.8" -#define DRIVER_AUTHOR "Kevin Lloyd " +#define DRIVER_VERSION "v.1.2.9c" +#define DRIVER_AUTHOR "Kevin Lloyd " #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" #include @@ -31,7 +31,6 @@ #define SWIMS_USB_REQUEST_SetPower 0x00 #define SWIMS_USB_REQUEST_SetNmea 0x07 #define SWIMS_USB_REQUEST_SetMode 0x0B -#define SWIMS_USB_REQUEST_TYPE_VSC_SET 0x40 #define SWIMS_SET_MODE_Modem 0x0001 /* per port private data */ @@ -55,7 +54,7 @@ static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) dev_dbg(&udev->dev, "%s", "SET POWER STATE\n"); result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), SWIMS_USB_REQUEST_SetPower, /* __u8 request */ - SWIMS_USB_REQUEST_TYPE_VSC_SET, /* __u8 request type */ + USB_TYPE_VENDOR, /* __u8 request type */ swiState, /* __u16 value */ 0, /* __u16 index */ NULL, /* void *data */ @@ -70,7 +69,7 @@ static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSWocMode) dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH\n"); result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), SWIMS_USB_REQUEST_SetMode, /* __u8 request */ - SWIMS_USB_REQUEST_TYPE_VSC_SET, /* __u8 request type */ + USB_TYPE_VENDOR, /* __u8 request type */ eSWocMode, /* __u16 value */ 0x0000, /* __u16 index */ NULL, /* void *data */ @@ -85,7 +84,7 @@ static int sierra_vsc_set_nmea(struct usb_device *udev, __u16 enable) dev_dbg(&udev->dev, "%s", "NMEA Enable sent\n"); result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), SWIMS_USB_REQUEST_SetNmea, /* __u8 request */ - SWIMS_USB_REQUEST_TYPE_VSC_SET, /* __u8 request type */ + USB_TYPE_VENDOR, /* __u8 request type */ enable, /* __u16 value */ 0x0000, /* __u16 index */ NULL, /* void *data */ @@ -453,7 +452,7 @@ static void sierra_instat_callback(struct urb *urb) struct usb_serial *serial = port->serial; dbg("%s", __FUNCTION__); - dbg("%s: urb %p port %p has data %p", __FUNCTION__,urb,port,portdata); + dbg("%s: urb %p port %p has data %p", __FUNCTION__, urb, port, portdata); if (status == 0) { struct usb_ctrlrequest *req_pkt = @@ -483,7 +482,7 @@ static void sierra_instat_callback(struct urb *urb) tty_hangup(port->tty); } else { dbg("%s: type %x req %x", __FUNCTION__, - req_pkt->bRequestType,req_pkt->bRequest); + req_pkt->bRequestType, req_pkt->bRequest); } } else dbg("%s: error %d", __FUNCTION__, status); -- cgit v1.2.3 From 69a90f8189960f37cc73f5da6c331b23227e2197 Mon Sep 17 00:00:00 2001 From: Kevin Lloyd Date: Mon, 31 Mar 2008 10:20:54 -0700 Subject: USB: Serial: Sierra: C597 fix This patch is for the sierra driver and fixes a Compass 597 bug that allows users to access the SD-Card. This targets kernel 2.6.25-rc7 Signed-off-by: Kevin Lloyd Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 5e55959daaa..af667a1828b 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -155,7 +155,7 @@ static struct usb_device_id id_table [] = { { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ - { USB_DEVICE(0x1199, 0x0023) }, /* Sierra Wireless AirCard */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, /* Sierra Wireless C597 */ { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ -- cgit v1.2.3 From 7106967ecc0a33a7d7e2e04798eb9f45377f448b Mon Sep 17 00:00:00 2001 From: Kevin Lloyd Date: Wed, 2 Apr 2008 11:24:56 -0700 Subject: usb/usb-serial-sierra-add-new-dev-group This patch is for the sierra driver and adds support for a new group of devices that have a new USB configuration. This targets kernel 2.6.25-rc7 Signed-off-by: Kevin Lloyd Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index af667a1828b..f791eb8887f 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -108,6 +108,26 @@ static int sierra_calc_num_ports(struct usb_serial *serial) return result; } +static int sierra_calc_interface(struct usb_serial *serial) +{ + int interface; + struct usb_interface *p_interface; + struct usb_host_interface *p_host_interface; + + /* Get the interface structure pointer from the serial struct */ + p_interface = serial->interface; + + /* Get a pointer to the host interface structure */ + p_host_interface = p_interface->cur_altsetting; + + /* read the interface descriptor for this active altsetting + * to find out the interface number we are on + */ + interface = p_host_interface->desc.bInterfaceNumber; + + return interface; +} + static int sierra_probe(struct usb_serial *serial, const struct usb_device_id *id) { @@ -123,6 +143,22 @@ static int sierra_probe(struct usb_serial *serial, ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber; udev = serial->dev; + /* Figure out the interface number from the serial structure */ + ifnum = sierra_calc_interface(serial); + + /* + * If this interface supports more than 1 alternate + * select the 2nd one + */ + if (serial->interface->num_altsetting == 2) { + dev_dbg(&udev->dev, + "Selecting alt setting for interface %d\n", + ifnum); + + /* We know the alternate setting is 1 for the MC8785 */ + usb_set_interface(udev, ifnum, 1); + } + /* Check if in installer mode */ if (truinstall && id->driver_info == DEVICE_INSTALLER) { dev_dbg(&udev->dev, "%s", "FOUND TRU-INSTALL DEVICE(SW)\n"); @@ -165,14 +201,18 @@ static struct usb_device_id id_table [] = { { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */ { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ + { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ + { USB_DEVICE(0x1199, 0x683B), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless MC8785 Composite*/ { USB_DEVICE(0x1199, 0x6850) }, /* Sierra Wireless AirCard 880 */ { USB_DEVICE(0x1199, 0x6851) }, /* Sierra Wireless AirCard 881 */ { USB_DEVICE(0x1199, 0x6852) }, /* Sierra Wireless AirCard 880 E */ { USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881 E */ { USB_DEVICE(0x1199, 0x6855) }, /* Sierra Wireless AirCard 880 U */ { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ + { USB_DEVICE(0x1199, 0x6859), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless AirCard 885 E */ + { USB_DEVICE(0x1199, 0x685A), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless AirCard 885 E */ { USB_DEVICE(0x1199, 0x6468) }, /* Sierra Wireless MP3G - EVDO */ { USB_DEVICE(0x1199, 0x6469) }, /* Sierra Wireless MP3G - UMTS/HSPA */ -- cgit v1.2.3 From 619a6f1d1423d08e74ed2b8a2113f12ef18e4373 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 7 Feb 2008 23:59:03 +0100 Subject: USB: add usb-serial spcp8x5 driver Original version of the driver done by Linxb, changes by Harald, and lots of cleanups by me in order to get it into a mergable state. Cc: Linxb Cc: Harald Klein Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/Kconfig | 10 + drivers/usb/serial/Makefile | 3 +- drivers/usb/serial/spcp8x5.c | 1075 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1087 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/serial/spcp8x5.c diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index a769f6a5d7f..f9c6c0922c0 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -503,6 +503,16 @@ config USB_SERIAL_OTI6858 To compile this driver as a module, choose M here: the module will be called oti6858. +config USB_SERIAL_SPCP8X5 + tristate "USB SPCP8x5 USB To Serial Driver" + depends on USB_SERIAL + help + Say Y here if you want to use the spcp8x5 converter chip. This is + commonly found in some Z-Wave USB devices. + + To compile this driver as a module, choose M here: the + module will be called spcp8x5. + config USB_SERIAL_HP4X tristate "USB HP4x Calculators support" depends on USB_SERIAL diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 0db109a54d1..756859510d8 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -30,8 +30,8 @@ obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o obj-$(CONFIG_USB_SERIAL_HP4X) += hp4x.o obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o obj-$(CONFIG_USB_SERIAL_IPW) += ipw.o -obj-$(CONFIG_USB_SERIAL_IUU) += iuu_phoenix.o obj-$(CONFIG_USB_SERIAL_IR) += ir-usb.o +obj-$(CONFIG_USB_SERIAL_IUU) += iuu_phoenix.o obj-$(CONFIG_USB_SERIAL_KEYSPAN) += keyspan.o obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda.o obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o @@ -46,6 +46,7 @@ obj-$(CONFIG_USB_SERIAL_OTI6858) += oti6858.o obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o +obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c new file mode 100644 index 00000000000..1b46b846f10 --- /dev/null +++ b/drivers/usb/serial/spcp8x5.c @@ -0,0 +1,1075 @@ +/* + * spcp8x5 USB to serial adaptor driver + * + * Copyright (C) 2006 Linxb (xubin.lin@worldplus.com.cn) + * Copyright (C) 2006 S1 Corp. + * + * Original driver for 2.6.10 pl2303 driver by + * Greg Kroah-Hartman (greg@kroah.com) + * Changes for 2.6.20 by Harald Klein + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Version Information */ +#define DRIVER_VERSION "v0.04" +#define DRIVER_DESC "SPCP8x5 USB to serial adaptor driver" + +static int debug; + +#define SPCP8x5_007_VID 0x04FC +#define SPCP8x5_007_PID 0x0201 +#define SPCP8x5_008_VID 0x04fc +#define SPCP8x5_008_PID 0x0235 +#define SPCP8x5_PHILIPS_VID 0x0471 +#define SPCP8x5_PHILIPS_PID 0x081e +#define SPCP8x5_INTERMATIC_VID 0x04FC +#define SPCP8x5_INTERMATIC_PID 0x0204 +#define SPCP8x5_835_VID 0x04fc +#define SPCP8x5_835_PID 0x0231 + +static struct usb_device_id id_table [] = { + { USB_DEVICE(SPCP8x5_PHILIPS_VID , SPCP8x5_PHILIPS_PID)}, + { USB_DEVICE(SPCP8x5_INTERMATIC_VID, SPCP8x5_INTERMATIC_PID)}, + { USB_DEVICE(SPCP8x5_835_VID, SPCP8x5_835_PID)}, + { USB_DEVICE(SPCP8x5_008_VID, SPCP8x5_008_PID)}, + { USB_DEVICE(SPCP8x5_007_VID, SPCP8x5_007_PID)}, + { } /* Terminating entry */ +}; +MODULE_DEVICE_TABLE(usb, id_table); + +struct spcp8x5_usb_ctrl_arg { + u8 type; + u8 cmd; + u8 cmd_type; + u16 value; + u16 index; + u16 length; +}; + +/* wait 30s before close */ +#define SPCP8x5_CLOSING_WAIT (30*HZ) + +#define SPCP8x5_BUF_SIZE 1024 + + +/* spcp8x5 spec register define */ +#define MCR_CONTROL_LINE_RTS 0x02 +#define MCR_CONTROL_LINE_DTR 0x01 +#define MCR_DTR 0x01 +#define MCR_RTS 0x02 + +#define MSR_STATUS_LINE_DCD 0x80 +#define MSR_STATUS_LINE_RI 0x40 +#define MSR_STATUS_LINE_DSR 0x20 +#define MSR_STATUS_LINE_CTS 0x10 + +/* verdor command here , we should define myself */ +#define SET_DEFAULT 0x40 +#define SET_DEFAULT_TYPE 0x20 + +#define SET_UART_FORMAT 0x40 +#define SET_UART_FORMAT_TYPE 0x21 +#define SET_UART_FORMAT_SIZE_5 0x00 +#define SET_UART_FORMAT_SIZE_6 0x01 +#define SET_UART_FORMAT_SIZE_7 0x02 +#define SET_UART_FORMAT_SIZE_8 0x03 +#define SET_UART_FORMAT_STOP_1 0x00 +#define SET_UART_FORMAT_STOP_2 0x04 +#define SET_UART_FORMAT_PAR_NONE 0x00 +#define SET_UART_FORMAT_PAR_ODD 0x10 +#define SET_UART_FORMAT_PAR_EVEN 0x30 +#define SET_UART_FORMAT_PAR_MASK 0xD0 +#define SET_UART_FORMAT_PAR_SPACE 0x90 + +#define GET_UART_STATUS_TYPE 0xc0 +#define GET_UART_STATUS 0x22 +#define GET_UART_STATUS_MSR 0x06 + +#define SET_UART_STATUS 0x40 +#define SET_UART_STATUS_TYPE 0x23 +#define SET_UART_STATUS_MCR 0x0004 +#define SET_UART_STATUS_MCR_DTR 0x01 +#define SET_UART_STATUS_MCR_RTS 0x02 +#define SET_UART_STATUS_MCR_LOOP 0x10 + +#define SET_WORKING_MODE 0x40 +#define SET_WORKING_MODE_TYPE 0x24 +#define SET_WORKING_MODE_U2C 0x00 +#define SET_WORKING_MODE_RS485 0x01 +#define SET_WORKING_MODE_PDMA 0x02 +#define SET_WORKING_MODE_SPP 0x03 + +#define SET_FLOWCTL_CHAR 0x40 +#define SET_FLOWCTL_CHAR_TYPE 0x25 + +#define GET_VERSION 0xc0 +#define GET_VERSION_TYPE 0x26 + +#define SET_REGISTER 0x40 +#define SET_REGISTER_TYPE 0x27 + +#define GET_REGISTER 0xc0 +#define GET_REGISTER_TYPE 0x28 + +#define SET_RAM 0x40 +#define SET_RAM_TYPE 0x31 + +#define GET_RAM 0xc0 +#define GET_RAM_TYPE 0x32 + +/* how come ??? */ +#define UART_STATE 0x08 +#define UART_STATE_TRANSIENT_MASK 0x74 +#define UART_DCD 0x01 +#define UART_DSR 0x02 +#define UART_BREAK_ERROR 0x04 +#define UART_RING 0x08 +#define UART_FRAME_ERROR 0x10 +#define UART_PARITY_ERROR 0x20 +#define UART_OVERRUN_ERROR 0x40 +#define UART_CTS 0x80 + +enum spcp8x5_type { + SPCP825_007_TYPE, + SPCP825_008_TYPE, + SPCP825_PHILIP_TYPE, + SPCP825_INTERMATIC_TYPE, + SPCP835_TYPE, +}; + +/* 1st in 1st out buffer 4 driver */ +struct ringbuf { + unsigned int buf_size; + char *buf_buf; + char *buf_get; + char *buf_put; +}; + +/* alloc the ring buf and alloc the buffer itself */ +static inline struct ringbuf *alloc_ringbuf(unsigned int size) +{ + struct ringbuf *pb; + + if (size == 0) + return NULL; + + pb = kmalloc(sizeof(*pb), GFP_KERNEL); + if (pb == NULL) + return NULL; + + pb->buf_buf = kmalloc(size, GFP_KERNEL); + if (pb->buf_buf == NULL) { + kfree(pb); + return NULL; + } + + pb->buf_size = size; + pb->buf_get = pb->buf_put = pb->buf_buf; + + return pb; +} + +/* free the ring buf and the buffer itself */ +static inline void free_ringbuf(struct ringbuf *pb) +{ + if (pb != NULL) { + kfree(pb->buf_buf); + kfree(pb); + } +} + +/* clear pipo , juest repoint the pointer here */ +static inline void clear_ringbuf(struct ringbuf *pb) +{ + if (pb != NULL) + pb->buf_get = pb->buf_put; +} + +/* get the number of data in the pipo */ +static inline unsigned int ringbuf_avail_data(struct ringbuf *pb) +{ + if (pb == NULL) + return 0; + return ((pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size); +} + +/* get the number of space in the pipo */ +static inline unsigned int ringbuf_avail_space(struct ringbuf *pb) +{ + if (pb == NULL) + return 0; + return ((pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size); +} + +/* put count data into pipo */ +static unsigned int put_ringbuf(struct ringbuf *pb, const char *buf, + unsigned int count) +{ + unsigned int len; + + if (pb == NULL) + return 0; + + len = ringbuf_avail_space(pb); + if (count > len) + count = len; + + if (count == 0) + return 0; + + len = pb->buf_buf + pb->buf_size - pb->buf_put; + if (count > len) { + memcpy(pb->buf_put, buf, len); + memcpy(pb->buf_buf, buf+len, count - len); + pb->buf_put = pb->buf_buf + count - len; + } else { + memcpy(pb->buf_put, buf, count); + if (count < len) + pb->buf_put += count; + else /* count == len */ + pb->buf_put = pb->buf_buf; + } + return count; +} + +/* get count data from pipo */ +static unsigned int get_ringbuf(struct ringbuf *pb, char *buf, + unsigned int count) +{ + unsigned int len; + + if (pb == NULL || buf == NULL) + return 0; + + len = ringbuf_avail_data(pb); + if (count > len) + count = len; + + if (count == 0) + return 0; + + len = pb->buf_buf + pb->buf_size - pb->buf_get; + if (count > len) { + memcpy(buf, pb->buf_get, len); + memcpy(buf+len, pb->buf_buf, count - len); + pb->buf_get = pb->buf_buf + count - len; + } else { + memcpy(buf, pb->buf_get, count); + if (count < len) + pb->buf_get += count; + else /* count == len */ + pb->buf_get = pb->buf_buf; + } + + return count; +} + +static struct usb_driver spcp8x5_driver = { + .name = "spcp8x5", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, + .no_dynamic_id = 1, +}; + + +struct spcp8x5_private { + spinlock_t lock; + struct ringbuf *buf; + int write_urb_in_use; + enum spcp8x5_type type; + wait_queue_head_t delta_msr_wait; + u8 line_control; + u8 line_status; + u8 termios_initialized; +}; + +/* desc : when device plug in,this function would be called. + * thanks to usb_serial subsystem,then do almost every things for us. And what + * we should do just alloc the buffer */ +static int spcp8x5_startup(struct usb_serial *serial) +{ + struct spcp8x5_private *priv; + int i; + enum spcp8x5_type type = SPCP825_007_TYPE; + + if (serial->dev->descriptor.idProduct == 0x0201) + type = SPCP825_007_TYPE; + else if (serial->dev->descriptor.idProduct == 0x0231) + type = SPCP835_TYPE; + else if (serial->dev->descriptor.idProduct == 0x0235) + type = SPCP825_008_TYPE; + else if (serial->dev->descriptor.idProduct == 0x0204) + type = SPCP825_INTERMATIC_TYPE; + else if (serial->dev->descriptor.idProduct == 0x0471 && + serial->dev->descriptor.idVendor == 0x081e) + type = SPCP825_PHILIP_TYPE; + dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); + + for (i = 0; i < serial->num_ports; ++i) { + priv = kzalloc(sizeof(struct spcp8x5_private), GFP_KERNEL); + if (!priv) + goto cleanup; + + spin_lock_init(&priv->lock); + priv->buf = alloc_ringbuf(SPCP8x5_BUF_SIZE); + if (priv->buf == NULL) + goto cleanup2; + + init_waitqueue_head(&priv->delta_msr_wait); + priv->type = type; + usb_set_serial_port_data(serial->port[i] , priv); + + } + + return 0; + +cleanup2: + kfree(priv); +cleanup: + for (--i; i >= 0; --i) { + priv = usb_get_serial_port_data(serial->port[i]); + free_ringbuf(priv->buf); + kfree(priv); + usb_set_serial_port_data(serial->port[i] , NULL); + } + return -ENOMEM; +} + +/* call when the device plug out. free all the memory alloced by probe */ +static void spcp8x5_shutdown(struct usb_serial *serial) +{ + int i; + struct spcp8x5_private *priv; + + for (i = 0; i < serial->num_ports; i++) { + priv = usb_get_serial_port_data(serial->port[i]); + if (priv) { + free_ringbuf(priv->buf); + kfree(priv); + usb_set_serial_port_data(serial->port[i] , NULL); + } + } +} + +/* set the modem control line of the device. + * NOTE spcp825-007 not supported this */ +static int spcp8x5_set_ctrlLine(struct usb_device *dev, u8 value, + enum spcp8x5_type type) +{ + int retval; + u8 mcr = 0 ; + + if (type == SPCP825_007_TYPE) + return -EPERM; + + mcr = (unsigned short)value; + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + SET_UART_STATUS_TYPE, SET_UART_STATUS, + mcr, 0x04, NULL, 0, 100); + if (retval != 0) + dev_dbg(&dev->dev, "usb_control_msg return %#x\n", retval); + return retval; +} + +/* get the modem status register of the device + * NOTE spcp825-007 not supported this */ +static int spcp8x5_get_msr(struct usb_device *dev, u8 *status, + enum spcp8x5_type type) +{ + u8 *status_buffer; + int ret; + + /* I return Permited not support here but seem inval device + * is more fix */ + if (type == SPCP825_007_TYPE) + return -EPERM; + if (status == NULL) + return -EINVAL; + + status_buffer = kmalloc(1, GFP_KERNEL); + if (!status_buffer) + return -ENOMEM; + status_buffer[0] = status[0]; + + ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + GET_UART_STATUS, GET_UART_STATUS_TYPE, + 0, GET_UART_STATUS_MSR, status_buffer, 1, 100); + if (ret < 0) + dev_dbg(&dev->dev, "Get MSR = 0x%p failed (error = %d)", + status_buffer, ret); + + dev_dbg(&dev->dev, "0xc0:0x22:0:6 %d - 0x%p ", ret, status_buffer); + status[0] = status_buffer[0]; + kfree(status_buffer); + + return ret; +} + +/* select the work mode. + * NOTE this function not supported by spcp825-007 */ +static void spcp8x5_set_workMode(struct usb_device *dev, u16 value, + u16 index, enum spcp8x5_type type) +{ + int ret; + + /* I return Permited not support here but seem inval device + * is more fix */ + if (type == SPCP825_007_TYPE) + return; + + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + SET_WORKING_MODE_TYPE, SET_WORKING_MODE, + value, index, NULL, 0, 100); + dev_dbg(&dev->dev, "value = %#x , index = %#x\n", value, index); + if (ret < 0) + dev_dbg(&dev->dev, + "RTSCTS usb_control_msg(enable flowctrl) = %d\n", ret); +} + +/* close the serial port. We should wait for data sending to device 1st and + * then kill all urb. */ +static void spcp8x5_close(struct usb_serial_port *port, struct file *filp) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + unsigned int c_cflag; + int bps; + long timeout; + wait_queue_t wait; + int result; + + dbg("%s - port %d", __func__, port->number); + + /* wait for data to drain from the buffer */ + spin_lock_irqsave(&priv->lock, flags); + timeout = SPCP8x5_CLOSING_WAIT; + init_waitqueue_entry(&wait, current); + add_wait_queue(&port->tty->write_wait, &wait); + for (;;) { + set_current_state(TASK_INTERRUPTIBLE); + if (ringbuf_avail_data(priv->buf) == 0 || + timeout == 0 || signal_pending(current)) + break; + spin_unlock_irqrestore(&priv->lock, flags); + timeout = schedule_timeout(timeout); + spin_lock_irqsave(&priv->lock, flags); + } + set_current_state(TASK_RUNNING); + remove_wait_queue(&port->tty->write_wait, &wait); + + /* clear out any remaining data in the buffer */ + clear_ringbuf(priv->buf); + spin_unlock_irqrestore(&priv->lock, flags); + + /* wait for characters to drain from the device (this is long enough + * for the entire all byte spcp8x5 hardware buffer to drain with no + * flow control for data rates of 1200 bps or more, for lower rates we + * should really know how much data is in the buffer to compute a delay + * that is not unnecessarily long) */ + bps = tty_get_baud_rate(port->tty); + if (bps > 1200) + timeout = max((HZ*2560) / bps, HZ/10); + else + timeout = 2*HZ; + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(timeout); + + /* clear control lines */ + if (port->tty) { + c_cflag = port->tty->termios->c_cflag; + if (c_cflag & HUPCL) { + spin_lock_irqsave(&priv->lock, flags); + priv->line_control = 0; + spin_unlock_irqrestore(&priv->lock, flags); + spcp8x5_set_ctrlLine(port->serial->dev, 0 , priv->type); + } + } + + /* kill urb */ + if (port->write_urb != NULL) { + result = usb_unlink_urb(port->write_urb); + if (result) + dev_dbg(&port->dev, + "usb_unlink_urb(write_urb) = %d\n", result); + } + result = usb_unlink_urb(port->read_urb); + if (result) + dev_dbg(&port->dev, "usb_unlink_urb(read_urb) = %d\n", result); +} + +/* set the serial param for transfer. we should check if we really need to + * transfer. then if be set flow contorl we should do this too. */ +static void spcp8x5_set_termios(struct usb_serial_port *port, + struct ktermios *old_termios) +{ + struct usb_serial *serial = port->serial; + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + unsigned int cflag = port->tty->termios->c_cflag; + unsigned int old_cflag = old_termios->c_cflag; + unsigned short uartdata; + unsigned char buf[2] = {0, 0}; + int baud; + int i; + u8 control; + + if ((!port->tty) || (!port->tty->termios)) + return; + + /* for the 1st time call this function */ + spin_lock_irqsave(&priv->lock, flags); + if (!priv->termios_initialized) { + *(port->tty->termios) = tty_std_termios; + port->tty->termios->c_cflag = B115200 | CS8 | CREAD | + HUPCL | CLOCAL; + priv->termios_initialized = 1; + } + spin_unlock_irqrestore(&priv->lock, flags); + + /* check that they really want us to change something */ + if (!tty_termios_hw_change(port->tty->termios, old_termios)) + return; + + /* set DTR/RTS active */ + spin_lock_irqsave(&priv->lock, flags); + control = priv->line_control; + if ((old_cflag & CBAUD) == B0) { + priv->line_control |= MCR_DTR; + if (!(old_cflag & CRTSCTS)) + priv->line_control |= MCR_RTS; + } + if (control != priv->line_control) { + control = priv->line_control; + spin_unlock_irqrestore(&priv->lock, flags); + spcp8x5_set_ctrlLine(serial->dev, control , priv->type); + } else { + spin_unlock_irqrestore(&priv->lock, flags); + } + + /* Set Baud Rate */ + baud = tty_get_baud_rate(port->tty);; + switch (baud) { + case 300: buf[0] = 0x00; break; + case 600: buf[0] = 0x01; break; + case 1200: buf[0] = 0x02; break; + case 2400: buf[0] = 0x03; break; + case 4800: buf[0] = 0x04; break; + case 9600: buf[0] = 0x05; break; + case 19200: buf[0] = 0x07; break; + case 38400: buf[0] = 0x09; break; + case 57600: buf[0] = 0x0a; break; + case 115200: buf[0] = 0x0b; break; + case 230400: buf[0] = 0x0c; break; + case 460800: buf[0] = 0x0d; break; + case 921600: buf[0] = 0x0e; break; +/* case 1200000: buf[0] = 0x0f; break; */ +/* case 2400000: buf[0] = 0x10; break; */ + case 3000000: buf[0] = 0x11; break; +/* case 6000000: buf[0] = 0x12; break; */ + case 0: + case 1000000: + buf[0] = 0x0b; break; + default: + err("spcp825 driver does not support the baudrate " + "requested, using default of 9600."); + } + + /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */ + if (cflag & CSIZE) { + switch (cflag & CSIZE) { + case CS5: + buf[1] |= SET_UART_FORMAT_SIZE_5; + break; + case CS6: + buf[1] |= SET_UART_FORMAT_SIZE_6; + break; + case CS7: + buf[1] |= SET_UART_FORMAT_SIZE_7; + break; + default: + case CS8: + buf[1] |= SET_UART_FORMAT_SIZE_8; + break; + } + } + + /* Set Stop bit2 : 0:1bit 1:2bit */ + buf[1] |= (cflag & CSTOPB) ? SET_UART_FORMAT_STOP_2 : + SET_UART_FORMAT_STOP_1; + + /* Set Parity bit3-4 01:Odd 11:Even */ + if (cflag & PARENB) { + buf[1] |= (cflag & PARODD) ? + SET_UART_FORMAT_PAR_ODD : SET_UART_FORMAT_PAR_EVEN ; + } else + buf[1] |= SET_UART_FORMAT_PAR_NONE; + + uartdata = buf[0] | buf[1]<<8; + + i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + SET_UART_FORMAT_TYPE, SET_UART_FORMAT, + uartdata, 0, NULL, 0, 100); + if (i < 0) + err("Set UART format %#x failed (error = %d)", uartdata, i); + dbg("0x21:0x40:0:0 %d\n", i); + + if (cflag & CRTSCTS) { + /* enable hardware flow control */ + spcp8x5_set_workMode(serial->dev, 0x000a, + SET_WORKING_MODE_U2C, priv->type); + } + return; +} + +/* open the serial port. do some usb system call. set termios and get the line + * status of the device. then submit the read urb */ +static int spcp8x5_open(struct usb_serial_port *port, struct file *filp) +{ + struct ktermios tmp_termios; + struct usb_serial *serial = port->serial; + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + int ret; + unsigned long flags; + u8 status = 0x30; + /* status 0x30 means DSR and CTS = 1 other CDC RI and delta = 0 */ + + dbg("%s - port %d", __func__, port->number); + + usb_clear_halt(serial->dev, port->write_urb->pipe); + usb_clear_halt(serial->dev, port->read_urb->pipe); + + ret = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + 0x09, 0x00, + 0x01, 0x00, NULL, 0x00, 100); + if (ret) + return ret; + + spin_lock_irqsave(&priv->lock, flags); + if (port->tty->termios->c_cflag & CBAUD) + priv->line_control = MCR_DTR | MCR_RTS; + else + priv->line_control = 0; + spin_unlock_irqrestore(&priv->lock, flags); + + spcp8x5_set_ctrlLine(serial->dev, priv->line_control , priv->type); + + /* Setup termios */ + if (port->tty) + spcp8x5_set_termios(port, &tmp_termios); + + spcp8x5_get_msr(serial->dev, &status, priv->type); + + /* may be we should update uart status here but now we did not do */ + spin_lock_irqsave(&priv->lock, flags); + priv->line_status = status & 0xf0 ; + spin_unlock_irqrestore(&priv->lock, flags); + + /* FIXME: need to assert RTS and DTR if CRTSCTS off */ + + dbg("%s - submitting read urb", __func__); + port->read_urb->dev = serial->dev; + ret = usb_submit_urb(port->read_urb, GFP_KERNEL); + if (ret) { + spcp8x5_close(port, NULL); + return -EPROTO; + } + return 0; +} + +/* bulk read call back function. check the status of the urb. if transfer + * failed return. then update the status and the tty send data to tty subsys. + * submit urb again. + */ +static void spcp8x5_read_bulk_callback(struct urb *urb) +{ + struct usb_serial_port *port = urb->context; + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + struct tty_struct *tty; + unsigned char *data = urb->transfer_buffer; + unsigned long flags; + int i; + int result; + u8 status = 0; + char tty_flag; + + dev_dbg(&port->dev, "start, urb->status = %d, " + "urb->actual_length = %d\n,", urb->status, urb->actual_length); + + /* check the urb status */ + if (urb->status) { + if (!port->open_count) + return; + if (urb->status == -EPROTO) { + /* spcp8x5 mysteriously fails with -EPROTO */ + /* reschedule the read */ + urb->status = 0; + urb->dev = port->serial->dev; + result = usb_submit_urb(urb , GFP_ATOMIC); + if (result) + dev_dbg(&port->dev, + "failed submitting read urb %d\n", + result); + return; + } + dev_dbg(&port->dev, "unable to handle the error, exiting.\n"); + return; + } + + /* get tty_flag from status */ + tty_flag = TTY_NORMAL; + + spin_lock_irqsave(&priv->lock, flags); + status = priv->line_status; + priv->line_status &= ~UART_STATE_TRANSIENT_MASK; + spin_unlock_irqrestore(&priv->lock, flags); + /* wake up the wait for termios */ + wake_up_interruptible(&priv->delta_msr_wait); + + /* break takes precedence over parity, which takes precedence over + * framing errors */ + if (status & UART_BREAK_ERROR) + tty_flag = TTY_BREAK; + else if (status & UART_PARITY_ERROR) + tty_flag = TTY_PARITY; + else if (status & UART_FRAME_ERROR) + tty_flag = TTY_FRAME; + dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag); + + tty = port->tty; + if (tty && urb->actual_length) { + tty_buffer_request_room(tty, urb->actual_length + 1); + /* overrun is special, not associated with a char */ + if (status & UART_OVERRUN_ERROR) + tty_insert_flip_char(tty, 0, TTY_OVERRUN); + for (i = 0; i < urb->actual_length; ++i) + tty_insert_flip_char(tty, data[i], tty_flag); + tty_flip_buffer_push(tty); + } + + /* Schedule the next read _if_ we are still open */ + if (port->open_count) { + urb->dev = port->serial->dev; + result = usb_submit_urb(urb , GFP_ATOMIC); + if (result) + dev_dbg(&port->dev, "failed submitting read urb %d\n", + result); + } + + return; +} + +/* get data from ring buffer and then write to usb bus */ +static void spcp8x5_send(struct usb_serial_port *port) +{ + int count, result; + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + + spin_lock_irqsave(&priv->lock, flags); + + if (priv->write_urb_in_use) { + dev_dbg(&port->dev, "write urb still used\n"); + spin_unlock_irqrestore(&priv->lock, flags); + return; + } + + /* send the 1st urb for writting */ + memset(port->write_urb->transfer_buffer , 0x00 , port->bulk_out_size); + count = get_ringbuf(priv->buf, port->write_urb->transfer_buffer, + port->bulk_out_size); + + if (count == 0) { + spin_unlock_irqrestore(&priv->lock, flags); + return; + } + + /* update the urb status */ + priv->write_urb_in_use = 1; + + spin_unlock_irqrestore(&priv->lock, flags); + + port->write_urb->transfer_buffer_length = count; + port->write_urb->dev = port->serial->dev; + + result = usb_submit_urb(port->write_urb, GFP_ATOMIC); + if (result) { + dev_dbg(&port->dev, "failed submitting write urb, error %d\n", + result); + priv->write_urb_in_use = 0; + /* TODO: reschedule spcp8x5_send */ + } + + + schedule_work(&port->work); +} + +/* this is the call back function for write urb. NOTE we should not sleep in + * this routine. check the urb return code and then submit the write urb again + * to hold the write loop */ +static void spcp8x5_write_bulk_callback(struct urb *urb) +{ + struct usb_serial_port *port = urb->context; + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + int result; + + switch (urb->status) { + case 0: + /* success */ + break; + case -ECONNRESET: + case -ENOENT: + case -ESHUTDOWN: + /* this urb is terminated, clean up */ + dev_dbg(&port->dev, "urb shutting down with status: %d\n", + urb->status); + priv->write_urb_in_use = 0; + return; + default: + /* error in the urb, so we have to resubmit it */ + dbg("%s - Overflow in write", __func__); + dbg("%s - nonzero write bulk status received: %d", + __func__, urb->status); + port->write_urb->transfer_buffer_length = 1; + port->write_urb->dev = port->serial->dev; + result = usb_submit_urb(port->write_urb, GFP_ATOMIC); + if (result) + dev_dbg(&port->dev, + "failed resubmitting write urb %d\n", result); + else + return; + } + + priv->write_urb_in_use = 0; + + /* send any buffered data */ + spcp8x5_send(port); +} + +/* write data to ring buffer. and then start the write transfer */ +static int spcp8x5_write(struct usb_serial_port *port, + const unsigned char *buf, int count) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + + dev_dbg(&port->dev, "%d bytes\n", count); + + if (!count) + return count; + + spin_lock_irqsave(&priv->lock, flags); + count = put_ringbuf(priv->buf, buf, count); + spin_unlock_irqrestore(&priv->lock, flags); + + spcp8x5_send(port); + + return count; +} + +static int spcp8x5_wait_modem_info(struct usb_serial_port *port, + unsigned int arg) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + unsigned int prevstatus; + unsigned int status; + unsigned int changed; + + spin_lock_irqsave(&priv->lock, flags); + prevstatus = priv->line_status; + spin_unlock_irqrestore(&priv->lock, flags); + + while (1) { + /* wake up in bulk read */ + interruptible_sleep_on(&priv->delta_msr_wait); + + /* see if a signal did it */ + if (signal_pending(current)) + return -ERESTARTSYS; + + spin_lock_irqsave(&priv->lock, flags); + status = priv->line_status; + spin_unlock_irqrestore(&priv->lock, flags); + + changed = prevstatus^status; + + if (((arg & TIOCM_RNG) && (changed & MSR_STATUS_LINE_RI)) || + ((arg & TIOCM_DSR) && (changed & MSR_STATUS_LINE_DSR)) || + ((arg & TIOCM_CD) && (changed & MSR_STATUS_LINE_DCD)) || + ((arg & TIOCM_CTS) && (changed & MSR_STATUS_LINE_CTS))) + return 0; + + prevstatus = status; + } + /* NOTREACHED */ + return 0; +} + +static int spcp8x5_ioctl(struct usb_serial_port *port, struct file *file, + unsigned int cmd, unsigned long arg) +{ + dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd); + + switch (cmd) { + case TIOCMIWAIT: + dbg("%s (%d) TIOCMIWAIT", __func__, port->number); + return spcp8x5_wait_modem_info(port, arg); + + default: + dbg("%s not supported = 0x%04x", __func__, cmd); + break; + } + + return -ENOIOCTLCMD; +} + +static int spcp8x5_tiocmset(struct usb_serial_port *port, struct file *file, + unsigned int set, unsigned int clear) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + u8 control; + + spin_lock_irqsave(&priv->lock, flags); + if (set & TIOCM_RTS) + priv->line_control |= MCR_RTS; + if (set & TIOCM_DTR) + priv->line_control |= MCR_DTR; + if (clear & TIOCM_RTS) + priv->line_control &= ~MCR_RTS; + if (clear & TIOCM_DTR) + priv->line_control &= ~MCR_DTR; + control = priv->line_control; + spin_unlock_irqrestore(&priv->lock, flags); + + return spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type); +} + +static int spcp8x5_tiocmget(struct usb_serial_port *port, struct file *file) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + unsigned long flags; + unsigned int mcr; + unsigned int status; + unsigned int result; + + spin_lock_irqsave(&priv->lock, flags); + mcr = priv->line_control; + status = priv->line_status; + spin_unlock_irqrestore(&priv->lock, flags); + + result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) + | ((mcr & MCR_RTS) ? TIOCM_RTS : 0) + | ((status & MSR_STATUS_LINE_CTS) ? TIOCM_CTS : 0) + | ((status & MSR_STATUS_LINE_DSR) ? TIOCM_DSR : 0) + | ((status & MSR_STATUS_LINE_RI) ? TIOCM_RI : 0) + | ((status & MSR_STATUS_LINE_DCD) ? TIOCM_CD : 0); + + return result; +} + +/* get the avail space room in ring buffer */ +static int spcp8x5_write_room(struct usb_serial_port *port) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + int room = 0; + unsigned long flags; + + spin_lock_irqsave(&priv->lock, flags); + room = ringbuf_avail_space(priv->buf); + spin_unlock_irqrestore(&priv->lock, flags); + + return room; +} + +/* get the number of avail data in write ring buffer */ +static int spcp8x5_chars_in_buffer(struct usb_serial_port *port) +{ + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + int chars = 0; + unsigned long flags; + + spin_lock_irqsave(&priv->lock, flags); + chars = ringbuf_avail_data(priv->buf); + spin_unlock_irqrestore(&priv->lock, flags); + + return chars; +} + +/* All of the device info needed for the spcp8x5 SIO serial converter */ +static struct usb_serial_driver spcp8x5_device = { + .driver = { + .owner = THIS_MODULE, + .name = "SPCP8x5", + }, + .id_table = id_table, + .num_interrupt_in = NUM_DONT_CARE, + .num_bulk_in = 1, + .num_bulk_out = 1, + .num_ports = 1, + .open = spcp8x5_open, + .close = spcp8x5_close, + .write = spcp8x5_write, + .set_termios = spcp8x5_set_termios, + .ioctl = spcp8x5_ioctl, + .tiocmget = spcp8x5_tiocmget, + .tiocmset = spcp8x5_tiocmset, + .write_room = spcp8x5_write_room, + .read_bulk_callback = spcp8x5_read_bulk_callback, + .write_bulk_callback = spcp8x5_write_bulk_callback, + .chars_in_buffer = spcp8x5_chars_in_buffer, + .attach = spcp8x5_startup, + .shutdown = spcp8x5_shutdown, +}; + +static int __init spcp8x5_init(void) +{ + int retval; + retval = usb_serial_register(&spcp8x5_device); + if (retval) + goto failed_usb_serial_register; + retval = usb_register(&spcp8x5_driver); + if (retval) + goto failed_usb_register; + info(DRIVER_DESC " " DRIVER_VERSION); + return 0; +failed_usb_register: + usb_serial_deregister(&spcp8x5_device); +failed_usb_serial_register: + return retval; +} + +static void __exit spcp8x5_exit(void) +{ + usb_deregister(&spcp8x5_driver); + usb_serial_deregister(&spcp8x5_device); +} + +module_init(spcp8x5_init); +module_exit(spcp8x5_exit); + +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_VERSION(DRIVER_VERSION); +MODULE_LICENSE("GPL"); + +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Debug enabled or not"); -- cgit v1.2.3 From b40f8d3980d3eef26b3bd77da5314728a5b30aea Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Sun, 23 Mar 2008 00:00:01 -0700 Subject: usb: u132-hcd driver style clean up I was converting a semaphore in this file to a mutex when I noticed that this file has some fairly rampant style problems. Practically every line has spaces instead of tabs .. Once I cleared that up, checkpatch.pl showed a number of other problem.. I think this file might be a good one to review for new style checks that could be added.. Below are the only two remaining which I didn't remove. #5083: FILE: drivers/usb/host/u132-hcd.c:2907: + error: WARNING: labels should not be indented #5087: FILE: drivers/usb/host/u132-hcd.c:2911: + stall: These labels are actually inside a switch statement, and they are right under "default:". "default:" appears to be exempt and these other label should be too, or default shouldn't be exempt. I also deleted a few lines due to single statements inside { } , if (is_error()) { return; } becomes, if (is_error()) return; with one line deleted. Signed-off-by: Daniel Walker Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/u132-hcd.c | 5132 +++++++++++++++++++++---------------------- 1 file changed, 2563 insertions(+), 2569 deletions(-) diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 6e9b7edff52..28b8684942d 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -67,7 +67,7 @@ #include "ohci.h" #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR #define OHCI_INTR_INIT (OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_RD | \ - OHCI_INTR_WDH) + OHCI_INTR_WDH) MODULE_AUTHOR("Tony Olech - Elan Digital Systems Limited"); MODULE_DESCRIPTION("U132 USB Host Controller Driver"); MODULE_LICENSE("GPL"); @@ -77,15 +77,15 @@ INT_MODULE_PARM(testing, 0); static int distrust_firmware = 1; module_param(distrust_firmware, bool, 0); MODULE_PARM_DESC(distrust_firmware, "true to distrust firmware power/overcurren" - "t setup"); + "t setup"); static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait); /* * u132_module_lock exists to protect access to global variables * */ static struct mutex u132_module_lock; -static int u132_exiting = 0; -static int u132_instances = 0; +static int u132_exiting; +static int u132_instances; static struct list_head u132_static_list; /* * end of the global variables protected by u132_module_lock @@ -97,115 +97,115 @@ static struct workqueue_struct *workqueue; #define MAX_U132_ENDPS 100 #define MAX_U132_RINGS 4 static const char *cc_to_text[16] = { - "No Error ", - "CRC Error ", - "Bit Stuff ", - "Data Togg ", - "Stall ", - "DevNotResp ", - "PIDCheck ", - "UnExpPID ", - "DataOver ", - "DataUnder ", - "(for hw) ", - "(for hw) ", - "BufferOver ", - "BuffUnder ", - "(for HCD) ", - "(for HCD) " + "No Error ", + "CRC Error ", + "Bit Stuff ", + "Data Togg ", + "Stall ", + "DevNotResp ", + "PIDCheck ", + "UnExpPID ", + "DataOver ", + "DataUnder ", + "(for hw) ", + "(for hw) ", + "BufferOver ", + "BuffUnder ", + "(for HCD) ", + "(for HCD) " }; struct u132_port { - struct u132 *u132; - int reset; - int enable; - int power; - int Status; + struct u132 *u132; + int reset; + int enable; + int power; + int Status; }; struct u132_addr { - u8 address; + u8 address; }; struct u132_udev { - struct kref kref; - struct usb_device *usb_device; - u8 enumeration; - u8 udev_number; - u8 usb_addr; - u8 portnumber; - u8 endp_number_in[16]; - u8 endp_number_out[16]; + struct kref kref; + struct usb_device *usb_device; + u8 enumeration; + u8 udev_number; + u8 usb_addr; + u8 portnumber; + u8 endp_number_in[16]; + u8 endp_number_out[16]; }; #define ENDP_QUEUE_SHIFT 3 #define ENDP_QUEUE_SIZE (1<platform_dev, offsetof(struct \ - ohci_regs, member), 0, data); + usb_ftdi_elan_read_pcimem(u132->platform_dev, offsetof(struct \ + ohci_regs, member), 0, data); #define u132_write_pcimem(u132, member, data) \ - usb_ftdi_elan_write_pcimem(u132->platform_dev, offsetof(struct \ - ohci_regs, member), 0, data); + usb_ftdi_elan_write_pcimem(u132->platform_dev, offsetof(struct \ + ohci_regs, member), 0, data); static inline struct u132 *udev_to_u132(struct u132_udev *udev) { - u8 udev_number = udev->udev_number; - return container_of(udev, struct u132, udev[udev_number]); + u8 udev_number = udev->udev_number; + return container_of(udev, struct u132, udev[udev_number]); } static inline struct u132 *hcd_to_u132(struct usb_hcd *hcd) { - return (struct u132 *)(hcd->hcd_priv); + return (struct u132 *)(hcd->hcd_priv); } static inline struct usb_hcd *u132_to_hcd(struct u132 *u132) { - return container_of((void *)u132, struct usb_hcd, hcd_priv); + return container_of((void *)u132, struct usb_hcd, hcd_priv); } static inline void u132_disable(struct u132 *u132) { - u132_to_hcd(u132)->state = HC_STATE_HALT; + u132_to_hcd(u132)->state = HC_STATE_HALT; } @@ -250,147 +250,147 @@ static inline void u132_disable(struct u132 *u132) #include "../misc/usb_u132.h" static const char hcd_name[] = "u132_hcd"; #define PORT_C_MASK ((USB_PORT_STAT_C_CONNECTION | USB_PORT_STAT_C_ENABLE | \ - USB_PORT_STAT_C_SUSPEND | USB_PORT_STAT_C_OVERCURRENT | \ - USB_PORT_STAT_C_RESET) << 16) + USB_PORT_STAT_C_SUSPEND | USB_PORT_STAT_C_OVERCURRENT | \ + USB_PORT_STAT_C_RESET) << 16) static void u132_hcd_delete(struct kref *kref) { - struct u132 *u132 = kref_to_u132(kref); - struct platform_device *pdev = u132->platform_dev; - struct usb_hcd *hcd = u132_to_hcd(u132); - u132->going += 1; - mutex_lock(&u132_module_lock); - list_del_init(&u132->u132_list); - u132_instances -= 1; - mutex_unlock(&u132_module_lock); - dev_warn(&u132->platform_dev->dev, "FREEING the hcd=%p and thus the u13" - "2=%p going=%d pdev=%p\n", hcd, u132, u132->going, pdev); - usb_put_hcd(hcd); + struct u132 *u132 = kref_to_u132(kref); + struct platform_device *pdev = u132->platform_dev; + struct usb_hcd *hcd = u132_to_hcd(u132); + u132->going += 1; + mutex_lock(&u132_module_lock); + list_del_init(&u132->u132_list); + u132_instances -= 1; + mutex_unlock(&u132_module_lock); + dev_warn(&u132->platform_dev->dev, "FREEING the hcd=%p and thus the u13" + "2=%p going=%d pdev=%p\n", hcd, u132, u132->going, pdev); + usb_put_hcd(hcd); } static inline void u132_u132_put_kref(struct u132 *u132) { - kref_put(&u132->kref, u132_hcd_delete); + kref_put(&u132->kref, u132_hcd_delete); } static inline void u132_u132_init_kref(struct u132 *u132) { - kref_init(&u132->kref); + kref_init(&u132->kref); } static void u132_udev_delete(struct kref *kref) { - struct u132_udev *udev = kref_to_u132_udev(kref); - udev->udev_number = 0; - udev->usb_device = NULL; - udev->usb_addr = 0; - udev->enumeration = 0; + struct u132_udev *udev = kref_to_u132_udev(kref); + udev->udev_number = 0; + udev->usb_device = NULL; + udev->usb_addr = 0; + udev->enumeration = 0; } static inline void u132_udev_put_kref(struct u132 *u132, struct u132_udev *udev) { - kref_put(&udev->kref, u132_udev_delete); + kref_put(&udev->kref, u132_udev_delete); } static inline void u132_udev_get_kref(struct u132 *u132, struct u132_udev *udev) { - kref_get(&udev->kref); + kref_get(&udev->kref); } static inline void u132_udev_init_kref(struct u132 *u132, - struct u132_udev *udev) + struct u132_udev *udev) { - kref_init(&udev->kref); + kref_init(&udev->kref); } static inline void u132_ring_put_kref(struct u132 *u132, struct u132_ring *ring) { - kref_put(&u132->kref, u132_hcd_delete); + kref_put(&u132->kref, u132_hcd_delete); } static void u132_ring_requeue_work(struct u132 *u132, struct u132_ring *ring, - unsigned int delta) + unsigned int delta) { - if (delta > 0) { - if (queue_delayed_work(workqueue, &ring->scheduler, delta)) - return; - } else if (queue_delayed_work(workqueue, &ring->scheduler, 0)) - return; - kref_put(&u132->kref, u132_hcd_delete); - return; + if (delta > 0) { + if (queue_delayed_work(workqueue, &ring->scheduler, delta)) + return; + } else if (queue_delayed_work(workqueue, &ring->scheduler, 0)) + return; + kref_put(&u132->kref, u132_hcd_delete); + return; } static void u132_ring_queue_work(struct u132 *u132, struct u132_ring *ring, - unsigned int delta) + unsigned int delta) { - kref_get(&u132->kref); - u132_ring_requeue_work(u132, ring, delta); - return; + kref_get(&u132->kref); + u132_ring_requeue_work(u132, ring, delta); + return; } static void u132_ring_cancel_work(struct u132 *u132, struct u132_ring *ring) { - if (cancel_delayed_work(&ring->scheduler)) { - kref_put(&u132->kref, u132_hcd_delete); - } + if (cancel_delayed_work(&ring->scheduler)) + kref_put(&u132->kref, u132_hcd_delete); } static void u132_endp_delete(struct kref *kref) { - struct u132_endp *endp = kref_to_u132_endp(kref); - struct u132 *u132 = endp->u132; - u8 usb_addr = endp->usb_addr; - u8 usb_endp = endp->usb_endp; - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - u8 endp_number = endp->endp_number; - struct usb_host_endpoint *hep = endp->hep; - struct u132_ring *ring = endp->ring; - struct list_head *head = &endp->endp_ring; - ring->length -= 1; - if (endp == ring->curr_endp) { - if (list_empty(head)) { - ring->curr_endp = NULL; - list_del(head); - } else { - struct u132_endp *next_endp = list_entry(head->next, - struct u132_endp, endp_ring); - ring->curr_endp = next_endp; - list_del(head); - }} else - list_del(head); - if (endp->input) { - udev->endp_number_in[usb_endp] = 0; - u132_udev_put_kref(u132, udev); - } - if (endp->output) { - udev->endp_number_out[usb_endp] = 0; - u132_udev_put_kref(u132, udev); - } - u132->endp[endp_number - 1] = NULL; - hep->hcpriv = NULL; - kfree(endp); - u132_u132_put_kref(u132); + struct u132_endp *endp = kref_to_u132_endp(kref); + struct u132 *u132 = endp->u132; + u8 usb_addr = endp->usb_addr; + u8 usb_endp = endp->usb_endp; + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + u8 endp_number = endp->endp_number; + struct usb_host_endpoint *hep = endp->hep; + struct u132_ring *ring = endp->ring; + struct list_head *head = &endp->endp_ring; + ring->length -= 1; + if (endp == ring->curr_endp) { + if (list_empty(head)) { + ring->curr_endp = NULL; + list_del(head); + } else { + struct u132_endp *next_endp = list_entry(head->next, + struct u132_endp, endp_ring); + ring->curr_endp = next_endp; + list_del(head); + } + } else + list_del(head); + if (endp->input) { + udev->endp_number_in[usb_endp] = 0; + u132_udev_put_kref(u132, udev); + } + if (endp->output) { + udev->endp_number_out[usb_endp] = 0; + u132_udev_put_kref(u132, udev); + } + u132->endp[endp_number - 1] = NULL; + hep->hcpriv = NULL; + kfree(endp); + u132_u132_put_kref(u132); } static inline void u132_endp_put_kref(struct u132 *u132, struct u132_endp *endp) { - kref_put(&endp->kref, u132_endp_delete); + kref_put(&endp->kref, u132_endp_delete); } static inline void u132_endp_get_kref(struct u132 *u132, struct u132_endp *endp) { - kref_get(&endp->kref); + kref_get(&endp->kref); } static inline void u132_endp_init_kref(struct u132 *u132, - struct u132_endp *endp) + struct u132_endp *endp) { - kref_init(&endp->kref); - kref_get(&u132->kref); + kref_init(&endp->kref); + kref_get(&u132->kref); } static void u132_endp_queue_work(struct u132 *u132, struct u132_endp *endp, - unsigned int delta) + unsigned int delta) { if (queue_delayed_work(workqueue, &endp->scheduler, delta)) kref_get(&endp->kref); @@ -398,13 +398,13 @@ static void u132_endp_queue_work(struct u132 *u132, struct u132_endp *endp, static void u132_endp_cancel_work(struct u132 *u132, struct u132_endp *endp) { - if (cancel_delayed_work(&endp->scheduler)) - kref_put(&endp->kref, u132_endp_delete); + if (cancel_delayed_work(&endp->scheduler)) + kref_put(&endp->kref, u132_endp_delete); } static inline void u132_monitor_put_kref(struct u132 *u132) { - kref_put(&u132->kref, u132_hcd_delete); + kref_put(&u132->kref, u132_hcd_delete); } static void u132_monitor_queue_work(struct u132 *u132, unsigned int delta) @@ -421,200 +421,201 @@ static void u132_monitor_requeue_work(struct u132 *u132, unsigned int delta) static void u132_monitor_cancel_work(struct u132 *u132) { - if (cancel_delayed_work(&u132->monitor)) - kref_put(&u132->kref, u132_hcd_delete); + if (cancel_delayed_work(&u132->monitor)) + kref_put(&u132->kref, u132_hcd_delete); } static int read_roothub_info(struct u132 *u132) { - u32 revision; - int retval; - retval = u132_read_pcimem(u132, revision, &revision); - if (retval) { - dev_err(&u132->platform_dev->dev, "error %d accessing device co" - "ntrol\n", retval); - return retval; - } else if ((revision & 0xFF) == 0x10) { - } else if ((revision & 0xFF) == 0x11) { - } else { - dev_err(&u132->platform_dev->dev, "device revision is not valid" - " %08X\n", revision); - return -ENODEV; - } - retval = u132_read_pcimem(u132, control, &u132->hc_control); - if (retval) { - dev_err(&u132->platform_dev->dev, "error %d accessing device co" - "ntrol\n", retval); - return retval; - } - retval = u132_read_pcimem(u132, roothub.status, - &u132->hc_roothub_status); - if (retval) { - dev_err(&u132->platform_dev->dev, "error %d accessing device re" - "g roothub.status\n", retval); - return retval; - } - retval = u132_read_pcimem(u132, roothub.a, &u132->hc_roothub_a); - if (retval) { - dev_err(&u132->platform_dev->dev, "error %d accessing device re" - "g roothub.a\n", retval); - return retval; - } - { - int I = u132->num_ports; - int i = 0; - while (I-- > 0) { - retval = u132_read_pcimem(u132, roothub.portstatus[i], - &u132->hc_roothub_portstatus[i]); - if (retval) { - dev_err(&u132->platform_dev->dev, "error %d acc" - "essing device roothub.portstatus[%d]\n" - , retval, i); - return retval; - } else - i += 1; - } - } - return 0; + u32 revision; + int retval; + retval = u132_read_pcimem(u132, revision, &revision); + if (retval) { + dev_err(&u132->platform_dev->dev, "error %d accessing device co" + "ntrol\n", retval); + return retval; + } else if ((revision & 0xFF) == 0x10) { + } else if ((revision & 0xFF) == 0x11) { + } else { + dev_err(&u132->platform_dev->dev, "device revision is not valid" + " %08X\n", revision); + return -ENODEV; + } + retval = u132_read_pcimem(u132, control, &u132->hc_control); + if (retval) { + dev_err(&u132->platform_dev->dev, "error %d accessing device co" + "ntrol\n", retval); + return retval; + } + retval = u132_read_pcimem(u132, roothub.status, + &u132->hc_roothub_status); + if (retval) { + dev_err(&u132->platform_dev->dev, "error %d accessing device re" + "g roothub.status\n", retval); + return retval; + } + retval = u132_read_pcimem(u132, roothub.a, &u132->hc_roothub_a); + if (retval) { + dev_err(&u132->platform_dev->dev, "error %d accessing device re" + "g roothub.a\n", retval); + return retval; + } + { + int I = u132->num_ports; + int i = 0; + while (I-- > 0) { + retval = u132_read_pcimem(u132, roothub.portstatus[i], + &u132->hc_roothub_portstatus[i]); + if (retval) { + dev_err(&u132->platform_dev->dev, "error %d acc" + "essing device roothub.portstatus[%d]\n" + , retval, i); + return retval; + } else + i += 1; + } + } + return 0; } static void u132_hcd_monitor_work(struct work_struct *work) { - struct u132 *u132 = container_of(work, struct u132, monitor.work); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - u132_monitor_put_kref(u132); - return; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - u132_monitor_put_kref(u132); - return; - } else { - int retval; - mutex_lock(&u132->sw_lock); - retval = read_roothub_info(u132); - if (retval) { - struct usb_hcd *hcd = u132_to_hcd(u132); - u132_disable(u132); - u132->going = 1; - mutex_unlock(&u132->sw_lock); - usb_hc_died(hcd); - ftdi_elan_gone_away(u132->platform_dev); - u132_monitor_put_kref(u132); - return; - } else { - u132_monitor_requeue_work(u132, 500); - mutex_unlock(&u132->sw_lock); - return; - } - } + struct u132 *u132 = container_of(work, struct u132, monitor.work); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + u132_monitor_put_kref(u132); + return; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + u132_monitor_put_kref(u132); + return; + } else { + int retval; + mutex_lock(&u132->sw_lock); + retval = read_roothub_info(u132); + if (retval) { + struct usb_hcd *hcd = u132_to_hcd(u132); + u132_disable(u132); + u132->going = 1; + mutex_unlock(&u132->sw_lock); + usb_hc_died(hcd); + ftdi_elan_gone_away(u132->platform_dev); + u132_monitor_put_kref(u132); + return; + } else { + u132_monitor_requeue_work(u132, 500); + mutex_unlock(&u132->sw_lock); + return; + } + } } static void u132_hcd_giveback_urb(struct u132 *u132, struct u132_endp *endp, - struct urb *urb, int status) + struct urb *urb, int status) { - struct u132_ring *ring; - unsigned long irqs; - struct usb_hcd *hcd = u132_to_hcd(u132); - urb->error_count = 0; - spin_lock_irqsave(&endp->queue_lock.slock, irqs); + struct u132_ring *ring; + unsigned long irqs; + struct usb_hcd *hcd = u132_to_hcd(u132); + urb->error_count = 0; + spin_lock_irqsave(&endp->queue_lock.slock, irqs); usb_hcd_unlink_urb_from_ep(hcd, urb); - endp->queue_next += 1; - if (ENDP_QUEUE_SIZE > --endp->queue_size) { - endp->active = 0; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - } else { - struct list_head *next = endp->urb_more.next; - struct u132_urbq *urbq = list_entry(next, struct u132_urbq, - urb_more); - list_del(next); - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = - urbq->urb; - endp->active = 0; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - kfree(urbq); - } down(&u132->scheduler_lock); - ring = endp->ring; - ring->in_use = 0; - u132_ring_cancel_work(u132, ring); - u132_ring_queue_work(u132, ring, 0); - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); + endp->queue_next += 1; + if (ENDP_QUEUE_SIZE > --endp->queue_size) { + endp->active = 0; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + } else { + struct list_head *next = endp->urb_more.next; + struct u132_urbq *urbq = list_entry(next, struct u132_urbq, + urb_more); + list_del(next); + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = + urbq->urb; + endp->active = 0; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + kfree(urbq); + } + down(&u132->scheduler_lock); + ring = endp->ring; + ring->in_use = 0; + u132_ring_cancel_work(u132, ring); + u132_ring_queue_work(u132, ring, 0); + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); usb_hcd_giveback_urb(hcd, urb, status); - return; + return; } static void u132_hcd_forget_urb(struct u132 *u132, struct u132_endp *endp, - struct urb *urb, int status) + struct urb *urb, int status) { - u132_endp_put_kref(u132, endp); + u132_endp_put_kref(u132, endp); } static void u132_hcd_abandon_urb(struct u132 *u132, struct u132_endp *endp, - struct urb *urb, int status) + struct urb *urb, int status) { - unsigned long irqs; - struct usb_hcd *hcd = u132_to_hcd(u132); - urb->error_count = 0; - spin_lock_irqsave(&endp->queue_lock.slock, irqs); + unsigned long irqs; + struct usb_hcd *hcd = u132_to_hcd(u132); + urb->error_count = 0; + spin_lock_irqsave(&endp->queue_lock.slock, irqs); usb_hcd_unlink_urb_from_ep(hcd, urb); - endp->queue_next += 1; - if (ENDP_QUEUE_SIZE > --endp->queue_size) { - endp->active = 0; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - } else { - struct list_head *next = endp->urb_more.next; - struct u132_urbq *urbq = list_entry(next, struct u132_urbq, - urb_more); - list_del(next); - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = - urbq->urb; - endp->active = 0; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - kfree(urbq); + endp->queue_next += 1; + if (ENDP_QUEUE_SIZE > --endp->queue_size) { + endp->active = 0; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + } else { + struct list_head *next = endp->urb_more.next; + struct u132_urbq *urbq = list_entry(next, struct u132_urbq, + urb_more); + list_del(next); + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = + urbq->urb; + endp->active = 0; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + kfree(urbq); } usb_hcd_giveback_urb(hcd, urb, status); - return; + return; } static inline int edset_input(struct u132 *u132, struct u132_ring *ring, - struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, - void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, - int toggle_bits, int error_count, int condition_code, int repeat_number, - int halted, int skipped, int actual, int non_null)) + struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, + void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, + int toggle_bits, int error_count, int condition_code, int repeat_number, + int halted, int skipped, int actual, int non_null)) { - return usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, - urb, address, endp->usb_endp, toggle_bits, callback); + return usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, + urb, address, endp->usb_endp, toggle_bits, callback); } static inline int edset_setup(struct u132 *u132, struct u132_ring *ring, - struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, - void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, - int toggle_bits, int error_count, int condition_code, int repeat_number, - int halted, int skipped, int actual, int non_null)) + struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, + void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, + int toggle_bits, int error_count, int condition_code, int repeat_number, + int halted, int skipped, int actual, int non_null)) { - return usb_ftdi_elan_edset_setup(u132->platform_dev, ring->number, endp, - urb, address, endp->usb_endp, toggle_bits, callback); + return usb_ftdi_elan_edset_setup(u132->platform_dev, ring->number, endp, + urb, address, endp->usb_endp, toggle_bits, callback); } static inline int edset_single(struct u132 *u132, struct u132_ring *ring, - struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, - void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, - int toggle_bits, int error_count, int condition_code, int repeat_number, - int halted, int skipped, int actual, int non_null)) + struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, + void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, + int toggle_bits, int error_count, int condition_code, int repeat_number, + int halted, int skipped, int actual, int non_null)) { - return usb_ftdi_elan_edset_single(u132->platform_dev, ring->number, - endp, urb, address, endp->usb_endp, toggle_bits, callback); + return usb_ftdi_elan_edset_single(u132->platform_dev, ring->number, + endp, urb, address, endp->usb_endp, toggle_bits, callback); } static inline int edset_output(struct u132 *u132, struct u132_ring *ring, - struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, - void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, - int toggle_bits, int error_count, int condition_code, int repeat_number, - int halted, int skipped, int actual, int non_null)) + struct u132_endp *endp, struct urb *urb, u8 address, u8 toggle_bits, + void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, + int toggle_bits, int error_count, int condition_code, int repeat_number, + int halted, int skipped, int actual, int non_null)) { - return usb_ftdi_elan_edset_output(u132->platform_dev, ring->number, - endp, urb, address, endp->usb_endp, toggle_bits, callback); + return usb_ftdi_elan_edset_output(u132->platform_dev, ring->number, + endp, urb, address, endp->usb_endp, toggle_bits, callback); } @@ -623,683 +624,678 @@ static inline int edset_output(struct u132 *u132, struct u132_ring *ring, * */ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - struct u132_ring *ring = endp->ring; - u8 *u = urb->transfer_buffer + urb->actual_length; - u8 *b = buf; - int L = len; - while (L-- > 0) { - *u++ = *b++; - } - urb->actual_length += len; - if ((condition_code == TD_CC_NOERROR) && - (urb->transfer_buffer_length > urb->actual_length)) { - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, - 1 & toggle_bits); - if (urb->actual_length > 0) { - int retval; - up(&u132->scheduler_lock); - retval = edset_single(u132, ring, endp, urb, - address, endp->toggle_bits, - u132_hcd_interrupt_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, - retval); - } else { - ring->in_use = 0; - endp->active = 0; - endp->jiffies = jiffies + - msecs_to_jiffies(urb->interval); - u132_ring_cancel_work(u132, ring); - u132_ring_queue_work(u132, ring, 0); - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - } - return; - } else if ((condition_code == TD_DATAUNDERRUN) && - ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0)) { - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, - 1 & toggle_bits); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else { - if (condition_code == TD_CC_NOERROR) { - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, - 0, 1 & toggle_bits); - } else if (condition_code == TD_CC_STALL) { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, endp->usb_endp, - 0, 0); - } else { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, endp->usb_endp, - 0, 0); - dev_err(&u132->platform_dev->dev, "urb=%p givin" - "g back INTERRUPT %s\n", urb, - cc_to_text[condition_code]); - } - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, - cc_to_error[condition_code]); - return; - } - } else { + struct u132_ring *ring = endp->ring; + u8 *u = urb->transfer_buffer + urb->actual_length; + u8 *b = buf; + int L = len; + + while (L-- > 0) + *u++ = *b++; + + urb->actual_length += len; + if ((condition_code == TD_CC_NOERROR) && + (urb->transfer_buffer_length > urb->actual_length)) { + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, + 1 & toggle_bits); + if (urb->actual_length > 0) { + int retval; + up(&u132->scheduler_lock); + retval = edset_single(u132, ring, endp, urb, + address, endp->toggle_bits, + u132_hcd_interrupt_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, + retval); + } else { + ring->in_use = 0; + endp->active = 0; + endp->jiffies = jiffies + + msecs_to_jiffies(urb->interval); + u132_ring_cancel_work(u132, ring); + u132_ring_queue_work(u132, ring, 0); + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + } + return; + } else if ((condition_code == TD_DATAUNDERRUN) && + ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0)) { + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, + 1 & toggle_bits); + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else { + if (condition_code == TD_CC_NOERROR) { + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, + 0, 1 & toggle_bits); + } else if (condition_code == TD_CC_STALL) { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, endp->usb_endp, + 0, 0); + } else { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, endp->usb_endp, + 0, 0); + dev_err(&u132->platform_dev->dev, "urb=%p givin" + "g back INTERRUPT %s\n", urb, + cc_to_text[condition_code]); + } + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, + cc_to_error[condition_code]); + return; + } + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - struct u132_ring *ring = endp->ring; - urb->actual_length += len; - endp->toggle_bits = toggle_bits; - if (urb->transfer_buffer_length > urb->actual_length) { - int retval; - up(&u132->scheduler_lock); - retval = edset_output(u132, ring, endp, urb, address, - endp->toggle_bits, u132_hcd_bulk_output_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else { - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } - } else { + struct u132_ring *ring = endp->ring; + urb->actual_length += len; + endp->toggle_bits = toggle_bits; + if (urb->transfer_buffer_length > urb->actual_length) { + int retval; + up(&u132->scheduler_lock); + retval = edset_output(u132, ring, endp, urb, address, + endp->toggle_bits, u132_hcd_bulk_output_sent); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else { + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - struct u132_ring *ring = endp->ring; - u8 *u = urb->transfer_buffer + urb->actual_length; - u8 *b = buf; - int L = len; - while (L-- > 0) { - *u++ = *b++; - } - urb->actual_length += len; - if ((condition_code == TD_CC_NOERROR) && - (urb->transfer_buffer_length > urb->actual_length)) { - int retval; - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, - 1 & toggle_bits); - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_input(u132->platform_dev, - ring->number, endp, urb, address, - endp->usb_endp, endp->toggle_bits, - u132_hcd_bulk_input_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else if (condition_code == TD_CC_NOERROR) { - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, - 1 & toggle_bits); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, - cc_to_error[condition_code]); - return; - } else if ((condition_code == TD_DATAUNDERRUN) && - ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0)) { - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, - 1 & toggle_bits); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else if (condition_code == TD_DATAUNDERRUN) { - endp->toggle_bits = toggle_bits; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, - 1 & toggle_bits); - dev_warn(&u132->platform_dev->dev, "urb=%p(SHORT NOT OK" - ") giving back BULK IN %s\n", urb, - cc_to_text[condition_code]); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else if (condition_code == TD_CC_STALL) { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, - cc_to_error[condition_code]); - return; - } else { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0); - dev_err(&u132->platform_dev->dev, "urb=%p giving back B" - "ULK IN code=%d %s\n", urb, condition_code, - cc_to_text[condition_code]); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, - cc_to_error[condition_code]); - return; - } - } else { + struct u132_ring *ring = endp->ring; + u8 *u = urb->transfer_buffer + urb->actual_length; + u8 *b = buf; + int L = len; + + while (L-- > 0) + *u++ = *b++; + + urb->actual_length += len; + if ((condition_code == TD_CC_NOERROR) && + (urb->transfer_buffer_length > urb->actual_length)) { + int retval; + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, + 1 & toggle_bits); + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_input(u132->platform_dev, + ring->number, endp, urb, address, + endp->usb_endp, endp->toggle_bits, + u132_hcd_bulk_input_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else if (condition_code == TD_CC_NOERROR) { + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, + 1 & toggle_bits); + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, + cc_to_error[condition_code]); + return; + } else if ((condition_code == TD_DATAUNDERRUN) && + ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0)) { + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, + 1 & toggle_bits); + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else if (condition_code == TD_DATAUNDERRUN) { + endp->toggle_bits = toggle_bits; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, + 1 & toggle_bits); + dev_warn(&u132->platform_dev->dev, "urb=%p(SHORT NOT OK" + ") giving back BULK IN %s\n", urb, + cc_to_text[condition_code]); + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else if (condition_code == TD_CC_STALL) { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0); + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, + cc_to_error[condition_code]); + return; + } else { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0); + dev_err(&u132->platform_dev->dev, "urb=%p giving back B" + "ULK IN code=%d %s\n", urb, condition_code, + cc_to_text[condition_code]); + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, + cc_to_error[condition_code]); + return; + } + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_configure_empty_sent(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else { + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - struct u132_ring *ring = endp->ring; - u8 *u = urb->transfer_buffer; - u8 *b = buf; - int L = len; - while (L-- > 0) { - *u++ = *b++; - } - urb->actual_length = len; - if ((condition_code == TD_CC_NOERROR) || ((condition_code == - TD_DATAUNDERRUN) && ((urb->transfer_flags & - URB_SHORT_NOT_OK) == 0))) { - int retval; - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_empty(u132->platform_dev, - ring->number, endp, urb, address, - endp->usb_endp, 0x3, - u132_hcd_configure_empty_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else if (condition_code == TD_CC_STALL) { - up(&u132->scheduler_lock); - dev_warn(&u132->platform_dev->dev, "giving back SETUP I" - "NPUT STALL urb %p\n", urb); - u132_hcd_giveback_urb(u132, endp, urb, - cc_to_error[condition_code]); - return; - } else { - up(&u132->scheduler_lock); - dev_err(&u132->platform_dev->dev, "giving back SETUP IN" - "PUT %s urb %p\n", cc_to_text[condition_code], - urb); - u132_hcd_giveback_urb(u132, endp, urb, - cc_to_error[condition_code]); - return; - } - } else { + struct u132_ring *ring = endp->ring; + u8 *u = urb->transfer_buffer; + u8 *b = buf; + int L = len; + + while (L-- > 0) + *u++ = *b++; + + urb->actual_length = len; + if ((condition_code == TD_CC_NOERROR) || ((condition_code == + TD_DATAUNDERRUN) && ((urb->transfer_flags & + URB_SHORT_NOT_OK) == 0))) { + int retval; + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_empty(u132->platform_dev, + ring->number, endp, urb, address, + endp->usb_endp, 0x3, + u132_hcd_configure_empty_sent); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else if (condition_code == TD_CC_STALL) { + up(&u132->scheduler_lock); + dev_warn(&u132->platform_dev->dev, "giving back SETUP I" + "NPUT STALL urb %p\n", urb); + u132_hcd_giveback_urb(u132, endp, urb, + cc_to_error[condition_code]); + return; + } else { + up(&u132->scheduler_lock); + dev_err(&u132->platform_dev->dev, "giving back SETUP IN" + "PUT %s urb %p\n", cc_to_text[condition_code], + urb); + u132_hcd_giveback_urb(u132, endp, urb, + cc_to_error[condition_code]); + return; + } + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_configure_empty_recv(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else { + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - if (usb_pipein(urb->pipe)) { - int retval; - struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_input(u132->platform_dev, - ring->number, endp, urb, address, - endp->usb_endp, 0, - u132_hcd_configure_input_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else { - int retval; - struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_input(u132->platform_dev, - ring->number, endp, urb, address, - endp->usb_endp, 0, - u132_hcd_configure_empty_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } - } else { + if (usb_pipein(urb->pipe)) { + int retval; + struct u132_ring *ring = endp->ring; + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_input(u132->platform_dev, + ring->number, endp, urb, address, + endp->usb_endp, 0, + u132_hcd_configure_input_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else { + int retval; + struct u132_ring *ring = endp->ring; + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_input(u132->platform_dev, + ring->number, endp, urb, address, + endp->usb_endp, 0, + u132_hcd_configure_empty_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_enumeration_empty_recv(void *data, struct urb *urb, - u8 *buf, int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + u8 *buf, int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - u132->addr[0].address = 0; - endp->usb_addr = udev->usb_addr; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else { + u132->addr[0].address = 0; + endp->usb_addr = udev->usb_addr; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb, - u8 *buf, int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + u8 *buf, int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - int retval; - struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_input(u132->platform_dev, - ring->number, endp, urb, 0, endp->usb_endp, 0, - u132_hcd_enumeration_empty_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else { + int retval; + struct u132_ring *ring = endp->ring; + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_input(u132->platform_dev, + ring->number, endp, urb, 0, endp->usb_endp, 0, + u132_hcd_enumeration_empty_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_initial_empty_sent(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } else { + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, 0); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - int retval; - struct u132_ring *ring = endp->ring; - u8 *u = urb->transfer_buffer; - u8 *b = buf; - int L = len; - while (L-- > 0) { - *u++ = *b++; - } - urb->actual_length = len; - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_empty(u132->platform_dev, - ring->number, endp, urb, address, endp->usb_endp, 0x3, - u132_hcd_initial_empty_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else { + int retval; + struct u132_ring *ring = endp->ring; + u8 *u = urb->transfer_buffer; + u8 *b = buf; + int L = len; + + while (L-- > 0) + *u++ = *b++; + + urb->actual_length = len; + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_empty(u132->platform_dev, + ring->number, endp, urb, address, endp->usb_endp, 0x3, + u132_hcd_initial_empty_sent); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf, - int len, int toggle_bits, int error_count, int condition_code, - int repeat_number, int halted, int skipped, int actual, int non_null) -{ - struct u132_endp *endp = data; - struct u132 *u132 = endp->u132; - u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - up(&u132->scheduler_lock); - u132_hcd_forget_urb(u132, endp, urb, -ENODEV); - return; - } else if (endp->dequeueing) { - endp->dequeueing = 0; - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -EINTR); - return; - } else if (u132->going > 0) { + int len, int toggle_bits, int error_count, int condition_code, + int repeat_number, int halted, int skipped, int actual, int non_null) +{ + struct u132_endp *endp = data; + struct u132 *u132 = endp->u132; + u8 address = u132->addr[endp->usb_addr].address; + down(&u132->scheduler_lock); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + up(&u132->scheduler_lock); + u132_hcd_forget_urb(u132, endp, urb, -ENODEV); + return; + } else if (endp->dequeueing) { + endp->dequeueing = 0; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -EINTR); + return; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); - return; + up(&u132->scheduler_lock); + u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); + return; } else if (!urb->unlinked) { - int retval; - struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); - retval = usb_ftdi_elan_edset_input(u132->platform_dev, - ring->number, endp, urb, address, endp->usb_endp, 0, - u132_hcd_initial_input_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else { + int retval; + struct u132_ring *ring = endp->ring; + up(&u132->scheduler_lock); + retval = usb_ftdi_elan_edset_input(u132->platform_dev, + ring->number, endp, urb, address, endp->usb_endp, 0, + u132_hcd_initial_input_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); - return; - } + return; + } } /* @@ -1308,300 +1304,296 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf, */ static void u132_hcd_ring_work_scheduler(struct work_struct *work) { - struct u132_ring *ring = + struct u132_ring *ring = container_of(work, struct u132_ring, scheduler.work); - struct u132 *u132 = ring->u132; - down(&u132->scheduler_lock); - if (ring->in_use) { - up(&u132->scheduler_lock); - u132_ring_put_kref(u132, ring); - return; - } else if (ring->curr_endp) { - struct u132_endp *last_endp = ring->curr_endp; - struct list_head *scan; - struct list_head *head = &last_endp->endp_ring; - unsigned long wakeup = 0; - list_for_each(scan, head) { - struct u132_endp *endp = list_entry(scan, - struct u132_endp, endp_ring); - if (endp->queue_next == endp->queue_last) { - } else if ((endp->delayed == 0) - || time_after_eq(jiffies, endp->jiffies)) { - ring->curr_endp = endp; - u132_endp_cancel_work(u132, last_endp); - u132_endp_queue_work(u132, last_endp, 0); - up(&u132->scheduler_lock); - u132_ring_put_kref(u132, ring); - return; - } else { - unsigned long delta = endp->jiffies - jiffies; - if (delta > wakeup) - wakeup = delta; - } - } - if (last_endp->queue_next == last_endp->queue_last) { - } else if ((last_endp->delayed == 0) || time_after_eq(jiffies, - last_endp->jiffies)) { - u132_endp_cancel_work(u132, last_endp); - u132_endp_queue_work(u132, last_endp, 0); - up(&u132->scheduler_lock); - u132_ring_put_kref(u132, ring); - return; - } else { - unsigned long delta = last_endp->jiffies - jiffies; - if (delta > wakeup) - wakeup = delta; - } - if (wakeup > 0) { - u132_ring_requeue_work(u132, ring, wakeup); - up(&u132->scheduler_lock); - return; - } else { - up(&u132->scheduler_lock); - u132_ring_put_kref(u132, ring); - return; - } - } else { - up(&u132->scheduler_lock); - u132_ring_put_kref(u132, ring); - return; - } + struct u132 *u132 = ring->u132; + down(&u132->scheduler_lock); + if (ring->in_use) { + up(&u132->scheduler_lock); + u132_ring_put_kref(u132, ring); + return; + } else if (ring->curr_endp) { + struct u132_endp *last_endp = ring->curr_endp; + struct list_head *scan; + struct list_head *head = &last_endp->endp_ring; + unsigned long wakeup = 0; + list_for_each(scan, head) { + struct u132_endp *endp = list_entry(scan, + struct u132_endp, endp_ring); + if (endp->queue_next == endp->queue_last) { + } else if ((endp->delayed == 0) + || time_after_eq(jiffies, endp->jiffies)) { + ring->curr_endp = endp; + u132_endp_cancel_work(u132, last_endp); + u132_endp_queue_work(u132, last_endp, 0); + up(&u132->scheduler_lock); + u132_ring_put_kref(u132, ring); + return; + } else { + unsigned long delta = endp->jiffies - jiffies; + if (delta > wakeup) + wakeup = delta; + } + } + if (last_endp->queue_next == last_endp->queue_last) { + } else if ((last_endp->delayed == 0) || time_after_eq(jiffies, + last_endp->jiffies)) { + u132_endp_cancel_work(u132, last_endp); + u132_endp_queue_work(u132, last_endp, 0); + up(&u132->scheduler_lock); + u132_ring_put_kref(u132, ring); + return; + } else { + unsigned long delta = last_endp->jiffies - jiffies; + if (delta > wakeup) + wakeup = delta; + } + if (wakeup > 0) { + u132_ring_requeue_work(u132, ring, wakeup); + up(&u132->scheduler_lock); + return; + } else { + up(&u132->scheduler_lock); + u132_ring_put_kref(u132, ring); + return; + } + } else { + up(&u132->scheduler_lock); + u132_ring_put_kref(u132, ring); + return; + } } static void u132_hcd_endp_work_scheduler(struct work_struct *work) { - struct u132_ring *ring; - struct u132_endp *endp = + struct u132_ring *ring; + struct u132_endp *endp = container_of(work, struct u132_endp, scheduler.work); - struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); - ring = endp->ring; - if (endp->edset_flush) { - endp->edset_flush = 0; - if (endp->dequeueing) - usb_ftdi_elan_edset_flush(u132->platform_dev, - ring->number, endp); - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else if (endp->active) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else if (ring->in_use) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else if (endp->queue_next == endp->queue_last) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else if (endp->pipetype == PIPE_INTERRUPT) { - u8 address = u132->addr[endp->usb_addr].address; - if (ring->in_use) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else { - int retval; - struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & - endp->queue_next]; - endp->active = 1; - ring->curr_endp = endp; - ring->in_use = 1; - up(&u132->scheduler_lock); - retval = edset_single(u132, ring, endp, urb, address, - endp->toggle_bits, u132_hcd_interrupt_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } - } else if (endp->pipetype == PIPE_CONTROL) { - u8 address = u132->addr[endp->usb_addr].address; - if (ring->in_use) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else if (address == 0) { - int retval; - struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & - endp->queue_next]; - endp->active = 1; - ring->curr_endp = endp; - ring->in_use = 1; - up(&u132->scheduler_lock); - retval = edset_setup(u132, ring, endp, urb, address, - 0x2, u132_hcd_initial_setup_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else if (endp->usb_addr == 0) { - int retval; - struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & - endp->queue_next]; - endp->active = 1; - ring->curr_endp = endp; - ring->in_use = 1; - up(&u132->scheduler_lock); - retval = edset_setup(u132, ring, endp, urb, 0, 0x2, - u132_hcd_enumeration_address_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } else { - int retval; - u8 address = u132->addr[endp->usb_addr].address; - struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & - endp->queue_next]; - endp->active = 1; - ring->curr_endp = endp; - ring->in_use = 1; - up(&u132->scheduler_lock); - retval = edset_setup(u132, ring, endp, urb, address, - 0x2, u132_hcd_configure_setup_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, retval); - return; - } - } else { - if (endp->input) { - u8 address = u132->addr[endp->usb_addr].address; - if (ring->in_use) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else { - int retval; - struct urb *urb = endp->urb_list[ - ENDP_QUEUE_MASK & endp->queue_next]; - endp->active = 1; - ring->curr_endp = endp; - ring->in_use = 1; - up(&u132->scheduler_lock); - retval = edset_input(u132, ring, endp, urb, - address, endp->toggle_bits, - u132_hcd_bulk_input_recv); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, - retval); - return; - } - } else { /* output pipe */ - u8 address = u132->addr[endp->usb_addr].address; - if (ring->in_use) { - up(&u132->scheduler_lock); - u132_endp_put_kref(u132, endp); - return; - } else { - int retval; - struct urb *urb = endp->urb_list[ - ENDP_QUEUE_MASK & endp->queue_next]; - endp->active = 1; - ring->curr_endp = endp; - ring->in_use = 1; - up(&u132->scheduler_lock); - retval = edset_output(u132, ring, endp, urb, - address, endp->toggle_bits, - u132_hcd_bulk_output_sent); - if (retval == 0) { - } else - u132_hcd_giveback_urb(u132, endp, urb, - retval); - return; - } - } - } + struct u132 *u132 = endp->u132; + down(&u132->scheduler_lock); + ring = endp->ring; + if (endp->edset_flush) { + endp->edset_flush = 0; + if (endp->dequeueing) + usb_ftdi_elan_edset_flush(u132->platform_dev, + ring->number, endp); + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else if (endp->active) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else if (ring->in_use) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else if (endp->queue_next == endp->queue_last) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else if (endp->pipetype == PIPE_INTERRUPT) { + u8 address = u132->addr[endp->usb_addr].address; + if (ring->in_use) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else { + int retval; + struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & + endp->queue_next]; + endp->active = 1; + ring->curr_endp = endp; + ring->in_use = 1; + up(&u132->scheduler_lock); + retval = edset_single(u132, ring, endp, urb, address, + endp->toggle_bits, u132_hcd_interrupt_recv); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } + } else if (endp->pipetype == PIPE_CONTROL) { + u8 address = u132->addr[endp->usb_addr].address; + if (ring->in_use) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else if (address == 0) { + int retval; + struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & + endp->queue_next]; + endp->active = 1; + ring->curr_endp = endp; + ring->in_use = 1; + up(&u132->scheduler_lock); + retval = edset_setup(u132, ring, endp, urb, address, + 0x2, u132_hcd_initial_setup_sent); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else if (endp->usb_addr == 0) { + int retval; + struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & + endp->queue_next]; + endp->active = 1; + ring->curr_endp = endp; + ring->in_use = 1; + up(&u132->scheduler_lock); + retval = edset_setup(u132, ring, endp, urb, 0, 0x2, + u132_hcd_enumeration_address_sent); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } else { + int retval; + u8 address = u132->addr[endp->usb_addr].address; + struct urb *urb = endp->urb_list[ENDP_QUEUE_MASK & + endp->queue_next]; + endp->active = 1; + ring->curr_endp = endp; + ring->in_use = 1; + up(&u132->scheduler_lock); + retval = edset_setup(u132, ring, endp, urb, address, + 0x2, u132_hcd_configure_setup_sent); + if (retval != 0) + u132_hcd_giveback_urb(u132, endp, urb, retval); + return; + } + } else { + if (endp->input) { + u8 address = u132->addr[endp->usb_addr].address; + if (ring->in_use) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else { + int retval; + struct urb *urb = endp->urb_list[ + ENDP_QUEUE_MASK & endp->queue_next]; + endp->active = 1; + ring->curr_endp = endp; + ring->in_use = 1; + up(&u132->scheduler_lock); + retval = edset_input(u132, ring, endp, urb, + address, endp->toggle_bits, + u132_hcd_bulk_input_recv); + if (retval == 0) { + } else + u132_hcd_giveback_urb(u132, endp, urb, + retval); + return; + } + } else { /* output pipe */ + u8 address = u132->addr[endp->usb_addr].address; + if (ring->in_use) { + up(&u132->scheduler_lock); + u132_endp_put_kref(u132, endp); + return; + } else { + int retval; + struct urb *urb = endp->urb_list[ + ENDP_QUEUE_MASK & endp->queue_next]; + endp->active = 1; + ring->curr_endp = endp; + ring->in_use = 1; + up(&u132->scheduler_lock); + retval = edset_output(u132, ring, endp, urb, + address, endp->toggle_bits, + u132_hcd_bulk_output_sent); + if (retval == 0) { + } else + u132_hcd_giveback_urb(u132, endp, urb, + retval); + return; + } + } + } } #ifdef CONFIG_PM static void port_power(struct u132 *u132, int pn, int is_on) { - u132->port[pn].power = is_on; + u132->port[pn].power = is_on; } #endif static void u132_power(struct u132 *u132, int is_on) { - struct usb_hcd *hcd = u132_to_hcd(u132) - ; /* hub is inactive unless the port is powered */ - if (is_on) { - if (u132->power) - return; - u132->power = 1; - } else { - u132->power = 0; - hcd->state = HC_STATE_HALT; - } + struct usb_hcd *hcd = u132_to_hcd(u132) + ; /* hub is inactive unless the port is powered */ + if (is_on) { + if (u132->power) + return; + u132->power = 1; + } else { + u132->power = 0; + hcd->state = HC_STATE_HALT; + } } static int u132_periodic_reinit(struct u132 *u132) { - int retval; - u32 fi = u132->hc_fminterval & 0x03fff; - u32 fit; - u32 fminterval; - retval = u132_read_pcimem(u132, fminterval, &fminterval); - if (retval) - return retval; - fit = fminterval & FIT; - retval = u132_write_pcimem(u132, fminterval, - (fit ^ FIT) | u132->hc_fminterval); - if (retval) - return retval; - retval = u132_write_pcimem(u132, periodicstart, - ((9 *fi) / 10) & 0x3fff); - if (retval) - return retval; - return 0; + int retval; + u32 fi = u132->hc_fminterval & 0x03fff; + u32 fit; + u32 fminterval; + retval = u132_read_pcimem(u132, fminterval, &fminterval); + if (retval) + return retval; + fit = fminterval & FIT; + retval = u132_write_pcimem(u132, fminterval, + (fit ^ FIT) | u132->hc_fminterval); + if (retval) + return retval; + retval = u132_write_pcimem(u132, periodicstart, + ((9 * fi) / 10) & 0x3fff); + if (retval) + return retval; + return 0; } static char *hcfs2string(int state) { - switch (state) { - case OHCI_USB_RESET: - return "reset"; - case OHCI_USB_RESUME: - return "resume"; - case OHCI_USB_OPER: - return "operational"; - case OHCI_USB_SUSPEND: - return "suspend"; - } - return "?"; + switch (state) { + case OHCI_USB_RESET: + return "reset"; + case OHCI_USB_RESUME: + return "resume"; + case OHCI_USB_OPER: + return "operational"; + case OHCI_USB_SUSPEND: + return "suspend"; + } + return "?"; } static int u132_init(struct u132 *u132) { - int retval; - u32 control; - u132_disable(u132); - u132->next_statechange = jiffies; - retval = u132_write_pcimem(u132, intrdisable, OHCI_INTR_MIE); - if (retval) - return retval; - retval = u132_read_pcimem(u132, control, &control); - if (retval) - return retval; - if (u132->num_ports == 0) { - u32 rh_a = -1; - retval = u132_read_pcimem(u132, roothub.a, &rh_a); - if (retval) - return retval; - u132->num_ports = rh_a & RH_A_NDP; - retval = read_roothub_info(u132); - if (retval) - return retval; - } - if (u132->num_ports > MAX_U132_PORTS) { - return -EINVAL; - } - return 0; + int retval; + u32 control; + u132_disable(u132); + u132->next_statechange = jiffies; + retval = u132_write_pcimem(u132, intrdisable, OHCI_INTR_MIE); + if (retval) + return retval; + retval = u132_read_pcimem(u132, control, &control); + if (retval) + return retval; + if (u132->num_ports == 0) { + u32 rh_a = -1; + retval = u132_read_pcimem(u132, roothub.a, &rh_a); + if (retval) + return retval; + u132->num_ports = rh_a & RH_A_NDP; + retval = read_roothub_info(u132); + if (retval) + return retval; + } + if (u132->num_ports > MAX_U132_PORTS) + return -EINVAL; + + return 0; } @@ -1611,280 +1603,278 @@ static int u132_init(struct u132 *u132) */ static int u132_run(struct u132 *u132) { - int retval; - u32 control; - u32 status; - u32 fminterval; - u32 periodicstart; - u32 cmdstatus; - u32 roothub_a; - int mask = OHCI_INTR_INIT; - int first = u132->hc_fminterval == 0; - int sleep_time = 0; - int reset_timeout = 30; /* ... allow extra time */ - u132_disable(u132); - if (first) { - u32 temp; - retval = u132_read_pcimem(u132, fminterval, &temp); - if (retval) - return retval; - u132->hc_fminterval = temp & 0x3fff; - if (u132->hc_fminterval != FI) { - } - u132->hc_fminterval |= FSMP(u132->hc_fminterval) << 16; - } - retval = u132_read_pcimem(u132, control, &u132->hc_control); - if (retval) - return retval; - dev_info(&u132->platform_dev->dev, "resetting from state '%s', control " - "= %08X\n", hcfs2string(u132->hc_control & OHCI_CTRL_HCFS), - u132->hc_control); - switch (u132->hc_control & OHCI_CTRL_HCFS) { - case OHCI_USB_OPER: - sleep_time = 0; - break; - case OHCI_USB_SUSPEND: - case OHCI_USB_RESUME: - u132->hc_control &= OHCI_CTRL_RWC; - u132->hc_control |= OHCI_USB_RESUME; - sleep_time = 10; - break; - default: - u132->hc_control &= OHCI_CTRL_RWC; - u132->hc_control |= OHCI_USB_RESET; - sleep_time = 50; - break; - } - retval = u132_write_pcimem(u132, control, u132->hc_control); - if (retval) - return retval; - retval = u132_read_pcimem(u132, control, &control); - if (retval) - return retval; - msleep(sleep_time); - retval = u132_read_pcimem(u132, roothub.a, &roothub_a); - if (retval) - return retval; - if (!(roothub_a & RH_A_NPS)) { - int temp; /* power down each port */ - for (temp = 0; temp < u132->num_ports; temp++) { - retval = u132_write_pcimem(u132, - roothub.portstatus[temp], RH_PS_LSDA); - if (retval) - return retval; - } - } - retval = u132_read_pcimem(u132, control, &control); - if (retval) - return retval; - retry:retval = u132_read_pcimem(u132, cmdstatus, &status); - if (retval) - return retval; - retval = u132_write_pcimem(u132, cmdstatus, OHCI_HCR); - if (retval) - return retval; - extra:{ - retval = u132_read_pcimem(u132, cmdstatus, &status); - if (retval) - return retval; - if (0 != (status & OHCI_HCR)) { - if (--reset_timeout == 0) { - dev_err(&u132->platform_dev->dev, "USB HC reset" - " timed out!\n"); - return -ENODEV; - } else { - msleep(5); - goto extra; - } - } - } - if (u132->flags & OHCI_QUIRK_INITRESET) { - retval = u132_write_pcimem(u132, control, u132->hc_control); - if (retval) - return retval; - retval = u132_read_pcimem(u132, control, &control); - if (retval) - return retval; - } - retval = u132_write_pcimem(u132, ed_controlhead, 0x00000000); - if (retval) - return retval; - retval = u132_write_pcimem(u132, ed_bulkhead, 0x11000000); - if (retval) - return retval; - retval = u132_write_pcimem(u132, hcca, 0x00000000); - if (retval) - return retval; - retval = u132_periodic_reinit(u132); - if (retval) - return retval; - retval = u132_read_pcimem(u132, fminterval, &fminterval); - if (retval) - return retval; - retval = u132_read_pcimem(u132, periodicstart, &periodicstart); - if (retval) - return retval; - if (0 == (fminterval & 0x3fff0000) || 0 == periodicstart) { - if (!(u132->flags & OHCI_QUIRK_INITRESET)) { - u132->flags |= OHCI_QUIRK_INITRESET; - goto retry; - } else - dev_err(&u132->platform_dev->dev, "init err(%08x %04x)" - "\n", fminterval, periodicstart); - } /* start controller operations */ - u132->hc_control &= OHCI_CTRL_RWC; - u132->hc_control |= OHCI_CONTROL_INIT | OHCI_CTRL_BLE | OHCI_USB_OPER; - retval = u132_write_pcimem(u132, control, u132->hc_control); - if (retval) - return retval; - retval = u132_write_pcimem(u132, cmdstatus, OHCI_BLF); - if (retval) - return retval; - retval = u132_read_pcimem(u132, cmdstatus, &cmdstatus); - if (retval) - return retval; - retval = u132_read_pcimem(u132, control, &control); - if (retval) - return retval; - u132_to_hcd(u132)->state = HC_STATE_RUNNING; - retval = u132_write_pcimem(u132, roothub.status, RH_HS_DRWE); - if (retval) - return retval; - retval = u132_write_pcimem(u132, intrstatus, mask); - if (retval) - return retval; - retval = u132_write_pcimem(u132, intrdisable, - OHCI_INTR_MIE | OHCI_INTR_OC | OHCI_INTR_RHSC | OHCI_INTR_FNO | - OHCI_INTR_UE | OHCI_INTR_RD | OHCI_INTR_SF | OHCI_INTR_WDH | - OHCI_INTR_SO); - if (retval) - return retval; /* handle root hub init quirks ... */ - retval = u132_read_pcimem(u132, roothub.a, &roothub_a); - if (retval) - return retval; - roothub_a &= ~(RH_A_PSM | RH_A_OCPM); - if (u132->flags & OHCI_QUIRK_SUPERIO) { - roothub_a |= RH_A_NOCP; - roothub_a &= ~(RH_A_POTPGT | RH_A_NPS); - retval = u132_write_pcimem(u132, roothub.a, roothub_a); - if (retval) - return retval; - } else if ((u132->flags & OHCI_QUIRK_AMD756) || distrust_firmware) { - roothub_a |= RH_A_NPS; - retval = u132_write_pcimem(u132, roothub.a, roothub_a); - if (retval) - return retval; - } - retval = u132_write_pcimem(u132, roothub.status, RH_HS_LPSC); - if (retval) - return retval; - retval = u132_write_pcimem(u132, roothub.b, - (roothub_a & RH_A_NPS) ? 0 : RH_B_PPCM); - if (retval) - return retval; - retval = u132_read_pcimem(u132, control, &control); - if (retval) - return retval; - mdelay((roothub_a >> 23) & 0x1fe); - u132_to_hcd(u132)->state = HC_STATE_RUNNING; - return 0; + int retval; + u32 control; + u32 status; + u32 fminterval; + u32 periodicstart; + u32 cmdstatus; + u32 roothub_a; + int mask = OHCI_INTR_INIT; + int first = u132->hc_fminterval == 0; + int sleep_time = 0; + int reset_timeout = 30; /* ... allow extra time */ + u132_disable(u132); + if (first) { + u32 temp; + retval = u132_read_pcimem(u132, fminterval, &temp); + if (retval) + return retval; + u132->hc_fminterval = temp & 0x3fff; + u132->hc_fminterval |= FSMP(u132->hc_fminterval) << 16; + } + retval = u132_read_pcimem(u132, control, &u132->hc_control); + if (retval) + return retval; + dev_info(&u132->platform_dev->dev, "resetting from state '%s', control " + "= %08X\n", hcfs2string(u132->hc_control & OHCI_CTRL_HCFS), + u132->hc_control); + switch (u132->hc_control & OHCI_CTRL_HCFS) { + case OHCI_USB_OPER: + sleep_time = 0; + break; + case OHCI_USB_SUSPEND: + case OHCI_USB_RESUME: + u132->hc_control &= OHCI_CTRL_RWC; + u132->hc_control |= OHCI_USB_RESUME; + sleep_time = 10; + break; + default: + u132->hc_control &= OHCI_CTRL_RWC; + u132->hc_control |= OHCI_USB_RESET; + sleep_time = 50; + break; + } + retval = u132_write_pcimem(u132, control, u132->hc_control); + if (retval) + return retval; + retval = u132_read_pcimem(u132, control, &control); + if (retval) + return retval; + msleep(sleep_time); + retval = u132_read_pcimem(u132, roothub.a, &roothub_a); + if (retval) + return retval; + if (!(roothub_a & RH_A_NPS)) { + int temp; /* power down each port */ + for (temp = 0; temp < u132->num_ports; temp++) { + retval = u132_write_pcimem(u132, + roothub.portstatus[temp], RH_PS_LSDA); + if (retval) + return retval; + } + } + retval = u132_read_pcimem(u132, control, &control); + if (retval) + return retval; +retry: + retval = u132_read_pcimem(u132, cmdstatus, &status); + if (retval) + return retval; + retval = u132_write_pcimem(u132, cmdstatus, OHCI_HCR); + if (retval) + return retval; +extra: { + retval = u132_read_pcimem(u132, cmdstatus, &status); + if (retval) + return retval; + if (0 != (status & OHCI_HCR)) { + if (--reset_timeout == 0) { + dev_err(&u132->platform_dev->dev, "USB HC reset" + " timed out!\n"); + return -ENODEV; + } else { + msleep(5); + goto extra; + } + } + } + if (u132->flags & OHCI_QUIRK_INITRESET) { + retval = u132_write_pcimem(u132, control, u132->hc_control); + if (retval) + return retval; + retval = u132_read_pcimem(u132, control, &control); + if (retval) + return retval; + } + retval = u132_write_pcimem(u132, ed_controlhead, 0x00000000); + if (retval) + return retval; + retval = u132_write_pcimem(u132, ed_bulkhead, 0x11000000); + if (retval) + return retval; + retval = u132_write_pcimem(u132, hcca, 0x00000000); + if (retval) + return retval; + retval = u132_periodic_reinit(u132); + if (retval) + return retval; + retval = u132_read_pcimem(u132, fminterval, &fminterval); + if (retval) + return retval; + retval = u132_read_pcimem(u132, periodicstart, &periodicstart); + if (retval) + return retval; + if (0 == (fminterval & 0x3fff0000) || 0 == periodicstart) { + if (!(u132->flags & OHCI_QUIRK_INITRESET)) { + u132->flags |= OHCI_QUIRK_INITRESET; + goto retry; + } else + dev_err(&u132->platform_dev->dev, "init err(%08x %04x)" + "\n", fminterval, periodicstart); + } /* start controller operations */ + u132->hc_control &= OHCI_CTRL_RWC; + u132->hc_control |= OHCI_CONTROL_INIT | OHCI_CTRL_BLE | OHCI_USB_OPER; + retval = u132_write_pcimem(u132, control, u132->hc_control); + if (retval) + return retval; + retval = u132_write_pcimem(u132, cmdstatus, OHCI_BLF); + if (retval) + return retval; + retval = u132_read_pcimem(u132, cmdstatus, &cmdstatus); + if (retval) + return retval; + retval = u132_read_pcimem(u132, control, &control); + if (retval) + return retval; + u132_to_hcd(u132)->state = HC_STATE_RUNNING; + retval = u132_write_pcimem(u132, roothub.status, RH_HS_DRWE); + if (retval) + return retval; + retval = u132_write_pcimem(u132, intrstatus, mask); + if (retval) + return retval; + retval = u132_write_pcimem(u132, intrdisable, + OHCI_INTR_MIE | OHCI_INTR_OC | OHCI_INTR_RHSC | OHCI_INTR_FNO | + OHCI_INTR_UE | OHCI_INTR_RD | OHCI_INTR_SF | OHCI_INTR_WDH | + OHCI_INTR_SO); + if (retval) + return retval; /* handle root hub init quirks ... */ + retval = u132_read_pcimem(u132, roothub.a, &roothub_a); + if (retval) + return retval; + roothub_a &= ~(RH_A_PSM | RH_A_OCPM); + if (u132->flags & OHCI_QUIRK_SUPERIO) { + roothub_a |= RH_A_NOCP; + roothub_a &= ~(RH_A_POTPGT | RH_A_NPS); + retval = u132_write_pcimem(u132, roothub.a, roothub_a); + if (retval) + return retval; + } else if ((u132->flags & OHCI_QUIRK_AMD756) || distrust_firmware) { + roothub_a |= RH_A_NPS; + retval = u132_write_pcimem(u132, roothub.a, roothub_a); + if (retval) + return retval; + } + retval = u132_write_pcimem(u132, roothub.status, RH_HS_LPSC); + if (retval) + return retval; + retval = u132_write_pcimem(u132, roothub.b, + (roothub_a & RH_A_NPS) ? 0 : RH_B_PPCM); + if (retval) + return retval; + retval = u132_read_pcimem(u132, control, &control); + if (retval) + return retval; + mdelay((roothub_a >> 23) & 0x1fe); + u132_to_hcd(u132)->state = HC_STATE_RUNNING; + return 0; } static void u132_hcd_stop(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "u132 device %p(hcd=%p) has b" - "een removed %d\n", u132, hcd, u132->going); - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" - "ed\n", hcd); - } else { - mutex_lock(&u132->sw_lock); - msleep(100); - u132_power(u132, 0); - mutex_unlock(&u132->sw_lock); - } + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "u132 device %p(hcd=%p) has b" + "een removed %d\n", u132, hcd, u132->going); + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" + "ed\n", hcd); + } else { + mutex_lock(&u132->sw_lock); + msleep(100); + u132_power(u132, 0); + mutex_unlock(&u132->sw_lock); + } } static int u132_hcd_start(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else if (hcd->self.controller) { - int retval; - struct platform_device *pdev = - to_platform_device(hcd->self.controller); - u16 vendor = ((struct u132_platform_data *) - (pdev->dev.platform_data))->vendor; - u16 device = ((struct u132_platform_data *) - (pdev->dev.platform_data))->device; - mutex_lock(&u132->sw_lock); - msleep(10); - if (vendor == PCI_VENDOR_ID_AMD && device == 0x740c) { - u132->flags = OHCI_QUIRK_AMD756; - } else if (vendor == PCI_VENDOR_ID_OPTI && device == 0xc861) { - dev_err(&u132->platform_dev->dev, "WARNING: OPTi workar" - "ounds unavailable\n"); - } else if (vendor == PCI_VENDOR_ID_COMPAQ && device == 0xa0f8) - u132->flags |= OHCI_QUIRK_ZFMICRO; - retval = u132_run(u132); - if (retval) { - u132_disable(u132); - u132->going = 1; - } - msleep(100); - mutex_unlock(&u132->sw_lock); - return retval; - } else { - dev_err(&u132->platform_dev->dev, "platform_device missing\n"); - return -ENODEV; - } + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else if (hcd->self.controller) { + int retval; + struct platform_device *pdev = + to_platform_device(hcd->self.controller); + u16 vendor = ((struct u132_platform_data *) + (pdev->dev.platform_data))->vendor; + u16 device = ((struct u132_platform_data *) + (pdev->dev.platform_data))->device; + mutex_lock(&u132->sw_lock); + msleep(10); + if (vendor == PCI_VENDOR_ID_AMD && device == 0x740c) { + u132->flags = OHCI_QUIRK_AMD756; + } else if (vendor == PCI_VENDOR_ID_OPTI && device == 0xc861) { + dev_err(&u132->platform_dev->dev, "WARNING: OPTi workar" + "ounds unavailable\n"); + } else if (vendor == PCI_VENDOR_ID_COMPAQ && device == 0xa0f8) + u132->flags |= OHCI_QUIRK_ZFMICRO; + retval = u132_run(u132); + if (retval) { + u132_disable(u132); + u132->going = 1; + } + msleep(100); + mutex_unlock(&u132->sw_lock); + return retval; + } else { + dev_err(&u132->platform_dev->dev, "platform_device missing\n"); + return -ENODEV; + } } static int u132_hcd_reset(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else { - int retval; - mutex_lock(&u132->sw_lock); - retval = u132_init(u132); - if (retval) { - u132_disable(u132); - u132->going = 1; - } - mutex_unlock(&u132->sw_lock); - return retval; - } + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else { + int retval; + mutex_lock(&u132->sw_lock); + retval = u132_init(u132); + if (retval) { + u132_disable(u132); + u132->going = 1; + } + mutex_unlock(&u132->sw_lock); + return retval; + } } static int create_endpoint_and_queue_int(struct u132 *u132, struct u132_udev *udev, struct urb *urb, - struct usb_device *usb_dev, u8 usb_addr, u8 usb_endp, u8 address, - gfp_t mem_flags) + struct usb_device *usb_dev, u8 usb_addr, u8 usb_endp, u8 address, + gfp_t mem_flags) { - struct u132_ring *ring; - unsigned long irqs; + struct u132_ring *ring; + unsigned long irqs; int rc; u8 endp_number; struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags); - if (!endp) { - return -ENOMEM; - } + if (!endp) + return -ENOMEM; spin_lock_init(&endp->queue_lock.slock); spin_lock_irqsave(&endp->queue_lock.slock, irqs); @@ -1897,94 +1887,93 @@ static int create_endpoint_and_queue_int(struct u132 *u132, endp_number = ++u132->num_endpoints; urb->ep->hcpriv = u132->endp[endp_number - 1] = endp; - INIT_DELAYED_WORK(&endp->scheduler, u132_hcd_endp_work_scheduler); - INIT_LIST_HEAD(&endp->urb_more); - ring = endp->ring = &u132->ring[0]; - if (ring->curr_endp) { - list_add_tail(&endp->endp_ring, &ring->curr_endp->endp_ring); - } else { - INIT_LIST_HEAD(&endp->endp_ring); - ring->curr_endp = endp; - } - ring->length += 1; - endp->dequeueing = 0; - endp->edset_flush = 0; - endp->active = 0; - endp->delayed = 0; - endp->endp_number = endp_number; - endp->u132 = u132; + INIT_DELAYED_WORK(&endp->scheduler, u132_hcd_endp_work_scheduler); + INIT_LIST_HEAD(&endp->urb_more); + ring = endp->ring = &u132->ring[0]; + if (ring->curr_endp) { + list_add_tail(&endp->endp_ring, &ring->curr_endp->endp_ring); + } else { + INIT_LIST_HEAD(&endp->endp_ring); + ring->curr_endp = endp; + } + ring->length += 1; + endp->dequeueing = 0; + endp->edset_flush = 0; + endp->active = 0; + endp->delayed = 0; + endp->endp_number = endp_number; + endp->u132 = u132; endp->hep = urb->ep; - endp->pipetype = usb_pipetype(urb->pipe); - u132_endp_init_kref(u132, endp); - if (usb_pipein(urb->pipe)) { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, usb_endp, 0, 0); - endp->input = 1; - endp->output = 0; - udev->endp_number_in[usb_endp] = endp_number; - u132_udev_get_kref(u132, udev); - } else { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, usb_endp, 1, 0); - endp->input = 0; - endp->output = 1; - udev->endp_number_out[usb_endp] = endp_number; - u132_udev_get_kref(u132, udev); - } - urb->hcpriv = u132; - endp->delayed = 1; - endp->jiffies = jiffies + msecs_to_jiffies(urb->interval); - endp->udev_number = address; - endp->usb_addr = usb_addr; - endp->usb_endp = usb_endp; - endp->queue_size = 1; - endp->queue_last = 0; - endp->queue_next = 0; - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - u132_endp_queue_work(u132, endp, msecs_to_jiffies(urb->interval)); - return 0; + endp->pipetype = usb_pipetype(urb->pipe); + u132_endp_init_kref(u132, endp); + if (usb_pipein(urb->pipe)) { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, usb_endp, 0, 0); + endp->input = 1; + endp->output = 0; + udev->endp_number_in[usb_endp] = endp_number; + u132_udev_get_kref(u132, udev); + } else { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, usb_endp, 1, 0); + endp->input = 0; + endp->output = 1; + udev->endp_number_out[usb_endp] = endp_number; + u132_udev_get_kref(u132, udev); + } + urb->hcpriv = u132; + endp->delayed = 1; + endp->jiffies = jiffies + msecs_to_jiffies(urb->interval); + endp->udev_number = address; + endp->usb_addr = usb_addr; + endp->usb_endp = usb_endp; + endp->queue_size = 1; + endp->queue_last = 0; + endp->queue_next = 0; + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + u132_endp_queue_work(u132, endp, msecs_to_jiffies(urb->interval)); + return 0; } static int queue_int_on_old_endpoint(struct u132 *u132, struct u132_udev *udev, struct urb *urb, - struct usb_device *usb_dev, struct u132_endp *endp, u8 usb_addr, - u8 usb_endp, u8 address) -{ - urb->hcpriv = u132; - endp->delayed = 1; - endp->jiffies = jiffies + msecs_to_jiffies(urb->interval); - if (endp->queue_size++ < ENDP_QUEUE_SIZE) { - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; - } else { - struct u132_urbq *urbq = kmalloc(sizeof(struct u132_urbq), - GFP_ATOMIC); - if (urbq == NULL) { - endp->queue_size -= 1; - return -ENOMEM; - } else { - list_add_tail(&urbq->urb_more, &endp->urb_more); - urbq->urb = urb; - } - } - return 0; + struct usb_device *usb_dev, struct u132_endp *endp, u8 usb_addr, + u8 usb_endp, u8 address) +{ + urb->hcpriv = u132; + endp->delayed = 1; + endp->jiffies = jiffies + msecs_to_jiffies(urb->interval); + if (endp->queue_size++ < ENDP_QUEUE_SIZE) { + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; + } else { + struct u132_urbq *urbq = kmalloc(sizeof(struct u132_urbq), + GFP_ATOMIC); + if (urbq == NULL) { + endp->queue_size -= 1; + return -ENOMEM; + } else { + list_add_tail(&urbq->urb_more, &endp->urb_more); + urbq->urb = urb; + } + } + return 0; } static int create_endpoint_and_queue_bulk(struct u132 *u132, struct u132_udev *udev, struct urb *urb, - struct usb_device *usb_dev, u8 usb_addr, u8 usb_endp, u8 address, - gfp_t mem_flags) + struct usb_device *usb_dev, u8 usb_addr, u8 usb_endp, u8 address, + gfp_t mem_flags) { - int ring_number; - struct u132_ring *ring; - unsigned long irqs; + int ring_number; + struct u132_ring *ring; + unsigned long irqs; int rc; u8 endp_number; struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags); - if (!endp) { - return -ENOMEM; - } + if (!endp) + return -ENOMEM; spin_lock_init(&endp->queue_lock.slock); spin_lock_irqsave(&endp->queue_lock.slock, irqs); @@ -1997,91 +1986,90 @@ static int create_endpoint_and_queue_bulk(struct u132 *u132, endp_number = ++u132->num_endpoints; urb->ep->hcpriv = u132->endp[endp_number - 1] = endp; - INIT_DELAYED_WORK(&endp->scheduler, u132_hcd_endp_work_scheduler); - INIT_LIST_HEAD(&endp->urb_more); - endp->dequeueing = 0; - endp->edset_flush = 0; - endp->active = 0; - endp->delayed = 0; - endp->endp_number = endp_number; - endp->u132 = u132; + INIT_DELAYED_WORK(&endp->scheduler, u132_hcd_endp_work_scheduler); + INIT_LIST_HEAD(&endp->urb_more); + endp->dequeueing = 0; + endp->edset_flush = 0; + endp->active = 0; + endp->delayed = 0; + endp->endp_number = endp_number; + endp->u132 = u132; endp->hep = urb->ep; - endp->pipetype = usb_pipetype(urb->pipe); - u132_endp_init_kref(u132, endp); - if (usb_pipein(urb->pipe)) { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, usb_endp, 0, 0); - ring_number = 3; - endp->input = 1; - endp->output = 0; - udev->endp_number_in[usb_endp] = endp_number; - u132_udev_get_kref(u132, udev); - } else { - endp->toggle_bits = 0x2; - usb_settoggle(udev->usb_device, usb_endp, 1, 0); - ring_number = 2; - endp->input = 0; - endp->output = 1; - udev->endp_number_out[usb_endp] = endp_number; - u132_udev_get_kref(u132, udev); - } - ring = endp->ring = &u132->ring[ring_number - 1]; - if (ring->curr_endp) { - list_add_tail(&endp->endp_ring, &ring->curr_endp->endp_ring); - } else { - INIT_LIST_HEAD(&endp->endp_ring); - ring->curr_endp = endp; - } - ring->length += 1; - urb->hcpriv = u132; - endp->udev_number = address; - endp->usb_addr = usb_addr; - endp->usb_endp = usb_endp; - endp->queue_size = 1; - endp->queue_last = 0; - endp->queue_next = 0; - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - u132_endp_queue_work(u132, endp, 0); - return 0; + endp->pipetype = usb_pipetype(urb->pipe); + u132_endp_init_kref(u132, endp); + if (usb_pipein(urb->pipe)) { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, usb_endp, 0, 0); + ring_number = 3; + endp->input = 1; + endp->output = 0; + udev->endp_number_in[usb_endp] = endp_number; + u132_udev_get_kref(u132, udev); + } else { + endp->toggle_bits = 0x2; + usb_settoggle(udev->usb_device, usb_endp, 1, 0); + ring_number = 2; + endp->input = 0; + endp->output = 1; + udev->endp_number_out[usb_endp] = endp_number; + u132_udev_get_kref(u132, udev); + } + ring = endp->ring = &u132->ring[ring_number - 1]; + if (ring->curr_endp) { + list_add_tail(&endp->endp_ring, &ring->curr_endp->endp_ring); + } else { + INIT_LIST_HEAD(&endp->endp_ring); + ring->curr_endp = endp; + } + ring->length += 1; + urb->hcpriv = u132; + endp->udev_number = address; + endp->usb_addr = usb_addr; + endp->usb_endp = usb_endp; + endp->queue_size = 1; + endp->queue_last = 0; + endp->queue_next = 0; + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + u132_endp_queue_work(u132, endp, 0); + return 0; } static int queue_bulk_on_old_endpoint(struct u132 *u132, struct u132_udev *udev, struct urb *urb, - struct usb_device *usb_dev, struct u132_endp *endp, u8 usb_addr, - u8 usb_endp, u8 address) -{ - urb->hcpriv = u132; - if (endp->queue_size++ < ENDP_QUEUE_SIZE) { - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; - } else { - struct u132_urbq *urbq = kmalloc(sizeof(struct u132_urbq), - GFP_ATOMIC); - if (urbq == NULL) { - endp->queue_size -= 1; - return -ENOMEM; - } else { - list_add_tail(&urbq->urb_more, &endp->urb_more); - urbq->urb = urb; - } - } - return 0; + struct usb_device *usb_dev, struct u132_endp *endp, u8 usb_addr, + u8 usb_endp, u8 address) +{ + urb->hcpriv = u132; + if (endp->queue_size++ < ENDP_QUEUE_SIZE) { + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; + } else { + struct u132_urbq *urbq = kmalloc(sizeof(struct u132_urbq), + GFP_ATOMIC); + if (urbq == NULL) { + endp->queue_size -= 1; + return -ENOMEM; + } else { + list_add_tail(&urbq->urb_more, &endp->urb_more); + urbq->urb = urb; + } + } + return 0; } static int create_endpoint_and_queue_control(struct u132 *u132, struct urb *urb, - struct usb_device *usb_dev, u8 usb_addr, u8 usb_endp, - gfp_t mem_flags) + struct usb_device *usb_dev, u8 usb_addr, u8 usb_endp, + gfp_t mem_flags) { - struct u132_ring *ring; + struct u132_ring *ring; unsigned long irqs; int rc; u8 endp_number; struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags); - if (!endp) { - return -ENOMEM; - } + if (!endp) + return -ENOMEM; spin_lock_init(&endp->queue_lock.slock); spin_lock_irqsave(&endp->queue_lock.slock, irqs); @@ -2094,204 +2082,203 @@ static int create_endpoint_and_queue_control(struct u132 *u132, endp_number = ++u132->num_endpoints; urb->ep->hcpriv = u132->endp[endp_number - 1] = endp; - INIT_DELAYED_WORK(&endp->scheduler, u132_hcd_endp_work_scheduler); - INIT_LIST_HEAD(&endp->urb_more); - ring = endp->ring = &u132->ring[0]; - if (ring->curr_endp) { - list_add_tail(&endp->endp_ring, &ring->curr_endp->endp_ring); - } else { - INIT_LIST_HEAD(&endp->endp_ring); - ring->curr_endp = endp; - } - ring->length += 1; - endp->dequeueing = 0; - endp->edset_flush = 0; - endp->active = 0; - endp->delayed = 0; - endp->endp_number = endp_number; - endp->u132 = u132; + INIT_DELAYED_WORK(&endp->scheduler, u132_hcd_endp_work_scheduler); + INIT_LIST_HEAD(&endp->urb_more); + ring = endp->ring = &u132->ring[0]; + if (ring->curr_endp) { + list_add_tail(&endp->endp_ring, &ring->curr_endp->endp_ring); + } else { + INIT_LIST_HEAD(&endp->endp_ring); + ring->curr_endp = endp; + } + ring->length += 1; + endp->dequeueing = 0; + endp->edset_flush = 0; + endp->active = 0; + endp->delayed = 0; + endp->endp_number = endp_number; + endp->u132 = u132; endp->hep = urb->ep; - u132_endp_init_kref(u132, endp); - u132_endp_get_kref(u132, endp); - if (usb_addr == 0) { - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - endp->udev_number = address; - endp->usb_addr = usb_addr; - endp->usb_endp = usb_endp; - endp->input = 1; - endp->output = 1; - endp->pipetype = usb_pipetype(urb->pipe); - u132_udev_init_kref(u132, udev); - u132_udev_get_kref(u132, udev); - udev->endp_number_in[usb_endp] = endp_number; - udev->endp_number_out[usb_endp] = endp_number; - urb->hcpriv = u132; - endp->queue_size = 1; - endp->queue_last = 0; - endp->queue_next = 0; - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - u132_endp_queue_work(u132, endp, 0); - return 0; - } else { /*(usb_addr > 0) */ - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - endp->udev_number = address; - endp->usb_addr = usb_addr; - endp->usb_endp = usb_endp; - endp->input = 1; - endp->output = 1; - endp->pipetype = usb_pipetype(urb->pipe); - u132_udev_get_kref(u132, udev); - udev->enumeration = 2; - udev->endp_number_in[usb_endp] = endp_number; - udev->endp_number_out[usb_endp] = endp_number; - urb->hcpriv = u132; - endp->queue_size = 1; - endp->queue_last = 0; - endp->queue_next = 0; - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - u132_endp_queue_work(u132, endp, 0); - return 0; - } + u132_endp_init_kref(u132, endp); + u132_endp_get_kref(u132, endp); + if (usb_addr == 0) { + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + endp->udev_number = address; + endp->usb_addr = usb_addr; + endp->usb_endp = usb_endp; + endp->input = 1; + endp->output = 1; + endp->pipetype = usb_pipetype(urb->pipe); + u132_udev_init_kref(u132, udev); + u132_udev_get_kref(u132, udev); + udev->endp_number_in[usb_endp] = endp_number; + udev->endp_number_out[usb_endp] = endp_number; + urb->hcpriv = u132; + endp->queue_size = 1; + endp->queue_last = 0; + endp->queue_next = 0; + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + u132_endp_queue_work(u132, endp, 0); + return 0; + } else { /*(usb_addr > 0) */ + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + endp->udev_number = address; + endp->usb_addr = usb_addr; + endp->usb_endp = usb_endp; + endp->input = 1; + endp->output = 1; + endp->pipetype = usb_pipetype(urb->pipe); + u132_udev_get_kref(u132, udev); + udev->enumeration = 2; + udev->endp_number_in[usb_endp] = endp_number; + udev->endp_number_out[usb_endp] = endp_number; + urb->hcpriv = u132; + endp->queue_size = 1; + endp->queue_last = 0; + endp->queue_next = 0; + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = urb; + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + u132_endp_queue_work(u132, endp, 0); + return 0; + } } static int queue_control_on_old_endpoint(struct u132 *u132, struct urb *urb, - struct usb_device *usb_dev, struct u132_endp *endp, u8 usb_addr, - u8 usb_endp) -{ - if (usb_addr == 0) { - if (usb_pipein(urb->pipe)) { - urb->hcpriv = u132; - if (endp->queue_size++ < ENDP_QUEUE_SIZE) { - endp->urb_list[ENDP_QUEUE_MASK & - endp->queue_last++] = urb; - } else { - struct u132_urbq *urbq = - kmalloc(sizeof(struct u132_urbq), - GFP_ATOMIC); - if (urbq == NULL) { - endp->queue_size -= 1; - return -ENOMEM; - } else { - list_add_tail(&urbq->urb_more, - &endp->urb_more); - urbq->urb = urb; - } - } - return 0; - } else { /* usb_pipeout(urb->pipe) */ - struct u132_addr *addr = &u132->addr[usb_dev->devnum]; - int I = MAX_U132_UDEVS; - int i = 0; - while (--I > 0) { - struct u132_udev *udev = &u132->udev[++i]; - if (udev->usb_device) { - continue; - } else { - udev->enumeration = 1; - u132->addr[0].address = i; - endp->udev_number = i; - udev->udev_number = i; - udev->usb_addr = usb_dev->devnum; - u132_udev_init_kref(u132, udev); - udev->endp_number_in[usb_endp] = - endp->endp_number; - u132_udev_get_kref(u132, udev); - udev->endp_number_out[usb_endp] = - endp->endp_number; - udev->usb_device = usb_dev; - ((u8 *) (urb->setup_packet))[2] = - addr->address = i; - u132_udev_get_kref(u132, udev); - break; - } - } - if (I == 0) { - dev_err(&u132->platform_dev->dev, "run out of d" - "evice space\n"); - return -EINVAL; - } - urb->hcpriv = u132; - if (endp->queue_size++ < ENDP_QUEUE_SIZE) { - endp->urb_list[ENDP_QUEUE_MASK & - endp->queue_last++] = urb; - } else { - struct u132_urbq *urbq = - kmalloc(sizeof(struct u132_urbq), - GFP_ATOMIC); - if (urbq == NULL) { - endp->queue_size -= 1; - return -ENOMEM; - } else { - list_add_tail(&urbq->urb_more, - &endp->urb_more); - urbq->urb = urb; - } - } - return 0; - } - } else { /*(usb_addr > 0) */ - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - urb->hcpriv = u132; - if (udev->enumeration == 2) { - } else - udev->enumeration = 2; - if (endp->queue_size++ < ENDP_QUEUE_SIZE) { - endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = - urb; - } else { - struct u132_urbq *urbq = - kmalloc(sizeof(struct u132_urbq), GFP_ATOMIC); - if (urbq == NULL) { - endp->queue_size -= 1; - return -ENOMEM; - } else { - list_add_tail(&urbq->urb_more, &endp->urb_more); - urbq->urb = urb; - } - } - return 0; - } + struct usb_device *usb_dev, struct u132_endp *endp, u8 usb_addr, + u8 usb_endp) +{ + if (usb_addr == 0) { + if (usb_pipein(urb->pipe)) { + urb->hcpriv = u132; + if (endp->queue_size++ < ENDP_QUEUE_SIZE) { + endp->urb_list[ENDP_QUEUE_MASK & + endp->queue_last++] = urb; + } else { + struct u132_urbq *urbq = + kmalloc(sizeof(struct u132_urbq), + GFP_ATOMIC); + if (urbq == NULL) { + endp->queue_size -= 1; + return -ENOMEM; + } else { + list_add_tail(&urbq->urb_more, + &endp->urb_more); + urbq->urb = urb; + } + } + return 0; + } else { /* usb_pipeout(urb->pipe) */ + struct u132_addr *addr = &u132->addr[usb_dev->devnum]; + int I = MAX_U132_UDEVS; + int i = 0; + while (--I > 0) { + struct u132_udev *udev = &u132->udev[++i]; + if (udev->usb_device) { + continue; + } else { + udev->enumeration = 1; + u132->addr[0].address = i; + endp->udev_number = i; + udev->udev_number = i; + udev->usb_addr = usb_dev->devnum; + u132_udev_init_kref(u132, udev); + udev->endp_number_in[usb_endp] = + endp->endp_number; + u132_udev_get_kref(u132, udev); + udev->endp_number_out[usb_endp] = + endp->endp_number; + udev->usb_device = usb_dev; + ((u8 *) (urb->setup_packet))[2] = + addr->address = i; + u132_udev_get_kref(u132, udev); + break; + } + } + if (I == 0) { + dev_err(&u132->platform_dev->dev, "run out of d" + "evice space\n"); + return -EINVAL; + } + urb->hcpriv = u132; + if (endp->queue_size++ < ENDP_QUEUE_SIZE) { + endp->urb_list[ENDP_QUEUE_MASK & + endp->queue_last++] = urb; + } else { + struct u132_urbq *urbq = + kmalloc(sizeof(struct u132_urbq), + GFP_ATOMIC); + if (urbq == NULL) { + endp->queue_size -= 1; + return -ENOMEM; + } else { + list_add_tail(&urbq->urb_more, + &endp->urb_more); + urbq->urb = urb; + } + } + return 0; + } + } else { /*(usb_addr > 0) */ + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + urb->hcpriv = u132; + if (udev->enumeration != 2) + udev->enumeration = 2; + if (endp->queue_size++ < ENDP_QUEUE_SIZE) { + endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = + urb; + } else { + struct u132_urbq *urbq = + kmalloc(sizeof(struct u132_urbq), GFP_ATOMIC); + if (urbq == NULL) { + endp->queue_size -= 1; + return -ENOMEM; + } else { + list_add_tail(&urbq->urb_more, &endp->urb_more); + urbq->urb = urb; + } + } + return 0; + } } static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) { - struct u132 *u132 = hcd_to_u132(hcd); - if (irqs_disabled()) { - if (__GFP_WAIT & mem_flags) { - printk(KERN_ERR "invalid context for function that migh" - "t sleep\n"); - return -EINVAL; - } - } - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { + struct u132 *u132 = hcd_to_u132(hcd); + if (irqs_disabled()) { + if (__GFP_WAIT & mem_flags) { + printk(KERN_ERR "invalid context for function that migh" + "t sleep\n"); + return -EINVAL; + } + } + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - return -ESHUTDOWN; - } else { - u8 usb_addr = usb_pipedevice(urb->pipe); - u8 usb_endp = usb_pipeendpoint(urb->pipe); - struct usb_device *usb_dev = urb->dev; - if (usb_pipetype(urb->pipe) == PIPE_INTERRUPT) { - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - struct u132_endp *endp = urb->ep->hcpriv; - urb->actual_length = 0; - if (endp) { - unsigned long irqs; - int retval; - spin_lock_irqsave(&endp->queue_lock.slock, - irqs); + return -ESHUTDOWN; + } else { + u8 usb_addr = usb_pipedevice(urb->pipe); + u8 usb_endp = usb_pipeendpoint(urb->pipe); + struct usb_device *usb_dev = urb->dev; + if (usb_pipetype(urb->pipe) == PIPE_INTERRUPT) { + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + struct u132_endp *endp = urb->ep->hcpriv; + urb->actual_length = 0; + if (endp) { + unsigned long irqs; + int retval; + spin_lock_irqsave(&endp->queue_lock.slock, + irqs); retval = usb_hcd_link_urb_to_ep(hcd, urb); if (retval == 0) { retval = queue_int_on_old_endpoint( @@ -2301,39 +2288,39 @@ static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, address); if (retval) usb_hcd_unlink_urb_from_ep( - hcd, urb); + hcd, urb); + } + spin_unlock_irqrestore(&endp->queue_lock.slock, + irqs); + if (retval) { + return retval; + } else { + u132_endp_queue_work(u132, endp, + msecs_to_jiffies(urb->interval)) + ; + return 0; } - spin_unlock_irqrestore(&endp->queue_lock.slock, - irqs); - if (retval) { - return retval; - } else { - u132_endp_queue_work(u132, endp, - msecs_to_jiffies(urb->interval)) - ; - return 0; - } - } else if (u132->num_endpoints == MAX_U132_ENDPS) { - return -EINVAL; - } else { /*(endp == NULL) */ - return create_endpoint_and_queue_int(u132, udev, + } else if (u132->num_endpoints == MAX_U132_ENDPS) { + return -EINVAL; + } else { /*(endp == NULL) */ + return create_endpoint_and_queue_int(u132, udev, urb, usb_dev, usb_addr, usb_endp, address, mem_flags); - } - } else if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { - dev_err(&u132->platform_dev->dev, "the hardware does no" - "t support PIPE_ISOCHRONOUS\n"); - return -EINVAL; - } else if (usb_pipetype(urb->pipe) == PIPE_BULK) { - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - struct u132_endp *endp = urb->ep->hcpriv; - urb->actual_length = 0; - if (endp) { - unsigned long irqs; - int retval; - spin_lock_irqsave(&endp->queue_lock.slock, - irqs); + } + } else if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { + dev_err(&u132->platform_dev->dev, "the hardware does no" + "t support PIPE_ISOCHRONOUS\n"); + return -EINVAL; + } else if (usb_pipetype(urb->pipe) == PIPE_BULK) { + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + struct u132_endp *endp = urb->ep->hcpriv; + urb->actual_length = 0; + if (endp) { + unsigned long irqs; + int retval; + spin_lock_irqsave(&endp->queue_lock.slock, + irqs); retval = usb_hcd_link_urb_to_ep(hcd, urb); if (retval == 0) { retval = queue_bulk_on_old_endpoint( @@ -2343,46 +2330,46 @@ static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, address); if (retval) usb_hcd_unlink_urb_from_ep( - hcd, urb); + hcd, urb); + } + spin_unlock_irqrestore(&endp->queue_lock.slock, + irqs); + if (retval) { + return retval; + } else { + u132_endp_queue_work(u132, endp, 0); + return 0; } - spin_unlock_irqrestore(&endp->queue_lock.slock, - irqs); - if (retval) { - return retval; - } else { - u132_endp_queue_work(u132, endp, 0); - return 0; - } - } else if (u132->num_endpoints == MAX_U132_ENDPS) { - return -EINVAL; - } else - return create_endpoint_and_queue_bulk(u132, + } else if (u132->num_endpoints == MAX_U132_ENDPS) { + return -EINVAL; + } else + return create_endpoint_and_queue_bulk(u132, udev, urb, usb_dev, usb_addr, - usb_endp, address, mem_flags); - } else { - struct u132_endp *endp = urb->ep->hcpriv; - u16 urb_size = 8; - u8 *b = urb->setup_packet; - int i = 0; - char data[30 *3 + 4]; - char *d = data; - int m = (sizeof(data) - 1) / 3; - int l = 0; - data[0] = 0; - while (urb_size-- > 0) { - if (i > m) { - } else if (i++ < m) { - int w = sprintf(d, " %02X", *b++); - d += w; - l += w; - } else - d += sprintf(d, " .."); - } - if (endp) { - unsigned long irqs; - int retval; - spin_lock_irqsave(&endp->queue_lock.slock, - irqs); + usb_endp, address, mem_flags); + } else { + struct u132_endp *endp = urb->ep->hcpriv; + u16 urb_size = 8; + u8 *b = urb->setup_packet; + int i = 0; + char data[30 * 3 + 4]; + char *d = data; + int m = (sizeof(data) - 1) / 3; + int l = 0; + data[0] = 0; + while (urb_size-- > 0) { + if (i > m) { + } else if (i++ < m) { + int w = sprintf(d, " %02X", *b++); + d += w; + l += w; + } else + d += sprintf(d, " .."); + } + if (endp) { + unsigned long irqs; + int retval; + spin_lock_irqsave(&endp->queue_lock.slock, + irqs); retval = usb_hcd_link_urb_to_ep(hcd, urb); if (retval == 0) { retval = queue_control_on_old_endpoint( @@ -2393,267 +2380,267 @@ static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, usb_hcd_unlink_urb_from_ep( hcd, urb); } - spin_unlock_irqrestore(&endp->queue_lock.slock, - irqs); - if (retval) { - return retval; - } else { - u132_endp_queue_work(u132, endp, 0); - return 0; - } - } else if (u132->num_endpoints == MAX_U132_ENDPS) { - return -EINVAL; - } else - return create_endpoint_and_queue_control(u132, + spin_unlock_irqrestore(&endp->queue_lock.slock, + irqs); + if (retval) { + return retval; + } else { + u132_endp_queue_work(u132, endp, 0); + return 0; + } + } else if (u132->num_endpoints == MAX_U132_ENDPS) { + return -EINVAL; + } else + return create_endpoint_and_queue_control(u132, urb, usb_dev, usb_addr, usb_endp, - mem_flags); - } - } + mem_flags); + } + } } static int dequeue_from_overflow_chain(struct u132 *u132, - struct u132_endp *endp, struct urb *urb) -{ - struct list_head *scan; - struct list_head *head = &endp->urb_more; - list_for_each(scan, head) { - struct u132_urbq *urbq = list_entry(scan, struct u132_urbq, - urb_more); - if (urbq->urb == urb) { - struct usb_hcd *hcd = u132_to_hcd(u132); - list_del(scan); - endp->queue_size -= 1; - urb->error_count = 0; + struct u132_endp *endp, struct urb *urb) +{ + struct list_head *scan; + struct list_head *head = &endp->urb_more; + list_for_each(scan, head) { + struct u132_urbq *urbq = list_entry(scan, struct u132_urbq, + urb_more); + if (urbq->urb == urb) { + struct usb_hcd *hcd = u132_to_hcd(u132); + list_del(scan); + endp->queue_size -= 1; + urb->error_count = 0; usb_hcd_giveback_urb(hcd, urb, 0); - return 0; - } else - continue; - } - dev_err(&u132->platform_dev->dev, "urb=%p not found in endp[%d]=%p ring" - "[%d] %c%c usb_endp=%d usb_addr=%d size=%d next=%04X last=%04X" - "\n", urb, endp->endp_number, endp, endp->ring->number, - endp->input ? 'I' : ' ', endp->output ? 'O' : ' ', - endp->usb_endp, endp->usb_addr, endp->queue_size, - endp->queue_next, endp->queue_last); - return -EINVAL; + return 0; + } else + continue; + } + dev_err(&u132->platform_dev->dev, "urb=%p not found in endp[%d]=%p ring" + "[%d] %c%c usb_endp=%d usb_addr=%d size=%d next=%04X last=%04X" + "\n", urb, endp->endp_number, endp, endp->ring->number, + endp->input ? 'I' : ' ', endp->output ? 'O' : ' ', + endp->usb_endp, endp->usb_addr, endp->queue_size, + endp->queue_next, endp->queue_last); + return -EINVAL; } static int u132_endp_urb_dequeue(struct u132 *u132, struct u132_endp *endp, struct urb *urb, int status) { - unsigned long irqs; + unsigned long irqs; int rc; - spin_lock_irqsave(&endp->queue_lock.slock, irqs); + spin_lock_irqsave(&endp->queue_lock.slock, irqs); rc = usb_hcd_check_unlink_urb(u132_to_hcd(u132), urb, status); if (rc) { spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); return rc; } - if (endp->queue_size == 0) { - dev_err(&u132->platform_dev->dev, "urb=%p not found in endp[%d]" - "=%p ring[%d] %c%c usb_endp=%d usb_addr=%d\n", urb, - endp->endp_number, endp, endp->ring->number, - endp->input ? 'I' : ' ', endp->output ? 'O' : ' ', - endp->usb_endp, endp->usb_addr); - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - return -EINVAL; - } - if (urb == endp->urb_list[ENDP_QUEUE_MASK & endp->queue_next]) { - if (endp->active) { - endp->dequeueing = 1; - endp->edset_flush = 1; - u132_endp_queue_work(u132, endp, 0); - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - return 0; - } else { - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + if (endp->queue_size == 0) { + dev_err(&u132->platform_dev->dev, "urb=%p not found in endp[%d]" + "=%p ring[%d] %c%c usb_endp=%d usb_addr=%d\n", urb, + endp->endp_number, endp, endp->ring->number, + endp->input ? 'I' : ' ', endp->output ? 'O' : ' ', + endp->usb_endp, endp->usb_addr); + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + return -EINVAL; + } + if (urb == endp->urb_list[ENDP_QUEUE_MASK & endp->queue_next]) { + if (endp->active) { + endp->dequeueing = 1; + endp->edset_flush = 1; + u132_endp_queue_work(u132, endp, 0); + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + return 0; + } else { + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); u132_hcd_abandon_urb(u132, endp, urb, status); - return 0; - } - } else { - u16 queue_list = 0; - u16 queue_size = endp->queue_size; - u16 queue_scan = endp->queue_next; - struct urb **urb_slot = NULL; - while (++queue_list < ENDP_QUEUE_SIZE && --queue_size > 0) { - if (urb == endp->urb_list[ENDP_QUEUE_MASK & - ++queue_scan]) { - urb_slot = &endp->urb_list[ENDP_QUEUE_MASK & - queue_scan]; - break; - } else - continue; - } - while (++queue_list < ENDP_QUEUE_SIZE && --queue_size > 0) { - *urb_slot = endp->urb_list[ENDP_QUEUE_MASK & - ++queue_scan]; - urb_slot = &endp->urb_list[ENDP_QUEUE_MASK & - queue_scan]; - } - if (urb_slot) { - struct usb_hcd *hcd = u132_to_hcd(u132); + return 0; + } + } else { + u16 queue_list = 0; + u16 queue_size = endp->queue_size; + u16 queue_scan = endp->queue_next; + struct urb **urb_slot = NULL; + while (++queue_list < ENDP_QUEUE_SIZE && --queue_size > 0) { + if (urb == endp->urb_list[ENDP_QUEUE_MASK & + ++queue_scan]) { + urb_slot = &endp->urb_list[ENDP_QUEUE_MASK & + queue_scan]; + break; + } else + continue; + } + while (++queue_list < ENDP_QUEUE_SIZE && --queue_size > 0) { + *urb_slot = endp->urb_list[ENDP_QUEUE_MASK & + ++queue_scan]; + urb_slot = &endp->urb_list[ENDP_QUEUE_MASK & + queue_scan]; + } + if (urb_slot) { + struct usb_hcd *hcd = u132_to_hcd(u132); usb_hcd_unlink_urb_from_ep(hcd, urb); - endp->queue_size -= 1; - if (list_empty(&endp->urb_more)) { - spin_unlock_irqrestore(&endp->queue_lock.slock, - irqs); - } else { - struct list_head *next = endp->urb_more.next; - struct u132_urbq *urbq = list_entry(next, - struct u132_urbq, urb_more); - list_del(next); - *urb_slot = urbq->urb; - spin_unlock_irqrestore(&endp->queue_lock.slock, - irqs); - kfree(urbq); - } urb->error_count = 0; + endp->queue_size -= 1; + if (list_empty(&endp->urb_more)) { + spin_unlock_irqrestore(&endp->queue_lock.slock, + irqs); + } else { + struct list_head *next = endp->urb_more.next; + struct u132_urbq *urbq = list_entry(next, + struct u132_urbq, urb_more); + list_del(next); + *urb_slot = urbq->urb; + spin_unlock_irqrestore(&endp->queue_lock.slock, + irqs); + kfree(urbq); + } urb->error_count = 0; usb_hcd_giveback_urb(hcd, urb, status); - return 0; - } else if (list_empty(&endp->urb_more)) { - dev_err(&u132->platform_dev->dev, "urb=%p not found in " - "endp[%d]=%p ring[%d] %c%c usb_endp=%d usb_addr" - "=%d size=%d next=%04X last=%04X\n", urb, - endp->endp_number, endp, endp->ring->number, - endp->input ? 'I' : ' ', - endp->output ? 'O' : ' ', endp->usb_endp, - endp->usb_addr, endp->queue_size, - endp->queue_next, endp->queue_last); - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - return -EINVAL; - } else { + return 0; + } else if (list_empty(&endp->urb_more)) { + dev_err(&u132->platform_dev->dev, "urb=%p not found in " + "endp[%d]=%p ring[%d] %c%c usb_endp=%d usb_addr" + "=%d size=%d next=%04X last=%04X\n", urb, + endp->endp_number, endp, endp->ring->number, + endp->input ? 'I' : ' ', + endp->output ? 'O' : ' ', endp->usb_endp, + endp->usb_addr, endp->queue_size, + endp->queue_next, endp->queue_last); + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + return -EINVAL; + } else { int retval; usb_hcd_unlink_urb_from_ep(u132_to_hcd(u132), urb); retval = dequeue_from_overflow_chain(u132, endp, - urb); - spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - return retval; - } - } + urb); + spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); + return retval; + } + } } static int u132_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 2) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else { - u8 usb_addr = usb_pipedevice(urb->pipe); - u8 usb_endp = usb_pipeendpoint(urb->pipe); - u8 address = u132->addr[usb_addr].address; - struct u132_udev *udev = &u132->udev[address]; - if (usb_pipein(urb->pipe)) { - u8 endp_number = udev->endp_number_in[usb_endp]; - struct u132_endp *endp = u132->endp[endp_number - 1]; - return u132_endp_urb_dequeue(u132, endp, urb, status); - } else { - u8 endp_number = udev->endp_number_out[usb_endp]; - struct u132_endp *endp = u132->endp[endp_number - 1]; - return u132_endp_urb_dequeue(u132, endp, urb, status); - } - } + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 2) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else { + u8 usb_addr = usb_pipedevice(urb->pipe); + u8 usb_endp = usb_pipeendpoint(urb->pipe); + u8 address = u132->addr[usb_addr].address; + struct u132_udev *udev = &u132->udev[address]; + if (usb_pipein(urb->pipe)) { + u8 endp_number = udev->endp_number_in[usb_endp]; + struct u132_endp *endp = u132->endp[endp_number - 1]; + return u132_endp_urb_dequeue(u132, endp, urb, status); + } else { + u8 endp_number = udev->endp_number_out[usb_endp]; + struct u132_endp *endp = u132->endp[endp_number - 1]; + return u132_endp_urb_dequeue(u132, endp, urb, status); + } + } } static void u132_endpoint_disable(struct usb_hcd *hcd, - struct usb_host_endpoint *hep) -{ - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 2) { - dev_err(&u132->platform_dev->dev, "u132 device %p(hcd=%p hep=%p" - ") has been removed %d\n", u132, hcd, hep, - u132->going); - } else { - struct u132_endp *endp = hep->hcpriv; - if (endp) - u132_endp_put_kref(u132, endp); - } + struct usb_host_endpoint *hep) +{ + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 2) { + dev_err(&u132->platform_dev->dev, "u132 device %p(hcd=%p hep=%p" + ") has been removed %d\n", u132, hcd, hep, + u132->going); + } else { + struct u132_endp *endp = hep->hcpriv; + if (endp) + u132_endp_put_kref(u132, endp); + } } static int u132_get_frame(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else { - int frame = 0; - dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); - msleep(100); - return frame; - } + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else { + int frame = 0; + dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); + msleep(100); + return frame; + } } static int u132_roothub_descriptor(struct u132 *u132, - struct usb_hub_descriptor *desc) -{ - int retval; - u16 temp; - u32 rh_a = -1; - u32 rh_b = -1; - retval = u132_read_pcimem(u132, roothub.a, &rh_a); - if (retval) - return retval; - desc->bDescriptorType = 0x29; - desc->bPwrOn2PwrGood = (rh_a & RH_A_POTPGT) >> 24; - desc->bHubContrCurrent = 0; - desc->bNbrPorts = u132->num_ports; - temp = 1 + (u132->num_ports / 8); - desc->bDescLength = 7 + 2 *temp; - temp = 0; - if (rh_a & RH_A_NPS) - temp |= 0x0002; - if (rh_a & RH_A_PSM) - temp |= 0x0001; - if (rh_a & RH_A_NOCP) { - temp |= 0x0010; - } else if (rh_a & RH_A_OCPM) - temp |= 0x0008; - desc->wHubCharacteristics = cpu_to_le16(temp); - retval = u132_read_pcimem(u132, roothub.b, &rh_b); - if (retval) - return retval; - memset(desc->bitmap, 0xff, sizeof(desc->bitmap)); - desc->bitmap[0] = rh_b & RH_B_DR; - if (u132->num_ports > 7) { - desc->bitmap[1] = (rh_b & RH_B_DR) >> 8; - desc->bitmap[2] = 0xff; - } else - desc->bitmap[1] = 0xff; - return 0; + struct usb_hub_descriptor *desc) +{ + int retval; + u16 temp; + u32 rh_a = -1; + u32 rh_b = -1; + retval = u132_read_pcimem(u132, roothub.a, &rh_a); + if (retval) + return retval; + desc->bDescriptorType = 0x29; + desc->bPwrOn2PwrGood = (rh_a & RH_A_POTPGT) >> 24; + desc->bHubContrCurrent = 0; + desc->bNbrPorts = u132->num_ports; + temp = 1 + (u132->num_ports / 8); + desc->bDescLength = 7 + 2 * temp; + temp = 0; + if (rh_a & RH_A_NPS) + temp |= 0x0002; + if (rh_a & RH_A_PSM) + temp |= 0x0001; + if (rh_a & RH_A_NOCP) + temp |= 0x0010; + else if (rh_a & RH_A_OCPM) + temp |= 0x0008; + desc->wHubCharacteristics = cpu_to_le16(temp); + retval = u132_read_pcimem(u132, roothub.b, &rh_b); + if (retval) + return retval; + memset(desc->bitmap, 0xff, sizeof(desc->bitmap)); + desc->bitmap[0] = rh_b & RH_B_DR; + if (u132->num_ports > 7) { + desc->bitmap[1] = (rh_b & RH_B_DR) >> 8; + desc->bitmap[2] = 0xff; + } else + desc->bitmap[1] = 0xff; + return 0; } static int u132_roothub_status(struct u132 *u132, __le32 *desc) { - u32 rh_status = -1; - int ret_status = u132_read_pcimem(u132, roothub.status, &rh_status); - *desc = cpu_to_le32(rh_status); - return ret_status; + u32 rh_status = -1; + int ret_status = u132_read_pcimem(u132, roothub.status, &rh_status); + *desc = cpu_to_le32(rh_status); + return ret_status; } static int u132_roothub_portstatus(struct u132 *u132, __le32 *desc, u16 wIndex) { - if (wIndex == 0 || wIndex > u132->num_ports) { - return -EINVAL; - } else { - int port = wIndex - 1; - u32 rh_portstatus = -1; - int ret_portstatus = u132_read_pcimem(u132, - roothub.portstatus[port], &rh_portstatus); - *desc = cpu_to_le32(rh_portstatus); - if (*(u16 *) (desc + 2)) { - dev_info(&u132->platform_dev->dev, "Port %d Status Chan" - "ge = %08X\n", port, *desc); - } - return ret_portstatus; - } + if (wIndex == 0 || wIndex > u132->num_ports) { + return -EINVAL; + } else { + int port = wIndex - 1; + u32 rh_portstatus = -1; + int ret_portstatus = u132_read_pcimem(u132, + roothub.portstatus[port], &rh_portstatus); + *desc = cpu_to_le32(rh_portstatus); + if (*(u16 *) (desc + 2)) { + dev_info(&u132->platform_dev->dev, "Port %d Status Chan" + "ge = %08X\n", port, *desc); + } + return ret_portstatus; + } } @@ -2664,353 +2651,355 @@ static int u132_roothub_portstatus(struct u132 *u132, __le32 *desc, u16 wIndex) #define tick_before(t1, t2) ((s16)(((s16)(t1))-((s16)(t2))) < 0) static int u132_roothub_portreset(struct u132 *u132, int port_index) { - int retval; - u32 fmnumber; - u16 now; - u16 reset_done; - retval = u132_read_pcimem(u132, fmnumber, &fmnumber); - if (retval) - return retval; - now = fmnumber; - reset_done = now + PORT_RESET_MSEC; - do { - u32 portstat; - do { - retval = u132_read_pcimem(u132, - roothub.portstatus[port_index], &portstat); - if (retval) - return retval; - if (RH_PS_PRS & portstat) { - continue; - } else - break; - } while (tick_before(now, reset_done)); - if (RH_PS_PRS & portstat) - return -ENODEV; - if (RH_PS_CCS & portstat) { - if (RH_PS_PRSC & portstat) { - retval = u132_write_pcimem(u132, - roothub.portstatus[port_index], - RH_PS_PRSC); - if (retval) - return retval; - } - } else - break; /* start the next reset, - sleep till it's probably done */ - retval = u132_write_pcimem(u132, roothub.portstatus[port_index], - RH_PS_PRS); - if (retval) - return retval; - msleep(PORT_RESET_HW_MSEC); - retval = u132_read_pcimem(u132, fmnumber, &fmnumber); - if (retval) - return retval; - now = fmnumber; - } while (tick_before(now, reset_done)); - return 0; + int retval; + u32 fmnumber; + u16 now; + u16 reset_done; + retval = u132_read_pcimem(u132, fmnumber, &fmnumber); + if (retval) + return retval; + now = fmnumber; + reset_done = now + PORT_RESET_MSEC; + do { + u32 portstat; + do { + retval = u132_read_pcimem(u132, + roothub.portstatus[port_index], &portstat); + if (retval) + return retval; + if (RH_PS_PRS & portstat) + continue; + else + break; + } while (tick_before(now, reset_done)); + if (RH_PS_PRS & portstat) + return -ENODEV; + if (RH_PS_CCS & portstat) { + if (RH_PS_PRSC & portstat) { + retval = u132_write_pcimem(u132, + roothub.portstatus[port_index], + RH_PS_PRSC); + if (retval) + return retval; + } + } else + break; /* start the next reset, + sleep till it's probably done */ + retval = u132_write_pcimem(u132, roothub.portstatus[port_index], + RH_PS_PRS); + if (retval) + return retval; + msleep(PORT_RESET_HW_MSEC); + retval = u132_read_pcimem(u132, fmnumber, &fmnumber); + if (retval) + return retval; + now = fmnumber; + } while (tick_before(now, reset_done)); + return 0; } static int u132_roothub_setportfeature(struct u132 *u132, u16 wValue, - u16 wIndex) -{ - if (wIndex == 0 || wIndex > u132->num_ports) { - return -EINVAL; - } else { - int retval; - int port_index = wIndex - 1; - struct u132_port *port = &u132->port[port_index]; - port->Status &= ~(1 << wValue); - switch (wValue) { - case USB_PORT_FEAT_SUSPEND: - retval = u132_write_pcimem(u132, - roothub.portstatus[port_index], RH_PS_PSS); - if (retval) - return retval; - return 0; - case USB_PORT_FEAT_POWER: - retval = u132_write_pcimem(u132, - roothub.portstatus[port_index], RH_PS_PPS); - if (retval) - return retval; - return 0; - case USB_PORT_FEAT_RESET: - retval = u132_roothub_portreset(u132, port_index); - if (retval) - return retval; - return 0; - default: - return -EPIPE; - } - } + u16 wIndex) +{ + if (wIndex == 0 || wIndex > u132->num_ports) { + return -EINVAL; + } else { + int retval; + int port_index = wIndex - 1; + struct u132_port *port = &u132->port[port_index]; + port->Status &= ~(1 << wValue); + switch (wValue) { + case USB_PORT_FEAT_SUSPEND: + retval = u132_write_pcimem(u132, + roothub.portstatus[port_index], RH_PS_PSS); + if (retval) + return retval; + return 0; + case USB_PORT_FEAT_POWER: + retval = u132_write_pcimem(u132, + roothub.portstatus[port_index], RH_PS_PPS); + if (retval) + return retval; + return 0; + case USB_PORT_FEAT_RESET: + retval = u132_roothub_portreset(u132, port_index); + if (retval) + return retval; + return 0; + default: + return -EPIPE; + } + } } static int u132_roothub_clearportfeature(struct u132 *u132, u16 wValue, - u16 wIndex) -{ - if (wIndex == 0 || wIndex > u132->num_ports) { - return -EINVAL; - } else { - int port_index = wIndex - 1; - u32 temp; - int retval; - struct u132_port *port = &u132->port[port_index]; - port->Status &= ~(1 << wValue); - switch (wValue) { - case USB_PORT_FEAT_ENABLE: - temp = RH_PS_CCS; - break; - case USB_PORT_FEAT_C_ENABLE: - temp = RH_PS_PESC; - break; - case USB_PORT_FEAT_SUSPEND: - temp = RH_PS_POCI; - if ((u132->hc_control & OHCI_CTRL_HCFS) - != OHCI_USB_OPER) { - dev_err(&u132->platform_dev->dev, "TODO resume_" - "root_hub\n"); - } - break; - case USB_PORT_FEAT_C_SUSPEND: - temp = RH_PS_PSSC; - break; - case USB_PORT_FEAT_POWER: - temp = RH_PS_LSDA; - break; - case USB_PORT_FEAT_C_CONNECTION: - temp = RH_PS_CSC; - break; - case USB_PORT_FEAT_C_OVER_CURRENT: - temp = RH_PS_OCIC; - break; - case USB_PORT_FEAT_C_RESET: - temp = RH_PS_PRSC; - break; - default: - return -EPIPE; - } - retval = u132_write_pcimem(u132, roothub.portstatus[port_index], - temp); - if (retval) - return retval; - return 0; - } + u16 wIndex) +{ + if (wIndex == 0 || wIndex > u132->num_ports) { + return -EINVAL; + } else { + int port_index = wIndex - 1; + u32 temp; + int retval; + struct u132_port *port = &u132->port[port_index]; + port->Status &= ~(1 << wValue); + switch (wValue) { + case USB_PORT_FEAT_ENABLE: + temp = RH_PS_CCS; + break; + case USB_PORT_FEAT_C_ENABLE: + temp = RH_PS_PESC; + break; + case USB_PORT_FEAT_SUSPEND: + temp = RH_PS_POCI; + if ((u132->hc_control & OHCI_CTRL_HCFS) + != OHCI_USB_OPER) { + dev_err(&u132->platform_dev->dev, "TODO resume_" + "root_hub\n"); + } + break; + case USB_PORT_FEAT_C_SUSPEND: + temp = RH_PS_PSSC; + break; + case USB_PORT_FEAT_POWER: + temp = RH_PS_LSDA; + break; + case USB_PORT_FEAT_C_CONNECTION: + temp = RH_PS_CSC; + break; + case USB_PORT_FEAT_C_OVER_CURRENT: + temp = RH_PS_OCIC; + break; + case USB_PORT_FEAT_C_RESET: + temp = RH_PS_PRSC; + break; + default: + return -EPIPE; + } + retval = u132_write_pcimem(u132, roothub.portstatus[port_index], + temp); + if (retval) + return retval; + return 0; + } } /* the virtual root hub timer IRQ checks for hub status*/ static int u132_hub_status_data(struct usb_hcd *hcd, char *buf) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device hcd=%p has been remov" - "ed %d\n", hcd, u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" - "ed\n", hcd); - return -ESHUTDOWN; - } else { - int i, changed = 0, length = 1; - if (u132->flags & OHCI_QUIRK_AMD756) { - if ((u132->hc_roothub_a & RH_A_NDP) > MAX_ROOT_PORTS) { - dev_err(&u132->platform_dev->dev, "bogus NDP, r" - "ereads as NDP=%d\n", - u132->hc_roothub_a & RH_A_NDP); - goto done; - } - } - if (u132->hc_roothub_status & (RH_HS_LPSC | RH_HS_OCIC)) { - buf[0] = changed = 1; - } else - buf[0] = 0; - if (u132->num_ports > 7) { - buf[1] = 0; - length++; - } - for (i = 0; i < u132->num_ports; i++) { - if (u132->hc_roothub_portstatus[i] & (RH_PS_CSC | - RH_PS_PESC | RH_PS_PSSC | RH_PS_OCIC | - RH_PS_PRSC)) { - changed = 1; - if (i < 7) { - buf[0] |= 1 << (i + 1); - } else - buf[1] |= 1 << (i - 7); - continue; - } - if (!(u132->hc_roothub_portstatus[i] & RH_PS_CCS)) { - continue; - } - if ((u132->hc_roothub_portstatus[i] & RH_PS_PSS)) { - continue; - } - } - done:return changed ? length : 0; - } + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device hcd=%p has been remov" + "ed %d\n", hcd, u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" + "ed\n", hcd); + return -ESHUTDOWN; + } else { + int i, changed = 0, length = 1; + if (u132->flags & OHCI_QUIRK_AMD756) { + if ((u132->hc_roothub_a & RH_A_NDP) > MAX_ROOT_PORTS) { + dev_err(&u132->platform_dev->dev, "bogus NDP, r" + "ereads as NDP=%d\n", + u132->hc_roothub_a & RH_A_NDP); + goto done; + } + } + if (u132->hc_roothub_status & (RH_HS_LPSC | RH_HS_OCIC)) + buf[0] = changed = 1; + else + buf[0] = 0; + if (u132->num_ports > 7) { + buf[1] = 0; + length++; + } + for (i = 0; i < u132->num_ports; i++) { + if (u132->hc_roothub_portstatus[i] & (RH_PS_CSC | + RH_PS_PESC | RH_PS_PSSC | RH_PS_OCIC | + RH_PS_PRSC)) { + changed = 1; + if (i < 7) + buf[0] |= 1 << (i + 1); + else + buf[1] |= 1 << (i - 7); + continue; + } + if (!(u132->hc_roothub_portstatus[i] & RH_PS_CCS)) + continue; + + if ((u132->hc_roothub_portstatus[i] & RH_PS_PSS)) + continue; + } +done: + return changed ? length : 0; + } } static int u132_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, - u16 wIndex, char *buf, u16 wLength) -{ - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else { - int retval = 0; - mutex_lock(&u132->sw_lock); - switch (typeReq) { - case ClearHubFeature: - switch (wValue) { - case C_HUB_OVER_CURRENT: - case C_HUB_LOCAL_POWER: - break; - default: - goto stall; - } - break; - case SetHubFeature: - switch (wValue) { - case C_HUB_OVER_CURRENT: - case C_HUB_LOCAL_POWER: - break; - default: - goto stall; - } - break; - case ClearPortFeature:{ - retval = u132_roothub_clearportfeature(u132, - wValue, wIndex); - if (retval) - goto error; - break; - } - case GetHubDescriptor:{ - retval = u132_roothub_descriptor(u132, - (struct usb_hub_descriptor *)buf); - if (retval) - goto error; - break; - } - case GetHubStatus:{ - retval = u132_roothub_status(u132, - (__le32 *) buf); - if (retval) - goto error; - break; - } - case GetPortStatus:{ - retval = u132_roothub_portstatus(u132, - (__le32 *) buf, wIndex); - if (retval) - goto error; - break; - } - case SetPortFeature:{ - retval = u132_roothub_setportfeature(u132, - wValue, wIndex); - if (retval) - goto error; - break; - } - default: - goto stall; - error:u132_disable(u132); - u132->going = 1; - break; - stall:retval = -EPIPE; - break; - } - mutex_unlock(&u132->sw_lock); - return retval; - } + u16 wIndex, char *buf, u16 wLength) +{ + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else { + int retval = 0; + mutex_lock(&u132->sw_lock); + switch (typeReq) { + case ClearHubFeature: + switch (wValue) { + case C_HUB_OVER_CURRENT: + case C_HUB_LOCAL_POWER: + break; + default: + goto stall; + } + break; + case SetHubFeature: + switch (wValue) { + case C_HUB_OVER_CURRENT: + case C_HUB_LOCAL_POWER: + break; + default: + goto stall; + } + break; + case ClearPortFeature:{ + retval = u132_roothub_clearportfeature(u132, + wValue, wIndex); + if (retval) + goto error; + break; + } + case GetHubDescriptor:{ + retval = u132_roothub_descriptor(u132, + (struct usb_hub_descriptor *)buf); + if (retval) + goto error; + break; + } + case GetHubStatus:{ + retval = u132_roothub_status(u132, + (__le32 *) buf); + if (retval) + goto error; + break; + } + case GetPortStatus:{ + retval = u132_roothub_portstatus(u132, + (__le32 *) buf, wIndex); + if (retval) + goto error; + break; + } + case SetPortFeature:{ + retval = u132_roothub_setportfeature(u132, + wValue, wIndex); + if (retval) + goto error; + break; + } + default: + goto stall; + error: + u132_disable(u132); + u132->going = 1; + break; + stall: + retval = -EPIPE; + break; + } + mutex_unlock(&u132->sw_lock); + return retval; + } } static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else + return 0; } static void u132_hub_irq_enable(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - } else if (u132->going > 0) - dev_err(&u132->platform_dev->dev, "device is being removed\n"); + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + } else if (u132->going > 0) + dev_err(&u132->platform_dev->dev, "device is being removed\n"); } #ifdef CONFIG_PM static int u132_hcd_suspend(struct usb_hcd *hcd, pm_message_t message) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else + return 0; } static int u132_hcd_resume(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else + return 0; } static int u132_bus_suspend(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else + return 0; } static int u132_bus_resume(struct usb_hcd *hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else + return 0; } #else @@ -3020,25 +3009,25 @@ static int u132_bus_resume(struct usb_hcd *hcd) #define u132_bus_resume NULL #endif static struct hc_driver u132_hc_driver = { - .description = hcd_name, - .hcd_priv_size = sizeof(struct u132), - .irq = NULL, - .flags = HCD_USB11 | HCD_MEMORY, - .reset = u132_hcd_reset, - .start = u132_hcd_start, - .suspend = u132_hcd_suspend, - .resume = u132_hcd_resume, - .stop = u132_hcd_stop, - .urb_enqueue = u132_urb_enqueue, - .urb_dequeue = u132_urb_dequeue, - .endpoint_disable = u132_endpoint_disable, - .get_frame_number = u132_get_frame, - .hub_status_data = u132_hub_status_data, - .hub_control = u132_hub_control, - .bus_suspend = u132_bus_suspend, - .bus_resume = u132_bus_resume, - .start_port_reset = u132_start_port_reset, - .hub_irq_enable = u132_hub_irq_enable, + .description = hcd_name, + .hcd_priv_size = sizeof(struct u132), + .irq = NULL, + .flags = HCD_USB11 | HCD_MEMORY, + .reset = u132_hcd_reset, + .start = u132_hcd_start, + .suspend = u132_hcd_suspend, + .resume = u132_hcd_resume, + .stop = u132_hcd_stop, + .urb_enqueue = u132_urb_enqueue, + .urb_dequeue = u132_urb_dequeue, + .endpoint_disable = u132_endpoint_disable, + .get_frame_number = u132_get_frame, + .hub_status_data = u132_hub_status_data, + .hub_control = u132_hub_control, + .bus_suspend = u132_bus_suspend, + .bus_resume = u132_bus_resume, + .start_port_reset = u132_start_port_reset, + .hub_irq_enable = u132_hub_irq_enable, }; /* @@ -3049,148 +3038,152 @@ static struct hc_driver u132_hc_driver = { */ static int __devexit u132_remove(struct platform_device *pdev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); - if (hcd) { - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going++ > 1) { - dev_err(&u132->platform_dev->dev, "already being remove" + struct usb_hcd *hcd = platform_get_drvdata(pdev); + if (hcd) { + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going++ > 1) { + dev_err(&u132->platform_dev->dev, "already being remove" "d\n"); - return -ENODEV; - } else { - int rings = MAX_U132_RINGS; - int endps = MAX_U132_ENDPS; - dev_err(&u132->platform_dev->dev, "removing device u132" + return -ENODEV; + } else { + int rings = MAX_U132_RINGS; + int endps = MAX_U132_ENDPS; + dev_err(&u132->platform_dev->dev, "removing device u132" ".%d\n", u132->sequence_num); - msleep(100); - mutex_lock(&u132->sw_lock); - u132_monitor_cancel_work(u132); - while (rings-- > 0) { - struct u132_ring *ring = &u132->ring[rings]; - u132_ring_cancel_work(u132, ring); - } while (endps-- > 0) { - struct u132_endp *endp = u132->endp[endps]; - if (endp) - u132_endp_cancel_work(u132, endp); - } - u132->going += 1; - printk(KERN_INFO "removing device u132.%d\n", - u132->sequence_num); - mutex_unlock(&u132->sw_lock); - usb_remove_hcd(hcd); - u132_u132_put_kref(u132); - return 0; - } - } else - return 0; + msleep(100); + mutex_lock(&u132->sw_lock); + u132_monitor_cancel_work(u132); + while (rings-- > 0) { + struct u132_ring *ring = &u132->ring[rings]; + u132_ring_cancel_work(u132, ring); + } while (endps-- > 0) { + struct u132_endp *endp = u132->endp[endps]; + if (endp) + u132_endp_cancel_work(u132, endp); + } + u132->going += 1; + printk(KERN_INFO "removing device u132.%d\n", + u132->sequence_num); + mutex_unlock(&u132->sw_lock); + usb_remove_hcd(hcd); + u132_u132_put_kref(u132); + return 0; + } + } else + return 0; } static void u132_initialise(struct u132 *u132, struct platform_device *pdev) { - int rings = MAX_U132_RINGS; - int ports = MAX_U132_PORTS; - int addrs = MAX_U132_ADDRS; - int udevs = MAX_U132_UDEVS; - int endps = MAX_U132_ENDPS; - u132->board = pdev->dev.platform_data; - u132->platform_dev = pdev; - u132->power = 0; - u132->reset = 0; - mutex_init(&u132->sw_lock); - init_MUTEX(&u132->scheduler_lock); - while (rings-- > 0) { - struct u132_ring *ring = &u132->ring[rings]; - ring->u132 = u132; - ring->number = rings + 1; - ring->length = 0; - ring->curr_endp = NULL; - INIT_DELAYED_WORK(&ring->scheduler, + int rings = MAX_U132_RINGS; + int ports = MAX_U132_PORTS; + int addrs = MAX_U132_ADDRS; + int udevs = MAX_U132_UDEVS; + int endps = MAX_U132_ENDPS; + u132->board = pdev->dev.platform_data; + u132->platform_dev = pdev; + u132->power = 0; + u132->reset = 0; + mutex_init(&u132->sw_lock); + init_MUTEX(&u132->scheduler_lock); + while (rings-- > 0) { + struct u132_ring *ring = &u132->ring[rings]; + ring->u132 = u132; + ring->number = rings + 1; + ring->length = 0; + ring->curr_endp = NULL; + INIT_DELAYED_WORK(&ring->scheduler, u132_hcd_ring_work_scheduler); - } mutex_lock(&u132->sw_lock); - INIT_DELAYED_WORK(&u132->monitor, u132_hcd_monitor_work); - while (ports-- > 0) { - struct u132_port *port = &u132->port[ports]; - port->u132 = u132; - port->reset = 0; - port->enable = 0; - port->power = 0; - port->Status = 0; - } while (addrs-- > 0) { - struct u132_addr *addr = &u132->addr[addrs]; - addr->address = 0; - } while (udevs-- > 0) { - struct u132_udev *udev = &u132->udev[udevs]; - int i = ARRAY_SIZE(udev->endp_number_in); - int o = ARRAY_SIZE(udev->endp_number_out); - udev->usb_device = NULL; - udev->udev_number = 0; - udev->usb_addr = 0; - udev->portnumber = 0; - while (i-- > 0) { - udev->endp_number_in[i] = 0; - } - while (o-- > 0) { - udev->endp_number_out[o] = 0; - } - } - while (endps-- > 0) { - u132->endp[endps] = NULL; - } - mutex_unlock(&u132->sw_lock); - return; + } + mutex_lock(&u132->sw_lock); + INIT_DELAYED_WORK(&u132->monitor, u132_hcd_monitor_work); + while (ports-- > 0) { + struct u132_port *port = &u132->port[ports]; + port->u132 = u132; + port->reset = 0; + port->enable = 0; + port->power = 0; + port->Status = 0; + } + while (addrs-- > 0) { + struct u132_addr *addr = &u132->addr[addrs]; + addr->address = 0; + } + while (udevs-- > 0) { + struct u132_udev *udev = &u132->udev[udevs]; + int i = ARRAY_SIZE(udev->endp_number_in); + int o = ARRAY_SIZE(udev->endp_number_out); + udev->usb_device = NULL; + udev->udev_number = 0; + udev->usb_addr = 0; + udev->portnumber = 0; + while (i-- > 0) + udev->endp_number_in[i] = 0; + + while (o-- > 0) + udev->endp_number_out[o] = 0; + + } + while (endps-- > 0) + u132->endp[endps] = NULL; + + mutex_unlock(&u132->sw_lock); + return; } static int __devinit u132_probe(struct platform_device *pdev) { - struct usb_hcd *hcd; - int retval; - u32 control; - u32 rh_a = -1; - u32 num_ports; - msleep(100); - if (u132_exiting > 0) { - return -ENODEV; - } - retval = ftdi_write_pcimem(pdev, intrdisable, OHCI_INTR_MIE); - if (retval) - return retval; - retval = ftdi_read_pcimem(pdev, control, &control); - if (retval) - return retval; - retval = ftdi_read_pcimem(pdev, roothub.a, &rh_a); - if (retval) - return retval; - num_ports = rh_a & RH_A_NDP; /* refuse to confuse usbcore */ - if (pdev->dev.dma_mask) { - return -EINVAL; - } - hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, pdev->dev.bus_id); - if (!hcd) { - printk(KERN_ERR "failed to create the usb hcd struct for U132\n" - ); - ftdi_elan_gone_away(pdev); - return -ENOMEM; - } else { - int retval = 0; - struct u132 *u132 = hcd_to_u132(hcd); - hcd->rsrc_start = 0; - mutex_lock(&u132_module_lock); - list_add_tail(&u132->u132_list, &u132_static_list); - u132->sequence_num = ++u132_instances; - mutex_unlock(&u132_module_lock); - u132_u132_init_kref(u132); - u132_initialise(u132, pdev); - hcd->product_desc = "ELAN U132 Host Controller"; - retval = usb_add_hcd(hcd, 0, 0); - if (retval != 0) { - dev_err(&u132->platform_dev->dev, "init error %d\n", - retval); - u132_u132_put_kref(u132); - return retval; - } else { - u132_monitor_queue_work(u132, 100); - return 0; - } - } + struct usb_hcd *hcd; + int retval; + u32 control; + u32 rh_a = -1; + u32 num_ports; + + msleep(100); + if (u132_exiting > 0) + return -ENODEV; + + retval = ftdi_write_pcimem(pdev, intrdisable, OHCI_INTR_MIE); + if (retval) + return retval; + retval = ftdi_read_pcimem(pdev, control, &control); + if (retval) + return retval; + retval = ftdi_read_pcimem(pdev, roothub.a, &rh_a); + if (retval) + return retval; + num_ports = rh_a & RH_A_NDP; /* refuse to confuse usbcore */ + if (pdev->dev.dma_mask) + return -EINVAL; + + hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, pdev->dev.bus_id); + if (!hcd) { + printk(KERN_ERR "failed to create the usb hcd struct for U132\n" + ); + ftdi_elan_gone_away(pdev); + return -ENOMEM; + } else { + int retval = 0; + struct u132 *u132 = hcd_to_u132(hcd); + hcd->rsrc_start = 0; + mutex_lock(&u132_module_lock); + list_add_tail(&u132->u132_list, &u132_static_list); + u132->sequence_num = ++u132_instances; + mutex_unlock(&u132_module_lock); + u132_u132_init_kref(u132); + u132_initialise(u132, pdev); + hcd->product_desc = "ELAN U132 Host Controller"; + retval = usb_add_hcd(hcd, 0, 0); + if (retval != 0) { + dev_err(&u132->platform_dev->dev, "init error %d\n", + retval); + u132_u132_put_kref(u132); + return retval; + } else { + u132_monitor_queue_work(u132, 100); + return 0; + } + } } @@ -3201,58 +3194,58 @@ static int __devinit u132_probe(struct platform_device *pdev) */ static int u132_suspend(struct platform_device *pdev, pm_message_t state) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else { + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else { int retval = 0, ports; switch (state.event) { case PM_EVENT_FREEZE: - retval = u132_bus_suspend(hcd); + retval = u132_bus_suspend(hcd); break; case PM_EVENT_SUSPEND: case PM_EVENT_HIBERNATE: ports = MAX_U132_PORTS; - while (ports-- > 0) { - port_power(u132, ports, 0); - } + while (ports-- > 0) { + port_power(u132, ports, 0); + } break; } - return retval; - } + return retval; + } } static int u132_resume(struct platform_device *pdev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else { - int retval = 0; + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct u132 *u132 = hcd_to_u132(hcd); + if (u132->going > 1) { + dev_err(&u132->platform_dev->dev, "device has been removed %d\n" + , u132->going); + return -ENODEV; + } else if (u132->going > 0) { + dev_err(&u132->platform_dev->dev, "device is being removed\n"); + return -ESHUTDOWN; + } else { + int retval = 0; if (!u132->port[0].power) { - int ports = MAX_U132_PORTS; - while (ports-- > 0) { - port_power(u132, ports, 1); - } - retval = 0; - } else { - retval = u132_bus_resume(hcd); - } - return retval; - } + int ports = MAX_U132_PORTS; + while (ports-- > 0) { + port_power(u132, ports, 1); + } + retval = 0; + } else { + retval = u132_bus_resume(hcd); + } + return retval; + } } #else @@ -3265,47 +3258,48 @@ static int u132_resume(struct platform_device *pdev) * the platform_driver struct is static because it is per type of module */ static struct platform_driver u132_platform_driver = { - .probe = u132_probe, - .remove = __devexit_p(u132_remove), - .suspend = u132_suspend, - .resume = u132_resume, - .driver = { - .name = (char *)hcd_name, - .owner = THIS_MODULE, - }, + .probe = u132_probe, + .remove = __devexit_p(u132_remove), + .suspend = u132_suspend, + .resume = u132_resume, + .driver = { + .name = (char *)hcd_name, + .owner = THIS_MODULE, + }, }; static int __init u132_hcd_init(void) { - int retval; - INIT_LIST_HEAD(&u132_static_list); - u132_instances = 0; - u132_exiting = 0; - mutex_init(&u132_module_lock); - if (usb_disabled()) - return -ENODEV; - printk(KERN_INFO "driver %s built at %s on %s\n", hcd_name, __TIME__, - __DATE__); - workqueue = create_singlethread_workqueue("u132"); - retval = platform_driver_register(&u132_platform_driver); - return retval; + int retval; + INIT_LIST_HEAD(&u132_static_list); + u132_instances = 0; + u132_exiting = 0; + mutex_init(&u132_module_lock); + if (usb_disabled()) + return -ENODEV; + printk(KERN_INFO "driver %s built at %s on %s\n", hcd_name, __TIME__, + __DATE__); + workqueue = create_singlethread_workqueue("u132"); + retval = platform_driver_register(&u132_platform_driver); + return retval; } module_init(u132_hcd_init); static void __exit u132_hcd_exit(void) { - struct u132 *u132; - struct u132 *temp; - mutex_lock(&u132_module_lock); - u132_exiting += 1; - mutex_unlock(&u132_module_lock); - list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) { - platform_device_unregister(u132->platform_dev); - } platform_driver_unregister(&u132_platform_driver); - printk(KERN_INFO "u132-hcd driver deregistered\n"); - wait_event(u132_hcd_wait, u132_instances == 0); - flush_workqueue(workqueue); - destroy_workqueue(workqueue); + struct u132 *u132; + struct u132 *temp; + mutex_lock(&u132_module_lock); + u132_exiting += 1; + mutex_unlock(&u132_module_lock); + list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) { + platform_device_unregister(u132->platform_dev); + } + platform_driver_unregister(&u132_platform_driver); + printk(KERN_INFO "u132-hcd driver deregistered\n"); + wait_event(u132_hcd_wait, u132_instances == 0); + flush_workqueue(workqueue); + destroy_workqueue(workqueue); } -- cgit v1.2.3 From 50d8ca9b5624bf50cc3ff624fe9ababf0c789bd2 Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Sun, 23 Mar 2008 00:00:02 -0700 Subject: usb: u132-hcd driver: semaphore to mutex Signed-off-by: Daniel Walker Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/u132-hcd.c | 220 ++++++++++++++++++++++---------------------- 1 file changed, 110 insertions(+), 110 deletions(-) diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 28b8684942d..4616a880d89 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -184,7 +184,7 @@ struct u132 { struct kref kref; struct list_head u132_list; struct mutex sw_lock; - struct semaphore scheduler_lock; + struct mutex scheduler_lock; struct u132_platform_data *board; struct platform_device *platform_dev; struct u132_ring ring[MAX_U132_RINGS]; @@ -535,12 +535,12 @@ static void u132_hcd_giveback_urb(struct u132 *u132, struct u132_endp *endp, spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); kfree(urbq); } - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); ring = endp->ring; ring->in_use = 0; u132_ring_cancel_work(u132, ring); u132_ring_queue_work(u132, ring, 0); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); usb_hcd_giveback_urb(hcd, urb, status); return; @@ -631,22 +631,22 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; struct u132_udev *udev = &u132->udev[address]; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { @@ -666,7 +666,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, 1 & toggle_bits); if (urb->actual_length > 0) { int retval; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_single(u132, ring, endp, urb, address, endp->toggle_bits, u132_hcd_interrupt_recv); @@ -680,7 +680,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, msecs_to_jiffies(urb->interval); u132_ring_cancel_work(u132, ring); u132_ring_queue_work(u132, ring, 0); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); } return; @@ -689,7 +689,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, endp->toggle_bits = toggle_bits; usb_settoggle(udev->usb_device, endp->usb_endp, 0, 1 & toggle_bits); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { @@ -709,7 +709,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, "g back INTERRUPT %s\n", urb, cc_to_text[condition_code]); } - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, cc_to_error[condition_code]); return; @@ -717,7 +717,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -730,22 +730,22 @@ static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf, struct u132_endp *endp = data; struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { @@ -754,21 +754,21 @@ static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf, endp->toggle_bits = toggle_bits; if (urb->transfer_buffer_length > urb->actual_length) { int retval; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_output(u132, ring, endp, urb, address, endp->toggle_bits, u132_hcd_bulk_output_sent); if (retval != 0) u132_hcd_giveback_urb(u132, endp, urb, retval); return; } else { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -782,22 +782,22 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; struct u132_udev *udev = &u132->udev[address]; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { @@ -816,7 +816,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, endp->toggle_bits = toggle_bits; usb_settoggle(udev->usb_device, endp->usb_endp, 0, 1 & toggle_bits); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, urb, address, endp->usb_endp, endp->toggle_bits, @@ -828,7 +828,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, endp->toggle_bits = toggle_bits; usb_settoggle(udev->usb_device, endp->usb_endp, 0, 1 & toggle_bits); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, cc_to_error[condition_code]); return; @@ -837,7 +837,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, endp->toggle_bits = toggle_bits; usb_settoggle(udev->usb_device, endp->usb_endp, 0, 1 & toggle_bits); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else if (condition_code == TD_DATAUNDERRUN) { @@ -847,13 +847,13 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, dev_warn(&u132->platform_dev->dev, "urb=%p(SHORT NOT OK" ") giving back BULK IN %s\n", urb, cc_to_text[condition_code]); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else if (condition_code == TD_CC_STALL) { endp->toggle_bits = 0x2; usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, cc_to_error[condition_code]); return; @@ -863,7 +863,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, dev_err(&u132->platform_dev->dev, "urb=%p giving back B" "ULK IN code=%d %s\n", urb, condition_code, cc_to_text[condition_code]); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, cc_to_error[condition_code]); return; @@ -871,7 +871,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -883,32 +883,32 @@ static void u132_hcd_configure_empty_sent(void *data, struct urb *urb, u8 *buf, { struct u132_endp *endp = data; struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -921,22 +921,22 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, struct u132_endp *endp = data; struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { @@ -953,7 +953,7 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, TD_DATAUNDERRUN) && ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0))) { int retval; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_empty(u132->platform_dev, ring->number, endp, urb, address, endp->usb_endp, 0x3, @@ -962,14 +962,14 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, u132_hcd_giveback_urb(u132, endp, urb, retval); return; } else if (condition_code == TD_CC_STALL) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); dev_warn(&u132->platform_dev->dev, "giving back SETUP I" "NPUT STALL urb %p\n", urb); u132_hcd_giveback_urb(u132, endp, urb, cc_to_error[condition_code]); return; } else { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); dev_err(&u132->platform_dev->dev, "giving back SETUP IN" "PUT %s urb %p\n", cc_to_text[condition_code], urb); @@ -980,7 +980,7 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -992,32 +992,32 @@ static void u132_hcd_configure_empty_recv(void *data, struct urb *urb, u8 *buf, { struct u132_endp *endp = data; struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1030,29 +1030,29 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf, struct u132_endp *endp = data; struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { if (usb_pipein(urb->pipe)) { int retval; struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, urb, address, endp->usb_endp, 0, @@ -1063,7 +1063,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf, } else { int retval; struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, urb, address, endp->usb_endp, 0, @@ -1075,7 +1075,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1089,34 +1089,34 @@ static void u132_hcd_enumeration_empty_recv(void *data, struct urb *urb, struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; struct u132_udev *udev = &u132->udev[address]; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { u132->addr[0].address = 0; endp->usb_addr = udev->usb_addr; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1128,28 +1128,28 @@ static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb, { struct u132_endp *endp = data; struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { int retval; struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, urb, 0, endp->usb_endp, 0, u132_hcd_enumeration_empty_recv); @@ -1159,7 +1159,7 @@ static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1171,32 +1171,32 @@ static void u132_hcd_initial_empty_sent(void *data, struct urb *urb, u8 *buf, { struct u132_endp *endp = data; struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1209,22 +1209,22 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf, struct u132_endp *endp = data; struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { @@ -1238,7 +1238,7 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf, *u++ = *b++; urb->actual_length = len; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_empty(u132->platform_dev, ring->number, endp, urb, address, endp->usb_endp, 0x3, u132_hcd_initial_empty_sent); @@ -1248,7 +1248,7 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1261,28 +1261,28 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf, struct u132_endp *endp = data; struct u132 *u132 = endp->u132; u8 address = u132->addr[endp->usb_addr].address; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (u132->going > 1) { dev_err(&u132->platform_dev->dev, "device has been removed %d\n" , u132->going); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_forget_urb(u132, endp, urb, -ENODEV); return; } else if (endp->dequeueing) { endp->dequeueing = 0; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -EINTR); return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed " "urb=%p\n", urb); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; } else if (!urb->unlinked) { int retval; struct u132_ring *ring = endp->ring; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = usb_ftdi_elan_edset_input(u132->platform_dev, ring->number, endp, urb, address, endp->usb_endp, 0, u132_hcd_initial_input_recv); @@ -1292,7 +1292,7 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf, } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " "unlinked=%d\n", urb, urb->unlinked); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } @@ -1307,9 +1307,9 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work) struct u132_ring *ring = container_of(work, struct u132_ring, scheduler.work); struct u132 *u132 = ring->u132; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); if (ring->in_use) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_ring_put_kref(u132, ring); return; } else if (ring->curr_endp) { @@ -1326,7 +1326,7 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work) ring->curr_endp = endp; u132_endp_cancel_work(u132, last_endp); u132_endp_queue_work(u132, last_endp, 0); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_ring_put_kref(u132, ring); return; } else { @@ -1340,7 +1340,7 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work) last_endp->jiffies)) { u132_endp_cancel_work(u132, last_endp); u132_endp_queue_work(u132, last_endp, 0); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_ring_put_kref(u132, ring); return; } else { @@ -1350,15 +1350,15 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work) } if (wakeup > 0) { u132_ring_requeue_work(u132, ring, wakeup); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); return; } else { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_ring_put_kref(u132, ring); return; } } else { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_ring_put_kref(u132, ring); return; } @@ -1370,32 +1370,32 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) struct u132_endp *endp = container_of(work, struct u132_endp, scheduler.work); struct u132 *u132 = endp->u132; - down(&u132->scheduler_lock); + mutex_lock(&u132->scheduler_lock); ring = endp->ring; if (endp->edset_flush) { endp->edset_flush = 0; if (endp->dequeueing) usb_ftdi_elan_edset_flush(u132->platform_dev, ring->number, endp); - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else if (endp->active) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else if (ring->in_use) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else if (endp->queue_next == endp->queue_last) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else if (endp->pipetype == PIPE_INTERRUPT) { u8 address = u132->addr[endp->usb_addr].address; if (ring->in_use) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else { @@ -1405,7 +1405,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) endp->active = 1; ring->curr_endp = endp; ring->in_use = 1; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_single(u132, ring, endp, urb, address, endp->toggle_bits, u132_hcd_interrupt_recv); if (retval != 0) @@ -1415,7 +1415,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) } else if (endp->pipetype == PIPE_CONTROL) { u8 address = u132->addr[endp->usb_addr].address; if (ring->in_use) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else if (address == 0) { @@ -1425,7 +1425,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) endp->active = 1; ring->curr_endp = endp; ring->in_use = 1; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_setup(u132, ring, endp, urb, address, 0x2, u132_hcd_initial_setup_sent); if (retval != 0) @@ -1438,7 +1438,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) endp->active = 1; ring->curr_endp = endp; ring->in_use = 1; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_setup(u132, ring, endp, urb, 0, 0x2, u132_hcd_enumeration_address_sent); if (retval != 0) @@ -1452,7 +1452,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) endp->active = 1; ring->curr_endp = endp; ring->in_use = 1; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_setup(u132, ring, endp, urb, address, 0x2, u132_hcd_configure_setup_sent); if (retval != 0) @@ -1463,7 +1463,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) if (endp->input) { u8 address = u132->addr[endp->usb_addr].address; if (ring->in_use) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else { @@ -1473,7 +1473,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) endp->active = 1; ring->curr_endp = endp; ring->in_use = 1; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_input(u132, ring, endp, urb, address, endp->toggle_bits, u132_hcd_bulk_input_recv); @@ -1486,7 +1486,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) } else { /* output pipe */ u8 address = u132->addr[endp->usb_addr].address; if (ring->in_use) { - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); u132_endp_put_kref(u132, endp); return; } else { @@ -1496,7 +1496,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) endp->active = 1; ring->curr_endp = endp; ring->in_use = 1; - up(&u132->scheduler_lock); + mutex_unlock(&u132->scheduler_lock); retval = edset_output(u132, ring, endp, urb, address, endp->toggle_bits, u132_hcd_bulk_output_sent); @@ -3085,7 +3085,7 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) u132->power = 0; u132->reset = 0; mutex_init(&u132->sw_lock); - init_MUTEX(&u132->scheduler_lock); + mutex_init(&u132->scheduler_lock); while (rings-- > 0) { struct u132_ring *ring = &u132->ring[rings]; ring->u132 = u132; -- cgit v1.2.3 From 44a29fd715a017183e83377b297ab3f792995467 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sun, 23 Mar 2008 20:58:28 +0800 Subject: USB: fix comments of 2 functions in hcd.c Remove useless @type note for rh_string() and @r note for usb_hcd_irq() since this two parameters were removed. Signed-off-by: Ming Lei Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index e52ed1663b3..f936de75f44 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -291,7 +291,6 @@ static int ascii2utf (char *s, u8 *utf, int utfmax) * rh_string - provides manufacturer, product and serial strings for root hub * @id: the string ID number (1: serial number, 2: product, 3: vendor) * @hcd: the host controller for this root hub - * @type: string describing our driver * @data: return packet in UTF-16 LE * @len: length of the return packet * @@ -1677,7 +1676,6 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum); * usb_hcd_irq - hook IRQs to HCD framework (bus glue) * @irq: the IRQ being raised * @__hcd: pointer to the HCD whose IRQ is being signaled - * @r: saved hardware registers * * If the controller isn't HALTed, calls the driver's irq handler. * Checks whether the controller is now dead. -- cgit v1.2.3 From e04d80b03d2a116ddd6eb9140c8c83760c315b94 Mon Sep 17 00:00:00 2001 From: Matti Linnanvuori Date: Sun, 23 Mar 2008 04:08:01 -0700 Subject: USB: serial: Remove obsolete contact addresses Remove obsolete contact addresses. Signed-off-by: Matti Linnanvuori Signed-off-by: Greg Kroah-Hartman --- Documentation/usb/usb-serial.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt index 8b077e43eee..ff2c1ff57ba 100644 --- a/Documentation/usb/usb-serial.txt +++ b/Documentation/usb/usb-serial.txt @@ -192,12 +192,9 @@ Keyspan USA-series Serial Adapters FTDI Single Port Serial Driver - This is a single port DB-25 serial adapter. More information about this - device and the Linux driver can be found at: - http://reality.sgi.com/bryder_wellington/ftdi_sio/ + This is a single port DB-25 serial adapter. - For any questions or problems with this driver, please contact Bill Ryder - at bryder@sgi.com + For any questions or problems with this driver, please contact Bill Ryder. ZyXEL omni.net lcd plus ISDN TA -- cgit v1.2.3 From 119fc8c9acde650fb92b44c34ea6fc84feb0f6dd Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 21 Mar 2008 22:55:45 +0100 Subject: USB: test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove() platform_get_resource() may return null, so although it seems it will never do so here unless there's a bug elsewhere, it does no harm to be defensive and test. Signed-off-by: Jesper Juhl Acked-by: David Brownell Acked-by: Magnus Damm Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-sm501.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index ab1e366d779..54b6ac2e3e4 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -199,7 +199,8 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) usb_put_hcd(hcd); dma_release_declared_memory(&pdev->dev); mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); - release_mem_region(mem->start, mem->end - mem->start + 1); + if (mem) + release_mem_region(mem->start, mem->end - mem->start + 1); /* mask interrupts and disable power */ -- cgit v1.2.3 From cc901bbb2e2a4e4f96da3d70dae332882c10054b Mon Sep 17 00:00:00 2001 From: "Craig W. Nadler" Date: Thu, 20 Mar 2008 14:46:26 -0700 Subject: USB: g_printer bugfixes G_PRINTER: Bug fix for blocking reads and a fix for a memory leak. This fixes bugs in blocking IO calls. When the poll() entry point is called receive transfers will be setup if they have not already been. Another bug fix is that the poll() entry point now checks the current receive buffer for data when reporting if any data had been received. A memory leak was fixed that could have occurred when a USB reset happened. Signed-off-by: Craig W. Nadler Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/printer.c | 86 +++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 2c32bd08ee7..ecc1410073f 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c @@ -390,9 +390,12 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req) /* normal completion */ case 0: - list_add_tail(&req->list, &dev->rx_buffers); - wake_up_interruptible(&dev->rx_wait); - DBG(dev, "G_Printer : rx length %d\n", req->actual); + if (req->actual > 0) { + list_add_tail(&req->list, &dev->rx_buffers); + DBG(dev, "G_Printer : rx length %d\n", req->actual); + } else { + list_add(&req->list, &dev->rx_reqs); + } break; /* software-driven interface shutdown */ @@ -417,6 +420,8 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req) list_add(&req->list, &dev->rx_reqs); break; } + + wake_up_interruptible(&dev->rx_wait); spin_unlock_irqrestore(&dev->lock, flags); } @@ -494,6 +499,39 @@ printer_close(struct inode *inode, struct file *fd) return 0; } +/* This function must be called with interrupts turned off. */ +static void +setup_rx_reqs(struct printer_dev *dev) +{ + struct usb_request *req; + + while (likely(!list_empty(&dev->rx_reqs))) { + int error; + + req = container_of(dev->rx_reqs.next, + struct usb_request, list); + list_del_init(&req->list); + + /* The USB Host sends us whatever amount of data it wants to + * so we always set the length field to the full USB_BUFSIZE. + * If the amount of data is more than the read() caller asked + * for it will be stored in the request buffer until it is + * asked for by read(). + */ + req->length = USB_BUFSIZE; + req->complete = rx_complete; + + error = usb_ep_queue(dev->out_ep, req, GFP_ATOMIC); + if (error) { + DBG(dev, "rx submit --> %d\n", error); + list_add(&req->list, &dev->rx_reqs); + break; + } else { + list_add(&req->list, &dev->rx_reqs_active); + } + } +} + static ssize_t printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) { @@ -522,31 +560,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) */ dev->reset_printer = 0; - while (likely(!list_empty(&dev->rx_reqs))) { - int error; - - req = container_of(dev->rx_reqs.next, - struct usb_request, list); - list_del_init(&req->list); - - /* The USB Host sends us whatever amount of data it wants to - * so we always set the length field to the full USB_BUFSIZE. - * If the amount of data is more than the read() caller asked - * for it will be stored in the request buffer until it is - * asked for by read(). - */ - req->length = USB_BUFSIZE; - req->complete = rx_complete; - - error = usb_ep_queue(dev->out_ep, req, GFP_ATOMIC); - if (error) { - DBG(dev, "rx submit --> %d\n", error); - list_add(&req->list, &dev->rx_reqs); - break; - } else { - list_add(&req->list, &dev->rx_reqs_active); - } - } + setup_rx_reqs(dev); bytes_copied = 0; current_rx_req = dev->current_rx_req; @@ -615,9 +629,9 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) spin_lock_irqsave(&dev->lock, flags); - /* We've disconnected or reset free the req and buffer */ + /* We've disconnected or reset so return. */ if (dev->reset_printer) { - printer_req_free(dev->out_ep, current_rx_req); + list_add(¤t_rx_req->list, &dev->rx_reqs); spin_unlock_irqrestore(&dev->lock, flags); spin_unlock(&dev->lock_printer_io); return -EAGAIN; @@ -735,7 +749,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) /* We've disconnected or reset so free the req and buffer */ if (dev->reset_printer) { - printer_req_free(dev->in_ep, req); + list_add(&req->list, &dev->tx_reqs); spin_unlock_irqrestore(&dev->lock, flags); spin_unlock(&dev->lock_printer_io); return -EAGAIN; @@ -791,6 +805,12 @@ printer_poll(struct file *fd, poll_table *wait) unsigned long flags; int status = 0; + spin_lock(&dev->lock_printer_io); + spin_lock_irqsave(&dev->lock, flags); + setup_rx_reqs(dev); + spin_unlock_irqrestore(&dev->lock, flags); + spin_unlock(&dev->lock_printer_io); + poll_wait(fd, &dev->rx_wait, wait); poll_wait(fd, &dev->tx_wait, wait); @@ -798,7 +818,8 @@ printer_poll(struct file *fd, poll_table *wait) if (likely(!list_empty(&dev->tx_reqs))) status |= POLLOUT | POLLWRNORM; - if (likely(!list_empty(&dev->rx_buffers))) + if (likely(dev->current_rx_bytes) || + likely(!list_empty(&dev->rx_buffers))) status |= POLLIN | POLLRDNORM; spin_unlock_irqrestore(&dev->lock, flags); @@ -1084,6 +1105,7 @@ static void printer_soft_reset(struct printer_dev *dev) if (usb_ep_enable(dev->out_ep, dev->out)) DBG(dev, "Failed to enable USB out_ep\n"); + wake_up_interruptible(&dev->rx_wait); wake_up_interruptible(&dev->tx_wait); wake_up_interruptible(&dev->tx_flush_wait); } -- cgit v1.2.3 From 148d9fe4c91a6356dae1b05b76b8133586c26be4 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 27 Mar 2008 14:52:57 -0400 Subject: USB: usb-storage: use adaptive DMA mask This patch (as1060) makes usb-storage set the DMA alignment mask for SCSI slaves to match the maxpacket size of the bulk-IN endpoint, rather than always setting it to 511. For full-speed devices that mask is too restrictive, and wireless USB devices can have maxpacket sizes larger than 512. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/scsiglue.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 5405ba8cd9d..521f0297aef 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -73,6 +73,7 @@ static const char* host_info(struct Scsi_Host *host) static int slave_alloc (struct scsi_device *sdev) { struct us_data *us = host_to_us(sdev->host); + struct usb_host_endpoint *bulk_in_ep; /* * Set the INQUIRY transfer length to 36. We don't use any of @@ -84,12 +85,13 @@ static int slave_alloc (struct scsi_device *sdev) /* Scatter-gather buffers (all but the last) must have a length * divisible by the bulk maxpacket size. Otherwise a data packet * would end up being short, causing a premature end to the data - * transfer. Since high-speed bulk pipes have a maxpacket size - * of 512, we'll use that as the scsi device queue's DMA alignment - * mask. Guaranteeing proper alignment of the first buffer will - * have the desired effect because, except at the beginning and - * the end, scatter-gather buffers follow page boundaries. */ - blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); + * transfer. We'll use the maxpacket value of the bulk-IN pipe + * to set the SCSI device queue's DMA alignment mask. + */ + bulk_in_ep = us->pusb_dev->ep_in[usb_pipeendpoint(us->recv_bulk_pipe)]; + blk_queue_update_dma_alignment(sdev->request_queue, + le16_to_cpu(bulk_in_ep->desc.wMaxPacketSize) - 1); + /* wMaxPacketSize must be a power of 2 */ /* * The UFI spec treates the Peripheral Qualifier bits in an -- cgit v1.2.3 From 73d79aaba9ee21aaa1a6676f568ef7b3bdf993ea Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 28 Mar 2008 14:50:27 -0700 Subject: USB: mem leak fixes for AMD 5536 UDC high/full speed USB device controller driver In drivers/usb/gadget/amd5536udc.c::udc_pci_probe(), sizeof(struct udc) storage is allocated for 'dev'. There are many exit points from the function where 'dev' is not free'd but has also not yet been used for anything. The following patch free's 'dev' at the return points where it has not yet been used. Signed-off-by: Jesper Juhl Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/amd5536udc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index b663f23f264..fc6f3483be4 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c @@ -3248,6 +3248,8 @@ static int udc_pci_probe( /* pci setup */ if (pci_enable_device(pdev) < 0) { + kfree(dev); + dev = 0; retval = -ENODEV; goto finished; } @@ -3259,6 +3261,8 @@ static int udc_pci_probe( if (!request_mem_region(resource, len, name)) { dev_dbg(&pdev->dev, "pci device used already\n"); + kfree(dev); + dev = 0; retval = -EBUSY; goto finished; } @@ -3267,18 +3271,24 @@ static int udc_pci_probe( dev->virt_addr = ioremap_nocache(resource, len); if (dev->virt_addr == NULL) { dev_dbg(&pdev->dev, "start address cannot be mapped\n"); + kfree(dev); + dev = 0; retval = -EFAULT; goto finished; } if (!pdev->irq) { dev_err(&dev->pdev->dev, "irq not set\n"); + kfree(dev); + dev = 0; retval = -ENODEV; goto finished; } if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); + kfree(dev); + dev = 0; retval = -EBUSY; goto finished; } -- cgit v1.2.3 From 9063ff44f081a0297085952f6760dfe1f8ca840e Mon Sep 17 00:00:00 2001 From: Ingo van Lil Date: Fri, 28 Mar 2008 14:50:26 -0700 Subject: USB: gadget: dummy_hcd.c: fix nested switch statements Fix a messed up combination of two nested switch statements in drivers/usb/gadget/dummy_hcd.c. According to the USB spec (section 5.8.3) the maximum packet size for bulk endpoints can be 512 for high-speed devices and 8, 16, 32 or 64 for full-speed devices. Low-speed devices must not have bulk endpoints. Signed-off-by: Ingo van Lil Cc: David Brownell Signed-off-by: Andrew Morton Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/dummy_hcd.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index e454775c2ff..433f8c47cce 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -365,16 +365,14 @@ dummy_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) case USB_SPEED_HIGH: if (max == 512) break; - /* conserve return statements */ - default: - switch (max) { - case 8: case 16: case 32: case 64: + goto done; + case USB_SPEED_FULL: + if (max == 8 || max == 16 || max == 32 || max == 64) /* we'll fake any legal size */ break; - default: - case USB_SPEED_LOW: - goto done; - } + /* save a return statement */ + default: + goto done; } break; case USB_ENDPOINT_XFER_INT: -- cgit v1.2.3 From 0d22f65515307c878ddd20b1305cce925ca9516c Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 3 Apr 2008 11:35:26 -0400 Subject: USB: OHCI: fix bug in controller resume This patch (as1063) fixes a bug in the way ohci-hcd resumes its controllers. It leaves the Master Interrupt Enable bit turned off. If the root hub is resumed immediately this won't matter. But if the root hub is suspended (say because no devices are plugged in), it won't ever wake up by itself. Signed-off-by: Alan Stern CC: David Brownell Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index d0360f65ebd..b0e2275755c 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -312,11 +312,13 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) static int ohci_pci_resume (struct usb_hcd *hcd) { + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); /* FIXME: we should try to detect loss of VBUS power here */ prepare_for_handover(hcd); - + ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); return 0; } -- cgit v1.2.3 From 6fc88f53aaa4ff8ee621353ac27269b4a656d721 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 3 Apr 2008 21:40:59 +0200 Subject: USB: convert away from urb->status in xpad driver USB is moving to transfering status as a parameter. To ease the transition urb->status is to be touched only once in a function. The xpad driver has been overlooked. Dmitry wants this to go through the USB tree. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 0380597249b..2854c8fc334 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -339,9 +339,11 @@ static void xpad360_process_packet(struct usb_xpad *xpad, static void xpad_irq_in(struct urb *urb) { struct usb_xpad *xpad = urb->context; - int retval; + int retval, status; - switch (urb->status) { + status = urb->status; + + switch (status) { case 0: /* success */ break; @@ -350,11 +352,11 @@ static void xpad_irq_in(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, urb->status); + __FUNCTION__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, urb->status); + __FUNCTION__, status); goto exit; } @@ -373,9 +375,11 @@ exit: #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS) static void xpad_irq_out(struct urb *urb) { - int retval; + int retval, status; + + status = urb->status; - switch (urb->status) { + switch (status) { case 0: /* success */ break; @@ -384,11 +388,11 @@ static void xpad_irq_out(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, urb->status); + __FUNCTION__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, urb->status); + __FUNCTION__, status); goto exit; } -- cgit v1.2.3 From 7329e211b987a493cbcfca0e98c60eb108ab42df Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 3 Apr 2008 18:02:56 -0400 Subject: USB: root hubs don't lie about their number of TTs Currently EHCI root hubs enumerate with a bDeviceProtocol code indicating that they possess a Transaction Translator. However the vast majority of controllers do not; they rely on a companion controller to handle full- and low-speed communications. This patch (as1064) changes the root-hub device descriptor to match the actual situation. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd.c | 14 ++++++++++++-- drivers/usb/core/hcd.h | 1 + drivers/usb/host/ehci-pci.c | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index f936de75f44..e68fef5361d 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -129,7 +129,7 @@ static const u8 usb2_rh_dev_descriptor [18] = { 0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */ 0x00, /* __u8 bDeviceSubClass; */ - 0x01, /* __u8 bDeviceProtocol; [ usb 2.0 single TT ]*/ + 0x00, /* __u8 bDeviceProtocol; [ usb 2.0 no TT ] */ 0x40, /* __u8 bMaxPacketSize0; 64 Bytes */ 0x6b, 0x1d, /* __le16 idVendor; Linux Foundation */ @@ -354,9 +354,10 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) __attribute__((aligned(4))); const u8 *bufp = tbuf; int len = 0; - int patch_wakeup = 0; int status; int n; + u8 patch_wakeup = 0; + u8 patch_protocol = 0; might_sleep(); @@ -433,6 +434,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) else goto error; len = 18; + if (hcd->has_tt) + patch_protocol = 1; break; case USB_DT_CONFIG << 8: if (hcd->driver->flags & HCD_USB2) { @@ -527,6 +530,13 @@ error: bmAttributes)) ((struct usb_config_descriptor *)ubuf)->bmAttributes |= USB_CONFIG_ATT_WAKEUP; + + /* report whether RH hardware has an integrated TT */ + if (patch_protocol && + len > offsetof(struct usb_device_descriptor, + bDeviceProtocol)) + ((struct usb_device_descriptor *) ubuf)-> + bDeviceProtocol = 1; } /* any errors get returned through the urb completion */ diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 2c086b8460b..e0e99471c3f 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h @@ -99,6 +99,7 @@ struct usb_hcd { unsigned poll_pending:1; /* status has changed? */ unsigned wireless:1; /* Wireless USB HCD */ unsigned authorized_default:1; + unsigned has_tt:1; /* Integrated TT in root hub */ int irq; /* irq allocated */ void __iomem *regs; /* device memory/io */ diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 040bd8632eb..7c8a2ccf78f 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -130,6 +130,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) case PCI_VENDOR_ID_TDI: if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { ehci->is_tdi_rh_tt = 1; + hcd->has_tt = 1; tdi_reset(ehci); } break; -- cgit v1.2.3 From 7be7d7418776a41badce7ca00246e270d408e4b9 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 3 Apr 2008 18:03:06 -0400 Subject: USB: clarify usage of hcd->suspend/resume methods The .suspend and .resume method pointers in struct usb_hcd have not been fully understood by host-controller driver writers. They are meant for use with PCI controllers; other platform-specific drivers generally should not refer to them. To try and clarify matters, this patch (as1065) renames those methods to .pci_suspend and .pci_resume. It eliminates corresponding dead code and bogus references in the ohci-ssb and u132-hcd drivers. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd-pci.c | 10 +++++----- drivers/usb/core/hcd.h | 4 ++-- drivers/usb/host/ehci-pci.c | 4 ++-- drivers/usb/host/ohci-pci.c | 5 ++--- drivers/usb/host/ohci-ssb.c | 35 ----------------------------------- drivers/usb/host/u132-hcd.c | 32 -------------------------------- drivers/usb/host/uhci-hcd.c | 8 ++++---- 7 files changed, 15 insertions(+), 83 deletions(-) diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 739407bb849..5b87ae7f0a6 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -215,9 +215,9 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) hcd->state == HC_STATE_HALT)) return -EBUSY; - if (hcd->driver->suspend) { - retval = hcd->driver->suspend(hcd, message); - suspend_report_result(hcd->driver->suspend, retval); + if (hcd->driver->pci_suspend) { + retval = hcd->driver->pci_suspend(hcd, message); + suspend_report_result(hcd->driver->pci_suspend, retval); if (retval) goto done; } @@ -405,8 +405,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev) clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); - if (hcd->driver->resume) { - retval = hcd->driver->resume(hcd); + if (hcd->driver->pci_resume) { + retval = hcd->driver->pci_resume(hcd); if (retval) { dev_err(hcd->self.controller, "PCI post-resume error %d!\n", retval); diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index e0e99471c3f..3ba258eb05d 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h @@ -178,10 +178,10 @@ struct hc_driver { * a whole, not just the root hub; they're for PCI bus glue. */ /* called after suspending the hub, before entering D3 etc */ - int (*suspend) (struct usb_hcd *hcd, pm_message_t message); + int (*pci_suspend) (struct usb_hcd *hcd, pm_message_t message); /* called after entering D0 (etc), before resuming the hub */ - int (*resume) (struct usb_hcd *hcd); + int (*pci_resume) (struct usb_hcd *hcd); /* cleanly make HCD stop writing memory and doing I/O */ void (*stop) (struct usb_hcd *hcd); diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 7c8a2ccf78f..a0afc78b273 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -353,8 +353,8 @@ static const struct hc_driver ehci_pci_hc_driver = { .reset = ehci_pci_setup, .start = ehci_run, #ifdef CONFIG_PM - .suspend = ehci_pci_suspend, - .resume = ehci_pci_resume, + .pci_suspend = ehci_pci_suspend, + .pci_resume = ehci_pci_resume, #endif .stop = ehci_stop, .shutdown = ehci_shutdown, diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index b0e2275755c..40b62a35fd3 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -347,9 +347,8 @@ static const struct hc_driver ohci_pci_hc_driver = { .shutdown = ohci_shutdown, #ifdef CONFIG_PM - /* these suspend/resume entries are for upstream PCI glue ONLY */ - .suspend = ohci_pci_suspend, - .resume = ohci_pci_resume, + .pci_suspend = ohci_pci_suspend, + .pci_resume = ohci_pci_resume, #endif /* diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c index 6e9c2d6db88..7879f2fdad8 100644 --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c @@ -60,36 +60,6 @@ static int ssb_ohci_start(struct usb_hcd *hcd) return err; } -#ifdef CONFIG_PM -static int ssb_ohci_hcd_suspend(struct usb_hcd *hcd, pm_message_t message) -{ - struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd); - struct ohci_hcd *ohci = &ohcidev->ohci; - unsigned long flags; - - spin_lock_irqsave(&ohci->lock, flags); - - ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); - ohci_readl(ohci, &ohci->regs->intrdisable); /* commit write */ - - /* make sure snapshot being resumed re-enumerates everything */ - if (message.event == PM_EVENT_PRETHAW) - ohci_usb_reset(ohci); - - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - - spin_unlock_irqrestore(&ohci->lock, flags); - return 0; -} - -static int ssb_ohci_hcd_resume(struct usb_hcd *hcd) -{ - set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - usb_hcd_resume_root_hub(hcd); - return 0; -} -#endif /* CONFIG_PM */ - static const struct hc_driver ssb_ohci_hc_driver = { .description = "ssb-usb-ohci", .product_desc = "SSB OHCI Controller", @@ -103,11 +73,6 @@ static const struct hc_driver ssb_ohci_hc_driver = { .stop = ohci_stop, .shutdown = ohci_shutdown, -#ifdef CONFIG_PM - .suspend = ssb_ohci_hcd_suspend, - .resume = ssb_ohci_hcd_resume, -#endif - .urb_enqueue = ohci_urb_enqueue, .urb_dequeue = ohci_urb_dequeue, .endpoint_disable = ohci_endpoint_disable, diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 4616a880d89..9b6323f768b 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -2946,34 +2946,6 @@ static void u132_hub_irq_enable(struct usb_hcd *hcd) #ifdef CONFIG_PM -static int u132_hcd_suspend(struct usb_hcd *hcd, pm_message_t message) -{ - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; -} - -static int u132_hcd_resume(struct usb_hcd *hcd) -{ - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - return -ENODEV; - } else if (u132->going > 0) { - dev_err(&u132->platform_dev->dev, "device is being removed\n"); - return -ESHUTDOWN; - } else - return 0; -} - static int u132_bus_suspend(struct usb_hcd *hcd) { struct u132 *u132 = hcd_to_u132(hcd); @@ -3003,8 +2975,6 @@ static int u132_bus_resume(struct usb_hcd *hcd) } #else -#define u132_hcd_suspend NULL -#define u132_hcd_resume NULL #define u132_bus_suspend NULL #define u132_bus_resume NULL #endif @@ -3015,8 +2985,6 @@ static struct hc_driver u132_hc_driver = { .flags = HCD_USB11 | HCD_MEMORY, .reset = u132_hcd_reset, .start = u132_hcd_start, - .suspend = u132_hcd_suspend, - .resume = u132_hcd_resume, .stop = u132_hcd_stop, .urb_enqueue = u132_urb_enqueue, .urb_dequeue = u132_urb_dequeue, diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index ec987897b8e..fec9872dd9d 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -737,7 +737,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd) return rc; } -static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) +static int uhci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) { struct uhci_hcd *uhci = hcd_to_uhci(hcd); int rc = 0; @@ -774,7 +774,7 @@ done: return rc; } -static int uhci_resume(struct usb_hcd *hcd) +static int uhci_pci_resume(struct usb_hcd *hcd) { struct uhci_hcd *uhci = hcd_to_uhci(hcd); @@ -872,8 +872,8 @@ static const struct hc_driver uhci_driver = { .reset = uhci_init, .start = uhci_start, #ifdef CONFIG_PM - .suspend = uhci_suspend, - .resume = uhci_resume, + .pci_suspend = uhci_pci_suspend, + .pci_resume = uhci_pci_resume, .bus_suspend = uhci_rh_suspend, .bus_resume = uhci_rh_resume, #endif -- cgit v1.2.3 From 43bbb7e015c4380064796c5868b536437b165615 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 3 Apr 2008 18:03:17 -0400 Subject: USB: OHCI: host-controller resumes leave root hub suspended Drivers in the ohci-hcd family should perform certain tasks whenever their controller device is resumed. These include checking for loss of power during suspend, turning on port power, and enabling interrupt requests. Until now these jobs have been carried out when the root hub is resumed, not when the controller is. Many drivers work around the resulting awkwardness by automatically resuming their root hub whenever the controller is resumed. But this is wasteful and unnecessary. To simplify the situation, this patch (as1066) adds a new core routine, ohci_finish_controller_resume(), which can be used by all the OHCI-variant drivers. They can call the new routine instead of resuming their root hubs. And ohci-pci.c can call it instead of using its own special-purpose handler. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-at91.c | 1 + drivers/usb/host/ohci-ep93xx.c | 2 +- drivers/usb/host/ohci-hub.c | 43 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ohci-omap.c | 5 +++-- drivers/usb/host/ohci-pci.c | 43 +----------------------------------------- drivers/usb/host/ohci-pxa27x.c | 3 +-- drivers/usb/host/ohci-sm501.c | 5 +++-- drivers/usb/host/ohci-ssb.c | 1 + 8 files changed, 54 insertions(+), 49 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index d72dc07dda0..e534f9de0f0 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -348,6 +348,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) if (!clocked) at91_start_clock(); + ohci_finish_controller_resume(hcd); return 0; } #else diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 40c683f8987..5adaf36e47d 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -192,8 +192,8 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) ohci->next_statechange = jiffies; ep93xx_start_hc(&pdev->dev); - usb_hcd_resume_root_hub(hcd); + ohci_finish_controller_resume(hcd); return 0; } #endif diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index c638e6b33c4..28d6d775eb5 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -326,6 +326,49 @@ static int ohci_bus_resume (struct usb_hcd *hcd) return rc; } +/* Carry out the final steps of resuming the controller device */ +static void ohci_finish_controller_resume(struct usb_hcd *hcd) +{ + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + int port; + bool need_reinit = false; + + /* See if the controller is already running or has been reset */ + ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); + if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { + need_reinit = true; + } else { + switch (ohci->hc_control & OHCI_CTRL_HCFS) { + case OHCI_USB_OPER: + case OHCI_USB_RESET: + need_reinit = true; + } + } + + /* If needed, reinitialize and suspend the root hub */ + if (need_reinit) { + spin_lock_irq(&ohci->lock); + hcd->state = HC_STATE_RESUMING; + ohci_rh_resume(ohci); + hcd->state = HC_STATE_QUIESCING; + ohci_rh_suspend(ohci, 0); + hcd->state = HC_STATE_SUSPENDED; + spin_unlock_irq(&ohci->lock); + } + + /* Normally just turn on port power and enable interrupts */ + else { + ohci_dbg(ohci, "powerup ports\n"); + for (port = 0; port < ohci->num_ports; port++) + ohci_writel(ohci, RH_PS_PPS, + &ohci->regs->roothub.portstatus[port]); + + ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); + ohci_readl(ohci, &ohci->regs->intrenable); + msleep(20); + } +} + /* Carry out polling-, autostop-, and autoresume-related state changes */ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, int any_connected) diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 2aafa7b6c81..3a7c24c0367 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -510,14 +510,15 @@ static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) static int ohci_omap_resume(struct platform_device *dev) { - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); + struct usb_hcd *hcd = platform_get_drvdata(dev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies; omap_ohci_clock_power(1); - usb_hcd_resume_root_hub(platform_get_drvdata(dev)); + ohci_finish_controller_resume(hcd); return 0; } diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 40b62a35fd3..4696cc912e1 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -238,42 +238,6 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd) return ret; } -#if defined(CONFIG_USB_PERSIST) && (defined(CONFIG_USB_EHCI_HCD) || \ - defined(CONFIG_USB_EHCI_HCD_MODULE)) - -/* Following a power loss, we must prepare to regain control of the ports - * we used to own. This means turning on the port power before ehci-hcd - * tries to switch ownership. - * - * This isn't a 100% perfect solution. On most systems the OHCI controllers - * lie at lower PCI addresses than the EHCI controller, so they will be - * discovered (and hence resumed) first. But there is no guarantee things - * will always work this way. If the EHCI controller is resumed first and - * the OHCI ports are unpowered, then the handover will fail. - */ -static void prepare_for_handover(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int port; - - /* Here we "know" root ports should always stay powered */ - ohci_dbg(ohci, "powerup ports\n"); - for (port = 0; port < ohci->num_ports; port++) - ohci_writel(ohci, RH_PS_PPS, - &ohci->regs->roothub.portstatus[port]); - - /* Flush those writes */ - ohci_readl(ohci, &ohci->regs->control); - msleep(20); -} - -#else - -static inline void prepare_for_handover(struct usb_hcd *hcd) -{ } - -#endif /* CONFIG_USB_PERSIST etc. */ - #ifdef CONFIG_PM static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) @@ -312,13 +276,8 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) static int ohci_pci_resume (struct usb_hcd *hcd) { - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - - /* FIXME: we should try to detect loss of VBUS power here */ - prepare_for_handover(hcd); - ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); + ohci_finish_controller_resume(hcd); return 0; } diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 5d470263eed..d4ee27d92be 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -356,8 +356,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) if ((status = pxa27x_start_hc(&pdev->dev)) < 0) return status; - usb_hcd_resume_root_hub(hcd); - + ohci_finish_controller_resume(hcd); return 0; } #endif diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 54b6ac2e3e4..4a11e181601 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -231,14 +231,15 @@ static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg) static int ohci_sm501_resume(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(pdev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies; sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1); - usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); + ohci_finish_controller_resume(hcd); return 0; } #else diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c index 7879f2fdad8..7275186db31 100644 --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c @@ -189,6 +189,7 @@ static int ssb_ohci_resume(struct ssb_device *dev) ssb_device_enable(dev, ohcidev->enable_flags); + ohci_finish_controller_resume(hcd); return 0; } -- cgit v1.2.3 From 96e12fced365262e185a8e935db23973337b8a2a Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Fri, 4 Apr 2008 14:28:01 -0700 Subject: usb: replace remaining __PRETTY_FUNCTION__ occurrences The kernel is written in C, not C++, use __func__ Signed-off-by: Harvey Harrison Signed-off-by: Greg Kroah-Hartman --- drivers/usb/image/microtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 0badbbe2fd2..885867a86de 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -185,7 +185,7 @@ static struct usb_driver mts_usb_driver = { printk( KERN_DEBUG MTS_NAME x ) #define MTS_DEBUG_GOT_HERE() \ - MTS_DEBUG("got to %s:%d (%s)\n", __FILE__, (int)__LINE__, __PRETTY_FUNCTION__ ) + MTS_DEBUG("got to %s:%d (%s)\n", __FILE__, (int)__LINE__, __func__ ) #define MTS_DEBUG_INT() \ do { MTS_DEBUG_GOT_HERE(); \ MTS_DEBUG("transfer = 0x%x context = 0x%x\n",(int)transfer,(int)context ); \ -- cgit v1.2.3 From 61a5c657892a43653d6189972159590751a0673e Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 4 Apr 2008 23:46:59 -0400 Subject: USB: rework sysfs removal of interface files Removing an interface's sysfs files before unregistering the interface doesn't work properly, because usb_unbind_interface() will reinstall altsetting 0 and thereby create new sysfs files. This patch (as1074) removes the files after the unregistration is finished. It's not quite as clean, but at least it works. Also, there's no need to check if an interface has been registered before removing its sysfs files. If it hasn't been registered then the files won't have been created, so usb_remove_sysfs_intf_files() will simply do nothing. Signed-off-by: Alan Stern Tested-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/message.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a3695b5115f..5b23f6b017d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1089,8 +1089,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) continue; dev_dbg(&dev->dev, "unregistering interface %s\n", interface->dev.bus_id); - usb_remove_sysfs_intf_files(interface); device_del(&interface->dev); + usb_remove_sysfs_intf_files(interface); } /* Now that the interfaces are unbound, nobody should @@ -1231,7 +1231,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) */ /* prevent submissions using previous endpoint settings */ - if (iface->cur_altsetting != alt && device_is_registered(&iface->dev)) + if (iface->cur_altsetting != alt) usb_remove_sysfs_intf_files(iface); usb_disable_interface(dev, iface); @@ -1330,8 +1330,7 @@ int usb_reset_configuration(struct usb_device *dev) struct usb_interface *intf = config->interface[i]; struct usb_host_interface *alt; - if (device_is_registered(&intf->dev)) - usb_remove_sysfs_intf_files(intf); + usb_remove_sysfs_intf_files(intf); alt = usb_altnum_to_altsetting(intf, 0); /* No altsetting 0? We'll assume the first altsetting. -- cgit v1.2.3 From 0e530b45783f75a29bde20bbf9e287c915a4f68b Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 5 Apr 2008 14:17:14 -0700 Subject: USB: gadget section fixes Restore some section annotations: they were switched to "__devinit" while they should have been "__init", because of bogus warnings. The warnings are now fixed, so the runtime footprint of various drivers can now shrink a bit. On ARMv5, it's about 600 bytes except for the Ethernet gadget, where it can save a bit more. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/epautoconf.c | 12 ++++++------ drivers/usb/gadget/ether.c | 6 +++--- drivers/usb/gadget/gmidi.c | 2 +- drivers/usb/gadget/rndis.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index f9d07108bc3..8bdad221fa9 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -34,12 +34,12 @@ /* we must assign addresses for configurable endpoints (like net2280) */ -static __devinitdata unsigned epnum; +static __initdata unsigned epnum; // #define MANY_ENDPOINTS #ifdef MANY_ENDPOINTS /* more than 15 configurable endpoints */ -static __devinitdata unsigned in_epnum; +static __initdata unsigned in_epnum; #endif @@ -59,7 +59,7 @@ static __devinitdata unsigned in_epnum; * NOTE: each endpoint is unidirectional, as specified by its USB * descriptor; and isn't specific to a configuration or altsetting. */ -static int __devinit +static int __init ep_matches ( struct usb_gadget *gadget, struct usb_ep *ep, @@ -186,7 +186,7 @@ ep_matches ( return 1; } -static struct usb_ep * __devinit +static struct usb_ep * __init find_ep (struct usb_gadget *gadget, const char *name) { struct usb_ep *ep; @@ -228,7 +228,7 @@ find_ep (struct usb_gadget *gadget, const char *name) * * On failure, this returns a null endpoint descriptor. */ -struct usb_ep * __devinit usb_ep_autoconfig ( +struct usb_ep * __init usb_ep_autoconfig ( struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc ) @@ -295,7 +295,7 @@ struct usb_ep * __devinit usb_ep_autoconfig ( * state such as ep->driver_data and the record of assigned endpoints * used by usb_ep_autoconfig(). */ -void __devinit usb_ep_autoconfig_reset (struct usb_gadget *gadget) +void __init usb_ep_autoconfig_reset (struct usb_gadget *gadget) { struct usb_ep *ep; diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index e9987230814..92b9bf78071 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -2229,7 +2229,7 @@ eth_unbind (struct usb_gadget *gadget) set_gadget_data (gadget, NULL); } -static u8 __devinit nibble (unsigned char c) +static u8 __init nibble (unsigned char c) { if (likely (isdigit (c))) return c - '0'; @@ -2239,7 +2239,7 @@ static u8 __devinit nibble (unsigned char c) return 0; } -static int __devinit get_ether_addr(const char *str, u8 *dev_addr) +static int __init get_ether_addr(const char *str, u8 *dev_addr) { if (str) { unsigned i; @@ -2260,7 +2260,7 @@ static int __devinit get_ether_addr(const char *str, u8 *dev_addr) return 1; } -static int __devinit +static int __init eth_bind (struct usb_gadget *gadget) { struct eth_dev *dev; diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index 5b42ccd0035..ff3a8513e64 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c @@ -1149,7 +1149,7 @@ fail: /* * Creates an output endpoint, and initializes output ports. */ -static int __devinit gmidi_bind(struct usb_gadget *gadget) +static int __init gmidi_bind(struct usb_gadget *gadget) { struct gmidi_device *dev; struct usb_ep *in_ep, *out_ep; diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 3d036647431..934911ee5c7 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -1403,7 +1403,7 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS]; #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ -int __devinit rndis_init (void) +int __init rndis_init (void) { u8 i; -- cgit v1.2.3 From a89a2cd396b20c46a37fa8db4b652fb00f29d0a4 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 7 Apr 2008 15:03:25 -0400 Subject: USB: dummy-hcd: use dynamic allocation for platform_devices This patch (as1075) changes dummy-hcd to dynamically allocate its platform_device structures, using the core platform_device_alloc() interface. This is what it should have done all along, because the dynamically-allocated structures have a release method in the driver core and are therefore immune to being released after the module has been unloaded. Thanks to Richard Purdie for pointing out the need for this change. Signed-off-by: Alan Stern Cc: Richard Purdie Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/dummy_hcd.c | 70 +++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 433f8c47cce..74f51a703b4 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -1933,69 +1933,57 @@ static struct platform_driver dummy_hcd_driver = { /*-------------------------------------------------------------------------*/ -/* These don't need to do anything because the pdev structures are - * statically allocated. */ -static void -dummy_udc_release (struct device *dev) {} - -static void -dummy_hcd_release (struct device *dev) {} - -static struct platform_device the_udc_pdev = { - .name = (char *) gadget_name, - .id = -1, - .dev = { - .release = dummy_udc_release, - }, -}; - -static struct platform_device the_hcd_pdev = { - .name = (char *) driver_name, - .id = -1, - .dev = { - .release = dummy_hcd_release, - }, -}; +static struct platform_device *the_udc_pdev; +static struct platform_device *the_hcd_pdev; static int __init init (void) { - int retval; + int retval = -ENOMEM; if (usb_disabled ()) return -ENODEV; - retval = platform_driver_register (&dummy_hcd_driver); - if (retval < 0) + the_hcd_pdev = platform_device_alloc(driver_name, -1); + if (!the_hcd_pdev) return retval; + the_udc_pdev = platform_device_alloc(gadget_name, -1); + if (!the_udc_pdev) + goto err_alloc_udc; - retval = platform_driver_register (&dummy_udc_driver); + retval = platform_driver_register(&dummy_hcd_driver); + if (retval < 0) + goto err_register_hcd_driver; + retval = platform_driver_register(&dummy_udc_driver); if (retval < 0) goto err_register_udc_driver; - retval = platform_device_register (&the_hcd_pdev); + retval = platform_device_add(the_hcd_pdev); if (retval < 0) - goto err_register_hcd; - - retval = platform_device_register (&the_udc_pdev); + goto err_add_hcd; + retval = platform_device_add(the_udc_pdev); if (retval < 0) - goto err_register_udc; + goto err_add_udc; return retval; -err_register_udc: - platform_device_unregister (&the_hcd_pdev); -err_register_hcd: - platform_driver_unregister (&dummy_udc_driver); +err_add_udc: + platform_device_del(the_hcd_pdev); +err_add_hcd: + platform_driver_unregister(&dummy_udc_driver); err_register_udc_driver: - platform_driver_unregister (&dummy_hcd_driver); + platform_driver_unregister(&dummy_hcd_driver); +err_register_hcd_driver: + platform_device_put(the_udc_pdev); +err_alloc_udc: + platform_device_put(the_hcd_pdev); return retval; } module_init (init); static void __exit cleanup (void) { - platform_device_unregister (&the_udc_pdev); - platform_device_unregister (&the_hcd_pdev); - platform_driver_unregister (&dummy_udc_driver); - platform_driver_unregister (&dummy_hcd_driver); + platform_device_unregister(the_udc_pdev); + platform_device_unregister(the_hcd_pdev); + platform_driver_unregister(&dummy_udc_driver); + platform_driver_unregister(&dummy_hcd_driver); } module_exit (cleanup); -- cgit v1.2.3 From 3cf2723432dd27402a4a4941ad2d04eae5dd639c Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 6 Apr 2008 23:32:55 -0700 Subject: USB: at91_udc can prefetch data The at91sam9 chip are ARMv5 so they support preload instructions. Use preloading to load the FIFO a bit faster. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/at91_udc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index fd15ced899d..5d352c900d2 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -389,6 +389,7 @@ static int write_fifo(struct at91_ep *ep, struct at91_request *req) u32 csr = __raw_readl(creg); u8 __iomem *dreg = ep->creg + (AT91_UDP_FDR(0) - AT91_UDP_CSR(0)); unsigned total, count, is_last; + u8 *buf; /* * TODO: allow for writing two packets to the fifo ... that'll @@ -413,6 +414,8 @@ static int write_fifo(struct at91_ep *ep, struct at91_request *req) return 0; } + buf = req->req.buf + req->req.actual; + prefetch(buf); total = req->req.length - req->req.actual; if (ep->ep.maxpacket < total) { count = ep->ep.maxpacket; @@ -435,7 +438,7 @@ static int write_fifo(struct at91_ep *ep, struct at91_request *req) * recover when the actual bytecount matters (e.g. for USB Test * and Measurement Class devices). */ - __raw_writesb(dreg, req->req.buf + req->req.actual, count); + __raw_writesb(dreg, buf, count); csr &= ~SET_FX; csr |= CLR_FX | AT91_UDP_TXPKTRDY; __raw_writel(csr, creg); -- cgit v1.2.3 From 21da84a89312dd8d014ca3352d1ab5c2279ec548 Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Tue, 8 Apr 2008 14:30:18 -0700 Subject: USB: ehci shutdown refactored This patch refactors some shutdown code so it can be shared between ehci_stop() and ehci_shutdown(). This also fixes a couple potential bugs: - ehci_shutdown() was not locking ehci->lock before halting the HC. - ehci_shutdown() didn't disable the watchdog and IAA timers. - ehci_stop() was resetting the host controller when it may have been running, which the EHCI spec says "may result in undefined behavior". ehci_stop() was calling port_power() to turn off the ports, which waited 20ms after applying the port change. The msleep was for the case where the HC might take 20ms to turn the ports on; since we're shutting them off, we can avoid the msleep and just use ehci_turn_off_ports(). ehci_stop() doesn't need to clear the intr_enable register or revert ownership of the companion controllers to the BIOS, because the host controller reset should have done that. There might be a buggy host controller that doesn't follow the reset rules, but for now we assume it's redundant code and remove it. [ A subsequent patch will cancel the timers later ... this version carries forward existing bugs where timers could get re-armed after they're canceled. ] Signed-off-by: Sarah Sharp Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-hcd.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index a02dcff5eb2..369a8a5ea7b 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -331,17 +331,13 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci) &ehci->regs->port_status[port]); } -/* ehci_shutdown kick in for silicon on any bus (not just pci, etc). - * This forcibly disables dma and IRQs, helping kexec and other cases - * where the next system software may expect clean state. +/* + * Halt HC, turn off all ports, and let the BIOS use the companion controllers. + * Should be called with ehci->lock held. */ -static void -ehci_shutdown (struct usb_hcd *hcd) +static void ehci_silence_controller(struct ehci_hcd *ehci) { - struct ehci_hcd *ehci; - - ehci = hcd_to_ehci (hcd); - (void) ehci_halt (ehci); + ehci_halt(ehci); ehci_turn_off_all_ports(ehci); /* make BIOS/etc use companion controller during reboot */ @@ -351,6 +347,22 @@ ehci_shutdown (struct usb_hcd *hcd) ehci_readl(ehci, &ehci->regs->configured_flag); } +/* ehci_shutdown kick in for silicon on any bus (not just pci, etc). + * This forcibly disables dma and IRQs, helping kexec and other cases + * where the next system software may expect clean state. + */ +static void ehci_shutdown(struct usb_hcd *hcd) +{ + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + + del_timer_sync(&ehci->watchdog); + del_timer_sync(&ehci->iaa_watchdog); + + spin_lock_irq(&ehci->lock); + ehci_silence_controller(ehci); + spin_unlock_irq(&ehci->lock); +} + static void ehci_port_power (struct ehci_hcd *ehci, int is_on) { unsigned port; @@ -401,15 +413,15 @@ static void ehci_work (struct ehci_hcd *ehci) timer_action (ehci, TIMER_IO_WATCHDOG); } +/* + * Called when the ehci_hcd module is removed. + */ static void ehci_stop (struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); ehci_dbg (ehci, "stop\n"); - /* Turn off port power on all root hub ports. */ - ehci_port_power (ehci, 0); - /* no more interrupts ... */ del_timer_sync (&ehci->watchdog); del_timer_sync(&ehci->iaa_watchdog); @@ -418,13 +430,10 @@ static void ehci_stop (struct usb_hcd *hcd) if (HC_IS_RUNNING (hcd->state)) ehci_quiesce (ehci); + ehci_silence_controller(ehci); ehci_reset (ehci); - ehci_writel(ehci, 0, &ehci->regs->intr_enable); spin_unlock_irq(&ehci->lock); - /* let companion controllers work when we aren't */ - ehci_writel(ehci, 0, &ehci->regs->configured_flag); - remove_companion_file(ehci); remove_debug_files (ehci); -- cgit v1.2.3 From 97af0a911bfb1e798c395c6ebabb4731f821736f Mon Sep 17 00:00:00 2001 From: Paulius Zaleckas Date: Thu, 10 Apr 2008 14:20:08 +0300 Subject: USB: oti6858: fix TCFLSH ioctl handling Removes unimplemented TCFLSH handling from oti6858, because it was preventing TCFLSH handling by upper layer (line discipline) drivers (see drivers/char/tty_io.c line 3450). Signed-off-by: Paulius Zaleckas Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/oti6858.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index a3847d6c946..8acc907a318 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -814,10 +814,6 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file, __FUNCTION__, port->number, cmd, arg); switch (cmd) { - case TCFLSH: - /* FIXME */ - return 0; - case TIOCMBIS: if (copy_from_user(&x, user_arg, sizeof(x))) return -EFAULT; -- cgit v1.2.3 From 6d8791076c7742c65dd796ae0ac260ab22e85517 Mon Sep 17 00:00:00 2001 From: Yoshihiro Shimoda Date: Thu, 10 Apr 2008 21:05:47 +0900 Subject: USB: r8a66597-hcd: fix interrupt transfer interval This driver ignored the value of bInterval and revised the problem that performed interrupt transfer. ASIX USB Ethernet adapter comes to work with this host controller by applying this patch. Signed-off-by: Yoshihiro Shimoda Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/r8a66597-hcd.c | 77 +++++++++++++++++++++++++++++++++++------ drivers/usb/host/r8a66597.h | 3 ++ 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index b46ff9a80b6..dac2f7dd69b 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -46,7 +46,7 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Yoshihiro Shimoda"); MODULE_ALIAS("platform:r8a66597_hcd"); -#define DRIVER_VERSION "29 May 2007" +#define DRIVER_VERSION "10 Apr 2008" static const char hcd_name[] = "r8a66597_hcd"; @@ -577,13 +577,9 @@ static void pipe_buffer_setting(struct r8a66597 *r8a66597, PIPEBUF); r8a66597_write(r8a66597, make_devsel(info->address) | info->maxpacket, PIPEMAXP); - if (info->interval) - info->interval--; r8a66597_write(r8a66597, info->interval, PIPEPERI); } - - /* this function must be called with interrupt disabled */ static void pipe_setting(struct r8a66597 *r8a66597, struct r8a66597_td *td) { @@ -825,6 +821,25 @@ static void disable_r8a66597_pipe_all(struct r8a66597 *r8a66597, dev->dma_map = 0; } +static unsigned long get_timer_interval(struct urb *urb, __u8 interval) +{ + __u8 i; + unsigned long time = 1; + + if (usb_pipeisoc(urb->pipe)) + return 0; + + if (get_r8a66597_usb_speed(urb->dev->speed) == HSMODE) { + for (i = 0; i < (interval - 1); i++) + time *= 2; + time = time * 125 / 1000; /* uSOF -> msec */ + } else { + time = interval; + } + + return time; +} + /* this function must be called with interrupt disabled */ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb, struct usb_host_endpoint *hep, @@ -840,7 +855,16 @@ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb, & USB_ENDPOINT_XFERTYPE_MASK); info.bufnum = get_bufnum(info.pipenum); info.buf_bsize = get_buf_bsize(info.pipenum); - info.interval = ep->bInterval; + if (info.type == R8A66597_BULK) { + info.interval = 0; + info.timer_interval = 0; + } else { + if (ep->bInterval > IITV) + info.interval = IITV; + else + info.interval = ep->bInterval ? ep->bInterval - 1 : 0; + info.timer_interval = get_timer_interval(urb, ep->bInterval); + } if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) info.dir_in = 1; else @@ -1582,6 +1606,29 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) } } +static void r8a66597_interval_timer(unsigned long _r8a66597) +{ + struct r8a66597 *r8a66597 = (struct r8a66597 *)_r8a66597; + unsigned long flags; + u16 pipenum; + struct r8a66597_td *td; + + spin_lock_irqsave(&r8a66597->lock, flags); + + for (pipenum = 0; pipenum < R8A66597_MAX_NUM_PIPE; pipenum++) { + if (!(r8a66597->interval_map & (1 << pipenum))) + continue; + if (timer_pending(&r8a66597->interval_timer[pipenum])) + continue; + + td = r8a66597_get_td(r8a66597, pipenum); + if (td) + start_transfer(r8a66597, td); + } + + spin_unlock_irqrestore(&r8a66597->lock, flags); +} + static void r8a66597_td_timer(unsigned long _r8a66597) { struct r8a66597 *r8a66597 = (struct r8a66597 *)_r8a66597; @@ -1763,10 +1810,17 @@ static int r8a66597_urb_enqueue(struct usb_hcd *hcd, urb->hcpriv = td; if (request) { - ret = start_transfer(r8a66597, td); - if (ret < 0) { - list_del(&td->queue); - kfree(td); + if (td->pipe->info.timer_interval) { + r8a66597->interval_map |= 1 << td->pipenum; + mod_timer(&r8a66597->interval_timer[td->pipenum], + jiffies + msecs_to_jiffies( + td->pipe->info.timer_interval)); + } else { + ret = start_transfer(r8a66597, td); + if (ret < 0) { + list_del(&td->queue); + kfree(td); + } } } else set_td_timer(r8a66597, td); @@ -2192,6 +2246,9 @@ static int __init r8a66597_probe(struct platform_device *pdev) init_timer(&r8a66597->td_timer[i]); r8a66597->td_timer[i].function = r8a66597_td_timer; r8a66597->td_timer[i].data = (unsigned long)r8a66597; + setup_timer(&r8a66597->interval_timer[i], + r8a66597_interval_timer, + (unsigned long)r8a66597); } INIT_LIST_HEAD(&r8a66597->child_device); diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 57388252b69..a01461017ad 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h @@ -404,6 +404,7 @@ #define make_devsel(addr) (addr << 12) struct r8a66597_pipe_info { + unsigned long timer_interval; u16 pipenum; u16 address; /* R8A66597 HCD usb address */ u16 epnum; @@ -478,9 +479,11 @@ struct r8a66597 { struct timer_list rh_timer; struct timer_list td_timer[R8A66597_MAX_NUM_PIPE]; + struct timer_list interval_timer[R8A66597_MAX_NUM_PIPE]; unsigned short address_map; unsigned short timeout_map; + unsigned short interval_map; unsigned char pipe_cnt[R8A66597_MAX_NUM_PIPE]; unsigned char dma_map; -- cgit v1.2.3 From 29fab0cd897519be9009ba8c898410ab83b378e9 Mon Sep 17 00:00:00 2001 From: Yoshihiro Shimoda Date: Thu, 10 Apr 2008 21:05:55 +0900 Subject: USB: r8a66597-hcd: fix usb device connection timing Fix the problem that enumeration of a USB device was slow. Signed-off-by: Yoshihiro Shimoda Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/r8a66597-hcd.c | 56 +++++++++++++++++++++++------------------ drivers/usb/host/r8a66597.h | 3 ++- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index dac2f7dd69b..bb48f42bd7c 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -900,10 +900,19 @@ static void pipe_irq_disable(struct r8a66597 *r8a66597, u16 pipenum) } /* this function must be called with interrupt disabled */ -static void r8a66597_usb_preconnect(struct r8a66597 *r8a66597, int port) +static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port, + u16 syssts) { - r8a66597->root_hub[port].port |= (1 << USB_PORT_FEAT_CONNECTION) - | (1 << USB_PORT_FEAT_C_CONNECTION); + if (syssts == SE0) { + r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); + return; + } + + if (syssts == FS_JSTS) + r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port)); + else if (syssts == LS_JSTS) + r8a66597_bclr(r8a66597, HSE, get_syscfg_reg(port)); + r8a66597_write(r8a66597, ~DTCH, get_intsts_reg(port)); r8a66597_bset(r8a66597, DTCHE, get_intenb_reg(port)); } @@ -1478,13 +1487,21 @@ static void irq_pipe_nrdy(struct r8a66597 *r8a66597) } } +static void r8a66597_root_hub_start_polling(struct r8a66597 *r8a66597) +{ + mod_timer(&r8a66597->rh_timer, + jiffies + msecs_to_jiffies(R8A66597_RH_POLL_TIME)); +} + static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port) { struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; rh->scount = R8A66597_MAX_SAMPLING; - mod_timer(&r8a66597->rh_timer, jiffies + msecs_to_jiffies(50)); + r8a66597->root_hub[port].port |= (1 << USB_PORT_FEAT_CONNECTION) + | (1 << USB_PORT_FEAT_C_CONNECTION); + r8a66597_root_hub_start_polling(r8a66597); } static irqreturn_t r8a66597_irq(struct usb_hcd *hcd) @@ -1571,37 +1588,28 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) if ((tmp & USBRST) == USBRST) { r8a66597_mdfy(r8a66597, UACT, USBRST | UACT, dvstctr_reg); - mod_timer(&r8a66597->rh_timer, - jiffies + msecs_to_jiffies(50)); + r8a66597_root_hub_start_polling(r8a66597); } else r8a66597_usb_connect(r8a66597, port); } + if (!(rh->port & (1 << USB_PORT_FEAT_CONNECTION))) { + r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); + r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); + } + if (rh->scount > 0) { tmp = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; if (tmp == rh->old_syssts) { rh->scount--; - if (rh->scount == 0) { - if (tmp == FS_JSTS) { - r8a66597_bset(r8a66597, HSE, - get_syscfg_reg(port)); - r8a66597_usb_preconnect(r8a66597, port); - } else if (tmp == LS_JSTS) { - r8a66597_bclr(r8a66597, HSE, - get_syscfg_reg(port)); - r8a66597_usb_preconnect(r8a66597, port); - } else if (tmp == SE0) - r8a66597_bset(r8a66597, ATTCHE, - get_intenb_reg(port)); - } else { - mod_timer(&r8a66597->rh_timer, - jiffies + msecs_to_jiffies(50)); - } + if (rh->scount == 0) + r8a66597_check_syssts(r8a66597, port, tmp); + else + r8a66597_root_hub_start_polling(r8a66597); } else { rh->scount = R8A66597_MAX_SAMPLING; rh->old_syssts = tmp; - mod_timer(&r8a66597->rh_timer, - jiffies + msecs_to_jiffies(50)); + r8a66597_root_hub_start_polling(r8a66597); } } } diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index a01461017ad..f46f7dd944a 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h @@ -396,7 +396,8 @@ #define R8A66597_BUF_BSIZE 8 #define R8A66597_MAX_DEVICE 10 #define R8A66597_MAX_ROOT_HUB 2 -#define R8A66597_MAX_SAMPLING 10 +#define R8A66597_MAX_SAMPLING 5 +#define R8A66597_RH_POLL_TIME 10 #define R8A66597_MAX_DMA_CHANNEL 2 #define R8A66597_PIPE_NO_DMA R8A66597_MAX_DMA_CHANNEL #define check_bulk_or_isoc(pipenum) ((pipenum >= 1 && pipenum <= 5)) -- cgit v1.2.3 From 9424ea29658ce5bcdcf527ddf9617b9507ddf1aa Mon Sep 17 00:00:00 2001 From: Yoshihiro Shimoda Date: Thu, 10 Apr 2008 21:05:58 +0900 Subject: USB: r8a66597-hcd: Add support for SH7366 USB host R8A66597 is similar to SH7366 USB 2.0 Host/Function module. It can support SH7366 USB host by changing several R8A66597 code. Signed-off-by: Yoshihiro Shimoda Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/Kconfig | 6 +++ drivers/usb/host/r8a66597-hcd.c | 115 +++++++++++++++++++++++++++------------- drivers/usb/host/r8a66597.h | 45 ++++++++++++++++ 3 files changed, 129 insertions(+), 37 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 27f295b7805..0b87480dd71 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -260,3 +260,9 @@ config USB_R8A66597_HCD To compile this driver as a module, choose M here: the module will be called r8a66597-hcd. +config SUPERH_ON_CHIP_R8A66597 + boolean "Enable SuperH on-chip USB like the R8A66597" + depends on USB_R8A66597_HCD && CPU_SUBTYPE_SH7366 + help + Renesas SuperH processor has USB like the R8A66597. + This driver supported processor is SH7366. diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index bb48f42bd7c..f4fa93dabdd 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -51,10 +51,12 @@ MODULE_ALIAS("platform:r8a66597_hcd"); static const char hcd_name[] = "r8a66597_hcd"; /* module parameters */ +#if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) static unsigned short clock = XTAL12; module_param(clock, ushort, 0644); MODULE_PARM_DESC(clock, "input clock: 48MHz=32768, 24MHz=16384, 12MHz=0 " "(default=0)"); +#endif static unsigned short vif = LDRV; module_param(vif, ushort, 0644); @@ -106,11 +108,22 @@ static void set_devadd_reg(struct r8a66597 *r8a66597, u8 r8a66597_address, r8a66597_write(r8a66597, val, devadd_reg); } -static int enable_controller(struct r8a66597 *r8a66597) +static int r8a66597_clock_enable(struct r8a66597 *r8a66597) { u16 tmp; int i = 0; +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) + do { + r8a66597_write(r8a66597, SCKE, SYSCFG0); + tmp = r8a66597_read(r8a66597, SYSCFG0); + if (i++ > 1000) { + err("register access fail."); + return -ENXIO; + } + } while ((tmp & SCKE) != SCKE); + r8a66597_write(r8a66597, 0x04, 0x02); +#else do { r8a66597_write(r8a66597, USBE, SYSCFG0); tmp = r8a66597_read(r8a66597, SYSCFG0); @@ -132,13 +145,63 @@ static int enable_controller(struct r8a66597 *r8a66597) return -ENXIO; } } while ((tmp & SCKE) != SCKE); +#endif /* #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) */ + + return 0; +} + +static void r8a66597_clock_disable(struct r8a66597 *r8a66597) +{ + r8a66597_bclr(r8a66597, SCKE, SYSCFG0); + udelay(1); +#if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) + r8a66597_bclr(r8a66597, PLLC, SYSCFG0); + r8a66597_bclr(r8a66597, XCKE, SYSCFG0); + r8a66597_bclr(r8a66597, USBE, SYSCFG0); +#endif +} + +static void r8a66597_enable_port(struct r8a66597 *r8a66597, int port) +{ + u16 val; + + val = port ? DRPD : DCFM | DRPD; + r8a66597_bset(r8a66597, val, get_syscfg_reg(port)); + r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port)); + + r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, get_dmacfg_reg(port)); + r8a66597_bclr(r8a66597, DTCHE, get_intenb_reg(port)); + r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); +} + +static void r8a66597_disable_port(struct r8a66597 *r8a66597, int port) +{ + u16 val, tmp; - r8a66597_bset(r8a66597, DCFM | DRPD, SYSCFG0); - r8a66597_bset(r8a66597, DRPD, SYSCFG1); + r8a66597_write(r8a66597, 0, get_intenb_reg(port)); + r8a66597_write(r8a66597, 0, get_intsts_reg(port)); + + r8a66597_port_power(r8a66597, port, 0); + + do { + tmp = r8a66597_read(r8a66597, SOFCFG) & EDGESTS; + udelay(640); + } while (tmp == EDGESTS); + + val = port ? DRPD : DCFM | DRPD; + r8a66597_bclr(r8a66597, val, get_syscfg_reg(port)); + r8a66597_bclr(r8a66597, HSE, get_syscfg_reg(port)); +} + +static int enable_controller(struct r8a66597 *r8a66597) +{ + int ret, port; + + ret = r8a66597_clock_enable(r8a66597); + if (ret < 0) + return ret; r8a66597_bset(r8a66597, vif & LDRV, PINCFG); - r8a66597_bset(r8a66597, HSE, SYSCFG0); - r8a66597_bset(r8a66597, HSE, SYSCFG1); r8a66597_bset(r8a66597, USBE, SYSCFG0); r8a66597_bset(r8a66597, BEMPE | NRDYE | BRDYE, INTENB0); @@ -146,53 +209,30 @@ static int enable_controller(struct r8a66597 *r8a66597) r8a66597_bset(r8a66597, BRDY0, BRDYENB); r8a66597_bset(r8a66597, BEMP0, BEMPENB); - r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, DMA0CFG); - r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, DMA1CFG); - r8a66597_bset(r8a66597, endian & BIGEND, CFIFOSEL); r8a66597_bset(r8a66597, endian & BIGEND, D0FIFOSEL); r8a66597_bset(r8a66597, endian & BIGEND, D1FIFOSEL); - r8a66597_bset(r8a66597, TRNENSEL, SOFCFG); r8a66597_bset(r8a66597, SIGNE | SACKE, INTENB1); - r8a66597_bclr(r8a66597, DTCHE, INTENB1); - r8a66597_bset(r8a66597, ATTCHE, INTENB1); - r8a66597_bclr(r8a66597, DTCHE, INTENB2); - r8a66597_bset(r8a66597, ATTCHE, INTENB2); + + for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) + r8a66597_enable_port(r8a66597, port); return 0; } static void disable_controller(struct r8a66597 *r8a66597) { - u16 tmp; + int port; r8a66597_write(r8a66597, 0, INTENB0); - r8a66597_write(r8a66597, 0, INTENB1); - r8a66597_write(r8a66597, 0, INTENB2); r8a66597_write(r8a66597, 0, INTSTS0); - r8a66597_write(r8a66597, 0, INTSTS1); - r8a66597_write(r8a66597, 0, INTSTS2); - - r8a66597_port_power(r8a66597, 0, 0); - r8a66597_port_power(r8a66597, 1, 0); - - do { - tmp = r8a66597_read(r8a66597, SOFCFG) & EDGESTS; - udelay(640); - } while (tmp == EDGESTS); - r8a66597_bclr(r8a66597, DCFM | DRPD, SYSCFG0); - r8a66597_bclr(r8a66597, DRPD, SYSCFG1); - r8a66597_bclr(r8a66597, HSE, SYSCFG0); - r8a66597_bclr(r8a66597, HSE, SYSCFG1); + for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) + r8a66597_disable_port(r8a66597, port); - r8a66597_bclr(r8a66597, SCKE, SYSCFG0); - udelay(1); - r8a66597_bclr(r8a66597, PLLC, SYSCFG0); - r8a66597_bclr(r8a66597, XCKE, SYSCFG0); - r8a66597_bclr(r8a66597, USBE, SYSCFG0); + r8a66597_clock_disable(r8a66597); } static int get_parent_r8a66597_address(struct r8a66597 *r8a66597, @@ -711,6 +751,7 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597, struct r8a66597_pipe *pipe, struct urb *urb) { +#if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) int i; struct r8a66597_pipe_info *info = &pipe->info; @@ -738,6 +779,7 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597, break; } } +#endif /* #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) */ } /* this function must be called with interrupt disabled */ @@ -1054,8 +1096,7 @@ static void prepare_status_packet(struct r8a66597 *r8a66597, r8a66597_mdfy(r8a66597, ISEL, ISEL | CURPIPE, CFIFOSEL); r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, 0); r8a66597_write(r8a66597, ~BEMP0, BEMPSTS); - r8a66597_write(r8a66597, BCLR, CFIFOCTR); - r8a66597_write(r8a66597, BVAL, CFIFOCTR); + r8a66597_write(r8a66597, BCLR | BVAL, CFIFOCTR); enable_irq_empty(r8a66597, 0); } else { r8a66597_bclr(r8a66597, R8A66597_DIR, DCPCFG); diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index f46f7dd944a..84ee0141731 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h @@ -187,7 +187,11 @@ #define REW 0x4000 /* b14: Buffer rewind */ #define DCLRM 0x2000 /* b13: DMA buffer clear mode */ #define DREQE 0x1000 /* b12: DREQ output enable */ +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) +#define MBW 0x0800 +#else #define MBW 0x0400 /* b10: Maximum bit width for FIFO access */ +#endif #define MBW_8 0x0000 /* 8bit */ #define MBW_16 0x0400 /* 16bit */ #define BIGEND 0x0100 /* b8: Big endian mode */ @@ -395,7 +399,11 @@ #define R8A66597_MAX_NUM_PIPE 10 #define R8A66597_BUF_BSIZE 8 #define R8A66597_MAX_DEVICE 10 +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) +#define R8A66597_MAX_ROOT_HUB 1 +#else #define R8A66597_MAX_ROOT_HUB 2 +#endif #define R8A66597_MAX_SAMPLING 5 #define R8A66597_RH_POLL_TIME 10 #define R8A66597_MAX_DMA_CHANNEL 2 @@ -530,8 +538,21 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, unsigned long offset, u16 *buf, int len) { +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) + unsigned long fifoaddr = r8a66597->reg + offset; + unsigned long count; + + count = len / 4; + insl(fifoaddr, buf, count); + + if (len & 0x00000003) { + unsigned long tmp = inl(fifoaddr); + memcpy((unsigned char *)buf + count * 4, &tmp, len & 0x03); + } +#else len = (len + 1) / 2; insw(r8a66597->reg + offset, buf, len); +#endif } static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, @@ -545,6 +566,24 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, int len) { unsigned long fifoaddr = r8a66597->reg + offset; +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) + unsigned long count; + unsigned char *pb; + int i; + + count = len / 4; + outsl(fifoaddr, buf, count); + + if (len & 0x00000003) { + pb = (unsigned char *)buf + count * 4; + for (i = 0; i < (len & 0x00000003); i++) { + if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) + outb(pb[i], fifoaddr + i); + else + outb(pb[i], fifoaddr + 3 - i); + } + } +#else int odd = len & 0x0001; len = len / 2; @@ -553,6 +592,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, buf = &buf[len]; outb((unsigned char)*buf, fifoaddr); } +#endif } static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, @@ -585,6 +625,11 @@ static inline unsigned long get_dvstctr_reg(int port) return port == 0 ? DVSTCTR0 : DVSTCTR1; } +static inline unsigned long get_dmacfg_reg(int port) +{ + return port == 0 ? DMA0CFG : DMA1CFG; +} + static inline unsigned long get_intenb_reg(int port) { return port == 0 ? INTENB1 : INTENB2; -- cgit v1.2.3 From eda769593bbae8aee4e336b0732f6016353301a3 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 10 Apr 2008 14:07:37 +0200 Subject: USB: add extension of anchor API, usb_unlink_anchored_urbs This adds the ability to trigger asynchronous unlinks of anchored URBs. This is needed for error handling in the comntext of completion handlers, which cannot sleep. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/urb.c | 24 ++++++++++++++++++++++++ include/linux/usb.h | 1 + 2 files changed, 25 insertions(+) diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 9d7e63292c0..1d3ed1322fb 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -589,6 +589,30 @@ void usb_kill_anchored_urbs(struct usb_anchor *anchor) } EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); +/** + * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse + * @anchor: anchor the requests are bound to + * + * this allows all outstanding URBs to be unlinked starting + * from the back of the queue. This function is asynchronous. + * The unlinking is just tiggered. It may happen after this + * function has returned. + */ +void usb_unlink_anchored_urbs(struct usb_anchor *anchor) +{ + struct urb *victim; + + spin_lock_irq(&anchor->lock); + while (!list_empty(&anchor->urb_list)) { + victim = list_entry(anchor->urb_list.prev, struct urb, + anchor_list); + /* this will unanchor the URB */ + usb_unlink_urb(victim); + } + spin_unlock_irq(&anchor->lock); +} +EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); + /** * usb_wait_anchor_empty_timeout - wait for an anchor to be unused * @anchor: the anchor you want to become unused diff --git a/include/linux/usb.h b/include/linux/usb.h index dd9733cc0ac..52c449e4bdc 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1451,6 +1451,7 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); extern int usb_unlink_urb(struct urb *urb); extern void usb_kill_urb(struct urb *urb); extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); +extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); extern void usb_unanchor_urb(struct urb *urb); extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, -- cgit v1.2.3 From 51c159e7a8310f7272154fdd096315ae86bd36c2 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sun, 6 Apr 2008 08:00:30 -0400 Subject: USB: Remove superfluous "depends on USB_SERIAL" from Kconfig. Given that most of drivers/usb/serial/Kconfig is wrapped inside: if USB_SERIAL ... endif # USB_SERIAL remove the consequently redundant dependencies on USB_SERIAL. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/Kconfig | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index f9c6c0922c0..2cffec85ee7 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -44,13 +44,11 @@ config USB_SERIAL_CONSOLE config USB_EZUSB bool "Functions for loading firmware on EZUSB chips" - depends on USB_SERIAL help Say Y here if you need EZUSB device support. config USB_SERIAL_GENERIC bool "USB Generic Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use the generic USB serial driver. Please read for more information on @@ -60,7 +58,6 @@ config USB_SERIAL_GENERIC config USB_SERIAL_AIRCABLE tristate "USB AIRcable Bluetooth Dongle Driver" - depends on USB_SERIAL help Say Y here if you want to use USB AIRcable Bluetooth Dongle. @@ -69,7 +66,6 @@ config USB_SERIAL_AIRCABLE config USB_SERIAL_AIRPRIME tristate "USB AirPrime CDMA Wireless Driver" - depends on USB_SERIAL help Say Y here if you want to use a AirPrime CDMA Wireless PC card. @@ -78,7 +74,6 @@ config USB_SERIAL_AIRPRIME config USB_SERIAL_ARK3116 tristate "USB ARK Micro 3116 USB Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use a ARK Micro 3116 USB to Serial device. @@ -88,7 +83,6 @@ config USB_SERIAL_ARK3116 config USB_SERIAL_BELKIN tristate "USB Belkin and Peracom Single Port Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use a Belkin USB Serial single port adaptor (F5U103 is one of the model numbers) or the Peracom single @@ -99,7 +93,6 @@ config USB_SERIAL_BELKIN config USB_SERIAL_CH341 tristate "USB Winchiphead CH341 Single Port Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use a Winchiphead CH341 single port USB to serial adapter. @@ -109,7 +102,6 @@ config USB_SERIAL_CH341 config USB_SERIAL_WHITEHEAT tristate "USB ConnectTech WhiteHEAT Serial Driver" - depends on USB_SERIAL select USB_EZUSB help Say Y here if you want to use a ConnectTech WhiteHEAT 4 port @@ -120,7 +112,6 @@ config USB_SERIAL_WHITEHEAT config USB_SERIAL_DIGI_ACCELEPORT tristate "USB Digi International AccelePort USB Serial Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use Digi AccelePort USB 2 or 4 devices, 2 port (plus parallel port) and 4 port USB serial converters. The @@ -135,7 +126,6 @@ config USB_SERIAL_DIGI_ACCELEPORT config USB_SERIAL_CP2101 tristate "USB CP2101 UART Bridge Controller" - depends on USB_SERIAL help Say Y here if you want to use a CP2101/CP2102 based USB to RS232 converter. @@ -145,7 +135,6 @@ config USB_SERIAL_CP2101 config USB_SERIAL_CYPRESS_M8 tristate "USB Cypress M8 USB Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use a device that contains the Cypress USB to Serial microcontroller, such as the DeLorme Earthmate GPS. @@ -160,7 +149,6 @@ config USB_SERIAL_CYPRESS_M8 config USB_SERIAL_EMPEG tristate "USB Empeg empeg-car Mark I/II Driver" - depends on USB_SERIAL help Say Y here if you want to connect to your Empeg empeg-car Mark I/II mp3 player via USB. The driver uses a single ttyUSB{0,1,2,...} @@ -172,7 +160,6 @@ config USB_SERIAL_EMPEG config USB_SERIAL_FTDI_SIO tristate "USB FTDI Single Port Serial Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use a FTDI SIO single port USB to serial converter device. The implementation I have is called the USC-1000. @@ -186,7 +173,6 @@ config USB_SERIAL_FTDI_SIO config USB_SERIAL_FUNSOFT tristate "USB Fundamental Software Dongle Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use the Fundamental Software dongle. @@ -195,7 +181,6 @@ config USB_SERIAL_FUNSOFT config USB_SERIAL_VISOR tristate "USB Handspring Visor / Palm m50x / Sony Clie Driver" - depends on USB_SERIAL help Say Y here if you want to connect to your HandSpring Visor, Palm m500 or m505 through its USB docking station. See @@ -207,7 +192,6 @@ config USB_SERIAL_VISOR config USB_SERIAL_IPAQ tristate "USB PocketPC PDA Driver" - depends on USB_SERIAL help Say Y here if you want to connect to your Compaq iPAQ, HP Jornada or any other PDA running Windows CE 3.0 or PocketPC 2002 @@ -219,7 +203,6 @@ config USB_SERIAL_IPAQ config USB_SERIAL_IR tristate "USB IR Dongle Serial Driver" - depends on USB_SERIAL help Say Y here if you want to enable simple serial support for USB IrDA devices. This is useful if you do not want to use the full IrDA @@ -230,7 +213,6 @@ config USB_SERIAL_IR config USB_SERIAL_EDGEPORT tristate "USB Inside Out Edgeport Serial Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use any of the following devices from Inside Out Networks (Digi): @@ -256,7 +238,6 @@ config USB_SERIAL_EDGEPORT config USB_SERIAL_EDGEPORT_TI tristate "USB Inside Out Edgeport Serial Driver (TI devices)" - depends on USB_SERIAL help Say Y here if you want to use any of the devices from Inside Out Networks (Digi) that are not supported by the io_edgeport driver. @@ -267,7 +248,6 @@ config USB_SERIAL_EDGEPORT_TI config USB_SERIAL_GARMIN tristate "USB Garmin GPS driver" - depends on USB_SERIAL help Say Y here if you want to connect to your Garmin GPS. Should work with most Garmin GPS devices which have a native USB port. @@ -280,7 +260,6 @@ config USB_SERIAL_GARMIN config USB_SERIAL_IPW tristate "USB IPWireless (3G UMTS TDD) Driver" - depends on USB_SERIAL help Say Y here if you want to use a IPWireless USB modem such as the ones supplied by Axity3G/Sentech South Africa. @@ -290,7 +269,6 @@ config USB_SERIAL_IPW config USB_SERIAL_IUU tristate "USB Infinity USB Unlimited Phoenix Driver" - depends on USB_SERIAL help Say Y here if you want to use a IUU in phoenix mode and get an extra ttyUSBx device. More information available on @@ -301,7 +279,6 @@ config USB_SERIAL_IUU config USB_SERIAL_KEYSPAN_PDA tristate "USB Keyspan PDA Single Port Serial Driver" - depends on USB_SERIAL select USB_EZUSB help Say Y here if you want to use a Keyspan PDA single port USB to @@ -313,7 +290,6 @@ config USB_SERIAL_KEYSPAN_PDA config USB_SERIAL_KEYSPAN tristate "USB Keyspan USA-xxx Serial Driver" - depends on USB_SERIAL select USB_EZUSB ---help--- Say Y here if you want to use Keyspan USB to serial converter @@ -406,7 +382,6 @@ config USB_SERIAL_KEYSPAN_USA49WLC config USB_SERIAL_KLSI tristate "USB KL5KUSB105 (Palmconnect) Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use a KL5KUSB105 - based single port serial adapter. The most widely known -- and currently the only @@ -422,7 +397,6 @@ config USB_SERIAL_KLSI config USB_SERIAL_KOBIL_SCT tristate "USB KOBIL chipcard reader" - depends on USB_SERIAL ---help--- Say Y here if you want to use one of the following KOBIL USB chipcard readers: @@ -440,7 +414,6 @@ config USB_SERIAL_KOBIL_SCT config USB_SERIAL_MCT_U232 tristate "USB MCT Single Port Serial Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use a USB Serial single port adapter from Magic Control Technology Corp. (U232 is one of the model numbers). @@ -453,7 +426,6 @@ config USB_SERIAL_MCT_U232 config USB_SERIAL_MOS7720 tristate "USB Moschip 7720 Serial Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use USB Serial single and double port adapters from Moschip Semiconductor Tech. @@ -463,7 +435,6 @@ config USB_SERIAL_MOS7720 config USB_SERIAL_MOS7840 tristate "USB Moschip 7840/7820 USB Serial Driver" - depends on USB_SERIAL ---help--- Say Y here if you want to use a MCS7840 Quad-Serial or MCS7820 Dual-Serial port device from MosChip Semiconductor. @@ -478,14 +449,12 @@ config USB_SERIAL_MOS7840 config USB_SERIAL_NAVMAN tristate "USB Navman GPS device" - depends on USB_SERIAL help To compile this driver as a module, choose M here: the module will be called navman. config USB_SERIAL_PL2303 tristate "USB Prolific 2303 Single Port Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use the PL2303 USB Serial single port adapter from Prolific. @@ -495,7 +464,6 @@ config USB_SERIAL_PL2303 config USB_SERIAL_OTI6858 tristate "USB Ours Technology Inc. OTi-6858 USB To RS232 Bridge Controller" - depends on USB_SERIAL help Say Y here if you want to use the OTi-6858 single port USB to serial converter device. @@ -505,7 +473,6 @@ config USB_SERIAL_OTI6858 config USB_SERIAL_SPCP8X5 tristate "USB SPCP8x5 USB To Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use the spcp8x5 converter chip. This is commonly found in some Z-Wave USB devices. @@ -515,7 +482,6 @@ config USB_SERIAL_SPCP8X5 config USB_SERIAL_HP4X tristate "USB HP4x Calculators support" - depends on USB_SERIAL help Say Y here if you want to use an Hewlett-Packard 4x Calculator. @@ -524,7 +490,6 @@ config USB_SERIAL_HP4X config USB_SERIAL_SAFE tristate "USB Safe Serial (Encapsulated) Driver" - depends on USB_SERIAL config USB_SERIAL_SAFE_PADDED bool "USB Secure Encapsulated Driver - Padded" @@ -532,7 +497,6 @@ config USB_SERIAL_SAFE_PADDED config USB_SERIAL_SIERRAWIRELESS tristate "USB Sierra Wireless Driver" - depends on USB_SERIAL help Say M here if you want to use a Sierra Wireless device (if using an PC 5220 or AC580 please use the Airprime driver @@ -543,7 +507,6 @@ config USB_SERIAL_SIERRAWIRELESS config USB_SERIAL_TI tristate "USB TI 3410/5052 Serial Driver" - depends on USB_SERIAL help Say Y here if you want to use the TI USB 3410 or 5052 serial devices. @@ -553,7 +516,6 @@ config USB_SERIAL_TI config USB_SERIAL_CYBERJACK tristate "USB REINER SCT cyberJack pinpad/e-com chipcard reader" - depends on USB_SERIAL ---help--- Say Y here if you want to use a cyberJack pinpad/e-com USB chipcard reader. This is an interface to ISO 7816 compatible contact-based @@ -566,7 +528,6 @@ config USB_SERIAL_CYBERJACK config USB_SERIAL_XIRCOM tristate "USB Xircom / Entregra Single Port Serial Driver" - depends on USB_SERIAL select USB_EZUSB help Say Y here if you want to use a Xircom or Entregra single port USB to @@ -578,7 +539,6 @@ config USB_SERIAL_XIRCOM config USB_SERIAL_OPTION tristate "USB driver for GSM and CDMA modems" - depends on USB_SERIAL help Say Y here if you have a GSM or CDMA modem that's connected to USB. @@ -597,7 +557,6 @@ config USB_SERIAL_OPTION config USB_SERIAL_OMNINET tristate "USB ZyXEL omni.net LCD Plus Driver" - depends on USB_SERIAL help Say Y here if you want to use a ZyXEL omni.net LCD ISDN TA. @@ -606,7 +565,6 @@ config USB_SERIAL_OMNINET config USB_SERIAL_DEBUG tristate "USB Debugging Device" - depends on USB_SERIAL help Say Y here if you have a USB debugging device used to receive debugging data from another machine. The most common of these -- cgit v1.2.3 From 7ef4f0600df3dc2beff838b3f03652677ed28311 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 10 Apr 2008 15:15:37 +0200 Subject: USB: update comments about usb driver's header Comments here are so outdated that they are plain wrong. We cannot expect people to write correct drivers if the headers have incorrect comments. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 52c449e4bdc..4a91181629d 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -938,10 +938,11 @@ struct usbdrv_wrap { * and should normally be the same as the module name. * @probe: Called to see if the driver is willing to manage a particular * interface on a device. If it is, probe returns zero and uses - * dev_set_drvdata() to associate driver-specific data with the + * usb_set_intfdata() to associate driver-specific data with the * interface. It may also use usb_set_interface() to specify the * appropriate altsetting. If unwilling to manage the interface, - * return a negative errno value. + * return -ENODEV, if genuine IO errors occured, an appropriate + * negative errno value. * @disconnect: Called when the interface is no longer accessible, usually * because its device has been (or is being) disconnected or the * driver module is being unloaded. @@ -956,10 +957,7 @@ struct usbdrv_wrap { * @pre_reset: Called by usb_reset_composite_device() when the device * is about to be reset. * @post_reset: Called by usb_reset_composite_device() after the device - * has been reset, or in lieu of @resume following a reset-resume - * (i.e., the device is reset instead of being resumed, as might - * happen if power was lost). The second argument tells which is - * the reason. + * has been reset * @id_table: USB drivers use ID table to support hotplugging. * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set * or your driver's probe function will never get called. -- cgit v1.2.3 From 6427f7995338387ddded92f98adec19ddbf0ae5e Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 10 Apr 2008 12:45:34 -0400 Subject: USB: log an error message when USB enumeration fails This patch (as1077) logs an error message whenever the kernel is unable to enumerate a new USB device. Signed-off-by: Alan Stern Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9fc5179dfc6..1e23e360ea9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2708,6 +2708,7 @@ loop: if ((status == -ENOTCONN) || (status == -ENOTSUPP)) break; } + dev_err(hub_dev, "unable to enumerate USB device on port %d\n", port1); done: hub_port_disable(hub, port1, 1); -- cgit v1.2.3 From a082b5c7882bdbd8a86ace8470ca2ecda796d5a7 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Thu, 10 Apr 2008 14:21:06 -0700 Subject: USB: ehci: qh/qtd cleanup comments Provide better comments about qh_completions() and QTD handling. That code can be *VERY* confusing, since it's evolved over a few years to cope with both hardware races and silicon quirks. Remove two unlikely() annotations that match the GCC defaults (and are thus pointless); add an "else" to highlight code flow. This patch doesn't change driver behavior. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-q.c | 50 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index c0e752cffc6..64942ec584c 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -336,11 +336,20 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) /* always clean up qtds the hc de-activated */ if ((token & QTD_STS_ACTIVE) == 0) { + /* on STALL, error, and short reads this urb must + * complete and all its qtds must be recycled. + */ if ((token & QTD_STS_HALT) != 0) { stopped = 1; /* magic dummy for some short reads; qh won't advance. * that silicon quirk can kick in with this dummy too. + * + * other short reads won't stop the queue, including + * control transfers (status stage handles that) or + * most other single-qtd reads ... the queue stops if + * URB_SHORT_NOT_OK was set so the driver submitting + * the urbs could clean it up. */ } else if (IS_SHORT_READ (token) && !(qtd->hw_alt_next @@ -354,18 +363,18 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) && HC_IS_RUNNING (ehci_to_hcd(ehci)->state))) { break; + /* scan the whole queue for unlinks whenever it stops */ } else { stopped = 1; - if (unlikely (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state))) + /* cancel everything if we halt, suspend, etc */ + if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) last_status = -ESHUTDOWN; - /* ignore active urbs unless some previous qtd - * for the urb faulted (including short read) or - * its urb was canceled. we may patch qh or qtds. + /* this qtd is active; skip it unless a previous qtd + * for its urb faulted, or its urb was canceled. */ - if (likely(last_status == -EINPROGRESS && - !urb->unlinked)) + else if (last_status == -EINPROGRESS && !urb->unlinked) continue; /* issue status after short control reads */ @@ -375,7 +384,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) continue; } - /* token in overlay may be most current */ + /* qh unlinked; token in overlay may be most current */ if (state == QH_STATE_IDLE && cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw_current) @@ -402,11 +411,16 @@ halt: if (likely(last_status == -EINPROGRESS)) last_status = qtd_status; + /* if we're removing something not at the queue head, + * patch the hardware queue pointer. + */ if (stopped && qtd->qtd_list.prev != &qh->qtd_list) { last = list_entry (qtd->qtd_list.prev, struct ehci_qtd, qtd_list); last->hw_next = qtd->hw_next; } + + /* remove qtd; it's recycled after possible urb completion */ list_del (&qtd->qtd_list); last = qtd; } @@ -431,7 +445,15 @@ halt: qh_refresh(ehci, qh); break; case QH_STATE_LINKED: - /* should be rare for periodic transfers, + /* We won't refresh a QH that's linked (after the HC + * stopped the queue). That avoids a race: + * - HC reads first part of QH; + * - CPU updates that first part and the token; + * - HC reads rest of that QH, including token + * Result: HC gets an inconsistent image, and then + * DMAs to/from the wrong memory (corrupting it). + * + * That should be rare for interrupt transfers, * except maybe high bandwidth ... */ if ((cpu_to_hc32(ehci, QH_SMASK) @@ -549,6 +571,12 @@ qh_urb_transaction ( this_qtd_len = qtd_fill(ehci, qtd, buf, len, token, maxpacket); len -= this_qtd_len; buf += this_qtd_len; + + /* + * short reads advance to a "magic" dummy instead of the next + * qtd ... that forces the queue to stop, for manual cleanup. + * (this will usually be overridden later.) + */ if (is_input) qtd->hw_alt_next = ehci->async->hw_alt_next; @@ -568,8 +596,10 @@ qh_urb_transaction ( list_add_tail (&qtd->qtd_list, head); } - /* unless the bulk/interrupt caller wants a chance to clean - * up after short reads, hc should advance qh past this urb + /* + * unless the caller requires manual cleanup after short reads, + * have the alt_next mechanism keep the queue running after the + * last data qtd (the only one, for control and most other cases). */ if (likely ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0 || usb_pipecontrol (urb->pipe))) -- cgit v1.2.3 From e6a79f1f07fc88a2efd6d0e8f0ccf591cb93cd34 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Wed, 9 Apr 2008 15:37:34 +0200 Subject: USB: add Documentation about usb_anchor This adds documentation about the new usb anchor infrastructure. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- Documentation/usb/anchors.txt | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/usb/anchors.txt diff --git a/Documentation/usb/anchors.txt b/Documentation/usb/anchors.txt new file mode 100644 index 00000000000..7304bcf5a30 --- /dev/null +++ b/Documentation/usb/anchors.txt @@ -0,0 +1,50 @@ +What is anchor? +=============== + +A USB driver needs to support some callbacks requiring +a driver to cease all IO to an interface. To do so, a +driver has to keep track of the URBs it has submitted +to know they've all completed or to call usb_kill_urb +for them. The anchor is a data structure takes care of +keeping track of URBs and provides methods to deal with +multiple URBs. + +Allocation and Initialisation +============================= + +There's no API to allocate an anchor. It is simply declared +as struct usb_anchor. init_usb_anchor() must be called to +initialise the data structure. + +Deallocation +============ + +Once it has no more URBs associated with it, the anchor can be +freed with normal memory management operations. + +Association and disassociation of URBs with anchors +=================================================== + +An association of URBs to an anchor is made by an explicit +call to usb_anchor_urb(). The association is maintained until +an URB is finished by (successfull) completion. Thus disassociation +is automatic. A function is provided to forcibly finish (kill) +all URBs associated with an anchor. +Furthermore, disassociation can be made with usb_unanchor_urb() + +Operations on multitudes of URBs +================================ + +usb_kill_anchored_urbs() +------------------------ + +This function kills all URBs associated with an anchor. The URBs +are called in the reverse temporal order they were submitted. +This way no data can be reordered. + +usb_wait_anchor_empty_timeout() +------------------------------- + +This function waits for all URBs associated with an anchor to finish +or a timeout, whichever comes first. Its return value will tell you +whether the timeout was reached. -- cgit v1.2.3 From 5f760040bcb4cc0498d4c662c4ea305290198ef3 Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Thu, 10 Apr 2008 10:15:53 +0200 Subject: USB: option.c: correct DTR behaviour Setting DTR et al. should work for all interfaces if you actually pass the interface number. :-P This should help with devices that have important pseudo-serial ports that aren't on the first interface in the device. Signed-off-by: Chris Collins Signed-off-by: Matthias Urlichs Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/option.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 0e7eeb2820e..130aa96746f 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -28,7 +28,7 @@ device features. */ -#define DRIVER_VERSION "v0.7.1" +#define DRIVER_VERSION "v0.7.2" #define DRIVER_AUTHOR "Matthias Urlichs " #define DRIVER_DESC "USB Driver for GSM modems" @@ -824,16 +824,19 @@ static void option_setup_urbs(struct usb_serial *serial) } } + +/** send RTS/DTR state to the port. + * + * This is exactly the same as SET_CONTROL_LINE_STATE from the PSTN + * CDC. +*/ static int option_send_setup(struct usb_serial_port *port) { struct usb_serial *serial = port->serial; struct option_port_private *portdata; - + int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; dbg("%s", __FUNCTION__); - if (port->number != 0) - return 0; - portdata = usb_get_serial_port_data(port); if (port->tty) { @@ -845,7 +848,7 @@ static int option_send_setup(struct usb_serial_port *port) return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), - 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); + 0x22,0x21,val,ifNum,NULL,0,USB_CTRL_SET_TIMEOUT); } return 0; -- cgit v1.2.3 From 0ba4034e20abf372dae6c6cabeeeab600acb5889 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 16 Apr 2008 09:17:38 -0700 Subject: USB: serial: remove unneeded number endpoints settings The usb-serial core no longer checks these fields so remove them from all of the individual drivers. They will be removed from the usb-serial core in a patch later in the series. Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/airprime.c | 3 --- drivers/usb/serial/ark3116.c | 3 --- drivers/usb/serial/belkin_sa.c | 3 --- drivers/usb/serial/ch341.c | 3 --- drivers/usb/serial/cp2101.c | 3 --- drivers/usb/serial/cyberjack.c | 3 --- drivers/usb/serial/cypress_m8.c | 12 ------------ drivers/usb/serial/digi_acceleport.c | 6 ------ drivers/usb/serial/empeg.c | 3 --- drivers/usb/serial/ftdi_sio.c | 3 --- drivers/usb/serial/funsoft.c | 3 --- drivers/usb/serial/garmin_gps.c | 3 --- drivers/usb/serial/generic.c | 3 --- drivers/usb/serial/hp4x.c | 3 --- drivers/usb/serial/io_tables.h | 12 ------------ drivers/usb/serial/io_ti.c | 6 ------ drivers/usb/serial/ipaq.c | 3 --- drivers/usb/serial/ipw.c | 3 --- drivers/usb/serial/ir-usb.c | 3 --- drivers/usb/serial/iuu_phoenix.c | 3 --- drivers/usb/serial/keyspan.h | 16 ---------------- drivers/usb/serial/keyspan_pda.c | 9 --------- drivers/usb/serial/kl5kusb105.c | 3 --- drivers/usb/serial/kobil_sct.c | 4 ---- drivers/usb/serial/mct_u232.c | 3 --- drivers/usb/serial/mos7720.c | 3 --- drivers/usb/serial/mos7840.c | 5 ----- drivers/usb/serial/navman.c | 3 --- drivers/usb/serial/omninet.c | 3 --- drivers/usb/serial/option.c | 3 --- drivers/usb/serial/oti6858.c | 3 --- drivers/usb/serial/pl2303.c | 3 --- drivers/usb/serial/safe_serial.c | 3 --- drivers/usb/serial/sierra.c | 3 --- drivers/usb/serial/spcp8x5.c | 3 --- drivers/usb/serial/ti_usb_3410_5052.c | 6 ------ drivers/usb/serial/usb_debug.c | 3 --- drivers/usb/serial/visor.c | 9 --------- drivers/usb/serial/whiteheat.c | 6 ------ 39 files changed, 175 deletions(-) diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index f156dba0300..d5bcb377403 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c @@ -306,9 +306,6 @@ static struct usb_serial_driver airprime_device = { }, .usb_driver = &airprime_driver, .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .open = airprime_open, .close = airprime_close, .write = airprime_write, diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index fe2bfd67ba8..aa7a6838a3d 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -447,9 +447,6 @@ static struct usb_serial_driver ark3116_device = { }, .id_table = id_table, .usb_driver = &ark3116_driver, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .attach = ark3116_attach, .set_termios = ark3116_set_termios, diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index df0a2b3b029..b6950648804 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -128,9 +128,6 @@ static struct usb_serial_driver belkin_device = { .description = "Belkin / Peracom / GoHubs USB Serial Adapter", .usb_driver = &belkin_driver, .id_table = id_table_combined, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = belkin_sa_open, .close = belkin_sa_close, diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 42582d49b69..d947d955bce 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -318,9 +318,6 @@ static struct usb_serial_driver ch341_device = { }, .id_table = id_table, .usb_driver = &ch341_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = ch341_open, .set_termios = ch341_set_termios, diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index 3b4fa94ecf2..2af8d21bb12 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c @@ -109,9 +109,6 @@ static struct usb_serial_driver cp2101_device = { }, .usb_driver = &cp2101_driver, .id_table = id_table, - .num_interrupt_in = 0, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .open = cp2101_open, .close = cp2101_close, diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 8d9b045aa7e..cbae876cd67 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -90,9 +90,6 @@ static struct usb_serial_driver cyberjack_device = { .description = "Reiner SCT Cyberjack USB card reader", .usb_driver = &cyberjack_driver, .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .attach = cyberjack_startup, .shutdown = cyberjack_shutdown, diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 36f8ef07947..d8304eaf34c 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -200,10 +200,6 @@ static struct usb_serial_driver cypress_earthmate_device = { .description = "DeLorme Earthmate USB", .usb_driver = &cypress_driver, .id_table = id_table_earthmate, - .num_interrupt_in = 1, - .num_interrupt_out = 1, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .attach = cypress_earthmate_startup, .shutdown = cypress_shutdown, @@ -230,10 +226,6 @@ static struct usb_serial_driver cypress_hidcom_device = { .description = "HID->COM RS232 Adapter", .usb_driver = &cypress_driver, .id_table = id_table_cyphidcomrs232, - .num_interrupt_in = 1, - .num_interrupt_out = 1, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .attach = cypress_hidcom_startup, .shutdown = cypress_shutdown, @@ -260,10 +252,6 @@ static struct usb_serial_driver cypress_ca42v2_device = { .description = "Nokia CA-42 V2 Adapter", .usb_driver = &cypress_driver, .id_table = id_table_nokiaca42v2, - .num_interrupt_in = 1, - .num_interrupt_out = 1, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .attach = cypress_ca42v2_startup, .shutdown = cypress_shutdown, diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 5f9c6e46bee..4e3d5993a8e 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -508,9 +508,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { .description = "Digi 2 port USB adapter", .usb_driver = &digi_driver, .id_table = id_table_2, - .num_interrupt_in = 0, - .num_bulk_in = 4, - .num_bulk_out = 4, .num_ports = 3, .open = digi_open, .close = digi_close, @@ -538,9 +535,6 @@ static struct usb_serial_driver digi_acceleport_4_device = { .description = "Digi 4 port USB adapter", .usb_driver = &digi_driver, .id_table = id_table_4, - .num_interrupt_in = 0, - .num_bulk_in = 5, - .num_bulk_out = 5, .num_ports = 4, .open = digi_open, .close = digi_close, diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index a5c8e1e17ea..2cf82177117 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c @@ -118,9 +118,6 @@ static struct usb_serial_driver empeg_device = { }, .id_table = id_table, .usb_driver = &empeg_driver, - .num_interrupt_in = 0, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = empeg_open, .close = empeg_close, diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 496c0c93ad8..54b502f2924 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -439,9 +439,6 @@ static struct usb_serial_driver ftdi_sio_device = { .description = "FTDI USB Serial Device", .usb_driver = &ftdi_driver , .id_table = id_table_combined, - .num_interrupt_in = 0, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .probe = ftdi_sio_probe, .port_probe = ftdi_sio_port_probe, diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c index b5194dc7d3b..e8ba2cb5995 100644 --- a/drivers/usb/serial/funsoft.c +++ b/drivers/usb/serial/funsoft.c @@ -39,9 +39,6 @@ static struct usb_serial_driver funsoft_device = { }, .id_table = id_table, .usb_driver = &funsoft_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, }; diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index d74e43d6923..87b77f92ae0 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -1579,9 +1579,6 @@ static struct usb_serial_driver garmin_device = { .description = "Garmin GPS usb/tty", .usb_driver = &garmin_driver, .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = garmin_open, .close = garmin_close, diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 7cfce9dabb9..5b0952054de 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -62,9 +62,6 @@ struct usb_serial_driver usb_serial_generic_device = { }, .id_table = generic_device_ids, .usb_driver = &generic_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .shutdown = usb_serial_generic_shutdown, .throttle = usb_serial_generic_throttle, diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index 6c6ebae741c..75b88b356eb 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c @@ -50,9 +50,6 @@ static struct usb_serial_driver hp49gp_device = { }, .id_table = id_table, .usb_driver = &hp49gp_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, }; diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index 6d300877254..2ec85893f27 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h @@ -111,9 +111,6 @@ static struct usb_serial_driver edgeport_2port_device = { .description = "Edgeport 2 port adapter", .usb_driver = &io_driver, .id_table = edgeport_2port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 2, .open = edge_open, .close = edge_close, @@ -142,9 +139,6 @@ static struct usb_serial_driver edgeport_4port_device = { .description = "Edgeport 4 port adapter", .usb_driver = &io_driver, .id_table = edgeport_4port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 4, .open = edge_open, .close = edge_close, @@ -173,9 +167,6 @@ static struct usb_serial_driver edgeport_8port_device = { .description = "Edgeport 8 port adapter", .usb_driver = &io_driver, .id_table = edgeport_8port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 8, .open = edge_open, .close = edge_close, @@ -203,9 +194,6 @@ static struct usb_serial_driver epic_device = { }, .description = "EPiC device", .id_table = Epic_port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = edge_open, .close = edge_close, diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 316467ecd77..856e4d9afd6 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -3032,9 +3032,6 @@ static struct usb_serial_driver edgeport_1port_device = { .description = "Edgeport TI 1 port adapter", .usb_driver = &io_driver, .id_table = edgeport_1port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = edge_open, .close = edge_close, @@ -3064,9 +3061,6 @@ static struct usb_serial_driver edgeport_2port_device = { .description = "Edgeport TI 2 port adapter", .usb_driver = &io_driver, .id_table = edgeport_2port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 2, - .num_bulk_out = 2, .num_ports = 2, .open = edge_open, .close = edge_close, diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 17f2a53b8ba..1711dda0ea6 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -570,9 +570,6 @@ static struct usb_serial_driver ipaq_device = { .description = "PocketPC PDA", .usb_driver = &ipaq_driver, .id_table = ipaq_id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 2, .open = ipaq_open, .close = ipaq_close, diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index cbe5530f3db..ec0ccd14e18 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -448,9 +448,6 @@ static struct usb_serial_driver ipw_device = { .description = "IPWireless converter", .usb_driver = &usb_ipw_driver, .id_table = usb_ipw_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = ipw_open, .close = ipw_close, diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 6b803ab9854..82e12f8d600 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -145,9 +145,6 @@ static struct usb_serial_driver ir_device = { .description = "IR Dongle", .usb_driver = &ir_driver, .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .set_termios = ir_set_termios, .attach = ir_startup, diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index a09b9a85b16..7fee53441c2 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -1162,9 +1162,6 @@ static struct usb_serial_driver iuu_device = { .name = "iuu_phoenix", }, .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = iuu_open, .close = iuu_close, diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 74ce8bca3e6..8d6ed0293bf 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h @@ -636,10 +636,6 @@ static struct usb_serial_driver keyspan_pre_device = { }, .description = "Keyspan - (without firmware)", .id_table = keyspan_pre_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_interrupt_out = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .attach = keyspan_fake_startup, }; @@ -651,10 +647,6 @@ static struct usb_serial_driver keyspan_1port_device = { }, .description = "Keyspan 1 port adapter", .id_table = keyspan_1port_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_interrupt_out = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .open = keyspan_open, .close = keyspan_close, @@ -679,10 +671,6 @@ static struct usb_serial_driver keyspan_2port_device = { }, .description = "Keyspan 2 port adapter", .id_table = keyspan_2port_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_interrupt_out = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 2, .open = keyspan_open, .close = keyspan_close, @@ -707,10 +695,6 @@ static struct usb_serial_driver keyspan_4port_device = { }, .description = "Keyspan 4 port adapter", .id_table = keyspan_4port_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_interrupt_out = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 4, .open = keyspan_open, .close = keyspan_close, diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index b1fa5a376e9..03984779518 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -793,9 +793,6 @@ static struct usb_serial_driver keyspan_pda_fake_device = { .description = "Keyspan PDA - (prerenumeration)", .usb_driver = &keyspan_pda_driver, .id_table = id_table_fake, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .attach = keyspan_pda_fake_startup, }; @@ -810,9 +807,6 @@ static struct usb_serial_driver xircom_pgs_fake_device = { .description = "Xircom / Entregra PGS - (prerenumeration)", .usb_driver = &keyspan_pda_driver, .id_table = id_table_fake_xircom, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .attach = keyspan_pda_fake_startup, }; @@ -826,9 +820,6 @@ static struct usb_serial_driver keyspan_pda_device = { .description = "Keyspan PDA", .usb_driver = &keyspan_pda_driver, .id_table = id_table_std, - .num_interrupt_in = 1, - .num_bulk_in = 0, - .num_bulk_out = 1, .num_ports = 1, .open = keyspan_pda_open, .close = keyspan_pda_close, diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 55736df7d2f..d7100428390 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -126,9 +126,6 @@ static struct usb_serial_driver kl5kusb105d_device = { .description = "KL5KUSB105D / PalmConnect", .usb_driver = &kl5kusb105d_driver, .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = klsi_105_open, .close = klsi_105_close, diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 03cb5dd8cbe..78458c807ea 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -113,10 +113,6 @@ static struct usb_serial_driver kobil_device = { .description = "KOBIL USB smart card terminal", .usb_driver = &kobil_driver, .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_interrupt_out = NUM_DONT_CARE, - .num_bulk_in = 0, - .num_bulk_out = 0, .num_ports = 1, .attach = kobil_startup, .shutdown = kobil_shutdown, diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index fc1cea4aba1..b9e0fbacc8a 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -143,9 +143,6 @@ static struct usb_serial_driver mct_u232_device = { .description = "MCT U232", .usb_driver = &mct_u232_driver, .id_table = id_table_combined, - .num_interrupt_in = 2, - .num_bulk_in = 0, - .num_bulk_out = 1, .num_ports = 1, .open = mct_u232_open, .close = mct_u232_close, diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 40f3a018880..2e14fdd0846 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -1596,9 +1596,6 @@ static struct usb_serial_driver moschip7720_2port_driver = { .description = "Moschip 2 port adapter", .usb_driver = &usb_driver, .id_table = moschip_port_id_table, - .num_interrupt_in = 1, - .num_bulk_in = 2, - .num_bulk_out = 2, .num_ports = 2, .open = mos7720_open, .close = mos7720_close, diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 0b29c5383dc..37c4f0736bc 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -2800,12 +2800,7 @@ static struct usb_serial_driver moschip7840_4port_device = { .description = DRIVER_DESC, .usb_driver = &io_driver, .id_table = moschip_port_id_table, - .num_interrupt_in = 1, //NUM_DONT_CARE,//1, -#ifdef check - .num_bulk_in = 4, - .num_bulk_out = 4, .num_ports = 4, -#endif .open = mos7840_open, .close = mos7840_close, .write = mos7840_write, diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c index 7f337c9aeb5..ddaccbcde84 100644 --- a/drivers/usb/serial/navman.c +++ b/drivers/usb/serial/navman.c @@ -121,9 +121,6 @@ static struct usb_serial_driver navman_device = { }, .id_table = id_table, .usb_driver = &navman_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .open = navman_open, .close = navman_close, diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index ee94d9616d8..050511ff2b1 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -95,9 +95,6 @@ static struct usb_serial_driver zyxel_omninet_device = { .description = "ZyXEL - omni.net lcd plus usb", .usb_driver = &omninet_driver, .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 2, .num_ports = 1, .attach = omninet_attach, .open = omninet_open, diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 130aa96746f..f4914209871 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -325,9 +325,6 @@ static struct usb_serial_driver option_1port_device = { .description = "GSM modem (1-port)", .usb_driver = &option_driver, .id_table = option_ids, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .open = option_open, .close = option_close, diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 8acc907a318..20a680ed0cc 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -179,9 +179,6 @@ static struct usb_serial_driver oti6858_device = { .name = "oti6858", }, .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = oti6858_open, .close = oti6858_close, diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2af778555bd..1fbb4dbdf23 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -1114,9 +1114,6 @@ static struct usb_serial_driver pl2303_device = { }, .id_table = id_table, .usb_driver = &pl2303_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = pl2303_open, .close = pl2303_close, diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 4e6dcc199be..353c54fa058 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -394,9 +394,6 @@ static struct usb_serial_driver safe_device = { }, .id_table = id_table, .usb_driver = &safe_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .write = safe_write, .write_room = safe_write_room, diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index f791eb8887f..07eabaf9f04 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -746,9 +746,6 @@ static struct usb_serial_driver sierra_device = { .description = "Sierra USB modem", .id_table = id_table, .usb_driver = &sierra_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .calc_num_ports = sierra_calc_num_ports, .probe = sierra_probe, .open = sierra_open, diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 1b46b846f10..2282d620186 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c @@ -1022,9 +1022,6 @@ static struct usb_serial_driver spcp8x5_device = { .name = "SPCP8x5", }, .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = spcp8x5_open, .close = spcp8x5_close, diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 5b470f76e91..f3bbf777c81 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -264,9 +264,6 @@ static struct usb_serial_driver ti_1port_device = { .description = "TI USB 3410 1 port adapter", .usb_driver = &ti_usb_driver, .id_table = ti_id_table_3410, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = 1, .num_ports = 1, .attach = ti_startup, .shutdown = ti_shutdown, @@ -295,9 +292,6 @@ static struct usb_serial_driver ti_2port_device = { .description = "TI USB 5052 2 port adapter", .usb_driver = &ti_usb_driver, .id_table = ti_id_table_5052, - .num_interrupt_in = 1, - .num_bulk_in = 2, - .num_bulk_out = 2, .num_ports = 2, .attach = ti_startup, .shutdown = ti_shutdown, diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c index 257a5e43687..f9fc926b56d 100644 --- a/drivers/usb/serial/usb_debug.c +++ b/drivers/usb/serial/usb_debug.c @@ -35,9 +35,6 @@ static struct usb_serial_driver debug_device = { .name = "debug", }, .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, }; diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index c2b01f7c319..f2d59b06c36 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -189,9 +189,6 @@ static struct usb_serial_driver handspring_device = { .description = "Handspring Visor / Palm OS", .usb_driver = &visor_driver, .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 2, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 2, .open = visor_open, .close = visor_close, @@ -219,9 +216,6 @@ static struct usb_serial_driver clie_5_device = { .description = "Sony Clie 5.0", .usb_driver = &visor_driver, .id_table = clie_id_5_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 2, - .num_bulk_out = 2, .num_ports = 2, .open = visor_open, .close = visor_close, @@ -249,9 +243,6 @@ static struct usb_serial_driver clie_3_5_device = { .description = "Sony Clie 3.5", .usb_driver = &visor_driver, .id_table = clie_id_3_5_table, - .num_interrupt_in = 0, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = visor_open, .close = visor_close, diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 38726ef3132..c5af57be62f 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -164,9 +164,6 @@ static struct usb_serial_driver whiteheat_fake_device = { .description = "Connect Tech - WhiteHEAT - (prerenumeration)", .usb_driver = &whiteheat_driver, .id_table = id_table_prerenumeration, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 1, .probe = whiteheat_firmware_download, .attach = whiteheat_firmware_attach, @@ -180,9 +177,6 @@ static struct usb_serial_driver whiteheat_device = { .description = "Connect Tech - WhiteHEAT", .usb_driver = &whiteheat_driver, .id_table = id_table_std, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, .num_ports = 4, .attach = whiteheat_attach, .shutdown = whiteheat_shutdown, -- cgit v1.2.3 From 9aebfd6bda789891e6d296bb49b5fb32d1057f18 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 16 Apr 2008 09:17:38 -0700 Subject: USB: serial: remove endpoints setting checks from core and header Remove the unused check for num_interrupt and friends as well as remove them from the header file because no usb-serial drivers no longer reference them. Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb-serial.c | 16 ---------------- include/linux/usb/serial.h | 18 ------------------ 2 files changed, 34 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index aea861e9173..5b464811fa4 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -861,22 +861,6 @@ int usb_serial_probe(struct usb_interface *interface, serial->num_interrupt_in = num_interrupt_in; serial->num_interrupt_out = num_interrupt_out; -#if 0 - /* check that the device meets the driver's requirements */ - if ((type->num_interrupt_in != NUM_DONT_CARE && - type->num_interrupt_in != num_interrupt_in) - || (type->num_interrupt_out != NUM_DONT_CARE && - type->num_interrupt_out != num_interrupt_out) - || (type->num_bulk_in != NUM_DONT_CARE && - type->num_bulk_in != num_bulk_in) - || (type->num_bulk_out != NUM_DONT_CARE && - type->num_bulk_out != num_bulk_out)) { - dbg("wrong number of endpoints"); - kfree(serial); - return -EIO; - } -#endif - /* found all that we need */ dev_info(&interface->dev, "%s converter detected\n", type->description); diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index f1b7434a96b..8f891cbaf9a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -145,8 +145,6 @@ struct usb_serial { }; #define to_usb_serial(d) container_of(d, struct usb_serial, kref) -#define NUM_DONT_CARE 99 - /* get and set the serial private data pointer helper functions */ static inline void *usb_get_serial_data(struct usb_serial *serial) { @@ -164,18 +162,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) * used in the syslog messages when a device is inserted or removed. * @id_table: pointer to a list of usb_device_id structures that define all * of the devices this structure can support. - * @num_interrupt_in: If a device doesn't have this many interrupt-in - * endpoints, it won't be sent to the driver's attach() method. - * (But it might still be sent to the probe() method.) - * @num_interrupt_out: If a device doesn't have this many interrupt-out - * endpoints, it won't be sent to the driver's attach() method. - * (But it might still be sent to the probe() method.) - * @num_bulk_in: If a device doesn't have this many bulk-in - * endpoints, it won't be sent to the driver's attach() method. - * (But it might still be sent to the probe() method.) - * @num_bulk_out: If a device doesn't have this many bulk-out - * endpoints, it won't be sent to the driver's attach() method. - * (But it might still be sent to the probe() method.) * @num_ports: the number of different ports this device will have. * @calc_num_ports: pointer to a function to determine how many ports this * device has dynamically. It will be called after the probe() @@ -211,10 +197,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) struct usb_serial_driver { const char *description; const struct usb_device_id *id_table; - char num_interrupt_in; - char num_interrupt_out; - char num_bulk_in; - char num_bulk_out; char num_ports; struct list_head driver_list; -- cgit v1.2.3 From b950bdbc67041412cb042e404938667204c7902c Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 14 Apr 2008 11:45:29 -0400 Subject: USB: g_file_storage: ignore bulk-out data after invalid CBW This patch (as1061) makes g_file_storage more compliant with the Bulk-Only Transport specification. After an invalid CBW is received, the gadget must ignore any further bulk-OUT data until it is reset. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/file_storage.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 017a196d041..0a726e106cc 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -644,7 +644,7 @@ struct fsg_dev { unsigned long atomic_bitflags; #define REGISTERED 0 -#define CLEAR_BULK_HALTS 1 +#define IGNORE_BULK_OUT 1 #define SUSPENDED 2 struct usb_ep *bulk_in; @@ -2936,8 +2936,8 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) struct usb_request *req = bh->outreq; struct bulk_cb_wrap *cbw = req->buf; - /* Was this a real packet? */ - if (req->status) + /* Was this a real packet? Should it be ignored? */ + if (req->status || test_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) return -EINVAL; /* Is the CBW valid? */ @@ -2948,13 +2948,17 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) req->actual, le32_to_cpu(cbw->Signature)); - /* The Bulk-only spec says we MUST stall the bulk pipes! - * If we want to avoid stalls, set a flag so that we will - * clear the endpoint halts at the next reset. */ - if (!mod_data.can_stall) - set_bit(CLEAR_BULK_HALTS, &fsg->atomic_bitflags); - fsg_set_halt(fsg, fsg->bulk_out); + /* The Bulk-only spec says we MUST stall the IN endpoint + * (6.6.1), so it's unavoidable. It also says we must + * retain this state until the next reset, but there's + * no way to tell the controller driver it should ignore + * Clear-Feature(HALT) requests. + * + * We aren't required to halt the OUT endpoint; instead + * we can simply accept and discard any data received + * until the next reset. */ halt_bulk_in_endpoint(fsg); + set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); return -EINVAL; } @@ -3140,6 +3144,7 @@ reset: goto reset; fsg->bulk_out_enabled = 1; fsg->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize); + clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); if (transport_is_cbi()) { d = ep_desc(fsg->gadget, &fs_intr_in_desc, &hs_intr_in_desc); @@ -3321,11 +3326,8 @@ static void handle_exception(struct fsg_dev *fsg) /* In case we were forced against our will to halt a * bulk endpoint, clear the halt now. (The SuperH UDC * requires this.) */ - if (test_and_clear_bit(CLEAR_BULK_HALTS, - &fsg->atomic_bitflags)) { + if (test_and_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) usb_ep_clear_halt(fsg->bulk_in); - usb_ep_clear_halt(fsg->bulk_out); - } if (transport_is_bbb()) { if (fsg->ep0_req_tag == exception_req_tag) -- cgit v1.2.3 From 58a97ffeb2297f154659f339d77eb3f32c4d8b3e Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 14 Apr 2008 12:17:10 -0400 Subject: USB: HCDs use the do_remote_wakeup flag When a USB device is suspended, whether or not it is enabled for remote wakeup depends on the device_may_wakeup() setting. The setting is then saved in the do_remote_wakeup flag. Later on, however, the device_may_wakeup() value can change because of user activity. So when testing whether a suspended device is or should be enabled for remote wakeup, we should always test do_remote_wakeup instead of device_may_wakeup(). This patch (as1076) makes that change for root hubs in several places. The patch also adjusts uhci-hcd so that when an autostopped controller is suspended, the remote wakeup setting agrees with the value recorded in the root hub's do_remote_wakeup flag. And the patch adjusts ehci-hcd so that wakeup events on selectively suspended ports (i.e., the bus itself isn't suspended) don't turn on the PME# wakeup signal. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/driver.c | 1 - drivers/usb/host/ehci-hub.c | 17 +++++++---------- drivers/usb/host/ehci-pci.c | 2 +- drivers/usb/host/isp116x-hcd.c | 2 +- drivers/usb/host/ohci-hub.c | 5 ++--- drivers/usb/host/uhci-hcd.c | 21 +++++++-------------- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 2ea333a43d6..edc31e13e95 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -932,7 +932,6 @@ static int autosuspend_check(struct usb_device *udev, int reschedule) * is disabled. Also fail if any interfaces require remote wakeup * but it isn't available. */ - udev->do_remote_wakeup = device_may_wakeup(&udev->dev); if (udev->pm_usage_cnt > 0) return -EBUSY; if (udev->autosuspend_delay < 0 || udev->autosuspend_disabled) diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 21ac3781f21..536b433d24f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -30,6 +30,8 @@ #ifdef CONFIG_PM +#define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) + static int ehci_hub_control( struct usb_hcd *hcd, u16 typeReq, @@ -149,10 +151,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) } /* enable remote wakeup on all ports */ - if (device_may_wakeup(&hcd->self.root_hub->dev)) - t2 |= PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E; + if (hcd->self.root_hub->do_remote_wakeup) + t2 |= PORT_WAKE_BITS; else - t2 &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E); + t2 &= ~PORT_WAKE_BITS; if (t1 != t2) { ehci_vdbg (ehci, "port %d, %08x -> %08x\n", @@ -174,7 +176,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) /* allow remote wakeup */ mask = INTR_MASK; - if (!device_may_wakeup(&hcd->self.root_hub->dev)) + if (!hcd->self.root_hub->do_remote_wakeup) mask &= ~STS_PCD; ehci_writel(ehci, mask, &ehci->regs->intr_enable); ehci_readl(ehci, &ehci->regs->intr_enable); @@ -232,8 +234,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) i = HCS_N_PORTS (ehci->hcs_params); while (i--) { temp = ehci_readl(ehci, &ehci->regs->port_status [i]); - temp &= ~(PORT_RWC_BITS - | PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E); + temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); if (test_bit(i, &ehci->bus_suspended) && (temp & PORT_SUSPEND)) { ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); @@ -534,8 +535,6 @@ ehci_hub_descriptor ( /*-------------------------------------------------------------------------*/ -#define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) - static int ehci_hub_control ( struct usb_hcd *hcd, u16 typeReq, @@ -801,8 +800,6 @@ static int ehci_hub_control ( if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) goto error; - if (device_may_wakeup(&hcd->self.root_hub->dev)) - temp |= PORT_WAKE_BITS; ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); break; case USB_PORT_FEAT_POWER: diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index a0afc78b273..88dad4b5313 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -300,7 +300,7 @@ static int ehci_pci_resume(struct usb_hcd *hcd) if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF) { int mask = INTR_MASK; - if (!device_may_wakeup(&hcd->self.root_hub->dev)) + if (!hcd->self.root_hub->do_remote_wakeup) mask &= ~STS_PCD; ehci_writel(ehci, mask, &ehci->regs->intr_enable); ehci_readl(ehci, &ehci->regs->intr_enable); diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 66d773c726f..20b9a0d0742 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c @@ -1400,7 +1400,7 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd) spin_unlock_irqrestore(&isp116x->lock, flags); val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE); val |= HCCONTROL_USB_SUSPEND; - if (device_may_wakeup(&hcd->self.root_hub->dev)) + if (hcd->self.root_hub->do_remote_wakeup) val |= HCCONTROL_RWE; /* Wait for usb transfers to finish */ msleep(2); diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 28d6d775eb5..cf3e1d25563 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -103,10 +103,9 @@ __acquires(ohci->lock) finish_unlinks (ohci, ohci_frame_no(ohci)); /* maybe resume can wake root hub */ - if (device_may_wakeup(&ohci_to_hcd(ohci)->self.root_hub->dev) || - autostop) + if (ohci_to_hcd(ohci)->self.root_hub->do_remote_wakeup || autostop) { ohci->hc_control |= OHCI_CTRL_RWE; - else { + } else { ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrdisable); ohci->hc_control &= ~OHCI_CTRL_RWE; } diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index fec9872dd9d..f65d5a85873 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -262,20 +262,12 @@ __acquires(uhci->lock) { int auto_stop; int int_enable, egsm_enable; + struct usb_device *rhdev = uhci_to_hcd(uhci)->self.root_hub; auto_stop = (new_state == UHCI_RH_AUTO_STOPPED); - dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, - "%s%s\n", __FUNCTION__, + dev_dbg(&rhdev->dev, "%s%s\n", __func__, (auto_stop ? " (auto-stop)" : "")); - /* If we get a suspend request when we're already auto-stopped - * then there's nothing to do. - */ - if (uhci->rh_state == UHCI_RH_AUTO_STOPPED) { - uhci->rh_state = new_state; - return; - } - /* Enable resume-detect interrupts if they work. * Then enter Global Suspend mode if _it_ works, still configured. */ @@ -285,8 +277,10 @@ __acquires(uhci->lock) if (remote_wakeup_is_broken(uhci)) egsm_enable = 0; if (resume_detect_interrupts_are_broken(uhci) || !egsm_enable || - !device_may_wakeup( - &uhci_to_hcd(uhci)->self.root_hub->dev)) +#ifdef CONFIG_PM + (!auto_stop && !rhdev->do_remote_wakeup) || +#endif + (auto_stop && !device_may_wakeup(&rhdev->dev))) uhci->working_RD = int_enable = 0; outw(int_enable, uhci->io_addr + USBINTR); @@ -308,8 +302,7 @@ __acquires(uhci->lock) return; } if (!(inw(uhci->io_addr + USBSTS) & USBSTS_HCH)) - dev_warn(&uhci_to_hcd(uhci)->self.root_hub->dev, - "Controller not stopped yet!\n"); + dev_warn(uhci_dev(uhci), "Controller not stopped yet!\n"); uhci_get_current_frame_number(uhci); -- cgit v1.2.3 From 5f47493cdf90b8afe5353e59de30e449e775ea8b Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 14 Apr 2008 12:17:49 -0400 Subject: USB: OHCI: turn off RD when remote wakeup is disabled This patch (as1068b) disables the RD interrupt flag when an OHCI root hub is suspended with remote wakeup disabled. Although the spec clearly states that this flag permits the controller to issue an interrupt when a resume request from downstream is detected and not when a local status change occurs, some controllers mistakenly use it for both types of event. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-hub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index cf3e1d25563..355a82f2527 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -106,7 +106,8 @@ __acquires(ohci->lock) if (ohci_to_hcd(ohci)->self.root_hub->do_remote_wakeup || autostop) { ohci->hc_control |= OHCI_CTRL_RWE; } else { - ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrdisable); + ohci_writel(ohci, OHCI_INTR_RHSC | OHCI_INTR_RD, + &ohci->regs->intrdisable); ohci->hc_control &= ~OHCI_CTRL_RWE; } -- cgit v1.2.3 From e872154921a6b5256a3c412dd69158ac0b135176 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 14 Apr 2008 12:17:56 -0400 Subject: USB: don't explicitly reenable root-hub status interrupts This patch (as1069b) changes the way OHCI root-hub status-change interrupts are enabled. Currently a special HCD method, hub_irq_enable(), is called when the hub driver is finished using a root hub. This approach turns out to be subject to races, resulting in unnecessary polling. The patch does away with the method entirely. Instead, the driver automatically enables the RHSC interrupt when no more status changes are present. This scheme is safe with controllers using level-triggered semantics for their interrupt flags. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd.c | 9 ------- drivers/usb/core/hcd.h | 2 -- drivers/usb/core/hub.c | 9 ------- drivers/usb/host/ohci-at91.c | 1 - drivers/usb/host/ohci-au1xxx.c | 1 - drivers/usb/host/ohci-ep93xx.c | 1 - drivers/usb/host/ohci-hub.c | 53 ++++++++++++++++++++++++----------------- drivers/usb/host/ohci-lh7a404.c | 1 - drivers/usb/host/ohci-omap.c | 1 - drivers/usb/host/ohci-pci.c | 1 - drivers/usb/host/ohci-pnx4008.c | 1 - drivers/usb/host/ohci-pnx8550.c | 1 - drivers/usb/host/ohci-ppc-of.c | 1 - drivers/usb/host/ohci-ppc-soc.c | 1 - drivers/usb/host/ohci-ps3.c | 1 - drivers/usb/host/ohci-pxa27x.c | 1 - drivers/usb/host/ohci-s3c2410.c | 1 - drivers/usb/host/ohci-sa1111.c | 1 - drivers/usb/host/ohci-sh.c | 1 - drivers/usb/host/ohci-sm501.c | 1 - drivers/usb/host/ohci-ssb.c | 1 - drivers/usb/host/u132-hcd.c | 11 --------- 22 files changed, 31 insertions(+), 70 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index e68fef5361d..bf10e9c4195 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -924,15 +924,6 @@ static int register_root_hub(struct usb_hcd *hcd) return retval; } -void usb_enable_root_hub_irq (struct usb_bus *bus) -{ - struct usb_hcd *hcd; - - hcd = container_of (bus, struct usb_hcd, self); - if (hcd->driver->hub_irq_enable && hcd->state != HC_STATE_HALT) - hcd->driver->hub_irq_enable (hcd); -} - /*-------------------------------------------------------------------------*/ diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 3ba258eb05d..1e4b81e9eb5 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h @@ -210,8 +210,6 @@ struct hc_driver { int (*bus_suspend)(struct usb_hcd *); int (*bus_resume)(struct usb_hcd *); int (*start_port_reset)(struct usb_hcd *, unsigned port_num); - void (*hub_irq_enable)(struct usb_hcd *); - /* Needed only if port-change IRQs are level-triggered */ /* force handover of high-speed port to full-speed companion */ void (*relinquish_port)(struct usb_hcd *, int); diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1e23e360ea9..5a338a5d4fe 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2001,8 +2001,6 @@ int usb_port_resume(struct usb_device *udev) } clear_bit(port1, hub->busy_bits); - if (!hub->hdev->parent && !hub->busy_bits[0]) - usb_enable_root_hub_irq(hub->hdev->bus); if (status == 0) status = finish_port_resume(udev); @@ -2918,11 +2916,6 @@ static void hub_events(void) hub->activating = 0; - /* If this is a root hub, tell the HCD it's okay to - * re-enable port-change interrupts now. */ - if (!hdev->parent && !hub->busy_bits[0]) - usb_enable_root_hub_irq(hdev->bus); - loop_autopm: /* Allow autosuspend if we're not going to run again */ if (list_empty(&hub->event_list)) @@ -3148,8 +3141,6 @@ int usb_reset_device(struct usb_device *udev) break; } clear_bit(port1, parent_hub->busy_bits); - if (!parent_hdev->parent && !parent_hub->busy_bits[0]) - usb_enable_root_hub_irq(parent_hdev->bus); if (ret < 0) goto re_enumerate; diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index e534f9de0f0..c96db1153dc 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -261,7 +261,6 @@ static const struct hc_driver ohci_at91_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index f90fe0c7373..1b9abdba920 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c @@ -288,7 +288,6 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 5adaf36e47d..06aadfb0ec2 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -135,7 +135,6 @@ static struct hc_driver ohci_ep93xx_hc_driver = { .get_frame_number = ohci_get_frame, .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 355a82f2527..5be3bb3e6a9 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -36,18 +36,6 @@ /*-------------------------------------------------------------------------*/ -/* hcd->hub_irq_enable() */ -static void ohci_rhsc_enable (struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci (hcd); - - spin_lock_irq(&ohci->lock); - if (!ohci->autostop) - del_timer(&hcd->rh_timer); /* Prevent next poll */ - ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); - spin_unlock_irq(&ohci->lock); -} - #define OHCI_SCHED_ENABLES \ (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) @@ -374,18 +362,28 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, int any_connected) { int poll_rh = 1; + int rhsc; + rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC; switch (ohci->hc_control & OHCI_CTRL_HCFS) { case OHCI_USB_OPER: - /* keep on polling until we know a device is connected - * and RHSC is enabled */ + /* If no status changes are pending, enable status-change + * interrupts. + */ + if (!rhsc && !changed) { + rhsc = OHCI_INTR_RHSC; + ohci_writel(ohci, rhsc, &ohci->regs->intrenable); + } + + /* Keep on polling until we know a device is connected + * and RHSC is enabled, or until we autostop. + */ if (!ohci->autostop) { if (any_connected || !device_may_wakeup(&ohci_to_hcd(ohci) ->self.root_hub->dev)) { - if (ohci_readl(ohci, &ohci->regs->intrenable) & - OHCI_INTR_RHSC) + if (rhsc) poll_rh = 0; } else { ohci->autostop = 1; @@ -398,12 +396,13 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, ohci->autostop = 0; ohci->next_statechange = jiffies + STATECHANGE_DELAY; - } else if (time_after_eq(jiffies, + } else if (rhsc && time_after_eq(jiffies, ohci->next_statechange) && !ohci->ed_rm_list && !(ohci->hc_control & OHCI_SCHED_ENABLES)) { ohci_rh_suspend(ohci, 1); + poll_rh = 0; } } break; @@ -417,6 +416,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, else usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); } else { + if (!rhsc && (ohci->autostop || + ohci_to_hcd(ohci)->self.root_hub-> + do_remote_wakeup)) + ohci_writel(ohci, OHCI_INTR_RHSC, + &ohci->regs->intrenable); + /* everything is idle, no need for polling */ poll_rh = 0; } @@ -438,12 +443,16 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci) static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, int any_connected) { - int poll_rh = 1; - - /* keep on polling until RHSC is enabled */ + /* If RHSC is enabled, don't poll */ if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) - poll_rh = 0; - return poll_rh; + return 0; + + /* If no status changes are pending, enable status-change interrupts */ + if (!changed) { + ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); + return 0; + } + return 1; } #endif /* CONFIG_PM */ diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 13c12ed2225..96d14fa1d83 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c @@ -193,7 +193,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 3a7c24c0367..6859fb5f1d6 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -466,7 +466,6 @@ static const struct hc_driver ohci_omap_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 4696cc912e1..3bf175d95a2 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -327,7 +327,6 @@ static const struct hc_driver ohci_pci_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c index 28b458f20cc..664f07ee873 100644 --- a/drivers/usb/host/ohci-pnx4008.c +++ b/drivers/usb/host/ohci-pnx4008.c @@ -280,7 +280,6 @@ static const struct hc_driver ohci_pnx4008_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c index 605d59cba28..28467e288a9 100644 --- a/drivers/usb/host/ohci-pnx8550.c +++ b/drivers/usb/host/ohci-pnx8550.c @@ -201,7 +201,6 @@ static const struct hc_driver ohci_pnx8550_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index a6725279122..50e55db1363 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c @@ -72,7 +72,6 @@ static const struct hc_driver ohci_ppc_of_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 523c3012557..cd3398b675b 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c @@ -172,7 +172,6 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index c1935ae537f..bfdeb0d22d0 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c @@ -68,7 +68,6 @@ static const struct hc_driver ps3_ohci_hc_driver = { .get_frame_number = ohci_get_frame, .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, .start_port_reset = ohci_start_port_reset, #if defined(CONFIG_PM) .bus_suspend = ohci_bus_suspend, diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index d4ee27d92be..70b0d4b459e 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -298,7 +298,6 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index ead4772f0f2..a73d2ff322e 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -466,7 +466,6 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { */ .hub_status_data = ohci_s3c2410_hub_status_data, .hub_control = ohci_s3c2410_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 0f48f2d9922..99438c65981 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c @@ -231,7 +231,6 @@ static const struct hc_driver ohci_sa1111_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c index e7ee607278f..60f03cc7ec4 100644 --- a/drivers/usb/host/ohci-sh.c +++ b/drivers/usb/host/ohci-sh.c @@ -68,7 +68,6 @@ static const struct hc_driver ohci_sh_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 4a11e181601..77204f001b9 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -75,7 +75,6 @@ static const struct hc_driver ohci_sm501_hc_driver = { */ .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c index 7275186db31..c4265caec78 100644 --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c @@ -81,7 +81,6 @@ static const struct hc_driver ssb_ohci_hc_driver = { .hub_status_data = ohci_hub_status_data, .hub_control = ohci_hub_control, - .hub_irq_enable = ohci_rhsc_enable, #ifdef CONFIG_PM .bus_suspend = ohci_bus_suspend, .bus_resume = ohci_bus_resume, diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 9b6323f768b..f29307405bb 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -2934,16 +2934,6 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num) return 0; } -static void u132_hub_irq_enable(struct usb_hcd *hcd) -{ - struct u132 *u132 = hcd_to_u132(hcd); - if (u132->going > 1) { - dev_err(&u132->platform_dev->dev, "device has been removed %d\n" - , u132->going); - } else if (u132->going > 0) - dev_err(&u132->platform_dev->dev, "device is being removed\n"); -} - #ifdef CONFIG_PM static int u132_bus_suspend(struct usb_hcd *hcd) @@ -2995,7 +2985,6 @@ static struct hc_driver u132_hc_driver = { .bus_suspend = u132_bus_suspend, .bus_resume = u132_bus_resume, .start_port_reset = u132_start_port_reset, - .hub_irq_enable = u132_hub_irq_enable, }; /* -- cgit v1.2.3 From 08177e12b7b4c3d59060f829e5c151d06f9a08d6 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Wed, 16 Apr 2008 15:46:37 +0200 Subject: USB: add documentation about callbacks Add Documentation about callbacks in USB. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- Documentation/usb/callbacks.txt | 132 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 Documentation/usb/callbacks.txt diff --git a/Documentation/usb/callbacks.txt b/Documentation/usb/callbacks.txt new file mode 100644 index 00000000000..7c812411945 --- /dev/null +++ b/Documentation/usb/callbacks.txt @@ -0,0 +1,132 @@ +What callbacks will usbcore do? +=============================== + +Usbcore will call into a driver through callbacks defined in the driver +structure and through the completion handler of URBs a driver submits. +Only the former are in the scope of this document. These two kinds of +callbacks are completely independent of each other. Information on the +completion callback can be found in Documentation/usb/URB.txt. + +The callbacks defined in the driver structure are: + +1. Hotplugging callbacks: + + * @probe: Called to see if the driver is willing to manage a particular + * interface on a device. + * @disconnect: Called when the interface is no longer accessible, usually + * because its device has been (or is being) disconnected or the + * driver module is being unloaded. + +2. Odd backdoor through usbfs: + + * @ioctl: Used for drivers that want to talk to userspace through + * the "usbfs" filesystem. This lets devices provide ways to + * expose information to user space regardless of where they + * do (or don't) show up otherwise in the filesystem. + +3. Power management (PM) callbacks: + + * @suspend: Called when the device is going to be suspended. + * @resume: Called when the device is being resumed. + * @reset_resume: Called when the suspended device has been reset instead + * of being resumed. + +4. Device level operations: + + * @pre_reset: Called when the device is about to be reset. + * @post_reset: Called after the device has been reset + +The ioctl interface (2) should be used only if you have a very good +reason. Sysfs is preferred these days. The PM callbacks are covered +separately in Documentation/usb/power-management.txt. + +Calling conventions +=================== + +All callbacks are mutually exclusive. There's no need for locking +against other USB callbacks. All callbacks are called from a task +context. You may sleep. However, it is important that all sleeps have a +small fixed upper limit in time. In particular you must not call out to +user space and await results. + +Hotplugging callbacks +===================== + +These callbacks are intended to associate and disassociate a driver with +an interface. A driver's bond to an interface is exclusive. + +The probe() callback +-------------------- + +int (*probe) (struct usb_interface *intf, + const struct usb_device_id *id); + +Accept or decline an interface. If you accept the device return 0, +otherwise -ENODEV or -ENXIO. Other error codes should be used only if a +genuine error occurred during initialisation which prevented a driver +from accepting a device that would else have been accepted. +You are strongly encouraged to use usbcore'sfacility, +usb_set_intfdata(), to associate a data structure with an interface, so +that you know which internal state and identity you associate with a +particular interface. The device will not be suspended and you may do IO +to the interface you are called for and endpoint 0 of the device. Device +initialisation that doesn't take too long is a good idea here. + +The disconnect() callback +------------------------- + +void (*disconnect) (struct usb_interface *intf); + +This callback is a signal to break any connection with an interface. +You are not allowed any IO to a device after returning from this +callback. You also may not do any other operation that may interfere +with another driver bound the interface, eg. a power management +operation. +If you are called due to a physical disconnection, all your URBs will be +killed by usbcore. Note that in this case disconnect will be called some +time after the physical disconnection. Thus your driver must be prepared +to deal with failing IO even prior to the callback. + +Device level callbacks +====================== + +pre_reset +--------- + +int (*pre_reset)(struct usb_interface *intf); + +Another driver or user space is triggering a reset on the device which +contains the interface passed as an argument. Cease IO and save any +device state you need to restore. + +If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you +are in atomic context. + +post_reset +---------- + +int (*post_reset)(struct usb_interface *intf); + +The reset has completed. Restore any saved device state and begin +using the device again. + +If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you +are in atomic context. + +Call sequences +============== + +No callbacks other than probe will be invoked for an interface +that isn't bound to your driver. + +Probe will never be called for an interface bound to a driver. +Hence following a successful probe, disconnect will be called +before there is another probe for the same interface. + +Once your driver is bound to an interface, disconnect can be +called at any time except in between pre_reset and post_reset. +pre_reset is always followed by post_reset, even if the reset +failed or the device has been unplugged. + +suspend is always followed by one of: resume, reset_resume, or +disconnect. -- cgit v1.2.3 From c6dbf554bc8a79c9caab3dbf891a33c19068f646 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 13 Apr 2008 14:00:44 -0700 Subject: USB: cdc-acm: signedness fix Fix bogus assignment of "unsigned char *" to "char *": preserve unsignedness. These values are used directly as descriptor lengths when iterating through the buffer, so this *could* cause oddness that potentially includes oopsing. (IMO not likely, except as part of a malicious device...) Fix the bogus warning in CDC ACM which highlighted this problem (by showing a negative descriptor type). It uses the undesirable legacy err() for something that's not even an error; switch to use dev_dbg, and show descriptor types in hex notation to match the convention for such codes. Signed-off-by: David Brownell Acked-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/cdc-acm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d9b40811392..6d57413ac0f 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -804,7 +804,7 @@ static int acm_probe (struct usb_interface *intf, { struct usb_cdc_union_desc *union_header = NULL; struct usb_cdc_country_functional_desc *cfd = NULL; - char *buffer = intf->altsetting->extra; + unsigned char *buffer = intf->altsetting->extra; int buflen = intf->altsetting->extralen; struct usb_interface *control_interface; struct usb_interface *data_interface; @@ -881,9 +881,13 @@ static int acm_probe (struct usb_interface *intf, if ((call_management_function & 3) != 3) err("This device cannot do calls on its own. It is no modem."); break; - default: - err("Ignoring extra header, type %d, length %d", buffer[2], buffer[0]); + /* there are LOTS more CDC descriptors that + * could legitimately be found here. + */ + dev_dbg(&intf->dev, "Ignoring descriptor: " + "type %02x, length %d\n", + buffer[2], buffer[0]); break; } next_desc: -- cgit v1.2.3 From 4f6676274fb6303a8e8100d086ea8c2c00c0d8e3 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 12 Apr 2008 08:32:05 -0700 Subject: USB: ehci: qh_completions cleanup and bugfix Simplify processing of completed qtds, and correct handling of short reads, by removing two state variables: - "qtd_status" wasn't needed. The current URB's status is either OK (-EINPROGRESS) or some fault status. Once a fault appears, the queue halts and any later QTDs are immediately removed, so no temporary status is needed. (Or for typical short reads, it's not treated as a fault, so no queue halt is needed.) - "do_status" was erroneous. Because of how the queue is set up, short control reads can (and should!) be treated like full size reads, and cleaned up the usual way. The status stage will be executed transparently, and usbcore handles the choice of whether to report this status as unexected. The "do_status" problem caused a rather perplexing timing-dependent problem with usbtest case 10. Sometimes it would make the controller skip a dozen transactions while (wrongly) trying to clean up after a short transfer. Fortunately, removing a dcache contention issue made this become trivial to reproduce (on one test rig), so enough clues finally presented themselves ... I think this has been around for a very long time, but was worsened by recent urb->status changes. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-q.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 64942ec584c..315c7c14aaa 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -242,7 +242,8 @@ __acquires(ehci->lock) if (unlikely(urb->unlinked)) { COUNT(ehci->stats.unlink); } else { - if (likely(status == -EINPROGRESS)) + /* report non-error and short read status as zero */ + if (status == -EINPROGRESS || status == -EREMOTEIO) status = 0; COUNT(ehci->stats.complete); } @@ -283,7 +284,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) int last_status = -EINPROGRESS; int stopped; unsigned count = 0; - int do_status = 0; u8 state; u32 halt = HALT_BIT(ehci); @@ -309,7 +309,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) struct ehci_qtd *qtd; struct urb *urb; u32 token = 0; - int qtd_status; qtd = list_entry (entry, struct ehci_qtd, qtd_list); urb = qtd->urb; @@ -377,13 +376,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) else if (last_status == -EINPROGRESS && !urb->unlinked) continue; - /* issue status after short control reads */ - if (unlikely (do_status != 0) - && QTD_PID (token) == 0 /* OUT */) { - do_status = 0; - continue; - } - /* qh unlinked; token in overlay may be most current */ if (state == QH_STATE_IDLE && cpu_to_hc32(ehci, qtd->qtd_dma) @@ -401,15 +393,21 @@ halt: } } - /* remove it from the queue */ - qtd_status = qtd_copy_status(ehci, urb, qtd->length, token); - if (unlikely(qtd_status == -EREMOTEIO)) { - do_status = (!urb->unlinked && - usb_pipecontrol(urb->pipe)); - qtd_status = 0; + /* unless we already know the urb's status, collect qtd status + * and update count of bytes transferred. in common short read + * cases with only one data qtd (including control transfers), + * queue processing won't halt. but with two or more qtds (for + * example, with a 32 KB transfer), when the first qtd gets a + * short read the second must be removed by hand. + */ + if (last_status == -EINPROGRESS) { + last_status = qtd_copy_status(ehci, urb, + qtd->length, token); + if (last_status == -EREMOTEIO + && (qtd->hw_alt_next + & EHCI_LIST_END(ehci))) + last_status = -EINPROGRESS; } - if (likely(last_status == -EINPROGRESS)) - last_status = qtd_status; /* if we're removing something not at the queue head, * patch the hardware queue pointer. -- cgit v1.2.3 From aff6d18f95bb81b2d07994372c8edcc2c2b41180 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 18 Apr 2008 11:11:26 -0400 Subject: USB: fix compile problems in ehci-hcd This patch (as1072) fixes some recently-introduced compile problems that show up in ehci-hcd when CONFIG_PM is turned off. PORT_WAKE_BITS needs to be defined always. ehci_port_power() is called during initialization by all the EHCI variants other than the PCI version, in which it is "defined but not used". So add a call to it. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-hub.c | 4 ++-- drivers/usb/host/ehci-pci.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 536b433d24f..efffef64f59 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -28,10 +28,10 @@ /*-------------------------------------------------------------------------*/ -#ifdef CONFIG_PM - #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) +#ifdef CONFIG_PM + static int ehci_hub_control( struct usb_hcd *hcd, u16 typeReq, diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 88dad4b5313..5bb7f6bb13f 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -222,6 +222,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) ehci_warn(ehci, "selective suspend/wakeup unavailable\n"); #endif + ehci_port_power(ehci, 1); retval = ehci_pci_reinit(ehci, pdev); done: return retval; -- cgit v1.2.3 From 14722ef4acedc643f0b78b7165ceff2d300dae4d Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 17 Apr 2008 10:18:11 -0400 Subject: USB: usbfs: export the URB_NO_INTERRUPT flag to userspace This patch (as1079) cleans up the way URB_* flags are exported in usbfs. The URB_NO_INTERRUPT flag is now exported (this is the only behavioral change). USBDEVFS_URB_* macros are added for URB_NO_FSBR, URB_ZERO_PACKET, and URB_NO_INTERRUPT, making explicit the fact that the kernel accepts them. The flag matching takes into account that the URB_* values may change as the kernel evolves, whereas the USBDEVFS_URB_* values must remain fixed since they are a user API. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/devio.c | 27 +++++++++++++++++++++++---- include/linux/usbdevice_fs.h | 7 +++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 039ba23cc8b..6c4cd82d7d1 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -948,8 +948,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, int ret, ifnum = -1; int is_in; - if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| - URB_NO_FSBR|URB_ZERO_PACKET)) + if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP | + USBDEVFS_URB_SHORT_NOT_OK | + USBDEVFS_URB_NO_FSBR | + USBDEVFS_URB_ZERO_PACKET | + USBDEVFS_URB_NO_INTERRUPT)) return -EINVAL; if (!uurb->buffer) return -EINVAL; @@ -1104,8 +1107,24 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, as->urb->pipe = (uurb->type << 30) | __create_pipe(ps->dev, uurb->endpoint & 0xf) | (uurb->endpoint & USB_DIR_IN); - as->urb->transfer_flags = uurb->flags | - (is_in ? URB_DIR_IN : URB_DIR_OUT); + + /* This tedious sequence is necessary because the URB_* flags + * are internal to the kernel and subject to change, whereas + * the USBDEVFS_URB_* flags are a user API and must not be changed. + */ + u = (is_in ? URB_DIR_IN : URB_DIR_OUT); + if (uurb->flags & USBDEVFS_URB_ISO_ASAP) + u |= URB_ISO_ASAP; + if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK) + u |= URB_SHORT_NOT_OK; + if (uurb->flags & USBDEVFS_URB_NO_FSBR) + u |= URB_NO_FSBR; + if (uurb->flags & USBDEVFS_URB_ZERO_PACKET) + u |= URB_ZERO_PACKET; + if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT) + u |= URB_NO_INTERRUPT; + as->urb->transfer_flags = u; + as->urb->transfer_buffer_length = uurb->buffer_length; as->urb->setup_packet = (unsigned char *)dr; as->urb->start_frame = uurb->start_frame; diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 17cb108b7db..3118ede2c67 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -77,8 +77,11 @@ struct usbdevfs_connectinfo { unsigned char slow; }; -#define USBDEVFS_URB_SHORT_NOT_OK 1 -#define USBDEVFS_URB_ISO_ASAP 2 +#define USBDEVFS_URB_SHORT_NOT_OK 0x01 +#define USBDEVFS_URB_ISO_ASAP 0x02 +#define USBDEVFS_URB_NO_FSBR 0x20 +#define USBDEVFS_URB_ZERO_PACKET 0x40 +#define USBDEVFS_URB_NO_INTERRUPT 0x80 #define USBDEVFS_URB_TYPE_ISO 0 #define USBDEVFS_URB_TYPE_INTERRUPT 1 -- cgit v1.2.3 From 441b62c1edb986827154768d89bbac0ba779984f Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Mon, 3 Mar 2008 16:08:34 -0800 Subject: USB: replace remaining __FUNCTION__ occurrences __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison Signed-off-by: Greg Kroah-Hartman --- drivers/usb/atm/ueagle-atm.c | 6 +- drivers/usb/class/cdc-acm.c | 6 +- drivers/usb/core/devio.c | 42 ++-- drivers/usb/core/driver.c | 30 +-- drivers/usb/core/hub.c | 8 +- drivers/usb/core/inode.c | 4 +- drivers/usb/core/message.c | 8 +- drivers/usb/core/urb.c | 2 +- drivers/usb/gadget/at91_udc.c | 4 +- drivers/usb/gadget/dummy_hcd.c | 12 +- drivers/usb/gadget/ether.c | 12 +- drivers/usb/gadget/file_storage.c | 8 +- drivers/usb/gadget/fsl_usb2_udc.c | 4 +- drivers/usb/gadget/fsl_usb2_udc.h | 2 +- drivers/usb/gadget/goku_udc.c | 20 +- drivers/usb/gadget/inode.c | 18 +- drivers/usb/gadget/lh7a40x_udc.c | 132 ++++++------ drivers/usb/gadget/net2280.h | 2 +- drivers/usb/gadget/omap_udc.c | 16 +- drivers/usb/gadget/printer.c | 6 +- drivers/usb/gadget/pxa2xx_udc.c | 26 +-- drivers/usb/gadget/rndis.c | 146 ++++++------- drivers/usb/host/ehci-q.c | 4 +- drivers/usb/host/ehci-sched.c | 2 +- drivers/usb/host/pci-quirks.c | 6 +- drivers/usb/host/sl811-hcd.c | 4 +- drivers/usb/host/uhci-hcd.c | 6 +- drivers/usb/host/uhci-q.c | 2 +- drivers/usb/misc/adutux.c | 120 +++++------ drivers/usb/misc/appledisplay.c | 6 +- drivers/usb/misc/auerswald.c | 8 +- drivers/usb/misc/emi26.c | 30 +-- drivers/usb/misc/emi62.c | 32 +-- drivers/usb/misc/iowarrior.c | 6 +- drivers/usb/misc/ldusb.c | 10 +- drivers/usb/misc/legousbtower.c | 88 ++++---- drivers/usb/misc/phidgetkit.c | 6 +- drivers/usb/misc/phidgetmotorcontrol.c | 2 +- drivers/usb/misc/phidgetservo.c | 6 +- drivers/usb/misc/usblcd.c | 6 +- drivers/usb/misc/usbtest.c | 4 +- drivers/usb/serial/aircable.c | 52 ++--- drivers/usb/serial/airprime.c | 34 +-- drivers/usb/serial/ark3116.c | 6 +- drivers/usb/serial/belkin_sa.c | 18 +- drivers/usb/serial/console.c | 10 +- drivers/usb/serial/cp2101.c | 108 +++++----- drivers/usb/serial/cyberjack.c | 72 +++---- drivers/usb/serial/cypress_m8.c | 128 ++++++------ drivers/usb/serial/digi_acceleport.c | 36 ++-- drivers/usb/serial/empeg.c | 54 ++--- drivers/usb/serial/ezusb.c | 8 +- drivers/usb/serial/ftdi_sio.c | 156 +++++++------- drivers/usb/serial/garmin_gps.c | 106 +++++----- drivers/usb/serial/generic.c | 44 ++-- drivers/usb/serial/io_edgeport.c | 318 ++++++++++++++-------------- drivers/usb/serial/io_ti.c | 364 ++++++++++++++++----------------- drivers/usb/serial/ipaq.c | 44 ++-- drivers/usb/serial/ipw.c | 48 ++--- drivers/usb/serial/ir-usb.c | 46 ++--- drivers/usb/serial/iuu_phoenix.c | 128 ++++++------ drivers/usb/serial/keyspan.c | 234 ++++++++++----------- drivers/usb/serial/keyspan_pda.c | 20 +- drivers/usb/serial/kl5kusb105.c | 78 +++---- drivers/usb/serial/kobil_sct.c | 56 ++--- drivers/usb/serial/mct_u232.c | 36 ++-- drivers/usb/serial/mos7720.c | 118 +++++------ drivers/usb/serial/mos7840.c | 150 +++++++------- drivers/usb/serial/navman.c | 18 +- drivers/usb/serial/omninet.c | 32 +-- drivers/usb/serial/option.c | 64 +++--- drivers/usb/serial/oti6858.c | 108 +++++----- drivers/usb/serial/pl2303.c | 106 +++++----- drivers/usb/serial/safe_serial.c | 28 +-- drivers/usb/serial/sierra.c | 62 +++--- drivers/usb/serial/ti_usb_3410_5052.c | 190 ++++++++--------- drivers/usb/serial/usb-serial.c | 78 +++---- drivers/usb/serial/visor.c | 86 ++++---- drivers/usb/serial/whiteheat.c | 104 +++++----- drivers/usb/storage/scsiglue.c | 10 +- drivers/usb/storage/transport.c | 18 +- drivers/usb/storage/usb.c | 16 +- drivers/usb/usb-skeleton.c | 6 +- 83 files changed, 2130 insertions(+), 2130 deletions(-) diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index c5ec1a55eee..abb7d7410e6 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -83,7 +83,7 @@ if (debug >= 1) \ dev_dbg(&(usb_dev)->dev, \ "[ueagle-atm dbg] %s: " format, \ - __FUNCTION__, ##args); \ + __func__, ##args); \ } while (0) #define uea_vdbg(usb_dev, format, args...) \ @@ -94,10 +94,10 @@ } while (0) #define uea_enters(usb_dev) \ - uea_vdbg(usb_dev, "entering %s\n", __FUNCTION__) + uea_vdbg(usb_dev, "entering %s\n", __func__) #define uea_leaves(usb_dev) \ - uea_vdbg(usb_dev, "leaving %s\n", __FUNCTION__) + uea_vdbg(usb_dev, "leaving %s\n", __func__) #define uea_err(usb_dev, format,args...) \ dev_err(&(usb_dev)->dev ,"[UEAGLE-ATM] " format , ##args) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 6d57413ac0f..33cdf8fa2f2 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -260,10 +260,10 @@ static void acm_ctrl_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, status); + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, status); + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } @@ -307,7 +307,7 @@ exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } /* data interface returns incoming bytes, or we got unthrottled */ diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 6c4cd82d7d1..de17738f3ac 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1530,60 +1530,60 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, switch (cmd) { case USBDEVFS_CONTROL: - snoop(&dev->dev, "%s: CONTROL\n", __FUNCTION__); + snoop(&dev->dev, "%s: CONTROL\n", __func__); ret = proc_control(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_BULK: - snoop(&dev->dev, "%s: BULK\n", __FUNCTION__); + snoop(&dev->dev, "%s: BULK\n", __func__); ret = proc_bulk(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_RESETEP: - snoop(&dev->dev, "%s: RESETEP\n", __FUNCTION__); + snoop(&dev->dev, "%s: RESETEP\n", __func__); ret = proc_resetep(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_RESET: - snoop(&dev->dev, "%s: RESET\n", __FUNCTION__); + snoop(&dev->dev, "%s: RESET\n", __func__); ret = proc_resetdevice(ps); break; case USBDEVFS_CLEAR_HALT: - snoop(&dev->dev, "%s: CLEAR_HALT\n", __FUNCTION__); + snoop(&dev->dev, "%s: CLEAR_HALT\n", __func__); ret = proc_clearhalt(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_GETDRIVER: - snoop(&dev->dev, "%s: GETDRIVER\n", __FUNCTION__); + snoop(&dev->dev, "%s: GETDRIVER\n", __func__); ret = proc_getdriver(ps, p); break; case USBDEVFS_CONNECTINFO: - snoop(&dev->dev, "%s: CONNECTINFO\n", __FUNCTION__); + snoop(&dev->dev, "%s: CONNECTINFO\n", __func__); ret = proc_connectinfo(ps, p); break; case USBDEVFS_SETINTERFACE: - snoop(&dev->dev, "%s: SETINTERFACE\n", __FUNCTION__); + snoop(&dev->dev, "%s: SETINTERFACE\n", __func__); ret = proc_setintf(ps, p); break; case USBDEVFS_SETCONFIGURATION: - snoop(&dev->dev, "%s: SETCONFIGURATION\n", __FUNCTION__); + snoop(&dev->dev, "%s: SETCONFIGURATION\n", __func__); ret = proc_setconfig(ps, p); break; case USBDEVFS_SUBMITURB: - snoop(&dev->dev, "%s: SUBMITURB\n", __FUNCTION__); + snoop(&dev->dev, "%s: SUBMITURB\n", __func__); ret = proc_submiturb(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; @@ -1592,60 +1592,60 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, #ifdef CONFIG_COMPAT case USBDEVFS_SUBMITURB32: - snoop(&dev->dev, "%s: SUBMITURB32\n", __FUNCTION__); + snoop(&dev->dev, "%s: SUBMITURB32\n", __func__); ret = proc_submiturb_compat(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_REAPURB32: - snoop(&dev->dev, "%s: REAPURB32\n", __FUNCTION__); + snoop(&dev->dev, "%s: REAPURB32\n", __func__); ret = proc_reapurb_compat(ps, p); break; case USBDEVFS_REAPURBNDELAY32: - snoop(&dev->dev, "%s: REAPURBDELAY32\n", __FUNCTION__); + snoop(&dev->dev, "%s: REAPURBDELAY32\n", __func__); ret = proc_reapurbnonblock_compat(ps, p); break; case USBDEVFS_IOCTL32: - snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); + snoop(&dev->dev, "%s: IOCTL\n", __func__); ret = proc_ioctl_compat(ps, ptr_to_compat(p)); break; #endif case USBDEVFS_DISCARDURB: - snoop(&dev->dev, "%s: DISCARDURB\n", __FUNCTION__); + snoop(&dev->dev, "%s: DISCARDURB\n", __func__); ret = proc_unlinkurb(ps, p); break; case USBDEVFS_REAPURB: - snoop(&dev->dev, "%s: REAPURB\n", __FUNCTION__); + snoop(&dev->dev, "%s: REAPURB\n", __func__); ret = proc_reapurb(ps, p); break; case USBDEVFS_REAPURBNDELAY: - snoop(&dev->dev, "%s: REAPURBDELAY\n", __FUNCTION__); + snoop(&dev->dev, "%s: REAPURBDELAY\n", __func__); ret = proc_reapurbnonblock(ps, p); break; case USBDEVFS_DISCSIGNAL: - snoop(&dev->dev, "%s: DISCSIGNAL\n", __FUNCTION__); + snoop(&dev->dev, "%s: DISCSIGNAL\n", __func__); ret = proc_disconnectsignal(ps, p); break; case USBDEVFS_CLAIMINTERFACE: - snoop(&dev->dev, "%s: CLAIMINTERFACE\n", __FUNCTION__); + snoop(&dev->dev, "%s: CLAIMINTERFACE\n", __func__); ret = proc_claiminterface(ps, p); break; case USBDEVFS_RELEASEINTERFACE: - snoop(&dev->dev, "%s: RELEASEINTERFACE\n", __FUNCTION__); + snoop(&dev->dev, "%s: RELEASEINTERFACE\n", __func__); ret = proc_releaseinterface(ps, p); break; case USBDEVFS_IOCTL: - snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); + snoop(&dev->dev, "%s: IOCTL\n", __func__); ret = proc_ioctl_default(ps, p); break; } diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index edc31e13e95..1e56f1cfa6d 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -157,7 +157,7 @@ static int usb_probe_device(struct device *dev) struct usb_device *udev; int error = -ENODEV; - dev_dbg(dev, "%s\n", __FUNCTION__); + dev_dbg(dev, "%s\n", __func__); if (!is_usb_device(dev)) /* Sanity check */ return error; @@ -194,7 +194,7 @@ static int usb_probe_interface(struct device *dev) const struct usb_device_id *id; int error = -ENODEV; - dev_dbg(dev, "%s\n", __FUNCTION__); + dev_dbg(dev, "%s\n", __func__); if (is_usb_device(dev)) /* Sanity check */ return error; @@ -211,7 +211,7 @@ static int usb_probe_interface(struct device *dev) if (!id) id = usb_match_dynamic_id(intf, driver); if (id) { - dev_dbg(dev, "%s - got id\n", __FUNCTION__); + dev_dbg(dev, "%s - got id\n", __func__); error = usb_autoresume_device(udev); if (error) @@ -793,7 +793,7 @@ static int usb_suspend_device(struct usb_device *udev, pm_message_t msg) status = udriver->suspend(udev, msg); done: - dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); + dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); return status; } @@ -821,7 +821,7 @@ static int usb_resume_device(struct usb_device *udev) status = udriver->resume(udev); done: - dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); + dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); if (status == 0) udev->autoresume_disabled = 0; return status; @@ -860,7 +860,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) } done: - dev_vdbg(&intf->dev, "%s: status %d\n", __FUNCTION__, status); + dev_vdbg(&intf->dev, "%s: status %d\n", __func__, status); return status; } @@ -910,7 +910,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) } done: - dev_vdbg(&intf->dev, "%s: status %d\n", __FUNCTION__, status); + dev_vdbg(&intf->dev, "%s: status %d\n", __func__, status); if (status == 0) mark_active(intf); @@ -1093,7 +1093,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) } done: - dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); + dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); return status; } @@ -1187,7 +1187,7 @@ static int usb_resume_both(struct usb_device *udev) } done: - dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); + dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); if (!status) udev->reset_resume = 0; return status; @@ -1257,7 +1257,7 @@ void usb_autosuspend_device(struct usb_device *udev) status = usb_autopm_do_device(udev, -1); dev_vdbg(&udev->dev, "%s: cnt %d\n", - __FUNCTION__, udev->pm_usage_cnt); + __func__, udev->pm_usage_cnt); } /** @@ -1277,7 +1277,7 @@ void usb_try_autosuspend_device(struct usb_device *udev) { usb_autopm_do_device(udev, 0); dev_vdbg(&udev->dev, "%s: cnt %d\n", - __FUNCTION__, udev->pm_usage_cnt); + __func__, udev->pm_usage_cnt); } /** @@ -1305,7 +1305,7 @@ int usb_autoresume_device(struct usb_device *udev) status = usb_autopm_do_device(udev, 1); dev_vdbg(&udev->dev, "%s: status %d cnt %d\n", - __FUNCTION__, status, udev->pm_usage_cnt); + __func__, status, udev->pm_usage_cnt); return status; } @@ -1377,7 +1377,7 @@ void usb_autopm_put_interface(struct usb_interface *intf) status = usb_autopm_do_interface(intf, -1); dev_vdbg(&intf->dev, "%s: status %d cnt %d\n", - __FUNCTION__, status, intf->pm_usage_cnt); + __func__, status, intf->pm_usage_cnt); } EXPORT_SYMBOL_GPL(usb_autopm_put_interface); @@ -1421,7 +1421,7 @@ int usb_autopm_get_interface(struct usb_interface *intf) status = usb_autopm_do_interface(intf, 1); dev_vdbg(&intf->dev, "%s: status %d cnt %d\n", - __FUNCTION__, status, intf->pm_usage_cnt); + __func__, status, intf->pm_usage_cnt); return status; } EXPORT_SYMBOL_GPL(usb_autopm_get_interface); @@ -1443,7 +1443,7 @@ int usb_autopm_set_interface(struct usb_interface *intf) status = usb_autopm_do_interface(intf, 0); dev_vdbg(&intf->dev, "%s: status %d cnt %d\n", - __FUNCTION__, status, intf->pm_usage_cnt); + __func__, status, intf->pm_usage_cnt); return status; } EXPORT_SYMBOL_GPL(usb_autopm_set_interface); diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 5a338a5d4fe..06c3acb161e 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -575,7 +575,7 @@ static int hub_hub_status(struct usb_hub *hub, ret = get_hub_status(hub->hdev, &hub->status->hub); if (ret < 0) dev_err (hub->intfdev, - "%s failed (err = %d)\n", __FUNCTION__, ret); + "%s failed (err = %d)\n", __func__, ret); else { *status = le16_to_cpu(hub->status->hub.wHubStatus); *change = le16_to_cpu(hub->status->hub.wHubChange); @@ -1270,7 +1270,7 @@ void usb_disconnect(struct usb_device **pdev) int i; if (!udev) { - pr_debug ("%s nodev\n", __FUNCTION__); + pr_debug ("%s nodev\n", __func__); return; } @@ -2072,7 +2072,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) } } - dev_dbg(&intf->dev, "%s\n", __FUNCTION__); + dev_dbg(&intf->dev, "%s\n", __func__); /* stop khubd and related activity */ hub_quiesce(hub); @@ -3125,7 +3125,7 @@ int usb_reset_device(struct usb_device *udev) if (!parent_hdev) { /* this requires hcd-specific logic; see OHCI hc_restart() */ - dev_dbg(&udev->dev, "%s for root hub!\n", __FUNCTION__); + dev_dbg(&udev->dev, "%s for root hub!\n", __func__); return -EISDIR; } parent_hub = hdev_to_hub(parent_hdev); diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 83a373e9cc3..8607846e3c3 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c @@ -463,13 +463,13 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent) inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0); if (!inode) { - dbg("%s: could not get inode!",__FUNCTION__); + dbg("%s: could not get inode!",__func__); return -ENOMEM; } root = d_alloc_root(inode); if (!root) { - dbg("%s: could not get root dentry!",__FUNCTION__); + dbg("%s: could not get root dentry!",__func__); iput(inode); return -ENOMEM; } diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 5b23f6b017d..e819e5359d5 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -312,7 +312,7 @@ static void sg_complete(struct urb *urb) retval != -EBUSY) dev_err(&io->dev->dev, "%s, unlink --> %d\n", - __FUNCTION__, retval); + __func__, retval); } else if (urb == io->urbs [i]) found = 1; } @@ -550,7 +550,7 @@ void usb_sg_wait(struct usb_sg_request *io) io->urbs[i]->dev = NULL; io->urbs[i]->status = retval; dev_dbg(&io->dev->dev, "%s, submit --> %d\n", - __FUNCTION__, retval); + __func__, retval); usb_sg_cancel(io); } spin_lock_irq(&io->lock); @@ -600,7 +600,7 @@ void usb_sg_cancel(struct usb_sg_request *io) retval = usb_unlink_urb(io->urbs [i]); if (retval != -EINPROGRESS && retval != -EBUSY) dev_warn(&io->dev->dev, "%s, unlink --> %d\n", - __FUNCTION__, retval); + __func__, retval); } spin_lock(&io->lock); } @@ -1068,7 +1068,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) { int i; - dev_dbg(&dev->dev, "%s nuking %s URBs\n", __FUNCTION__, + dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, skip_ep0 ? "non-ep0" : "all"); for (i = skip_ep0; i < 16; ++i) { usb_disable_endpoint(dev, i); diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 1d3ed1322fb..c0b1ae25ae2 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -334,7 +334,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) dev_dbg(&dev->dev, "bogus endpoint ep%d%s in %s (bad maxpacket %d)\n", usb_endpoint_num(&ep->desc), is_out ? "out" : "in", - __FUNCTION__, max); + __func__, max); return -EMSGSIZE; } diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 5d352c900d2..9b913afb2e6 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -460,7 +460,7 @@ static void nuke(struct at91_ep *ep, int status) if (list_empty(&ep->queue)) return; - VDBG("%s %s\n", __FUNCTION__, ep->ep.name); + VDBG("%s %s\n", __func__, ep->ep.name); while (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, struct at91_request, queue); done(ep, req, status); @@ -795,7 +795,7 @@ static int at91_wakeup(struct usb_gadget *gadget) int status = -EINVAL; unsigned long flags; - DBG("%s\n", __FUNCTION__ ); + DBG("%s\n", __func__ ); local_irq_save(flags); if (!udc->clocked || !udc->suspended) diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 74f51a703b4..66293105d13 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -892,7 +892,7 @@ static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state) { struct dummy *dum = platform_get_drvdata(pdev); - dev_dbg (&pdev->dev, "%s\n", __FUNCTION__); + dev_dbg (&pdev->dev, "%s\n", __func__); spin_lock_irq (&dum->lock); dum->udc_suspended = 1; set_link_state (dum); @@ -906,7 +906,7 @@ static int dummy_udc_resume (struct platform_device *pdev) { struct dummy *dum = platform_get_drvdata(pdev); - dev_dbg (&pdev->dev, "%s\n", __FUNCTION__); + dev_dbg (&pdev->dev, "%s\n", __func__); spin_lock_irq (&dum->lock); dum->udc_suspended = 0; set_link_state (dum); @@ -1707,7 +1707,7 @@ static int dummy_bus_suspend (struct usb_hcd *hcd) { struct dummy *dum = hcd_to_dummy (hcd); - dev_dbg (&hcd->self.root_hub->dev, "%s\n", __FUNCTION__); + dev_dbg (&hcd->self.root_hub->dev, "%s\n", __func__); spin_lock_irq (&dum->lock); dum->rh_state = DUMMY_RH_SUSPENDED; @@ -1722,7 +1722,7 @@ static int dummy_bus_resume (struct usb_hcd *hcd) struct dummy *dum = hcd_to_dummy (hcd); int rc = 0; - dev_dbg (&hcd->self.root_hub->dev, "%s\n", __FUNCTION__); + dev_dbg (&hcd->self.root_hub->dev, "%s\n", __func__); spin_lock_irq (&dum->lock); if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { @@ -1896,7 +1896,7 @@ static int dummy_hcd_suspend (struct platform_device *pdev, pm_message_t state) struct dummy *dum; int rc = 0; - dev_dbg (&pdev->dev, "%s\n", __FUNCTION__); + dev_dbg (&pdev->dev, "%s\n", __func__); hcd = platform_get_drvdata (pdev); dum = hcd_to_dummy (hcd); @@ -1912,7 +1912,7 @@ static int dummy_hcd_resume (struct platform_device *pdev) { struct usb_hcd *hcd; - dev_dbg (&pdev->dev, "%s\n", __FUNCTION__); + dev_dbg (&pdev->dev, "%s\n", __func__); hcd = platform_get_drvdata (pdev); set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 92b9bf78071..bb93bdd7659 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1102,7 +1102,7 @@ static void eth_reset_config (struct eth_dev *dev) if (dev->config == 0) return; - DEBUG (dev, "%s\n", __FUNCTION__); + DEBUG (dev, "%s\n", __func__); netif_stop_queue (dev->net); netif_carrier_off (dev->net); @@ -1263,7 +1263,7 @@ static void issue_start_status (struct eth_dev *dev) struct usb_cdc_notification *event; int value; - DEBUG (dev, "%s, flush old status first\n", __FUNCTION__); + DEBUG (dev, "%s, flush old status first\n", __func__); /* flush old status * @@ -1329,7 +1329,7 @@ static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req) spin_lock(&dev->lock); status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf); if (status < 0) - ERROR(dev, "%s: rndis parse error %d\n", __FUNCTION__, status); + ERROR(dev, "%s: rndis parse error %d\n", __func__, status); spin_unlock(&dev->lock); } @@ -2113,7 +2113,7 @@ static int rndis_control_ack (struct net_device *net) static void eth_start (struct eth_dev *dev, gfp_t gfp_flags) { - DEBUG (dev, "%s\n", __FUNCTION__); + DEBUG (dev, "%s\n", __func__); /* fill the rx queue */ rx_fill (dev, gfp_flags); @@ -2133,7 +2133,7 @@ static int eth_open (struct net_device *net) { struct eth_dev *dev = netdev_priv(net); - DEBUG (dev, "%s\n", __FUNCTION__); + DEBUG (dev, "%s\n", __func__); if (netif_carrier_ok (dev->net)) eth_start (dev, GFP_KERNEL); return 0; @@ -2143,7 +2143,7 @@ static int eth_stop (struct net_device *net) { struct eth_dev *dev = netdev_priv(net); - VDEBUG (dev, "%s\n", __FUNCTION__); + VDEBUG (dev, "%s\n", __func__); netif_stop_queue (net); DEBUG (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld\n", diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 0a726e106cc..bf3f946fd45 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -1104,7 +1104,7 @@ static void ep0_complete(struct usb_ep *ep, struct usb_request *req) if (req->actual > 0) dump_msg(fsg, fsg->ep0req_name, req->buf, req->actual); if (req->status || req->actual != req->length) - DBG(fsg, "%s --> %d, %u/%u\n", __FUNCTION__, + DBG(fsg, "%s --> %d, %u/%u\n", __func__, req->status, req->actual, req->length); if (req->status == -ECONNRESET) // Request was cancelled usb_ep_fifo_flush(ep); @@ -1125,7 +1125,7 @@ static void bulk_in_complete(struct usb_ep *ep, struct usb_request *req) struct fsg_buffhd *bh = req->context; if (req->status || req->actual != req->length) - DBG(fsg, "%s --> %d, %u/%u\n", __FUNCTION__, + DBG(fsg, "%s --> %d, %u/%u\n", __func__, req->status, req->actual, req->length); if (req->status == -ECONNRESET) // Request was cancelled usb_ep_fifo_flush(ep); @@ -1146,7 +1146,7 @@ static void bulk_out_complete(struct usb_ep *ep, struct usb_request *req) dump_msg(fsg, "bulk-out", req->buf, req->actual); if (req->status || req->actual != bh->bulk_out_intended_length) - DBG(fsg, "%s --> %d, %u/%u\n", __FUNCTION__, + DBG(fsg, "%s --> %d, %u/%u\n", __func__, req->status, req->actual, bh->bulk_out_intended_length); if (req->status == -ECONNRESET) // Request was cancelled @@ -1169,7 +1169,7 @@ static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) struct fsg_buffhd *bh = req->context; if (req->status || req->actual != req->length) - DBG(fsg, "%s --> %d, %u/%u\n", __FUNCTION__, + DBG(fsg, "%s --> %d, %u/%u\n", __func__, req->status, req->actual, req->length); if (req->status == -ECONNRESET) // Request was cancelled usb_ep_fifo_flush(ep); diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 254012ad2b9..651b8270139 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c @@ -773,11 +773,11 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) /* catch various bogus parameters */ if (!_req || !req->req.complete || !req->req.buf || !list_empty(&req->queue)) { - VDBG("%s, bad params\n", __FUNCTION__); + VDBG("%s, bad params\n", __func__); return -EINVAL; } if (unlikely(!_ep || !ep->desc)) { - VDBG("%s, bad ep\n", __FUNCTION__); + VDBG("%s, bad ep\n", __func__); return -EINVAL; } if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) { diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index 9fb0b1ec852..98b1483ef6a 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -512,7 +512,7 @@ struct fsl_udc { #ifdef DEBUG #define DBG(fmt, args...) printk(KERN_DEBUG "[%s] " fmt "\n", \ - __FUNCTION__, ## args) + __func__, ## args) #else #define DBG(fmt, args...) do{}while(0) #endif diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index d3e702576de..64a592cbbe7 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c @@ -692,7 +692,7 @@ static void abort_dma(struct goku_ep *ep, int status) req->req.actual = (curr - req->req.dma) + 1; req->req.status = status; - VDBG(ep->dev, "%s %s %s %d/%d\n", __FUNCTION__, ep->ep.name, + VDBG(ep->dev, "%s %s %s %d/%d\n", __func__, ep->ep.name, ep->is_in ? "IN" : "OUT", req->req.actual, req->req.length); @@ -826,7 +826,7 @@ static int goku_dequeue(struct usb_ep *_ep, struct usb_request *_req) if (dev->ep0state == EP0_SUSPEND) return -EBUSY; - VDBG(dev, "%s %s %s %s %p\n", __FUNCTION__, _ep->name, + VDBG(dev, "%s %s %s %s %p\n", __func__, _ep->name, ep->is_in ? "IN" : "OUT", ep->dma ? "dma" : "pio", _req); @@ -898,7 +898,7 @@ static int goku_set_halt(struct usb_ep *_ep, int value) /* don't change EPxSTATUS_EP_INVALID to READY */ } else if (!ep->desc) { - DBG(ep->dev, "%s %s inactive?\n", __FUNCTION__, ep->ep.name); + DBG(ep->dev, "%s %s inactive?\n", __func__, ep->ep.name); return -EINVAL; } @@ -940,7 +940,7 @@ static int goku_fifo_status(struct usb_ep *_ep) regs = ep->dev->regs; size = readl(®s->EPxSizeLA[ep->num]) & DATASIZE; size += readl(®s->EPxSizeLB[ep->num]) & DATASIZE; - VDBG(ep->dev, "%s %s %u\n", __FUNCTION__, ep->ep.name, size); + VDBG(ep->dev, "%s %s %u\n", __func__, ep->ep.name, size); return size; } @@ -953,11 +953,11 @@ static void goku_fifo_flush(struct usb_ep *_ep) if (!_ep) return; ep = container_of(_ep, struct goku_ep, ep); - VDBG(ep->dev, "%s %s\n", __FUNCTION__, ep->ep.name); + VDBG(ep->dev, "%s %s\n", __func__, ep->ep.name); /* don't change EPxSTATUS_EP_INVALID to READY */ if (!ep->desc && ep->num != 0) { - DBG(ep->dev, "%s %s inactive?\n", __FUNCTION__, ep->ep.name); + DBG(ep->dev, "%s %s inactive?\n", __func__, ep->ep.name); return; } @@ -1286,7 +1286,7 @@ static void ep0_start(struct goku_udc *dev) struct goku_udc_regs __iomem *regs = dev->regs; unsigned i; - VDBG(dev, "%s\n", __FUNCTION__); + VDBG(dev, "%s\n", __func__); udc_reset(dev); udc_reinit (dev); @@ -1322,7 +1322,7 @@ static void udc_enable(struct goku_udc *dev) if (readl(&dev->regs->power_detect) & PW_DETECT) ep0_start(dev); else { - DBG(dev, "%s\n", __FUNCTION__); + DBG(dev, "%s\n", __func__); dev->int_enable = INT_PWRDETECT; writel(dev->int_enable, &dev->regs->int_enable); } @@ -1387,7 +1387,7 @@ stop_activity(struct goku_udc *dev, struct usb_gadget_driver *driver) { unsigned i; - DBG (dev, "%s\n", __FUNCTION__); + DBG (dev, "%s\n", __func__); if (dev->gadget.speed == USB_SPEED_UNKNOWN) driver = NULL; @@ -1726,7 +1726,7 @@ static void goku_remove(struct pci_dev *pdev) { struct goku_udc *dev = pci_get_drvdata(pdev); - DBG(dev, "%s\n", __FUNCTION__); + DBG(dev, "%s\n", __func__); BUG_ON(dev->driver); diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 0a6feafc8d2..69b0a2754f2 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1107,13 +1107,13 @@ scan: switch (state) { default: - DBG (dev, "fail %s, state %d\n", __FUNCTION__, state); + DBG (dev, "fail %s, state %d\n", __func__, state); retval = -ESRCH; break; case STATE_DEV_UNCONNECTED: case STATE_DEV_CONNECTED: spin_unlock_irq (&dev->lock); - DBG (dev, "%s wait\n", __FUNCTION__); + DBG (dev, "%s wait\n", __func__); /* wait for events */ retval = wait_event_interruptible (dev->wait, @@ -1222,7 +1222,7 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) DBG(dev, "bogus ep0out stall!\n"); } } else - DBG (dev, "fail %s, state %d\n", __FUNCTION__, dev->state); + DBG (dev, "fail %s, state %d\n", __func__, dev->state); spin_unlock_irq (&dev->lock); return retval; @@ -1233,7 +1233,7 @@ ep0_fasync (int f, struct file *fd, int on) { struct dev_data *dev = fd->private_data; // caller must F_SETOWN before signal delivery happens - VDEBUG (dev, "%s %s\n", __FUNCTION__, on ? "on" : "off"); + VDEBUG (dev, "%s %s\n", __func__, on ? "on" : "off"); return fasync_helper (f, fd, on, &dev->fasync); } @@ -1575,7 +1575,7 @@ static void destroy_ep_files (struct dev_data *dev) { struct list_head *entry, *tmp; - DBG (dev, "%s %d\n", __FUNCTION__, dev->state); + DBG (dev, "%s %d\n", __func__, dev->state); /* dev->state must prevent interference */ restart: @@ -1662,7 +1662,7 @@ enomem1: put_dev (dev); kfree (data); enomem0: - DBG (dev, "%s enomem\n", __FUNCTION__); + DBG (dev, "%s enomem\n", __func__); destroy_ep_files (dev); return -ENOMEM; } @@ -1672,7 +1672,7 @@ gadgetfs_unbind (struct usb_gadget *gadget) { struct dev_data *dev = get_gadget_data (gadget); - DBG (dev, "%s\n", __FUNCTION__); + DBG (dev, "%s\n", __func__); spin_lock_irq (&dev->lock); dev->state = STATE_DEV_UNBOUND; @@ -1685,7 +1685,7 @@ gadgetfs_unbind (struct usb_gadget *gadget) /* we've already been disconnected ... no i/o is active */ if (dev->req) usb_ep_free_request (gadget->ep0, dev->req); - DBG (dev, "%s done\n", __FUNCTION__); + DBG (dev, "%s done\n", __func__); put_dev (dev); } @@ -1933,7 +1933,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) fail: spin_unlock_irq (&dev->lock); - pr_debug ("%s: %s fail %Zd, %p\n", shortname, __FUNCTION__, value, dev); + pr_debug ("%s: %s fail %Zd, %p\n", shortname, __func__, value, dev); kfree (dev->buf); dev->buf = NULL; return value; diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index 078f7246767..825abd2621b 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c @@ -253,7 +253,7 @@ udc_proc_read(char *page, char **start, off_t off, int count, */ static void udc_disable(struct lh7a40x_udc *dev) { - DEBUG("%s, %p\n", __FUNCTION__, dev); + DEBUG("%s, %p\n", __func__, dev); udc_set_address(dev, 0); @@ -285,7 +285,7 @@ static void udc_reinit(struct lh7a40x_udc *dev) { u32 i; - DEBUG("%s, %p\n", __FUNCTION__, dev); + DEBUG("%s, %p\n", __func__, dev); /* device/ep0 records init */ INIT_LIST_HEAD(&dev->gadget.ep_list); @@ -318,7 +318,7 @@ static void udc_enable(struct lh7a40x_udc *dev) { int ep; - DEBUG("%s, %p\n", __FUNCTION__, dev); + DEBUG("%s, %p\n", __func__, dev); dev->gadget.speed = USB_SPEED_UNKNOWN; @@ -412,7 +412,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) struct lh7a40x_udc *dev = the_controller; int retval; - DEBUG("%s: %s\n", __FUNCTION__, driver->driver.name); + DEBUG("%s: %s\n", __func__, driver->driver.name); if (!driver || driver->speed != USB_SPEED_FULL @@ -521,7 +521,7 @@ static int write_fifo(struct lh7a40x_ep *ep, struct lh7a40x_request *req) is_short = unlikely(max < ep_maxpacket(ep)); } - DEBUG("%s: wrote %s %d bytes%s%s %d left %p\n", __FUNCTION__, + DEBUG("%s: wrote %s %d bytes%s%s %d left %p\n", __func__, ep->ep.name, count, is_last ? "/L" : "", is_short ? "/S" : "", req->req.length - req->req.actual, req); @@ -555,7 +555,7 @@ static int read_fifo(struct lh7a40x_ep *ep, struct lh7a40x_request *req) /* make sure there's a packet in the FIFO. */ csr = usb_read(ep->csr1); if (!(csr & USB_OUT_CSR1_OUT_PKT_RDY)) { - DEBUG("%s: Packet NOT ready!\n", __FUNCTION__); + DEBUG("%s: Packet NOT ready!\n", __func__); return -EINVAL; } @@ -614,7 +614,7 @@ static void done(struct lh7a40x_ep *ep, struct lh7a40x_request *req, int status) unsigned int stopped = ep->stopped; u32 index; - DEBUG("%s, %p\n", __FUNCTION__, ep); + DEBUG("%s, %p\n", __func__, ep); list_del_init(&req->queue); if (likely(req->req.status == -EINPROGRESS)) @@ -644,7 +644,7 @@ static void done(struct lh7a40x_ep *ep, struct lh7a40x_request *req, int status) /** Enable EP interrupt */ static void pio_irq_enable(int ep) { - DEBUG("%s: %d\n", __FUNCTION__, ep); + DEBUG("%s: %d\n", __func__, ep); switch (ep) { case 1: @@ -665,7 +665,7 @@ static void pio_irq_enable(int ep) /** Disable EP interrupt */ static void pio_irq_disable(int ep) { - DEBUG("%s: %d\n", __FUNCTION__, ep); + DEBUG("%s: %d\n", __func__, ep); switch (ep) { case 1: @@ -690,7 +690,7 @@ void nuke(struct lh7a40x_ep *ep, int status) { struct lh7a40x_request *req; - DEBUG("%s, %p\n", __FUNCTION__, ep); + DEBUG("%s, %p\n", __func__, ep); /* Flush FIFO */ flush(ep); @@ -734,7 +734,7 @@ static void flush_all(struct lh7a40x_udc *dev) */ static void flush(struct lh7a40x_ep *ep) { - DEBUG("%s, %p\n", __FUNCTION__, ep); + DEBUG("%s, %p\n", __func__, ep); switch (ep->ep_type) { case ep_control: @@ -766,7 +766,7 @@ static void lh7a40x_in_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr) usb_set_index(ep_idx); csr = usb_read(ep->csr1); - DEBUG("%s: %d, csr %x\n", __FUNCTION__, ep_idx, csr); + DEBUG("%s: %d, csr %x\n", __func__, ep_idx, csr); if (csr & USB_IN_CSR1_SENT_STALL) { DEBUG("USB_IN_CSR1_SENT_STALL\n"); @@ -776,7 +776,7 @@ static void lh7a40x_in_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr) } if (!ep->desc) { - DEBUG("%s: NO EP DESC\n", __FUNCTION__); + DEBUG("%s: NO EP DESC\n", __func__); return; } @@ -802,7 +802,7 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr) struct lh7a40x_ep *ep = &dev->ep[ep_idx]; struct lh7a40x_request *req; - DEBUG("%s: %d\n", __FUNCTION__, ep_idx); + DEBUG("%s: %d\n", __func__, ep_idx); usb_set_index(ep_idx); @@ -814,11 +814,11 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr) usb_read(ep-> csr1)) & (USB_OUT_CSR1_OUT_PKT_RDY | USB_OUT_CSR1_SENT_STALL)) { - DEBUG("%s: %x\n", __FUNCTION__, csr); + DEBUG("%s: %x\n", __func__, csr); if (csr & USB_OUT_CSR1_SENT_STALL) { DEBUG("%s: stall sent, flush fifo\n", - __FUNCTION__); + __func__); /* usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1); */ flush(ep); } else if (csr & USB_OUT_CSR1_OUT_PKT_RDY) { @@ -832,7 +832,7 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr) if (!req) { printk("%s: NULL REQ %d\n", - __FUNCTION__, ep_idx); + __func__, ep_idx); flush(ep); break; } else { @@ -844,7 +844,7 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr) } else { /* Throw packet away.. */ - printk("%s: No descriptor?!?\n", __FUNCTION__); + printk("%s: No descriptor?!?\n", __func__); flush(ep); } } @@ -886,7 +886,7 @@ static void lh7a40x_reset_intr(struct lh7a40x_udc *dev) #if 0 /* def CONFIG_ARCH_LH7A404 */ /* Does not work always... */ - DEBUG("%s: %d\n", __FUNCTION__, dev->usb_address); + DEBUG("%s: %d\n", __func__, dev->usb_address); if (!dev->usb_address) { /*usb_set(USB_RESET_IO, USB_RESET); @@ -936,7 +936,7 @@ static irqreturn_t lh7a40x_udc_irq(int irq, void *_dev) if (!intr_out && !intr_in && !intr_int) break; - DEBUG("%s (on state %s)\n", __FUNCTION__, + DEBUG("%s (on state %s)\n", __func__, state_names[dev->ep0state]); DEBUG("intr_out = %x\n", intr_out); DEBUG("intr_in = %x\n", intr_in); @@ -1016,14 +1016,14 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep, struct lh7a40x_udc *dev; unsigned long flags; - DEBUG("%s, %p\n", __FUNCTION__, _ep); + DEBUG("%s, %p\n", __func__, _ep); ep = container_of(_ep, struct lh7a40x_ep, ep); if (!_ep || !desc || ep->desc || _ep->name == ep0name || desc->bDescriptorType != USB_DT_ENDPOINT || ep->bEndpointAddress != desc->bEndpointAddress || ep_maxpacket(ep) < le16_to_cpu(desc->wMaxPacketSize)) { - DEBUG("%s, bad ep or descriptor\n", __FUNCTION__); + DEBUG("%s, bad ep or descriptor\n", __func__); return -EINVAL; } @@ -1031,7 +1031,7 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep, if (ep->bmAttributes != desc->bmAttributes && ep->bmAttributes != USB_ENDPOINT_XFER_BULK && desc->bmAttributes != USB_ENDPOINT_XFER_INT) { - DEBUG("%s, %s type mismatch\n", __FUNCTION__, _ep->name); + DEBUG("%s, %s type mismatch\n", __func__, _ep->name); return -EINVAL; } @@ -1039,13 +1039,13 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep, if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK && le16_to_cpu(desc->wMaxPacketSize) != ep_maxpacket(ep)) || !desc->wMaxPacketSize) { - DEBUG("%s, bad %s maxpacket\n", __FUNCTION__, _ep->name); + DEBUG("%s, bad %s maxpacket\n", __func__, _ep->name); return -ERANGE; } dev = ep->dev; if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { - DEBUG("%s, bogus device state\n", __FUNCTION__); + DEBUG("%s, bogus device state\n", __func__); return -ESHUTDOWN; } @@ -1061,7 +1061,7 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep, /* Reset halt state (does flush) */ lh7a40x_set_halt(_ep, 0); - DEBUG("%s: enabled %s\n", __FUNCTION__, _ep->name); + DEBUG("%s: enabled %s\n", __func__, _ep->name); return 0; } @@ -1073,11 +1073,11 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep) struct lh7a40x_ep *ep; unsigned long flags; - DEBUG("%s, %p\n", __FUNCTION__, _ep); + DEBUG("%s, %p\n", __func__, _ep); ep = container_of(_ep, struct lh7a40x_ep, ep); if (!_ep || !ep->desc) { - DEBUG("%s, %s not enabled\n", __FUNCTION__, + DEBUG("%s, %s not enabled\n", __func__, _ep ? ep->ep.name : NULL); return -EINVAL; } @@ -1097,7 +1097,7 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep) spin_unlock_irqrestore(&ep->dev->lock, flags); - DEBUG("%s: disabled %s\n", __FUNCTION__, _ep->name); + DEBUG("%s: disabled %s\n", __func__, _ep->name); return 0; } @@ -1106,7 +1106,7 @@ static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, { struct lh7a40x_request *req; - DEBUG("%s, %p\n", __FUNCTION__, ep); + DEBUG("%s, %p\n", __func__, ep); req = kzalloc(sizeof(*req), gfp_flags); if (!req) @@ -1121,7 +1121,7 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req) { struct lh7a40x_request *req; - DEBUG("%s, %p\n", __FUNCTION__, ep); + DEBUG("%s, %p\n", __func__, ep); req = container_of(_req, struct lh7a40x_request, req); WARN_ON(!list_empty(&req->queue)); @@ -1140,25 +1140,25 @@ static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, struct lh7a40x_udc *dev; unsigned long flags; - DEBUG("\n\n\n%s, %p\n", __FUNCTION__, _ep); + DEBUG("\n\n\n%s, %p\n", __func__, _ep); req = container_of(_req, struct lh7a40x_request, req); if (unlikely (!_req || !_req->complete || !_req->buf || !list_empty(&req->queue))) { - DEBUG("%s, bad params\n", __FUNCTION__); + DEBUG("%s, bad params\n", __func__); return -EINVAL; } ep = container_of(_ep, struct lh7a40x_ep, ep); if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { - DEBUG("%s, bad ep\n", __FUNCTION__); + DEBUG("%s, bad ep\n", __func__); return -EINVAL; } dev = ep->dev; if (unlikely(!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)) { - DEBUG("%s, bogus device state %p\n", __FUNCTION__, dev->driver); + DEBUG("%s, bogus device state %p\n", __func__, dev->driver); return -ESHUTDOWN; } @@ -1218,7 +1218,7 @@ static int lh7a40x_dequeue(struct usb_ep *_ep, struct usb_request *_req) struct lh7a40x_request *req; unsigned long flags; - DEBUG("%s, %p\n", __FUNCTION__, _ep); + DEBUG("%s, %p\n", __func__, _ep); ep = container_of(_ep, struct lh7a40x_ep, ep); if (!_ep || ep->ep.name == ep0name) @@ -1253,13 +1253,13 @@ static int lh7a40x_set_halt(struct usb_ep *_ep, int value) ep = container_of(_ep, struct lh7a40x_ep, ep); if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { - DEBUG("%s, bad ep\n", __FUNCTION__); + DEBUG("%s, bad ep\n", __func__); return -EINVAL; } usb_set_index(ep_index(ep)); - DEBUG("%s, ep %d, val %d\n", __FUNCTION__, ep_index(ep), value); + DEBUG("%s, ep %d, val %d\n", __func__, ep_index(ep), value); spin_lock_irqsave(&ep->dev->lock, flags); @@ -1325,11 +1325,11 @@ static int lh7a40x_fifo_status(struct usb_ep *_ep) ep = container_of(_ep, struct lh7a40x_ep, ep); if (!_ep) { - DEBUG("%s, bad ep\n", __FUNCTION__); + DEBUG("%s, bad ep\n", __func__); return -ENODEV; } - DEBUG("%s, %d\n", __FUNCTION__, ep_index(ep)); + DEBUG("%s, %d\n", __func__, ep_index(ep)); /* LPD can't report unclaimed bytes from IN fifos */ if (ep_is_in(ep)) @@ -1355,7 +1355,7 @@ static void lh7a40x_fifo_flush(struct usb_ep *_ep) ep = container_of(_ep, struct lh7a40x_ep, ep); if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { - DEBUG("%s, bad ep\n", __FUNCTION__); + DEBUG("%s, bad ep\n", __func__); return; } @@ -1376,7 +1376,7 @@ static int write_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req) max = ep_maxpacket(ep); - DEBUG_EP0("%s\n", __FUNCTION__); + DEBUG_EP0("%s\n", __func__); count = write_packet(ep, req, max); @@ -1390,7 +1390,7 @@ static int write_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req) is_last = 1; } - DEBUG_EP0("%s: wrote %s %d bytes%s %d left %p\n", __FUNCTION__, + DEBUG_EP0("%s: wrote %s %d bytes%s %d left %p\n", __func__, ep->ep.name, count, is_last ? "/L" : "", req->req.length - req->req.actual, req); @@ -1434,7 +1434,7 @@ static int read_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req) unsigned bufferspace, count, is_short; volatile u32 *fifo = (volatile u32 *)ep->fifo; - DEBUG_EP0("%s\n", __FUNCTION__); + DEBUG_EP0("%s\n", __func__); csr = usb_read(USB_EP0_CSR); if (!(csr & USB_OUT_CSR1_OUT_PKT_RDY)) @@ -1492,7 +1492,7 @@ static int read_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req) */ static void udc_set_address(struct lh7a40x_udc *dev, unsigned char address) { - DEBUG_EP0("%s: %d\n", __FUNCTION__, address); + DEBUG_EP0("%s: %d\n", __func__, address); /* c.f. 15.1.2.2 Table 15-4 address will be used after DATA_END is set */ dev->usb_address = address; usb_set((address & USB_FA_FUNCTION_ADDR), USB_FA); @@ -1514,7 +1514,7 @@ static void lh7a40x_ep0_out(struct lh7a40x_udc *dev, u32 csr) struct lh7a40x_ep *ep = &dev->ep[0]; int ret; - DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: %x\n", __func__, csr); if (list_empty(&ep->queue)) req = 0; @@ -1533,13 +1533,13 @@ static void lh7a40x_ep0_out(struct lh7a40x_udc *dev, u32 csr) if (ret) { /* Done! */ DEBUG_EP0("%s: finished, waiting for status\n", - __FUNCTION__); + __func__); usb_set((EP0_CLR_OUT | EP0_DATA_END), USB_EP0_CSR); dev->ep0state = WAIT_FOR_SETUP; } else { /* Not done yet.. */ - DEBUG_EP0("%s: not finished\n", __FUNCTION__); + DEBUG_EP0("%s: not finished\n", __func__); usb_set(EP0_CLR_OUT, USB_EP0_CSR); } } else { @@ -1556,7 +1556,7 @@ static int lh7a40x_ep0_in(struct lh7a40x_udc *dev, u32 csr) struct lh7a40x_ep *ep = &dev->ep[0]; int ret, need_zlp = 0; - DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: %x\n", __func__, csr); if (list_empty(&ep->queue)) req = 0; @@ -1564,7 +1564,7 @@ static int lh7a40x_ep0_in(struct lh7a40x_udc *dev, u32 csr) req = list_entry(ep->queue.next, struct lh7a40x_request, queue); if (!req) { - DEBUG_EP0("%s: NULL REQ\n", __FUNCTION__); + DEBUG_EP0("%s: NULL REQ\n", __func__); return 0; } @@ -1585,17 +1585,17 @@ static int lh7a40x_ep0_in(struct lh7a40x_udc *dev, u32 csr) if (ret == 1 && !need_zlp) { /* Last packet */ - DEBUG_EP0("%s: finished, waiting for status\n", __FUNCTION__); + DEBUG_EP0("%s: finished, waiting for status\n", __func__); usb_set((EP0_IN_PKT_RDY | EP0_DATA_END), USB_EP0_CSR); dev->ep0state = WAIT_FOR_SETUP; } else { - DEBUG_EP0("%s: not finished\n", __FUNCTION__); + DEBUG_EP0("%s: not finished\n", __func__); usb_set(EP0_IN_PKT_RDY, USB_EP0_CSR); } if (need_zlp) { - DEBUG_EP0("%s: Need ZLP!\n", __FUNCTION__); + DEBUG_EP0("%s: Need ZLP!\n", __func__); usb_set(EP0_IN_PKT_RDY, USB_EP0_CSR); dev->ep0state = DATA_STATE_NEED_ZLP; } @@ -1694,7 +1694,7 @@ static void lh7a40x_ep0_setup(struct lh7a40x_udc *dev, u32 csr) struct usb_ctrlrequest ctrl; int i, bytes, is_in; - DEBUG_SETUP("%s: %x\n", __FUNCTION__, csr); + DEBUG_SETUP("%s: %x\n", __func__, csr); /* Nuke all previous transfers */ nuke(ep, -EPROTO); @@ -1799,7 +1799,7 @@ static void lh7a40x_ep0_setup(struct lh7a40x_udc *dev, u32 csr) */ static void lh7a40x_ep0_in_zlp(struct lh7a40x_udc *dev, u32 csr) { - DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: %x\n", __func__, csr); /* c.f. Table 15-14 */ usb_set((EP0_IN_PKT_RDY | EP0_DATA_END), USB_EP0_CSR); @@ -1818,7 +1818,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr) usb_set_index(0); csr = usb_read(USB_EP0_CSR); - DEBUG_EP0("%s: csr = %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: csr = %x\n", __func__, csr); /* * For overview of what we should be doing see c.f. Chapter 18.1.2.4 @@ -1832,7 +1832,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr) * - clear the SENT_STALL bit */ if (csr & EP0_SENT_STALL) { - DEBUG_EP0("%s: EP0_SENT_STALL is set: %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: EP0_SENT_STALL is set: %x\n", __func__, csr); usb_clear((EP0_SENT_STALL | EP0_SEND_STALL), USB_EP0_CSR); nuke(ep, -ECONNABORTED); dev->ep0state = WAIT_FOR_SETUP; @@ -1849,7 +1849,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr) */ if (!(csr & (EP0_IN_PKT_RDY | EP0_OUT_PKT_RDY))) { DEBUG_EP0("%s: IN_PKT_RDY and OUT_PKT_RDY are clear\n", - __FUNCTION__); + __func__); switch (dev->ep0state) { case DATA_STATE_XMIT: @@ -1877,7 +1877,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr) * - set SERVICED_SETUP_END_BIT */ if (csr & EP0_SETUP_END) { - DEBUG_EP0("%s: EP0_SETUP_END is set: %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: EP0_SETUP_END is set: %x\n", __func__, csr); usb_set(EP0_CLR_SETUP_END, USB_EP0_CSR); @@ -1896,7 +1896,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr) */ if (csr & EP0_OUT_PKT_RDY) { - DEBUG_EP0("%s: EP0_OUT_PKT_RDY is set: %x\n", __FUNCTION__, + DEBUG_EP0("%s: EP0_OUT_PKT_RDY is set: %x\n", __func__, csr); switch (dev->ep0state) { @@ -1926,7 +1926,7 @@ static void lh7a40x_ep0_kick(struct lh7a40x_udc *dev, struct lh7a40x_ep *ep) usb_set_index(0); csr = usb_read(USB_EP0_CSR); - DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); + DEBUG_EP0("%s: %x\n", __func__, csr); /* Clear "out packet ready" */ usb_set(EP0_CLR_OUT, USB_EP0_CSR); @@ -1949,7 +1949,7 @@ static int lh7a40x_udc_get_frame(struct usb_gadget *_gadget) { u32 frame1 = usb_read(USB_FRM_NUM1); /* Least significant 8 bits */ u32 frame2 = usb_read(USB_FRM_NUM2); /* Most significant 3 bits */ - DEBUG("%s, %p\n", __FUNCTION__, _gadget); + DEBUG("%s, %p\n", __func__, _gadget); return ((frame2 & 0x07) << 8) | (frame1 & 0xff); } @@ -1970,7 +1970,7 @@ static const struct usb_gadget_ops lh7a40x_udc_ops = { static void nop_release(struct device *dev) { - DEBUG("%s %s\n", __FUNCTION__, dev->bus_id); + DEBUG("%s %s\n", __func__, dev->bus_id); } static struct lh7a40x_udc memory = { @@ -2065,7 +2065,7 @@ static int lh7a40x_udc_probe(struct platform_device *pdev) struct lh7a40x_udc *dev = &memory; int retval; - DEBUG("%s: %p\n", __FUNCTION__, pdev); + DEBUG("%s: %p\n", __func__, pdev); spin_lock_init(&dev->lock); dev->dev = &pdev->dev; @@ -2098,7 +2098,7 @@ static int lh7a40x_udc_remove(struct platform_device *pdev) { struct lh7a40x_udc *dev = platform_get_drvdata(pdev); - DEBUG("%s: %p\n", __FUNCTION__, pdev); + DEBUG("%s: %p\n", __func__, pdev); if (dev->driver) return -EBUSY; @@ -2131,7 +2131,7 @@ static struct platform_driver udc_driver = { static int __init udc_init(void) { - DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); + DEBUG("%s: %s version %s\n", __func__, driver_name, DRIVER_VERSION); return platform_driver_register(&udc_driver); } diff --git a/drivers/usb/gadget/net2280.h b/drivers/usb/gadget/net2280.h index 44ca139983d..1f2af398a9a 100644 --- a/drivers/usb/gadget/net2280.h +++ b/drivers/usb/gadget/net2280.h @@ -299,7 +299,7 @@ static inline void assert_out_naking (struct net2280_ep *ep, const char *where) &ep->regs->ep_rsp); } } -#define ASSERT_OUT_NAKING(ep) assert_out_naking(ep,__FUNCTION__) +#define ASSERT_OUT_NAKING(ep) assert_out_naking(ep,__func__) #else #define ASSERT_OUT_NAKING(ep) do {} while (0) #endif diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 56277d24f04..95f7662376f 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c @@ -163,7 +163,7 @@ static int omap_ep_enable(struct usb_ep *_ep, || ep->bEndpointAddress != desc->bEndpointAddress || ep->maxpacket < le16_to_cpu (desc->wMaxPacketSize)) { - DBG("%s, bad ep or descriptor\n", __FUNCTION__); + DBG("%s, bad ep or descriptor\n", __func__); return -EINVAL; } maxp = le16_to_cpu (desc->wMaxPacketSize); @@ -171,7 +171,7 @@ static int omap_ep_enable(struct usb_ep *_ep, && maxp != ep->maxpacket) || le16_to_cpu(desc->wMaxPacketSize) > ep->maxpacket || !desc->wMaxPacketSize) { - DBG("%s, bad %s maxpacket\n", __FUNCTION__, _ep->name); + DBG("%s, bad %s maxpacket\n", __func__, _ep->name); return -ERANGE; } @@ -194,13 +194,13 @@ static int omap_ep_enable(struct usb_ep *_ep, if (ep->bmAttributes != desc->bmAttributes && ep->bmAttributes != USB_ENDPOINT_XFER_BULK && desc->bmAttributes != USB_ENDPOINT_XFER_INT) { - DBG("%s, %s type mismatch\n", __FUNCTION__, _ep->name); + DBG("%s, %s type mismatch\n", __func__, _ep->name); return -EINVAL; } udc = ep->udc; if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { - DBG("%s, bogus device state\n", __FUNCTION__); + DBG("%s, bogus device state\n", __func__); return -ESHUTDOWN; } @@ -249,7 +249,7 @@ static int omap_ep_disable(struct usb_ep *_ep) unsigned long flags; if (!_ep || !ep->desc) { - DBG("%s, %s not enabled\n", __FUNCTION__, + DBG("%s, %s not enabled\n", __func__, _ep ? ep->ep.name : NULL); return -EINVAL; } @@ -936,11 +936,11 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) /* catch various bogus parameters */ if (!_req || !req->req.complete || !req->req.buf || !list_empty(&req->queue)) { - DBG("%s, bad params\n", __FUNCTION__); + DBG("%s, bad params\n", __func__); return -EINVAL; } if (!_ep || (!ep->desc && ep->bEndpointAddress)) { - DBG("%s, bad ep\n", __FUNCTION__); + DBG("%s, bad ep\n", __func__); return -EINVAL; } if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { @@ -959,7 +959,7 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) && (ep->bEndpointAddress & USB_DIR_IN) == 0 && !cpu_class_is_omap2() && (req->req.length % ep->ep.maxpacket) != 0) { - DBG("%s, no partial packet OUT reads\n", __FUNCTION__); + DBG("%s, no partial packet OUT reads\n", __func__); return -EMSGSIZE; } diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index ecc1410073f..76be75e3ab8 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c @@ -915,7 +915,7 @@ static void printer_reset_interface(struct printer_dev *dev) if (dev->interface < 0) return; - DBG(dev, "%s\n", __FUNCTION__); + DBG(dev, "%s\n", __func__); if (dev->in) usb_ep_disable(dev->in_ep); @@ -1284,7 +1284,7 @@ printer_disconnect(struct usb_gadget *gadget) struct printer_dev *dev = get_gadget_data(gadget); unsigned long flags; - DBG(dev, "%s\n", __FUNCTION__); + DBG(dev, "%s\n", __func__); spin_lock_irqsave(&dev->lock, flags); @@ -1300,7 +1300,7 @@ printer_unbind(struct usb_gadget *gadget) struct usb_request *req; - DBG(dev, "%s\n", __FUNCTION__); + DBG(dev, "%s\n", __func__); /* Remove sysfs files */ device_destroy(usb_gadget_class, g_printer_devno); diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index c00cd8b9d3d..08f699b1fc5 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c @@ -235,7 +235,7 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, || ep->bEndpointAddress != desc->bEndpointAddress || ep->fifo_size < le16_to_cpu (desc->wMaxPacketSize)) { - DMSG("%s, bad ep or descriptor\n", __FUNCTION__); + DMSG("%s, bad ep or descriptor\n", __func__); return -EINVAL; } @@ -243,7 +243,7 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, if (ep->bmAttributes != desc->bmAttributes && ep->bmAttributes != USB_ENDPOINT_XFER_BULK && desc->bmAttributes != USB_ENDPOINT_XFER_INT) { - DMSG("%s, %s type mismatch\n", __FUNCTION__, _ep->name); + DMSG("%s, %s type mismatch\n", __func__, _ep->name); return -EINVAL; } @@ -252,13 +252,13 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, && le16_to_cpu (desc->wMaxPacketSize) != BULK_FIFO_SIZE) || !desc->wMaxPacketSize) { - DMSG("%s, bad %s maxpacket\n", __FUNCTION__, _ep->name); + DMSG("%s, bad %s maxpacket\n", __func__, _ep->name); return -ERANGE; } dev = ep->dev; if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { - DMSG("%s, bogus device state\n", __FUNCTION__); + DMSG("%s, bogus device state\n", __func__); return -ESHUTDOWN; } @@ -283,7 +283,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) ep = container_of (_ep, struct pxa2xx_ep, ep); if (!_ep || !ep->desc) { - DMSG("%s, %s not enabled\n", __FUNCTION__, + DMSG("%s, %s not enabled\n", __func__, _ep ? ep->ep.name : NULL); return -EINVAL; } @@ -461,7 +461,7 @@ void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag) USIR0 = USIR0_IR0; dev->req_pending = 0; DBG(DBG_VERY_NOISY, "%s %s, %02x/%02x\n", - __FUNCTION__, tag, UDCCS0, flags); + __func__, tag, UDCCS0, flags); } static int @@ -651,20 +651,20 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) req = container_of(_req, struct pxa2xx_request, req); if (unlikely (!_req || !_req->complete || !_req->buf || !list_empty(&req->queue))) { - DMSG("%s, bad params\n", __FUNCTION__); + DMSG("%s, bad params\n", __func__); return -EINVAL; } ep = container_of(_ep, struct pxa2xx_ep, ep); if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) { - DMSG("%s, bad ep\n", __FUNCTION__); + DMSG("%s, bad ep\n", __func__); return -EINVAL; } dev = ep->dev; if (unlikely (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)) { - DMSG("%s, bogus device state\n", __FUNCTION__); + DMSG("%s, bogus device state\n", __func__); return -ESHUTDOWN; } @@ -807,7 +807,7 @@ static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value) if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name)) || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { - DMSG("%s, bad ep\n", __FUNCTION__); + DMSG("%s, bad ep\n", __func__); return -EINVAL; } if (value == 0) { @@ -859,7 +859,7 @@ static int pxa2xx_ep_fifo_status(struct usb_ep *_ep) ep = container_of(_ep, struct pxa2xx_ep, ep); if (!_ep) { - DMSG("%s, bad ep\n", __FUNCTION__); + DMSG("%s, bad ep\n", __func__); return -ENODEV; } /* pxa can't report unclaimed bytes from IN fifos */ @@ -878,7 +878,7 @@ static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep) ep = container_of(_ep, struct pxa2xx_ep, ep); if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { - DMSG("%s, bad ep\n", __FUNCTION__); + DMSG("%s, bad ep\n", __func__); return; } @@ -1813,7 +1813,7 @@ pxa2xx_udc_irq(int irq, void *_dev) static void nop_release (struct device *dev) { - DMSG("%s %s\n", __FUNCTION__, dev->bus_id); + DMSG("%s %s\n", __func__, dev->bus_id); } /* this uses load-time allocation and initialization (instead of diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 934911ee5c7..bd58dd504f6 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -204,7 +204,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_SUPPORTED_LIST: - DBG("%s: OID_GEN_SUPPORTED_LIST\n", __FUNCTION__); + DBG("%s: OID_GEN_SUPPORTED_LIST\n", __func__); length = sizeof (oid_supported_list); count = length / sizeof (u32); for (i = 0; i < count; i++) @@ -214,7 +214,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_HARDWARE_STATUS: - DBG("%s: OID_GEN_HARDWARE_STATUS\n", __FUNCTION__); + DBG("%s: OID_GEN_HARDWARE_STATUS\n", __func__); /* Bogus question! * Hardware must be ready to receive high level protocols. * BTW: @@ -227,14 +227,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_MEDIA_SUPPORTED: - DBG("%s: OID_GEN_MEDIA_SUPPORTED\n", __FUNCTION__); + DBG("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__); *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); retval = 0; break; /* mandatory */ case OID_GEN_MEDIA_IN_USE: - DBG("%s: OID_GEN_MEDIA_IN_USE\n", __FUNCTION__); + DBG("%s: OID_GEN_MEDIA_IN_USE\n", __func__); /* one medium, one transport... (maybe you do it better) */ *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); retval = 0; @@ -242,7 +242,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_MAXIMUM_FRAME_SIZE: - DBG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __FUNCTION__); + DBG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__); if (rndis_per_dev_params [configNr].dev) { *outbuf = cpu_to_le32 ( rndis_per_dev_params [configNr].dev->mtu); @@ -253,7 +253,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_LINK_SPEED: if (rndis_debug > 1) - DBG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__); + DBG("%s: OID_GEN_LINK_SPEED\n", __func__); if (rndis_per_dev_params [configNr].media_state == NDIS_MEDIA_STATE_DISCONNECTED) *outbuf = __constant_cpu_to_le32 (0); @@ -265,7 +265,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_TRANSMIT_BLOCK_SIZE: - DBG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __FUNCTION__); + DBG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__); if (rndis_per_dev_params [configNr].dev) { *outbuf = cpu_to_le32 ( rndis_per_dev_params [configNr].dev->mtu); @@ -275,7 +275,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_RECEIVE_BLOCK_SIZE: - DBG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __FUNCTION__); + DBG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__); if (rndis_per_dev_params [configNr].dev) { *outbuf = cpu_to_le32 ( rndis_per_dev_params [configNr].dev->mtu); @@ -285,7 +285,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_VENDOR_ID: - DBG("%s: OID_GEN_VENDOR_ID\n", __FUNCTION__); + DBG("%s: OID_GEN_VENDOR_ID\n", __func__); *outbuf = cpu_to_le32 ( rndis_per_dev_params [configNr].vendorID); retval = 0; @@ -293,7 +293,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_VENDOR_DESCRIPTION: - DBG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __FUNCTION__); + DBG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__); length = strlen (rndis_per_dev_params [configNr].vendorDescr); memcpy (outbuf, rndis_per_dev_params [configNr].vendorDescr, length); @@ -301,7 +301,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_VENDOR_DRIVER_VERSION: - DBG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __FUNCTION__); + DBG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__); /* Created as LE */ *outbuf = rndis_driver_version; retval = 0; @@ -309,14 +309,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_CURRENT_PACKET_FILTER: - DBG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __FUNCTION__); + DBG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__); *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter); retval = 0; break; /* mandatory */ case OID_GEN_MAXIMUM_TOTAL_SIZE: - DBG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __FUNCTION__); + DBG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__); *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE); retval = 0; break; @@ -324,14 +324,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_MEDIA_CONNECT_STATUS: if (rndis_debug > 1) - DBG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __FUNCTION__); + DBG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__); *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .media_state); retval = 0; break; case OID_GEN_PHYSICAL_MEDIUM: - DBG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __FUNCTION__); + DBG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__); *outbuf = __constant_cpu_to_le32 (0); retval = 0; break; @@ -341,7 +341,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, * versions emit undefined RNDIS messages. DOCUMENT ALL THESE! */ case OID_GEN_MAC_OPTIONS: /* from WinME */ - DBG("%s: OID_GEN_MAC_OPTIONS\n", __FUNCTION__); + DBG("%s: OID_GEN_MAC_OPTIONS\n", __func__); *outbuf = __constant_cpu_to_le32( NDIS_MAC_OPTION_RECEIVE_SERIALIZED | NDIS_MAC_OPTION_FULL_DUPLEX); @@ -353,7 +353,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_XMIT_OK: if (rndis_debug > 1) - DBG("%s: OID_GEN_XMIT_OK\n", __FUNCTION__); + DBG("%s: OID_GEN_XMIT_OK\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 ( rndis_per_dev_params [configNr].stats->tx_packets - @@ -366,7 +366,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_RCV_OK: if (rndis_debug > 1) - DBG("%s: OID_GEN_RCV_OK\n", __FUNCTION__); + DBG("%s: OID_GEN_RCV_OK\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 ( rndis_per_dev_params [configNr].stats->rx_packets - @@ -379,7 +379,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_XMIT_ERROR: if (rndis_debug > 1) - DBG("%s: OID_GEN_XMIT_ERROR\n", __FUNCTION__); + DBG("%s: OID_GEN_XMIT_ERROR\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->tx_errors); @@ -390,7 +390,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_RCV_ERROR: if (rndis_debug > 1) - DBG("%s: OID_GEN_RCV_ERROR\n", __FUNCTION__); + DBG("%s: OID_GEN_RCV_ERROR\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->rx_errors); @@ -400,7 +400,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_GEN_RCV_NO_BUFFER: - DBG("%s: OID_GEN_RCV_NO_BUFFER\n", __FUNCTION__); + DBG("%s: OID_GEN_RCV_NO_BUFFER\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->rx_dropped); @@ -410,7 +410,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, #ifdef RNDIS_OPTIONAL_STATS case OID_GEN_DIRECTED_BYTES_XMIT: - DBG("%s: OID_GEN_DIRECTED_BYTES_XMIT\n", __FUNCTION__); + DBG("%s: OID_GEN_DIRECTED_BYTES_XMIT\n", __func__); /* * Aunt Tilly's size of shoes * minus antarctica count of penguins @@ -430,7 +430,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_DIRECTED_FRAMES_XMIT: - DBG("%s: OID_GEN_DIRECTED_FRAMES_XMIT\n", __FUNCTION__); + DBG("%s: OID_GEN_DIRECTED_FRAMES_XMIT\n", __func__); /* dito */ if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 ( @@ -446,7 +446,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_MULTICAST_BYTES_XMIT: - DBG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __FUNCTION__); + DBG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->multicast*1234); @@ -455,7 +455,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_MULTICAST_FRAMES_XMIT: - DBG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __FUNCTION__); + DBG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->multicast); @@ -464,7 +464,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_BROADCAST_BYTES_XMIT: - DBG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __FUNCTION__); + DBG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->tx_packets/42*255); @@ -473,7 +473,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_BROADCAST_FRAMES_XMIT: - DBG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __FUNCTION__); + DBG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->tx_packets/42); @@ -482,19 +482,19 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_DIRECTED_BYTES_RCV: - DBG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __FUNCTION__); + DBG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __func__); *outbuf = __constant_cpu_to_le32 (0); retval = 0; break; case OID_GEN_DIRECTED_FRAMES_RCV: - DBG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __FUNCTION__); + DBG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __func__); *outbuf = __constant_cpu_to_le32 (0); retval = 0; break; case OID_GEN_MULTICAST_BYTES_RCV: - DBG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __FUNCTION__); + DBG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->multicast * 1111); @@ -503,7 +503,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_MULTICAST_FRAMES_RCV: - DBG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __FUNCTION__); + DBG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->multicast); @@ -512,7 +512,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_BROADCAST_BYTES_RCV: - DBG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __FUNCTION__); + DBG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->rx_packets/42*255); @@ -521,7 +521,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_BROADCAST_FRAMES_RCV: - DBG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __FUNCTION__); + DBG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->rx_packets/42); @@ -530,7 +530,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_RCV_CRC_ERROR: - DBG("%s: OID_GEN_RCV_CRC_ERROR\n", __FUNCTION__); + DBG("%s: OID_GEN_RCV_CRC_ERROR\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->rx_crc_errors); @@ -539,7 +539,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_GEN_TRANSMIT_QUEUE_LENGTH: - DBG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __FUNCTION__); + DBG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __func__); *outbuf = __constant_cpu_to_le32 (0); retval = 0; break; @@ -549,7 +549,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_802_3_PERMANENT_ADDRESS: - DBG("%s: OID_802_3_PERMANENT_ADDRESS\n", __FUNCTION__); + DBG("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__); if (rndis_per_dev_params [configNr].dev) { length = ETH_ALEN; memcpy (outbuf, @@ -561,7 +561,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_802_3_CURRENT_ADDRESS: - DBG("%s: OID_802_3_CURRENT_ADDRESS\n", __FUNCTION__); + DBG("%s: OID_802_3_CURRENT_ADDRESS\n", __func__); if (rndis_per_dev_params [configNr].dev) { length = ETH_ALEN; memcpy (outbuf, @@ -573,7 +573,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_802_3_MULTICAST_LIST: - DBG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); + DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); /* Multicast base address only */ *outbuf = __constant_cpu_to_le32 (0xE0000000); retval = 0; @@ -581,21 +581,21 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_802_3_MAXIMUM_LIST_SIZE: - DBG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __FUNCTION__); + DBG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__); /* Multicast base address only */ *outbuf = __constant_cpu_to_le32 (1); retval = 0; break; case OID_802_3_MAC_OPTIONS: - DBG("%s: OID_802_3_MAC_OPTIONS\n", __FUNCTION__); + DBG("%s: OID_802_3_MAC_OPTIONS\n", __func__); break; /* ieee802.3 statistics OIDs (table 4-4) */ /* mandatory */ case OID_802_3_RCV_ERROR_ALIGNMENT: - DBG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __FUNCTION__); + DBG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__); if (rndis_per_dev_params [configNr].stats) { *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] .stats->rx_frame_errors); @@ -605,51 +605,51 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, /* mandatory */ case OID_802_3_XMIT_ONE_COLLISION: - DBG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__); *outbuf = __constant_cpu_to_le32 (0); retval = 0; break; /* mandatory */ case OID_802_3_XMIT_MORE_COLLISIONS: - DBG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__); *outbuf = __constant_cpu_to_le32 (0); retval = 0; break; #ifdef RNDIS_OPTIONAL_STATS case OID_802_3_XMIT_DEFERRED: - DBG("%s: OID_802_3_XMIT_DEFERRED\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_DEFERRED\n", __func__); /* TODO */ break; case OID_802_3_XMIT_MAX_COLLISIONS: - DBG("%s: OID_802_3_XMIT_MAX_COLLISIONS\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_MAX_COLLISIONS\n", __func__); /* TODO */ break; case OID_802_3_RCV_OVERRUN: - DBG("%s: OID_802_3_RCV_OVERRUN\n", __FUNCTION__); + DBG("%s: OID_802_3_RCV_OVERRUN\n", __func__); /* TODO */ break; case OID_802_3_XMIT_UNDERRUN: - DBG("%s: OID_802_3_XMIT_UNDERRUN\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_UNDERRUN\n", __func__); /* TODO */ break; case OID_802_3_XMIT_HEARTBEAT_FAILURE: - DBG("%s: OID_802_3_XMIT_HEARTBEAT_FAILURE\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_HEARTBEAT_FAILURE\n", __func__); /* TODO */ break; case OID_802_3_XMIT_TIMES_CRS_LOST: - DBG("%s: OID_802_3_XMIT_TIMES_CRS_LOST\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_TIMES_CRS_LOST\n", __func__); /* TODO */ break; case OID_802_3_XMIT_LATE_COLLISIONS: - DBG("%s: OID_802_3_XMIT_LATE_COLLISIONS\n", __FUNCTION__); + DBG("%s: OID_802_3_XMIT_LATE_COLLISIONS\n", __func__); /* TODO */ break; #endif /* RNDIS_OPTIONAL_STATS */ @@ -657,7 +657,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, #ifdef RNDIS_PM /* power management OIDs (table 4-5) */ case OID_PNP_CAPABILITIES: - DBG("%s: OID_PNP_CAPABILITIES\n", __FUNCTION__); + DBG("%s: OID_PNP_CAPABILITIES\n", __func__); /* for now, no wakeup capabilities */ length = sizeof (struct NDIS_PNP_CAPABILITIES); @@ -665,7 +665,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, retval = 0; break; case OID_PNP_QUERY_POWER: - DBG("%s: OID_PNP_QUERY_POWER D%d\n", __FUNCTION__, + DBG("%s: OID_PNP_QUERY_POWER D%d\n", __func__, le32_to_cpu(get_unaligned((__le32 *)buf)) - 1); /* only suspend is a real power state, and * it can't be entered by OID_PNP_SET_POWER... @@ -677,7 +677,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, default: pr_warning("%s: query unknown OID 0x%08X\n", - __FUNCTION__, OID); + __func__, OID); } if (retval < 0) length = 0; @@ -729,7 +729,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, *params->filter = (u16) le32_to_cpu(get_unaligned( (__le32 *)buf)); DBG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", - __FUNCTION__, *params->filter); + __func__, *params->filter); /* this call has a significant side effect: it's * what makes the packet flow start and stop, like @@ -753,7 +753,7 @@ update_linkstate: case OID_802_3_MULTICAST_LIST: /* I think we can ignore this */ - DBG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); + DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); retval = 0; break; #if 0 @@ -762,7 +762,7 @@ update_linkstate: struct rndis_config_parameter *param; param = (struct rndis_config_parameter *) buf; DBG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER '%*s'\n", - __FUNCTION__, + __func__, min(cpu_to_le32(param->ParameterNameLength),80), buf + param->ParameterNameOffset); retval = 0; @@ -778,7 +778,7 @@ update_linkstate: * FIXME ... then things go batty; Windows wedges itself. */ i = le32_to_cpu(get_unaligned((__le32 *)buf)); - DBG("%s: OID_PNP_SET_POWER D%d\n", __FUNCTION__, i - 1); + DBG("%s: OID_PNP_SET_POWER D%d\n", __func__, i - 1); switch (i) { case NdisDeviceStateD0: *params->filter = params->saved_filter; @@ -802,7 +802,7 @@ update_linkstate: default: pr_warning("%s: set unknown OID 0x%08X, size %d\n", - __FUNCTION__, OID, buf_len); + __func__, OID, buf_len); } return retval; @@ -855,7 +855,7 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) rndis_query_cmplt_type *resp; rndis_resp_t *r; - // DBG("%s: OID = %08X\n", __FUNCTION__, cpu_to_le32(buf->OID)); + // DBG("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP; /* @@ -908,9 +908,9 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf) BufOffset = le32_to_cpu (buf->InformationBufferOffset); #ifdef VERBOSE - DBG("%s: Length: %d\n", __FUNCTION__, BufLength); - DBG("%s: Offset: %d\n", __FUNCTION__, BufOffset); - DBG("%s: InfoBuffer: ", __FUNCTION__); + DBG("%s: Length: %d\n", __func__, BufLength); + DBG("%s: Offset: %d\n", __func__, BufOffset); + DBG("%s: InfoBuffer: ", __func__); for (i = 0; i < BufLength; i++) { DBG("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); @@ -1080,14 +1080,14 @@ int rndis_msg_parser (u8 configNr, u8 *buf) switch (MsgType) { case REMOTE_NDIS_INITIALIZE_MSG: DBG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", - __FUNCTION__ ); + __func__ ); params->state = RNDIS_INITIALIZED; return rndis_init_response (configNr, (rndis_init_msg_type *) buf); case REMOTE_NDIS_HALT_MSG: DBG("%s: REMOTE_NDIS_HALT_MSG\n", - __FUNCTION__ ); + __func__ ); params->state = RNDIS_UNINITIALIZED; if (params->dev) { netif_carrier_off (params->dev); @@ -1105,7 +1105,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf) case REMOTE_NDIS_RESET_MSG: DBG("%s: REMOTE_NDIS_RESET_MSG\n", - __FUNCTION__ ); + __func__ ); return rndis_reset_response (configNr, (rndis_reset_msg_type *) buf); @@ -1113,7 +1113,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf) /* For USB: host does this every 5 seconds */ if (rndis_debug > 1) DBG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", - __FUNCTION__ ); + __func__ ); return rndis_keepalive_response (configNr, (rndis_keepalive_msg_type *) buf); @@ -1124,7 +1124,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf) * suspending itself. */ pr_warning("%s: unknown RNDIS message 0x%08X len %d\n", - __FUNCTION__ , MsgType, MsgLength); + __func__ , MsgType, MsgLength); { unsigned i; for (i = 0; i < MsgLength; i += 16) { @@ -1159,7 +1159,7 @@ int rndis_register (int (* rndis_control_ack) (struct net_device *)) if (!rndis_per_dev_params [i].used) { rndis_per_dev_params [i].used = 1; rndis_per_dev_params [i].ack = rndis_control_ack; - DBG("%s: configNr = %d\n", __FUNCTION__, i); + DBG("%s: configNr = %d\n", __func__, i); return i; } } @@ -1170,7 +1170,7 @@ int rndis_register (int (* rndis_control_ack) (struct net_device *)) void rndis_deregister (int configNr) { - DBG("%s: \n", __FUNCTION__ ); + DBG("%s: \n", __func__ ); if (configNr >= RNDIS_MAX_CONFIGS) return; rndis_per_dev_params [configNr].used = 0; @@ -1182,7 +1182,7 @@ int rndis_set_param_dev (u8 configNr, struct net_device *dev, struct net_device_stats *stats, u16 *cdc_filter) { - DBG("%s:\n", __FUNCTION__ ); + DBG("%s:\n", __func__ ); if (!dev || !stats) return -1; if (configNr >= RNDIS_MAX_CONFIGS) return -1; @@ -1195,7 +1195,7 @@ int rndis_set_param_dev (u8 configNr, struct net_device *dev, int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) { - DBG("%s:\n", __FUNCTION__ ); + DBG("%s:\n", __func__ ); if (!vendorDescr) return -1; if (configNr >= RNDIS_MAX_CONFIGS) return -1; @@ -1207,7 +1207,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed) { - DBG("%s: %u %u\n", __FUNCTION__, medium, speed); + DBG("%s: %u %u\n", __func__, medium, speed); if (configNr >= RNDIS_MAX_CONFIGS) return -1; rndis_per_dev_params [configNr].medium = medium; @@ -1415,7 +1415,7 @@ int __init rndis_init (void) if (!(rndis_connect_state [i] = create_proc_entry (name, 0660, NULL))) { - DBG("%s :remove entries", __FUNCTION__); + DBG("%s :remove entries", __func__); while (i) { sprintf (name, NAME_TEMPLATE, --i); remove_proc_entry (name, NULL); diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 315c7c14aaa..5ae689139dd 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -251,7 +251,7 @@ __acquires(ehci->lock) #ifdef EHCI_URB_TRACE ehci_dbg (ehci, "%s %s urb %p ep%d%s status %d len %d/%d\n", - __FUNCTION__, urb->dev->devpath, urb, + __func__, urb->dev->devpath, urb, usb_pipeendpoint (urb->pipe), usb_pipein (urb->pipe) ? "in" : "out", status, @@ -974,7 +974,7 @@ submit_async ( #ifdef EHCI_URB_TRACE ehci_dbg (ehci, "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n", - __FUNCTION__, urb->dev->devpath, urb, + __func__, urb->dev->devpath, urb, epnum & 0x0f, (epnum & USB_DIR_IN) ? "in" : "out", urb->transfer_buffer_length, qtd, urb->ep->hcpriv); diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index e3cfe0a0355..be575e46eac 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -1677,7 +1677,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, #ifdef EHCI_URB_TRACE ehci_dbg (ehci, "%s %s urb %p ep%d%s len %d, %d pkts %d uframes [%p]\n", - __FUNCTION__, urb->dev->devpath, urb, + __func__, urb->dev->devpath, urb, usb_pipeendpoint (urb->pipe), usb_pipein (urb->pipe) ? "in" : "out", urb->transfer_buffer_length, diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 0ee694f043c..ae6e70edd74 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -106,7 +106,7 @@ int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) pci_read_config_word(pdev, UHCI_USBLEGSUP, &legsup); if (legsup & ~(UHCI_USBLEGSUP_RO | UHCI_USBLEGSUP_RWC)) { dev_dbg(&pdev->dev, "%s: legsup = 0x%04x\n", - __FUNCTION__, legsup); + __func__, legsup); goto reset_needed; } @@ -114,14 +114,14 @@ int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) if ((cmd & UHCI_USBCMD_RUN) || !(cmd & UHCI_USBCMD_CONFIGURE) || !(cmd & UHCI_USBCMD_EGSM)) { dev_dbg(&pdev->dev, "%s: cmd = 0x%04x\n", - __FUNCTION__, cmd); + __func__, cmd); goto reset_needed; } intr = inw(base + UHCI_USBINTR); if (intr & (~UHCI_USBINTR_RESUME)) { dev_dbg(&pdev->dev, "%s: intr = 0x%04x\n", - __FUNCTION__, intr); + __func__, intr); goto reset_needed; } return 0; diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index df256d61e2c..274276cf862 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c @@ -1335,7 +1335,7 @@ static int sl811h_bus_suspend(struct usb_hcd *hcd) { // SOFs off - DBG("%s\n", __FUNCTION__); + DBG("%s\n", __func__); return 0; } @@ -1343,7 +1343,7 @@ static int sl811h_bus_resume(struct usb_hcd *hcd) { // SOFs on - DBG("%s\n", __FUNCTION__); + DBG("%s\n", __func__); return 0; } diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index f65d5a85873..d3e0d8aa398 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -335,7 +335,7 @@ __releases(uhci->lock) __acquires(uhci->lock) { dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, - "%s%s\n", __FUNCTION__, + "%s%s\n", __func__, uhci->rh_state == UHCI_RH_AUTO_STOPPED ? " (auto-start)" : ""); @@ -735,7 +735,7 @@ static int uhci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) struct uhci_hcd *uhci = hcd_to_uhci(hcd); int rc = 0; - dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); + dev_dbg(uhci_dev(uhci), "%s\n", __func__); spin_lock_irq(&uhci->lock); if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) @@ -771,7 +771,7 @@ static int uhci_pci_resume(struct usb_hcd *hcd) { struct uhci_hcd *uhci = hcd_to_uhci(hcd); - dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); + dev_dbg(uhci_dev(uhci), "%s\n", __func__); /* Since we aren't in D3 any more, it's safe to set this flag * even if the controller was dead. diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index 60379b17bbc..db645936eed 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c @@ -1171,7 +1171,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) /* Some debugging code */ dev_dbg(&urb->dev->dev, "%s: failed with status %x\n", - __FUNCTION__, status); + __func__, status); if (debug > 1 && errbuf) { /* Print the chain for debugging */ diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 5a2c44e4c1f..965f6eaea6a 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -147,10 +147,10 @@ static void adu_abort_transfers(struct adu_device *dev) { unsigned long flags; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); if (dev->udev == NULL) { - dbg(1," %s : udev is null", __FUNCTION__); + dbg(1," %s : udev is null", __func__); goto exit; } @@ -172,12 +172,12 @@ static void adu_abort_transfers(struct adu_device *dev) spin_unlock_irqrestore(&dev->buflock, flags); exit: - dbg(2," %s : leave", __FUNCTION__); + dbg(2," %s : leave", __func__); } static void adu_delete(struct adu_device *dev) { - dbg(2, "%s enter", __FUNCTION__); + dbg(2, "%s enter", __func__); /* free data structures */ usb_free_urb(dev->interrupt_in_urb); @@ -188,7 +188,7 @@ static void adu_delete(struct adu_device *dev) kfree(dev->interrupt_out_buffer); kfree(dev); - dbg(2, "%s : leave", __FUNCTION__); + dbg(2, "%s : leave", __func__); } static void adu_interrupt_in_callback(struct urb *urb) @@ -196,8 +196,8 @@ static void adu_interrupt_in_callback(struct urb *urb) struct adu_device *dev = urb->context; int status = urb->status; - dbg(4," %s : enter, status %d", __FUNCTION__, status); - adu_debug_data(5, __FUNCTION__, urb->actual_length, + dbg(4," %s : enter, status %d", __func__, status); + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); spin_lock(&dev->buflock); @@ -206,7 +206,7 @@ static void adu_interrupt_in_callback(struct urb *urb) if ((status != -ENOENT) && (status != -ECONNRESET) && (status != -ESHUTDOWN)) { dbg(1," %s : nonzero status received: %d", - __FUNCTION__, status); + __func__, status); } goto exit; } @@ -220,10 +220,10 @@ static void adu_interrupt_in_callback(struct urb *urb) dev->interrupt_in_buffer, urb->actual_length); dev->read_buffer_length += urb->actual_length; - dbg(2," %s reading %d ", __FUNCTION__, + dbg(2," %s reading %d ", __func__, urb->actual_length); } else { - dbg(1," %s : read_buffer overflow", __FUNCTION__); + dbg(1," %s : read_buffer overflow", __func__); } } @@ -232,9 +232,9 @@ exit: spin_unlock(&dev->buflock); /* always wake up so we recover from errors */ wake_up_interruptible(&dev->read_wait); - adu_debug_data(5, __FUNCTION__, urb->actual_length, + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); - dbg(4," %s : leave, status %d", __FUNCTION__, status); + dbg(4," %s : leave, status %d", __func__, status); } static void adu_interrupt_out_callback(struct urb *urb) @@ -242,14 +242,14 @@ static void adu_interrupt_out_callback(struct urb *urb) struct adu_device *dev = urb->context; int status = urb->status; - dbg(4," %s : enter, status %d", __FUNCTION__, status); - adu_debug_data(5,__FUNCTION__, urb->actual_length, urb->transfer_buffer); + dbg(4," %s : enter, status %d", __func__, status); + adu_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer); if (status != 0) { if ((status != -ENOENT) && (status != -ECONNRESET)) { dbg(1, " %s :nonzero status received: %d", - __FUNCTION__, status); + __func__, status); } goto exit; } @@ -260,9 +260,9 @@ static void adu_interrupt_out_callback(struct urb *urb) spin_unlock(&dev->buflock); exit: - adu_debug_data(5, __FUNCTION__, urb->actual_length, + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); - dbg(4," %s : leave, status %d", __FUNCTION__, status); + dbg(4," %s : leave, status %d", __func__, status); } static int adu_open(struct inode *inode, struct file *file) @@ -272,19 +272,19 @@ static int adu_open(struct inode *inode, struct file *file) int subminor; int retval; - dbg(2,"%s : enter", __FUNCTION__); + dbg(2,"%s : enter", __func__); subminor = iminor(inode); if ((retval = mutex_lock_interruptible(&adutux_mutex))) { - dbg(2, "%s : mutex lock failed", __FUNCTION__); + dbg(2, "%s : mutex lock failed", __func__); goto exit_no_lock; } interface = usb_find_interface(&adu_driver, subminor); if (!interface) { err("%s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); retval = -ENODEV; goto exit_no_device; } @@ -302,7 +302,7 @@ static int adu_open(struct inode *inode, struct file *file) } ++dev->open_count; - dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); + dbg(2,"%s : open count %d", __func__, dev->open_count); /* save device in the file's private structure */ file->private_data = dev; @@ -332,23 +332,23 @@ static int adu_open(struct inode *inode, struct file *file) exit_no_device: mutex_unlock(&adutux_mutex); exit_no_lock: - dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); + dbg(2,"%s : leave, return value %d ", __func__, retval); return retval; } static void adu_release_internal(struct adu_device *dev) { - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); /* decrement our usage count for the device */ --dev->open_count; - dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); + dbg(2," %s : open count %d", __func__, dev->open_count); if (dev->open_count <= 0) { adu_abort_transfers(dev); dev->open_count = 0; } - dbg(2," %s : leave", __FUNCTION__); + dbg(2," %s : leave", __func__); } static int adu_release(struct inode *inode, struct file *file) @@ -356,17 +356,17 @@ static int adu_release(struct inode *inode, struct file *file) struct adu_device *dev; int retval = 0; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); if (file == NULL) { - dbg(1," %s : file is NULL", __FUNCTION__); + dbg(1," %s : file is NULL", __func__); retval = -ENODEV; goto exit; } dev = file->private_data; if (dev == NULL) { - dbg(1," %s : object is NULL", __FUNCTION__); + dbg(1," %s : object is NULL", __func__); retval = -ENODEV; goto exit; } @@ -374,7 +374,7 @@ static int adu_release(struct inode *inode, struct file *file) mutex_lock(&adutux_mutex); /* not interruptible */ if (dev->open_count <= 0) { - dbg(1," %s : device not opened", __FUNCTION__); + dbg(1," %s : device not opened", __func__); retval = -ENODEV; goto exit; } @@ -388,7 +388,7 @@ static int adu_release(struct inode *inode, struct file *file) exit: mutex_unlock(&adutux_mutex); - dbg(2," %s : leave, return value %d", __FUNCTION__, retval); + dbg(2," %s : leave, return value %d", __func__, retval); return retval; } @@ -405,10 +405,10 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, unsigned long flags; DECLARE_WAITQUEUE(wait, current); - dbg(2," %s : enter, count = %Zd, file=%p", __FUNCTION__, count, file); + dbg(2," %s : enter, count = %Zd, file=%p", __func__, count, file); dev = file->private_data; - dbg(2," %s : dev=%p", __FUNCTION__, dev); + dbg(2," %s : dev=%p", __func__, dev); if (mutex_lock_interruptible(&dev->mtx)) return -ERESTARTSYS; @@ -422,16 +422,16 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, /* verify that some data was requested */ if (count == 0) { - dbg(1," %s : read request of 0 bytes", __FUNCTION__); + dbg(1," %s : read request of 0 bytes", __func__); goto exit; } timeout = COMMAND_TIMEOUT; - dbg(2," %s : about to start looping", __FUNCTION__); + dbg(2," %s : about to start looping", __func__); while (bytes_to_read) { int data_in_secondary = dev->secondary_tail - dev->secondary_head; dbg(2," %s : while, data_in_secondary=%d, status=%d", - __FUNCTION__, data_in_secondary, + __func__, data_in_secondary, dev->interrupt_in_urb->status); if (data_in_secondary) { @@ -456,7 +456,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, /* we secure access to the primary */ char *tmp; dbg(2," %s : swap, read_buffer_length = %d", - __FUNCTION__, dev->read_buffer_length); + __func__, dev->read_buffer_length); tmp = dev->read_buffer_secondary; dev->read_buffer_secondary = dev->read_buffer_primary; dev->read_buffer_primary = tmp; @@ -471,10 +471,10 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, if (!dev->read_urb_finished) { /* somebody is doing IO */ spin_unlock_irqrestore(&dev->buflock, flags); - dbg(2," %s : submitted already", __FUNCTION__); + dbg(2," %s : submitted already", __func__); } else { /* we must initiate input */ - dbg(2," %s : initiate input", __FUNCTION__); + dbg(2," %s : initiate input", __func__); dev->read_urb_finished = 0; spin_unlock_irqrestore(&dev->buflock, flags); @@ -492,7 +492,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, if (retval == -ENOMEM) { retval = bytes_read ? bytes_read : -ENOMEM; } - dbg(2," %s : submit failed", __FUNCTION__); + dbg(2," %s : submit failed", __func__); goto exit; } } @@ -511,13 +511,13 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, remove_wait_queue(&dev->read_wait, &wait); if (timeout <= 0) { - dbg(2," %s : timeout", __FUNCTION__); + dbg(2," %s : timeout", __func__); retval = bytes_read ? bytes_read : -ETIMEDOUT; goto exit; } if (signal_pending(current)) { - dbg(2," %s : signal pending", __FUNCTION__); + dbg(2," %s : signal pending", __func__); retval = bytes_read ? bytes_read : -EINTR; goto exit; } @@ -550,7 +550,7 @@ exit: /* unlock the device */ mutex_unlock(&dev->mtx); - dbg(2," %s : leave, return value %d", __FUNCTION__, retval); + dbg(2," %s : leave, return value %d", __func__, retval); return retval; } @@ -565,7 +565,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, unsigned long flags; int retval; - dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); + dbg(2," %s : enter, count = %Zd", __func__, count); dev = file->private_data; @@ -582,7 +582,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, /* verify that we actually have some data to write */ if (count == 0) { - dbg(1," %s : write request of 0 bytes", __FUNCTION__); + dbg(1," %s : write request of 0 bytes", __func__); goto exit; } @@ -595,13 +595,13 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, mutex_unlock(&dev->mtx); if (signal_pending(current)) { - dbg(1," %s : interrupted", __FUNCTION__); + dbg(1," %s : interrupted", __func__); set_current_state(TASK_RUNNING); retval = -EINTR; goto exit_onqueue; } if (schedule_timeout(COMMAND_TIMEOUT) == 0) { - dbg(1, "%s - command timed out.", __FUNCTION__); + dbg(1, "%s - command timed out.", __func__); retval = -ETIMEDOUT; goto exit_onqueue; } @@ -612,18 +612,18 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, goto exit_nolock; } - dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count); + dbg(4," %s : in progress, count = %Zd", __func__, count); } else { spin_unlock_irqrestore(&dev->buflock, flags); set_current_state(TASK_RUNNING); remove_wait_queue(&dev->write_wait, &waita); - dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); + dbg(4," %s : sending, count = %Zd", __func__, count); /* write the data into interrupt_out_buffer from userspace */ buffer_size = le16_to_cpu(dev->interrupt_out_endpoint->wMaxPacketSize); bytes_to_write = count > buffer_size ? buffer_size : count; dbg(4," %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd", - __FUNCTION__, buffer_size, count, bytes_to_write); + __func__, buffer_size, count, bytes_to_write); if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write) != 0) { retval = -EFAULT; @@ -661,7 +661,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, exit: mutex_unlock(&dev->mtx); exit_nolock: - dbg(2," %s : leave, return value %d", __FUNCTION__, retval); + dbg(2," %s : leave, return value %d", __func__, retval); return retval; exit_onqueue: @@ -706,7 +706,7 @@ static int adu_probe(struct usb_interface *interface, int out_end_size; int i; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); if (udev == NULL) { dev_err(&interface->dev, "udev is NULL.\n"); @@ -807,7 +807,7 @@ static int adu_probe(struct usb_interface *interface, dev_err(&interface->dev, "Could not retrieve serial number\n"); goto error; } - dbg(2," %s : serial_number=%s", __FUNCTION__, dev->serial_number); + dbg(2," %s : serial_number=%s", __func__, dev->serial_number); /* we can register the device now, as it is ready */ usb_set_intfdata(interface, dev); @@ -828,7 +828,7 @@ static int adu_probe(struct usb_interface *interface, udev->descriptor.idProduct, dev->serial_number, (dev->minor - ADU_MINOR_BASE)); exit: - dbg(2," %s : leave, return value %p (dev)", __FUNCTION__, dev); + dbg(2," %s : leave, return value %p (dev)", __func__, dev); return retval; @@ -847,7 +847,7 @@ static void adu_disconnect(struct usb_interface *interface) struct adu_device *dev; int minor; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); dev = usb_get_intfdata(interface); @@ -861,7 +861,7 @@ static void adu_disconnect(struct usb_interface *interface) usb_set_intfdata(interface, NULL); /* if the device is not opened, then we clean up right now */ - dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); + dbg(2," %s : open count %d", __func__, dev->open_count); if (!dev->open_count) adu_delete(dev); @@ -870,7 +870,7 @@ static void adu_disconnect(struct usb_interface *interface) dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", (minor - ADU_MINOR_BASE)); - dbg(2," %s : leave", __FUNCTION__); + dbg(2," %s : leave", __func__); } /* usb specific object needed to register this driver with the usb subsystem */ @@ -885,7 +885,7 @@ static int __init adu_init(void) { int result; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); /* register this driver with the USB subsystem */ result = usb_register(&adu_driver); @@ -899,17 +899,17 @@ static int __init adu_init(void) info("adutux is an experimental driver. Use at your own risk"); exit: - dbg(2," %s : leave, return value %d", __FUNCTION__, result); + dbg(2," %s : leave, return value %d", __func__, result); return result; } static void __exit adu_exit(void) { - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); /* deregister this driver with the USB subsystem */ usb_deregister(&adu_driver); - dbg(2," %s : leave", __FUNCTION__); + dbg(2," %s : leave", __func__); } module_init(adu_init); diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index a5e4c3545c7..a076c24a312 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c @@ -103,11 +103,11 @@ static void appledisplay_complete(struct urb *urb) case -ESHUTDOWN: /* This urb is terminated, clean up */ dbg("%s - urb shuttingdown with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } @@ -131,7 +131,7 @@ exit: retval = usb_submit_urb(pdata->urb, GFP_ATOMIC); if (retval) { err("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } } diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 81d051ca229..309c743a09d 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -983,7 +983,7 @@ static void auerswald_int_complete (struct urb * urb) pauerbuf_t bp = NULL; pauerswald_t cp = (pauerswald_t) urb->context; - dbg ("%s called", __FUNCTION__); + dbg ("%s called", __func__); switch (status) { case 0: @@ -993,10 +993,10 @@ static void auerswald_int_complete (struct urb * urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, status); + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, status); + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } @@ -1081,7 +1081,7 @@ exit: ret = usb_submit_urb (urb, GFP_ATOMIC); if (ret) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, ret); + __func__, ret); } /* int memory deallocation diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 4a09b87bdd2..4b9dc81b845 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c @@ -70,8 +70,8 @@ static int emi26_writememory (struct usb_device *dev, int address, unsigned char static int emi26_set_reset (struct usb_device *dev, unsigned char reset_bit) { int response; - info("%s - %d", __FUNCTION__, reset_bit); - /* printk(KERN_DEBUG "%s - %d", __FUNCTION__, reset_bit); */ + info("%s - %d", __func__, reset_bit); + /* printk(KERN_DEBUG "%s - %d", __func__, reset_bit); */ response = emi26_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); if (response < 0) { err("emi26: set_reset (%d) failed", reset_bit); @@ -91,7 +91,7 @@ static int emi26_load_firmware (struct usb_device *dev) buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); if (!buf) { - err( "%s - error loading firmware: error = %d", __FUNCTION__, -ENOMEM); + err( "%s - error loading firmware: error = %d", __func__, -ENOMEM); err = -ENOMEM; goto wraperr; } @@ -99,7 +99,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi26_set_reset(dev,1); if (err < 0) { - err( "%s - error loading firmware: error = %d", __FUNCTION__, err); + err( "%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -107,7 +107,7 @@ static int emi26_load_firmware (struct usb_device *dev) for (i=0; g_Loader[i].type == 0; i++) { err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -115,7 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi26_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -135,7 +135,7 @@ static int emi26_load_firmware (struct usb_device *dev) } err = emi26_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } while (i > 0); @@ -143,7 +143,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi26_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -151,7 +151,7 @@ static int emi26_load_firmware (struct usb_device *dev) for (i=0; g_Loader[i].type == 0; i++) { err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -160,7 +160,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi26_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -169,7 +169,7 @@ static int emi26_load_firmware (struct usb_device *dev) if (!INTERNAL_RAM(g_Firmware[i].address)) { err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_EXTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -178,7 +178,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi26_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -186,7 +186,7 @@ static int emi26_load_firmware (struct usb_device *dev) if (INTERNAL_RAM(g_Firmware[i].address)) { err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -195,7 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi26_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -221,7 +221,7 @@ static int emi26_probe(struct usb_interface *intf, const struct usb_device_id *i { struct usb_device *dev = interface_to_usbdev(intf); - info("%s start", __FUNCTION__); + info("%s start", __func__); emi26_load_firmware(dev); diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index d1362415922..1a2b79ac5e1 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c @@ -78,7 +78,7 @@ static int emi62_writememory (struct usb_device *dev, int address, unsigned char static int emi62_set_reset (struct usb_device *dev, unsigned char reset_bit) { int response; - info("%s - %d", __FUNCTION__, reset_bit); + info("%s - %d", __func__, reset_bit); response = emi62_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); if (response < 0) { @@ -100,7 +100,7 @@ static int emi62_load_firmware (struct usb_device *dev) dev_dbg(&dev->dev, "load_firmware\n"); buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); if (!buf) { - err( "%s - error loading firmware: error = %d", __FUNCTION__, -ENOMEM); + err( "%s - error loading firmware: error = %d", __func__, -ENOMEM); err = -ENOMEM; goto wraperr; } @@ -108,7 +108,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi62_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -116,7 +116,7 @@ static int emi62_load_firmware (struct usb_device *dev) for (i=0; g_emi62_loader[i].type == 0; i++) { err = emi62_writememory(dev, g_emi62_loader[i].address, g_emi62_loader[i].data, g_emi62_loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -124,7 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi62_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -144,7 +144,7 @@ static int emi62_load_firmware (struct usb_device *dev) } err = emi62_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } while (i > 0); @@ -152,7 +152,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi62_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -160,7 +160,7 @@ static int emi62_load_firmware (struct usb_device *dev) for (i=0; g_emi62_loader[i].type == 0; i++) { err = emi62_writememory(dev, g_emi62_loader[i].address, g_emi62_loader[i].data, g_emi62_loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -168,7 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi62_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -181,7 +181,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (!INTERNAL_RAM(g_HexSpdifFw62[i].address)) { err = emi62_writememory(dev, g_HexSpdifFw62[i].address, g_HexSpdifFw62[i].data, g_HexSpdifFw62[i].length, ANCHOR_LOAD_EXTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -191,7 +191,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (!INTERNAL_RAM(g_HexMidiFw62[i].address)) { err = emi62_writememory(dev, g_HexMidiFw62[i].address, g_HexMidiFw62[i].data, g_HexMidiFw62[i].length, ANCHOR_LOAD_EXTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d\n", __FUNCTION__, err); + err("%s - error loading firmware: error = %d\n", __func__, err); goto wraperr; return err; } @@ -201,7 +201,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi62_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -211,7 +211,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (INTERNAL_RAM(g_HexSpdifFw62[i].address)) { err = emi62_writememory(dev, g_HexSpdifFw62[i].address, g_HexSpdifFw62[i].data, g_HexSpdifFw62[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -221,7 +221,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (INTERNAL_RAM(g_HexMidiFw62[i].address)) { err = emi62_writememory(dev, g_HexMidiFw62[i].address, g_HexMidiFw62[i].data, g_HexMidiFw62[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d\n", __FUNCTION__, err); + err("%s - error loading firmware: error = %d\n", __func__, err); goto wraperr; } } @@ -231,7 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi62_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -260,7 +260,7 @@ static int emi62_probe(struct usb_interface *intf, const struct usb_device_id *i struct usb_device *dev = interface_to_usbdev(intf); dev_dbg(&intf->dev, "emi62_probe\n"); - info("%s start", __FUNCTION__); + info("%s start", __func__); emi62_load_firmware(dev); diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 801070502cc..0a2549bc054 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -218,7 +218,7 @@ exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d\n", - __FUNCTION__, retval); + __func__, retval); } @@ -453,7 +453,7 @@ static ssize_t iowarrior_write(struct file *file, default: /* what do we have here ? An unsupported Product-ID ? */ dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n", - __FUNCTION__, dev->product_id); + __func__, dev->product_id); retval = -EFAULT; goto exit; break; @@ -604,7 +604,7 @@ static int iowarrior_open(struct inode *inode, struct file *file) interface = usb_find_interface(&iowarrior_driver, subminor); if (!interface) { - err("%s - error, can't find device for minor %d", __FUNCTION__, + err("%s - error, can't find device for minor %d", __func__, subminor); return -ENODEV; } diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index c730d20eec6..11580e81e2c 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -231,7 +231,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) goto exit; } else { dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", - __FUNCTION__, status); + __func__, status); spin_lock(&dev->rbsl); goto resubmit; /* maybe we can recover */ } @@ -247,7 +247,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) memcpy(actual_buffer+1, dev->interrupt_in_buffer, urb->actual_length); dev->ring_head = next_ring_head; dbg_info(&dev->intf->dev, "%s: received %d bytes\n", - __FUNCTION__, urb->actual_length); + __func__, urb->actual_length); } else { dev_warn(&dev->intf->dev, "Ring buffer overflow, %d bytes dropped\n", @@ -286,7 +286,7 @@ static void ld_usb_interrupt_out_callback(struct urb *urb) status == -ESHUTDOWN)) dbg_info(&dev->intf->dev, "%s - nonzero write interrupt status received: %d\n", - __FUNCTION__, status); + __func__, status); dev->interrupt_out_busy = 0; wake_up_interruptible(&dev->write_wait); @@ -309,7 +309,7 @@ static int ld_usb_open(struct inode *inode, struct file *file) if (!interface) { err("%s - error, can't find device for minor %d\n", - __FUNCTION__, subminor); + __func__, subminor); return -ENODEV; } @@ -556,7 +556,7 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size); if (bytes_to_write < count) dev_warn(&dev->intf->dev, "Write buffer overflow, %zd bytes dropped\n",count-bytes_to_write); - dbg_info(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", __FUNCTION__, count, bytes_to_write); + dbg_info(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", __func__, count, bytes_to_write); if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { retval = -EFAULT; diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 6664043f464..fae5b1730ba 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -31,7 +31,7 @@ * - imported into lejos project * - changed wake_up to wake_up_interruptible * - changed to use lego0 rather than tower0 - * - changed dbg() to use __func__ rather than deprecated __FUNCTION__ + * - changed dbg() to use __func__ rather than deprecated __func__ * 2003-01-12 - 0.53 david (david@csse.uwa.edu.au) * - changed read and write to write everything or * timeout (from a patch by Chris Riesen and Brett Thaeler driver) @@ -49,7 +49,7 @@ * - added poll * - forbid seeking * - added nonblocking I/O - * - changed back __func__ to __FUNCTION__ + * - changed back __func__ to __func__ * - read and log tower firmware version * - reset tower on probe, avoids failure of first write * 2004-03-09 - 0.7 Juergen Stuber @@ -309,7 +309,7 @@ static inline void lego_usb_tower_debug_data (int level, const char *function, i */ static inline void tower_delete (struct lego_usb_tower *dev) { - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); tower_abort_transfers (dev); @@ -321,7 +321,7 @@ static inline void tower_delete (struct lego_usb_tower *dev) kfree (dev->interrupt_out_buffer); kfree (dev); - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } @@ -337,7 +337,7 @@ static int tower_open (struct inode *inode, struct file *file) struct tower_reset_reply reset_reply; int result; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); nonseekable_open(inode, file); subminor = iminor(inode); @@ -346,7 +346,7 @@ static int tower_open (struct inode *inode, struct file *file) if (!interface) { err ("%s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); retval = -ENODEV; goto exit; } @@ -424,7 +424,7 @@ unlock_exit: mutex_unlock(&dev->lock); exit: - dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d ", __func__, retval); return retval; } @@ -437,12 +437,12 @@ static int tower_release (struct inode *inode, struct file *file) struct lego_usb_tower *dev; int retval = 0; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); dev = (struct lego_usb_tower *)file->private_data; if (dev == NULL) { - dbg(1, "%s: object is NULL", __FUNCTION__); + dbg(1, "%s: object is NULL", __func__); retval = -ENODEV; goto exit_nolock; } @@ -454,7 +454,7 @@ static int tower_release (struct inode *inode, struct file *file) } if (dev->open_count != 1) { - dbg(1, "%s: device not opened exactly once", __FUNCTION__); + dbg(1, "%s: device not opened exactly once", __func__); retval = -ENODEV; goto unlock_exit; } @@ -480,7 +480,7 @@ unlock_exit: exit: mutex_unlock(&open_disc_mutex); exit_nolock: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -491,10 +491,10 @@ exit_nolock: */ static void tower_abort_transfers (struct lego_usb_tower *dev) { - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); if (dev == NULL) { - dbg(1, "%s: dev is null", __FUNCTION__); + dbg(1, "%s: dev is null", __func__); goto exit; } @@ -509,7 +509,7 @@ static void tower_abort_transfers (struct lego_usb_tower *dev) usb_kill_urb(dev->interrupt_out_urb); exit: - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } @@ -542,7 +542,7 @@ static unsigned int tower_poll (struct file *file, poll_table *wait) struct lego_usb_tower *dev; unsigned int mask = 0; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); dev = file->private_data; @@ -557,7 +557,7 @@ static unsigned int tower_poll (struct file *file, poll_table *wait) mask |= POLLOUT | POLLWRNORM; } - dbg(2, "%s: leave, mask = %d", __FUNCTION__, mask); + dbg(2, "%s: leave, mask = %d", __func__, mask); return mask; } @@ -583,7 +583,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, int retval = 0; unsigned long timeout = 0; - dbg(2, "%s: enter, count = %Zd", __FUNCTION__, count); + dbg(2, "%s: enter, count = %Zd", __func__, count); dev = (struct lego_usb_tower *)file->private_data; @@ -602,7 +602,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, /* verify that we actually have some data to read */ if (count == 0) { - dbg(1, "%s: read request of 0 bytes", __FUNCTION__); + dbg(1, "%s: read request of 0 bytes", __func__); goto unlock_exit; } @@ -658,7 +658,7 @@ unlock_exit: mutex_unlock(&dev->lock); exit: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -672,7 +672,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t size_t bytes_to_write; int retval = 0; - dbg(2, "%s: enter, count = %Zd", __FUNCTION__, count); + dbg(2, "%s: enter, count = %Zd", __func__, count); dev = (struct lego_usb_tower *)file->private_data; @@ -691,7 +691,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t /* verify that we actually have some data to write */ if (count == 0) { - dbg(1, "%s: write request of 0 bytes", __FUNCTION__); + dbg(1, "%s: write request of 0 bytes", __func__); goto unlock_exit; } @@ -709,7 +709,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t /* write the data into interrupt_out_buffer from userspace */ bytes_to_write = min_t(int, count, write_buffer_size); - dbg(4, "%s: count = %Zd, bytes_to_write = %Zd", __FUNCTION__, count, bytes_to_write); + dbg(4, "%s: count = %Zd, bytes_to_write = %Zd", __func__, count, bytes_to_write); if (copy_from_user (dev->interrupt_out_buffer, buffer, bytes_to_write)) { retval = -EFAULT; @@ -742,7 +742,7 @@ unlock_exit: mutex_unlock(&dev->lock); exit: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -757,9 +757,9 @@ static void tower_interrupt_in_callback (struct urb *urb) int status = urb->status; int retval; - dbg(4, "%s: enter, status %d", __FUNCTION__, status); + dbg(4, "%s: enter, status %d", __func__, status); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); if (status) { if (status == -ENOENT || @@ -767,7 +767,7 @@ static void tower_interrupt_in_callback (struct urb *urb) status == -ESHUTDOWN) { goto exit; } else { - dbg(1, "%s: nonzero status received: %d", __FUNCTION__, status); + dbg(1, "%s: nonzero status received: %d", __func__, status); goto resubmit; /* maybe we can recover */ } } @@ -780,9 +780,9 @@ static void tower_interrupt_in_callback (struct urb *urb) urb->actual_length); dev->read_buffer_length += urb->actual_length; dev->read_last_arrival = jiffies; - dbg(3, "%s: received %d bytes", __FUNCTION__, urb->actual_length); + dbg(3, "%s: received %d bytes", __func__, urb->actual_length); } else { - printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __FUNCTION__, urb->actual_length); + printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __func__, urb->actual_length); } spin_unlock (&dev->read_buffer_lock); } @@ -792,7 +792,7 @@ resubmit: if (dev->interrupt_in_running && dev->udev) { retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC); if (retval) { - err("%s: usb_submit_urb failed (%d)", __FUNCTION__, retval); + err("%s: usb_submit_urb failed (%d)", __func__, retval); } } @@ -800,8 +800,8 @@ exit: dev->interrupt_in_done = 1; wake_up_interruptible (&dev->read_wait); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); - dbg(4, "%s: leave, status %d", __FUNCTION__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + dbg(4, "%s: leave, status %d", __func__, status); } @@ -813,22 +813,22 @@ static void tower_interrupt_out_callback (struct urb *urb) struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; int status = urb->status; - dbg(4, "%s: enter, status %d", __FUNCTION__, status); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); + dbg(4, "%s: enter, status %d", __func__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); /* sync/async unlink faults aren't errors */ if (status && !(status == -ENOENT || status == -ECONNRESET || status == -ESHUTDOWN)) { dbg(1, "%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); } dev->interrupt_out_busy = 0; wake_up_interruptible(&dev->write_wait); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); - dbg(4, "%s: leave, status %d", __FUNCTION__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + dbg(4, "%s: leave, status %d", __func__, status); } @@ -849,7 +849,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device int retval = -ENOMEM; int result; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); if (udev == NULL) { info ("udev is NULL."); @@ -978,7 +978,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device exit: - dbg(2, "%s: leave, return value 0x%.8lx (dev)", __FUNCTION__, (long) dev); + dbg(2, "%s: leave, return value 0x%.8lx (dev)", __func__, (long) dev); return retval; @@ -998,7 +998,7 @@ static void tower_disconnect (struct usb_interface *interface) struct lego_usb_tower *dev; int minor; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); dev = usb_get_intfdata (interface); mutex_lock(&open_disc_mutex); @@ -1023,7 +1023,7 @@ static void tower_disconnect (struct usb_interface *interface) info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE)); - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } @@ -1036,7 +1036,7 @@ static int __init lego_usb_tower_init(void) int result; int retval = 0; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); /* register this driver with the USB subsystem */ result = usb_register(&tower_driver); @@ -1049,7 +1049,7 @@ static int __init lego_usb_tower_init(void) info(DRIVER_DESC " " DRIVER_VERSION); exit: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -1060,12 +1060,12 @@ exit: */ static void __exit lego_usb_tower_exit(void) { - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); /* deregister this driver with the USB subsystem */ usb_deregister (&tower_driver); - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } module_init (lego_usb_tower_init); diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index aa9bcceabe7..24230c638b8 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c @@ -113,7 +113,7 @@ static int set_outputs(struct interfacekit *kit) buffer = kzalloc(4, GFP_KERNEL); if (!buffer) { - dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&kit->udev->dev, "%s - out of memory\n", __func__); return -ENOMEM; } buffer[0] = (u8)kit->outputs; @@ -146,7 +146,7 @@ static int change_string(struct interfacekit *kit, const char *display, unsigned buffer = kmalloc(8, GFP_KERNEL); form_buffer = kmalloc(30, GFP_KERNEL); if ((!buffer) || (!form_buffer)) { - dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&kit->udev->dev, "%s - out of memory\n", __func__); goto exit; } @@ -216,7 +216,7 @@ static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, buffer = kzalloc(8, GFP_KERNEL); if (!buffer) { - dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&kit->udev->dev, "%s - out of memory\n", __func__); goto exit; } diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index 2ad09b1f484..f0113c17cc5 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c @@ -61,7 +61,7 @@ static int set_motor(struct motorcontrol *mc, int motor) buffer = kzalloc(8, GFP_KERNEL); if (!buffer) { - dev_err(&mc->intf->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&mc->intf->dev, "%s - out of memory\n", __func__); return -ENOMEM; } diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 0d9de2f7393..7d590c09434 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c @@ -89,7 +89,7 @@ change_position_v30(struct phidget_servo *servo, int servo_no, int degrees, buffer = kmalloc(6, GFP_KERNEL); if (!buffer) { dev_err(&servo->udev->dev, "%s - out of memory\n", - __FUNCTION__); + __func__); return -ENOMEM; } @@ -162,7 +162,7 @@ change_position_v20(struct phidget_servo *servo, int servo_no, int degrees, buffer = kmalloc(2, GFP_KERNEL); if (!buffer) { dev_err(&servo->udev->dev, "%s - out of memory\n", - __FUNCTION__); + __func__); return -ENOMEM; } @@ -259,7 +259,7 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) dev = kzalloc(sizeof (struct phidget_servo), GFP_KERNEL); if (dev == NULL) { - dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&interface->dev, "%s - out of memory\n", __func__); rc = -ENOMEM; goto out; } diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 20777d01db6..ada7bf898fe 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c @@ -78,7 +78,7 @@ static int lcd_open(struct inode *inode, struct file *file) interface = usb_find_interface(&lcd_driver, subminor); if (!interface) { err ("USBLCD: %s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); return -ENODEV; } @@ -193,7 +193,7 @@ static void lcd_write_bulk_callback(struct urb *urb) status == -ECONNRESET || status == -ESHUTDOWN)) { dbg("USBLCD: %s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); } /* free up our allocated buffer */ @@ -248,7 +248,7 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz /* send the data out the bulk port */ retval = usb_submit_urb(urb, GFP_KERNEL); if (retval) { - err("USBLCD: %s - failed submitting write urb, error %d", __FUNCTION__, retval); + err("USBLCD: %s - failed submitting write urb, error %d", __func__, retval); goto error_unanchor; } diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 2c4fd4d6df9..678fac86c46 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1136,7 +1136,7 @@ static int verify_not_halted (int ep, struct urb *urb) dbg ("ep %02x bogus status: %04x != 0", ep, status); return -EINVAL; } - retval = simple_io (urb, 1, 0, 0, __FUNCTION__); + retval = simple_io (urb, 1, 0, 0, __func__); if (retval != 0) return -EINVAL; return 0; @@ -1158,7 +1158,7 @@ static int verify_halted (int ep, struct urb *urb) dbg ("ep %02x bogus status: %04x != 1", ep, status); return -EINVAL; } - retval = simple_io (urb, 1, 0, -EPIPE, __FUNCTION__); + retval = simple_io (urb, 1, 0, -EPIPE, __func__); if (retval != -EPIPE) return -EINVAL; retval = simple_io (urb, 1, 0, -EPIPE, "verify_still_halted"); diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index 1cd29cd6bd0..a238817762a 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c @@ -210,7 +210,7 @@ static void aircable_send(struct usb_serial_port *port) struct aircable_private *priv = usb_get_serial_port_data(port); unsigned char* buf; u16 *dbuf; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (port->write_urb_busy) return; @@ -220,7 +220,7 @@ static void aircable_send(struct usb_serial_port *port) buf = kzalloc(count + HCI_HEADER_LENGTH, GFP_ATOMIC); if (!buf) { - err("%s- kzalloc(%d) failed.", __FUNCTION__, + err("%s- kzalloc(%d) failed.", __func__, count + HCI_HEADER_LENGTH); return; } @@ -236,7 +236,7 @@ static void aircable_send(struct usb_serial_port *port) kfree(buf); port->write_urb_busy = 1; - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, count + HCI_HEADER_LENGTH, port->write_urb->transfer_buffer); port->write_urb->transfer_buffer_length = count + HCI_HEADER_LENGTH; @@ -246,7 +246,7 @@ static void aircable_send(struct usb_serial_port *port) if (result) { dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", - __FUNCTION__, result); + __func__, result); port->write_urb_busy = 0; } @@ -275,7 +275,7 @@ static void aircable_read(struct work_struct *work) if (!tty) { schedule_work(&priv->rx_work); - err("%s - No tty available", __FUNCTION__); + err("%s - No tty available", __func__); return ; } @@ -286,7 +286,7 @@ static void aircable_read(struct work_struct *work) tty_prepare_flip_string(tty, &data, count); if (!data){ - err("%s- kzalloc(%d) failed.", __FUNCTION__, count); + err("%s- kzalloc(%d) failed.", __func__, count); return; } @@ -332,7 +332,7 @@ static int aircable_attach (struct usb_serial *serial) priv = kzalloc(sizeof(struct aircable_private), GFP_KERNEL); if (!priv){ - err("%s- kmalloc(%Zd) failed.", __FUNCTION__, + err("%s- kmalloc(%Zd) failed.", __func__, sizeof(struct aircable_private)); return -ENOMEM; } @@ -366,7 +366,7 @@ static void aircable_shutdown(struct usb_serial *serial) struct usb_serial_port *port = serial->port[0]; struct aircable_private *priv = usb_get_serial_port_data(port); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (priv) { serial_buf_free(priv->tx_buf); @@ -388,12 +388,12 @@ static int aircable_write(struct usb_serial_port *port, struct aircable_private *priv = usb_get_serial_port_data(port); int temp; - dbg("%s - port %d, %d bytes", __FUNCTION__, port->number, count); + dbg("%s - port %d, %d bytes", __func__, port->number, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, source); + usb_serial_debug_data(debug, &port->dev, __func__, count, source); if (!count){ - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return count; } @@ -414,7 +414,7 @@ static void aircable_write_bulk_callback(struct urb *urb) int status = urb->status; int result; - dbg("%s - urb status: %d", __FUNCTION__ , status); + dbg("%s - urb status: %d", __func__ , status); /* This has been taken from cypress_m8.c cypress_write_int_callback */ switch (status) { @@ -426,21 +426,21 @@ static void aircable_write_bulk_callback(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); port->write_urb_busy = 0; return; default: /* error in the urb, so we have to resubmit it */ - dbg("%s - Overflow in write", __FUNCTION__); + dbg("%s - Overflow in write", __func__); dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); port->write_urb->transfer_buffer_length = 1; port->write_urb->dev = port->serial->dev; result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) dev_err(&urb->dev->dev, "%s - failed resubmitting write urb, error %d\n", - __FUNCTION__, result); + __func__, result); else return; } @@ -460,17 +460,17 @@ static void aircable_read_bulk_callback(struct urb *urb) unsigned char *temp; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { - dbg("%s - urb status = %d", __FUNCTION__, status); + dbg("%s - urb status = %d", __func__, status); if (!port->open_count) { - dbg("%s - port is closed, exiting.", __FUNCTION__); + dbg("%s - port is closed, exiting.", __func__); return; } if (status == -EPROTO) { dbg("%s - caught -EPROTO, resubmitting the urb", - __FUNCTION__); + __func__); usb_fill_bulk_urb(port->read_urb, port->serial->dev, usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), @@ -482,14 +482,14 @@ static void aircable_read_bulk_callback(struct urb *urb) if (result) dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", - __FUNCTION__, result); + __func__, result); return; } - dbg("%s - unable to handle the error, exiting.", __FUNCTION__); + dbg("%s - unable to handle the error, exiting.", __func__); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length,urb->transfer_buffer); tty = port->tty; @@ -538,7 +538,7 @@ static void aircable_read_bulk_callback(struct urb *urb) if (result) dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", - __FUNCTION__, result); + __func__, result); } return; @@ -550,7 +550,7 @@ static void aircable_throttle(struct usb_serial_port *port) struct aircable_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->rx_lock, flags); priv->rx_flags |= THROTTLED; @@ -564,7 +564,7 @@ static void aircable_unthrottle(struct usb_serial_port *port) int actually_throttled; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->rx_lock, flags); actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED; diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index d5bcb377403..725b6b94c27 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c @@ -53,7 +53,7 @@ static int airprime_send_setup(struct usb_serial_port *port) struct usb_serial *serial = port->serial; struct airprime_private *priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (port->number != 0) return 0; @@ -83,14 +83,14 @@ static void airprime_read_bulk_callback(struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); tty = port->tty; if (tty && urb->actual_length) { @@ -101,7 +101,7 @@ static void airprime_read_bulk_callback(struct urb *urb) result = usb_submit_urb (urb, GFP_ATOMIC); if (result) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", - __FUNCTION__, result); + __func__, result); return; } @@ -112,14 +112,14 @@ static void airprime_write_bulk_callback(struct urb *urb) int status = urb->status; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree (urb->transfer_buffer); if (status) dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); spin_lock_irqsave(&priv->lock, flags); --priv->outstanding_urbs; spin_unlock_irqrestore(&priv->lock, flags); @@ -136,7 +136,7 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) int i; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* initialize our private data structure if it isn't already created */ if (!priv) { @@ -157,7 +157,7 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { dev_err(&port->dev, "%s - out of memory.\n", - __FUNCTION__); + __func__); result = -ENOMEM; goto errout; } @@ -165,7 +165,7 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) if (!urb) { kfree(buffer); dev_err(&port->dev, "%s - no more urbs?\n", - __FUNCTION__); + __func__); result = -ENOMEM; goto errout; } @@ -180,7 +180,7 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) kfree(buffer); dev_err(&port->dev, "%s - failed submitting read urb %d for port %d, error %d\n", - __FUNCTION__, i, port->number, result); + __func__, i, port->number, result); goto errout; } /* remember this urb so we can kill it when the port is closed */ @@ -212,7 +212,7 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp) struct airprime_private *priv = usb_get_serial_port_data(port); int i; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); priv->rts_state = 0; priv->dtr_state = 0; @@ -242,12 +242,12 @@ static int airprime_write(struct usb_serial_port *port, unsigned char *buffer; unsigned long flags; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); if (priv->outstanding_urbs > NUM_WRITE_URBS) { spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - write limit hit\n", __FUNCTION__); + dbg("%s - write limit hit\n", __func__); return 0; } spin_unlock_irqrestore(&priv->lock, flags); @@ -264,7 +264,7 @@ static int airprime_write(struct usb_serial_port *port, } memcpy (buffer, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); usb_fill_bulk_urb(urb, serial->dev, usb_sndbulkpipe(serial->dev, @@ -277,7 +277,7 @@ static int airprime_write(struct usb_serial_port *port, if (status) { dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", - __FUNCTION__, status); + __func__, status); count = status; kfree (buffer); } else { @@ -328,7 +328,7 @@ static int __init airprime_init(void) static void __exit airprime_exit(void) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); usb_deregister(&airprime_driver); usb_serial_deregister(&airprime_device); diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index aa7a6838a3d..9d708b22e95 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -173,7 +173,7 @@ static void ark3116_set_termios(struct usb_serial_port *port, config = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); if (!priv->termios_initialized) { @@ -323,7 +323,7 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp) char *buf; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); buf = kmalloc(1, GFP_KERNEL); if (!buf) { @@ -395,7 +395,7 @@ static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, return -EFAULT; return 0; default: - dbg("%s cmd 0x%04x not supported", __FUNCTION__, cmd); + dbg("%s cmd 0x%04x not supported", __func__, cmd); break; } diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index b6950648804..5a2877c2212 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -195,7 +195,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial) struct belkin_sa_private *priv; int i; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); /* stop reads and writes on all ports */ for (i=0; i < serial->num_ports; ++i) { @@ -210,7 +210,7 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp) { int retval = 0; - dbg("%s port %d", __FUNCTION__, port->number); + dbg("%s port %d", __func__, port->number); /*Start reading from the device*/ /* TODO: Look at possibility of submitting multiple URBs to device to @@ -237,7 +237,7 @@ exit: static void belkin_sa_close (struct usb_serial_port *port, struct file *filp) { - dbg("%s port %d", __FUNCTION__, port->number); + dbg("%s port %d", __func__, port->number); /* shutdown our bulk reads and writes */ usb_kill_urb(port->write_urb); @@ -264,15 +264,15 @@ static void belkin_sa_read_int_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* Handle known interrupt data */ /* ignore data[0] and data[1] */ @@ -331,7 +331,7 @@ exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) @@ -478,7 +478,7 @@ static int belkin_sa_tiocmget (struct usb_serial_port *port, struct file *file) unsigned long control_state; unsigned long flags; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); spin_lock_irqsave(&priv->lock, flags); control_state = priv->control_state; @@ -499,7 +499,7 @@ static int belkin_sa_tiocmset (struct usb_serial_port *port, struct file *file, int rts = 0; int dtr = 0; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); spin_lock_irqsave(&priv->lock, flags); control_state = priv->control_state; diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 66ce30c1b75..201184c3fb8 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c @@ -67,7 +67,7 @@ static int usb_console_setup(struct console *co, char *options) struct tty_struct *tty = NULL; struct ktermios *termios = NULL, dummy; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); if (options) { baud = simple_strtoul(options, NULL, 10); @@ -225,10 +225,10 @@ static void usb_console_write(struct console *co, const char *buf, unsigned coun if (count == 0) return; - dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); + dbg("%s - port %d, %d byte(s)", __func__, port->number, count); if (!port->open_count) { - dbg ("%s - port not opened", __FUNCTION__); + dbg ("%s - port not opened", __func__); return; } @@ -248,7 +248,7 @@ static void usb_console_write(struct console *co, const char *buf, unsigned coun retval = serial->type->write(port, buf, i); else retval = usb_serial_generic_write(port, buf, i); - dbg("%s - return value : %d", __FUNCTION__, retval); + dbg("%s - return value : %d", __func__, retval); if (lf) { /* append CR after LF */ unsigned char cr = 13; @@ -256,7 +256,7 @@ static void usb_console_write(struct console *co, const char *buf, unsigned coun retval = serial->type->write(port, &cr, 1); else retval = usb_serial_generic_write(port, &cr, 1); - dbg("%s - return value : %d", __FUNCTION__, retval); + dbg("%s - return value : %d", __func__, retval); } buf += i; count -= i; diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index 2af8d21bb12..dc0ea08ed23 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c @@ -193,7 +193,7 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request, buf = kcalloc(length, sizeof(__le32), GFP_KERNEL); if (!buf) { - dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); + dev_err(&port->dev, "%s - out of memory.\n", __func__); return -ENOMEM; } @@ -214,7 +214,7 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request, if (result != size) { dev_err(&port->dev, "%s - Unable to send config request, " "request=0x%x size=%d result=%d\n", - __FUNCTION__, request, size, result); + __func__, request, size, result); return -EPROTO; } @@ -240,7 +240,7 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request, buf = kmalloc(length * sizeof(__le32), GFP_KERNEL); if (!buf) { dev_err(&port->dev, "%s - out of memory.\n", - __FUNCTION__); + __func__); return -ENOMEM; } @@ -265,7 +265,7 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request, if ((size > 2 && result != size) || result < 0) { dev_err(&port->dev, "%s - Unable to send request, " "request=0x%x size=%d result=%d\n", - __FUNCTION__, request, size, result); + __func__, request, size, result); return -EPROTO; } @@ -293,11 +293,11 @@ static int cp2101_open (struct usb_serial_port *port, struct file *filp) struct usb_serial *serial = port->serial; int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (cp2101_set_config_single(port, CP2101_UART, UART_ENABLE)) { dev_err(&port->dev, "%s - Unable to enable UART\n", - __FUNCTION__); + __func__); return -EPROTO; } @@ -312,7 +312,7 @@ static int cp2101_open (struct usb_serial_port *port, struct file *filp) result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) { dev_err(&port->dev, "%s - failed resubmitting read urb, " - "error %d\n", __FUNCTION__, result); + "error %d\n", __func__, result); return result; } @@ -329,7 +329,7 @@ static void cp2101_cleanup (struct usb_serial_port *port) { struct usb_serial *serial = port->serial; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (serial->dev) { /* shutdown any bulk reads that might be going on */ @@ -342,10 +342,10 @@ static void cp2101_cleanup (struct usb_serial_port *port) static void cp2101_close (struct usb_serial_port *port, struct file * filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* shutdown our urbs */ - dbg("%s - shutting down urbs", __FUNCTION__); + dbg("%s - shutting down urbs", __func__); usb_kill_urb(port->write_urb); usb_kill_urb(port->read_urb); @@ -367,10 +367,10 @@ static void cp2101_get_termios (struct usb_serial_port *port) int baud; int bits; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->tty || !port->tty->termios) { - dbg("%s - no tty structures", __FUNCTION__); + dbg("%s - no tty structures", __func__); return; } @@ -379,7 +379,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) if (baud) baud = BAUD_RATE_GEN_FREQ / baud; - dbg("%s - baud rate = %d", __FUNCTION__, baud); + dbg("%s - baud rate = %d", __func__, baud); tty_encode_baud_rate(port->tty, baud, baud); cflag = port->tty->termios->c_cflag; @@ -388,24 +388,24 @@ static void cp2101_get_termios (struct usb_serial_port *port) cflag &= ~CSIZE; switch(bits & BITS_DATA_MASK) { case BITS_DATA_5: - dbg("%s - data bits = 5", __FUNCTION__); + dbg("%s - data bits = 5", __func__); cflag |= CS5; break; case BITS_DATA_6: - dbg("%s - data bits = 6", __FUNCTION__); + dbg("%s - data bits = 6", __func__); cflag |= CS6; break; case BITS_DATA_7: - dbg("%s - data bits = 7", __FUNCTION__); + dbg("%s - data bits = 7", __func__); cflag |= CS7; break; case BITS_DATA_8: - dbg("%s - data bits = 8", __FUNCTION__); + dbg("%s - data bits = 8", __func__); cflag |= CS8; break; case BITS_DATA_9: dbg("%s - data bits = 9 (not supported, " - "using 8 data bits)", __FUNCTION__); + "using 8 data bits)", __func__); cflag |= CS8; bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8; @@ -413,7 +413,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) break; default: dbg("%s - Unknown number of data bits, " - "using 8", __FUNCTION__); + "using 8", __func__); cflag |= CS8; bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8; @@ -423,35 +423,35 @@ static void cp2101_get_termios (struct usb_serial_port *port) switch(bits & BITS_PARITY_MASK) { case BITS_PARITY_NONE: - dbg("%s - parity = NONE", __FUNCTION__); + dbg("%s - parity = NONE", __func__); cflag &= ~PARENB; break; case BITS_PARITY_ODD: - dbg("%s - parity = ODD", __FUNCTION__); + dbg("%s - parity = ODD", __func__); cflag |= (PARENB|PARODD); break; case BITS_PARITY_EVEN: - dbg("%s - parity = EVEN", __FUNCTION__); + dbg("%s - parity = EVEN", __func__); cflag &= ~PARODD; cflag |= PARENB; break; case BITS_PARITY_MARK: dbg("%s - parity = MARK (not supported, " - "disabling parity)", __FUNCTION__); + "disabling parity)", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp2101_set_config(port, CP2101_BITS, &bits, 2); break; case BITS_PARITY_SPACE: dbg("%s - parity = SPACE (not supported, " - "disabling parity)", __FUNCTION__); + "disabling parity)", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp2101_set_config(port, CP2101_BITS, &bits, 2); break; default: dbg("%s - Unknown parity mode, " - "disabling parity", __FUNCTION__); + "disabling parity", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp2101_set_config(port, CP2101_BITS, &bits, 2); @@ -461,21 +461,21 @@ static void cp2101_get_termios (struct usb_serial_port *port) cflag &= ~CSTOPB; switch(bits & BITS_STOP_MASK) { case BITS_STOP_1: - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); break; case BITS_STOP_1_5: dbg("%s - stop bits = 1.5 (not supported, " - "using 1 stop bit)", __FUNCTION__); + "using 1 stop bit)", __func__); bits &= ~BITS_STOP_MASK; cp2101_set_config(port, CP2101_BITS, &bits, 2); break; case BITS_STOP_2: - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); cflag |= CSTOPB; break; default: dbg("%s - Unknown number of stop bits, " - "using 1 stop bit", __FUNCTION__); + "using 1 stop bit", __func__); bits &= ~BITS_STOP_MASK; cp2101_set_config(port, CP2101_BITS, &bits, 2); break; @@ -483,10 +483,10 @@ static void cp2101_get_termios (struct usb_serial_port *port) cp2101_get_config(port, CP2101_MODEMCTL, modem_ctl, 16); if (modem_ctl[0] & 0x0008) { - dbg("%s - flow control = CRTSCTS", __FUNCTION__); + dbg("%s - flow control = CRTSCTS", __func__); cflag |= CRTSCTS; } else { - dbg("%s - flow control = NONE", __FUNCTION__); + dbg("%s - flow control = NONE", __func__); cflag &= ~CRTSCTS; } @@ -500,10 +500,10 @@ static void cp2101_set_termios (struct usb_serial_port *port, int baud=0, bits; unsigned int modem_ctl[4]; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->tty || !port->tty->termios) { - dbg("%s - no tty structures", __FUNCTION__); + dbg("%s - no tty structures", __func__); return; } port->tty->termios->c_cflag &= ~CMSPAR; @@ -542,7 +542,7 @@ static void cp2101_set_termios (struct usb_serial_port *port, } if (baud) { - dbg("%s - Setting baud rate to %d baud", __FUNCTION__, + dbg("%s - Setting baud rate to %d baud", __func__, baud); if (cp2101_set_config_single(port, CP2101_BAUDRATE, (BAUD_RATE_GEN_FREQ / baud))) { @@ -562,23 +562,23 @@ static void cp2101_set_termios (struct usb_serial_port *port, switch (cflag & CSIZE) { case CS5: bits |= BITS_DATA_5; - dbg("%s - data bits = 5", __FUNCTION__); + dbg("%s - data bits = 5", __func__); break; case CS6: bits |= BITS_DATA_6; - dbg("%s - data bits = 6", __FUNCTION__); + dbg("%s - data bits = 6", __func__); break; case CS7: bits |= BITS_DATA_7; - dbg("%s - data bits = 7", __FUNCTION__); + dbg("%s - data bits = 7", __func__); break; case CS8: bits |= BITS_DATA_8; - dbg("%s - data bits = 8", __FUNCTION__); + dbg("%s - data bits = 8", __func__); break; /*case CS9: bits |= BITS_DATA_9; - dbg("%s - data bits = 9", __FUNCTION__); + dbg("%s - data bits = 9", __func__); break;*/ default: dev_err(&port->dev, "cp2101 driver does not " @@ -598,10 +598,10 @@ static void cp2101_set_termios (struct usb_serial_port *port, if (cflag & PARENB) { if (cflag & PARODD) { bits |= BITS_PARITY_ODD; - dbg("%s - parity = ODD", __FUNCTION__); + dbg("%s - parity = ODD", __func__); } else { bits |= BITS_PARITY_EVEN; - dbg("%s - parity = EVEN", __FUNCTION__); + dbg("%s - parity = EVEN", __func__); } } if (cp2101_set_config(port, CP2101_BITS, &bits, 2)) @@ -614,10 +614,10 @@ static void cp2101_set_termios (struct usb_serial_port *port, bits &= ~BITS_STOP_MASK; if (cflag & CSTOPB) { bits |= BITS_STOP_2; - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); } else { bits |= BITS_STOP_1; - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); } if (cp2101_set_config(port, CP2101_BITS, &bits, 2)) dev_err(&port->dev, "Number of stop bits requested " @@ -627,23 +627,23 @@ static void cp2101_set_termios (struct usb_serial_port *port, if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { cp2101_get_config(port, CP2101_MODEMCTL, modem_ctl, 16); dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", - __FUNCTION__, modem_ctl[0], modem_ctl[1], + __func__, modem_ctl[0], modem_ctl[1], modem_ctl[2], modem_ctl[3]); if (cflag & CRTSCTS) { modem_ctl[0] &= ~0x7B; modem_ctl[0] |= 0x09; modem_ctl[1] = 0x80; - dbg("%s - flow control = CRTSCTS", __FUNCTION__); + dbg("%s - flow control = CRTSCTS", __func__); } else { modem_ctl[0] &= ~0x7B; modem_ctl[0] |= 0x01; modem_ctl[1] |= 0x40; - dbg("%s - flow control = NONE", __FUNCTION__); + dbg("%s - flow control = NONE", __func__); } dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", - __FUNCTION__, modem_ctl[0], modem_ctl[1], + __func__, modem_ctl[0], modem_ctl[1], modem_ctl[2], modem_ctl[3]); cp2101_set_config(port, CP2101_MODEMCTL, modem_ctl, 16); } @@ -655,7 +655,7 @@ static int cp2101_tiocmset (struct usb_serial_port *port, struct file *file, { int control = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (set & TIOCM_RTS) { control |= CONTROL_RTS; @@ -674,7 +674,7 @@ static int cp2101_tiocmset (struct usb_serial_port *port, struct file *file, control |= CONTROL_WRITE_DTR; } - dbg("%s - control = 0x%.4x", __FUNCTION__, control); + dbg("%s - control = 0x%.4x", __func__, control); return cp2101_set_config(port, CP2101_CONTROL, &control, 2); @@ -684,7 +684,7 @@ static int cp2101_tiocmget (struct usb_serial_port *port, struct file *file) { int control, result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); cp2101_get_config(port, CP2101_CONTROL, &control, 1); @@ -695,7 +695,7 @@ static int cp2101_tiocmget (struct usb_serial_port *port, struct file *file) |((control & CONTROL_RING)? TIOCM_RI : 0) |((control & CONTROL_DCD) ? TIOCM_CD : 0); - dbg("%s - control = 0x%.2x", __FUNCTION__, control); + dbg("%s - control = 0x%.2x", __func__, control); return result; } @@ -704,12 +704,12 @@ static void cp2101_break_ctl (struct usb_serial_port *port, int break_state) { int state; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (break_state == 0) state = BREAK_OFF; else state = BREAK_ON; - dbg("%s - turning break %s", __FUNCTION__, + dbg("%s - turning break %s", __func__, state==BREAK_OFF ? "off" : "on"); cp2101_set_config(port, CP2101_BREAK, &state, 2); } @@ -725,7 +725,7 @@ static void cp2101_shutdown (struct usb_serial *serial) { int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Stop reads and writes on all ports */ for (i=0; i < serial->num_ports; ++i) { diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index cbae876cd67..5348e97b52b 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -116,7 +116,7 @@ static int cyberjack_startup (struct usb_serial *serial) struct cyberjack_private *priv; int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* allocate the private data structure */ priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL); @@ -139,7 +139,7 @@ static int cyberjack_startup (struct usb_serial *serial) GFP_KERNEL); if (result) err(" usb_submit_urb(read int) failed"); - dbg("%s - usb_submit_urb(int urb)", __FUNCTION__); + dbg("%s - usb_submit_urb(int urb)", __func__); } return( 0 ); @@ -149,7 +149,7 @@ static void cyberjack_shutdown (struct usb_serial *serial) { int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i=0; i < serial->num_ports; ++i) { usb_kill_urb(serial->port[i]->interrupt_in_urb); @@ -165,9 +165,9 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp) unsigned long flags; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); - dbg("%s - usb_clear_halt", __FUNCTION__ ); + dbg("%s - usb_clear_halt", __func__ ); usb_clear_halt(port->serial->dev, port->write_urb->pipe); /* force low_latency on so that our tty_push actually forces @@ -188,7 +188,7 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp) static void cyberjack_close (struct usb_serial_port *port, struct file *filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (port->serial->dev) { /* shutdown any bulk reads that might be going on */ @@ -205,17 +205,17 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b int result; int wrexpected; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return (0); } spin_lock_bh(&port->lock); if (port->write_urb_busy) { spin_unlock_bh(&port->lock); - dbg("%s - already writing", __FUNCTION__); + dbg("%s - already writing", __func__); return 0; } port->write_urb_busy = 1; @@ -234,13 +234,13 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b /* Copy data */ memcpy (priv->wrbuf+priv->wrfilled, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, + usb_serial_debug_data(debug, &port->dev, __func__, count, priv->wrbuf+priv->wrfilled); priv->wrfilled += count; if( priv->wrfilled >= 3 ) { wrexpected = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; - dbg("%s - expected data: %d", __FUNCTION__, wrexpected); + dbg("%s - expected data: %d", __func__, wrexpected); } else { wrexpected = sizeof(priv->wrbuf); } @@ -249,7 +249,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b /* We have enough data to begin transmission */ int length; - dbg("%s - transmitting data (frame 1)", __FUNCTION__); + dbg("%s - transmitting data (frame 1)", __func__); length = (wrexpected > port->bulk_out_size) ? port->bulk_out_size : wrexpected; memcpy (port->write_urb->transfer_buffer, priv->wrbuf, length ); @@ -267,7 +267,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b /* send the data out the bulk port */ result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); /* Throw away data. No better idea what to do with it. */ priv->wrfilled=0; priv->wrsent=0; @@ -276,11 +276,11 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b return 0; } - dbg("%s - priv->wrsent=%d", __FUNCTION__,priv->wrsent); - dbg("%s - priv->wrfilled=%d", __FUNCTION__,priv->wrfilled); + dbg("%s - priv->wrsent=%d", __func__,priv->wrsent); + dbg("%s - priv->wrfilled=%d", __func__,priv->wrfilled); if( priv->wrsent>=priv->wrfilled ) { - dbg("%s - buffer cleaned", __FUNCTION__); + dbg("%s - buffer cleaned", __func__); memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); priv->wrfilled=0; priv->wrsent=0; @@ -305,13 +305,13 @@ static void cyberjack_read_int_callback( struct urb *urb ) int status = urb->status; int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* the urb might have been killed. */ if (status) return; - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* React only to interrupts signaling a bulk_in transfer */ if( (urb->actual_length==4) && (data[0]==0x01) ) { @@ -333,7 +333,7 @@ static void cyberjack_read_int_callback( struct urb *urb ) /* "+=" is probably more fault tollerant than "=" */ priv->rdtodo += size; - dbg("%s - rdtodo: %d", __FUNCTION__, priv->rdtodo); + dbg("%s - rdtodo: %d", __func__, priv->rdtodo); spin_unlock(&priv->lock); @@ -341,8 +341,8 @@ static void cyberjack_read_int_callback( struct urb *urb ) port->read_urb->dev = port->serial->dev; result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if( result ) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); - dbg("%s - usb_submit_urb(read urb)", __FUNCTION__); + err("%s - failed resubmitting read urb, error %d", __func__, result); + dbg("%s - usb_submit_urb(read urb)", __func__); } } @@ -351,7 +351,7 @@ resubmit: result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result) err(" usb_submit_urb(read int) failed"); - dbg("%s - usb_submit_urb(int urb)", __FUNCTION__); + dbg("%s - usb_submit_urb(int urb)", __func__); } static void cyberjack_read_bulk_callback (struct urb *urb) @@ -364,18 +364,18 @@ static void cyberjack_read_bulk_callback (struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } tty = port->tty; if (!tty) { - dbg("%s - ignoring since device not open\n", __FUNCTION__); + dbg("%s - ignoring since device not open\n", __func__); return; } if (urb->actual_length) { @@ -394,15 +394,15 @@ static void cyberjack_read_bulk_callback (struct urb *urb) spin_unlock(&priv->lock); - dbg("%s - rdtodo: %d", __FUNCTION__, todo); + dbg("%s - rdtodo: %d", __func__, todo); /* Continue to read if we have still urbs to do. */ if( todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/ ) { port->read_urb->dev = port->serial->dev; result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); - dbg("%s - usb_submit_urb(read urb)", __FUNCTION__); + err("%s - failed resubmitting read urb, error %d", __func__, result); + dbg("%s - usb_submit_urb(read urb)", __func__); } } @@ -412,12 +412,12 @@ static void cyberjack_write_bulk_callback (struct urb *urb) struct cyberjack_private *priv = usb_get_serial_port_data(port); int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -427,7 +427,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb) if( priv->wrfilled ) { int length, blksize, result; - dbg("%s - transmitting data (frame n)", __FUNCTION__); + dbg("%s - transmitting data (frame n)", __func__); length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ? port->bulk_out_size : (priv->wrfilled - priv->wrsent); @@ -448,20 +448,20 @@ static void cyberjack_write_bulk_callback (struct urb *urb) /* send the data out the bulk port */ result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); /* Throw away data. No better idea what to do with it. */ priv->wrfilled=0; priv->wrsent=0; goto exit; } - dbg("%s - priv->wrsent=%d", __FUNCTION__,priv->wrsent); - dbg("%s - priv->wrfilled=%d", __FUNCTION__,priv->wrfilled); + dbg("%s - priv->wrsent=%d", __func__,priv->wrsent); + dbg("%s - priv->wrfilled=%d", __func__,priv->wrfilled); blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) { - dbg("%s - buffer cleaned", __FUNCTION__); + dbg("%s - buffer cleaned", __func__); memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); priv->wrfilled=0; priv->wrsent=0; diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index d8304eaf34c..01dfc0afc65 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -330,7 +330,7 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra __u8 feature_buffer[5]; unsigned long flags; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); priv = usb_get_serial_port_data(port); @@ -345,7 +345,7 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra new_baudrate = priv->baud_rate; /* Change of speed ? */ else if (baud_rate != priv->baud_rate) { - dbg("%s - baud rate is changing", __FUNCTION__); + dbg("%s - baud rate is changing", __func__); retval = analyze_baud_rate(port, baud_rate); if (retval >= 0) { new_baudrate = retval; @@ -353,7 +353,7 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra __func__, new_baudrate); } } - dbg("%s - baud rate is being sent as %d", __FUNCTION__, new_baudrate); + dbg("%s - baud rate is being sent as %d", __func__, new_baudrate); memset(feature_buffer, 0, sizeof(feature_buffer)); /* fill the feature_buffer with new configuration */ @@ -367,8 +367,8 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra /* 1 bit gap */ feature_buffer[4] |= (reset << 7); /* assign reset at end of byte, 1 bit space */ - dbg("%s - device is being sent this feature report:", __FUNCTION__); - dbg("%s - %02X - %02X - %02X - %02X - %02X", __FUNCTION__, feature_buffer[0], feature_buffer[1], + dbg("%s - device is being sent this feature report:", __func__); + dbg("%s - %02X - %02X - %02X - %02X - %02X", __func__, feature_buffer[0], feature_buffer[1], feature_buffer[2], feature_buffer[3], feature_buffer[4]); do { @@ -386,7 +386,7 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra retval != -ENODEV); if (retval != sizeof(feature_buffer)) { - err("%s - failed sending serial line settings - %d", __FUNCTION__, retval); + err("%s - failed sending serial line settings - %d", __func__, retval); cypress_set_dead(port); } else { spin_lock_irqsave(&priv->lock, flags); @@ -406,7 +406,7 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra to crash the hardware. */ return -ENOTTY; } - dbg("%s - retreiving serial line settings", __FUNCTION__); + dbg("%s - retreiving serial line settings", __func__); /* set initial values in feature buffer */ memset(feature_buffer, 0, sizeof(feature_buffer)); @@ -425,7 +425,7 @@ static int cypress_serial_control (struct usb_serial_port *port, speed_t baud_ra retval != -ENODEV); if (retval != sizeof(feature_buffer)) { - err("%s - failed to retrieve serial line settings - %d", __FUNCTION__, retval); + err("%s - failed to retrieve serial line settings - %d", __func__, retval); cypress_set_dead(port); return retval; } else { @@ -473,7 +473,7 @@ static int generic_startup (struct usb_serial *serial) struct cypress_private *priv; struct usb_serial_port *port = serial->port[0]; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); priv = kzalloc(sizeof (struct cypress_private), GFP_KERNEL); if (!priv) @@ -509,12 +509,12 @@ static int generic_startup (struct usb_serial *serial) priv->write_urb_interval = interval; priv->read_urb_interval = interval; dbg("%s - port %d read & write intervals forced to %d", - __FUNCTION__,port->number,interval); + __func__,port->number,interval); } else { priv->write_urb_interval = port->interrupt_out_urb->interval; priv->read_urb_interval = port->interrupt_in_urb->interval; dbg("%s - port %d intervals: read=%d write=%d", - __FUNCTION__,port->number, + __func__,port->number, priv->read_urb_interval,priv->write_urb_interval); } usb_set_serial_port_data(port, priv); @@ -528,10 +528,10 @@ static int cypress_earthmate_startup (struct usb_serial *serial) struct cypress_private *priv; struct usb_serial_port *port = serial->port[0]; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (generic_startup(serial)) { - dbg("%s - Failed setting up port %d", __FUNCTION__, + dbg("%s - Failed setting up port %d", __func__, port->number); return 1; } @@ -559,10 +559,10 @@ static int cypress_hidcom_startup (struct usb_serial *serial) { struct cypress_private *priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (generic_startup(serial)) { - dbg("%s - Failed setting up port %d", __FUNCTION__, + dbg("%s - Failed setting up port %d", __func__, serial->port[0]->number); return 1; } @@ -578,10 +578,10 @@ static int cypress_ca42v2_startup (struct usb_serial *serial) { struct cypress_private *priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (generic_startup(serial)) { - dbg("%s - Failed setting up port %d", __FUNCTION__, + dbg("%s - Failed setting up port %d", __func__, serial->port[0]->number); return 1; } @@ -597,7 +597,7 @@ static void cypress_shutdown (struct usb_serial *serial) { struct cypress_private *priv; - dbg ("%s - port %d", __FUNCTION__, serial->port[0]->number); + dbg ("%s - port %d", __func__, serial->port[0]->number); /* all open ports are closed at this point */ @@ -618,7 +618,7 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp) unsigned long flags; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!priv->comm_is_ok) return -EIO; @@ -646,16 +646,16 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp) result = cypress_write(port, NULL, 0); if (result) { - dev_err(&port->dev, "%s - failed setting the control lines - error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed setting the control lines - error %d\n", __func__, result); return result; } else - dbg("%s - success setting the control lines", __FUNCTION__); + dbg("%s - success setting the control lines", __func__); cypress_set_termios(port, &priv->tmp_termios); /* setup the port and start reading from the device */ if(!port->interrupt_in_urb){ - err("%s - interrupt_in_urb is empty!", __FUNCTION__); + err("%s - interrupt_in_urb is empty!", __func__); return(-1); } @@ -666,7 +666,7 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp) result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result){ - dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result); cypress_set_dead(port); } @@ -682,7 +682,7 @@ static void cypress_close(struct usb_serial_port *port, struct file * filp) long timeout; wait_queue_t wait; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* wait for data to drain from buffer */ spin_lock_irq(&priv->lock); @@ -720,7 +720,7 @@ static void cypress_close(struct usb_serial_port *port, struct file * filp) timeout = 2*HZ; schedule_timeout_interruptible(timeout); - dbg("%s - stopping urbs", __FUNCTION__); + dbg("%s - stopping urbs", __func__); usb_kill_urb (port->interrupt_in_urb); usb_kill_urb (port->interrupt_out_urb); @@ -749,7 +749,7 @@ static int cypress_write(struct usb_serial_port *port, const unsigned char *buf, struct cypress_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d, %d bytes", __FUNCTION__, port->number, count); + dbg("%s - port %d, %d bytes", __func__, port->number, count); /* line control commands, which need to be executed immediately, are not put into the buffer for obvious reasons. @@ -782,12 +782,12 @@ static void cypress_send(struct usb_serial_port *port) if (!priv->comm_is_ok) return; - dbg("%s - port %d", __FUNCTION__, port->number); - dbg("%s - interrupt out size is %d", __FUNCTION__, port->interrupt_out_size); + dbg("%s - port %d", __func__, port->number); + dbg("%s - interrupt out size is %d", __func__, port->interrupt_out_size); spin_lock_irqsave(&priv->lock, flags); if (priv->write_urb_in_use) { - dbg("%s - can't write, urb in use", __FUNCTION__); + dbg("%s - can't write, urb in use", __func__); spin_unlock_irqrestore(&priv->lock, flags); return; } @@ -816,7 +816,7 @@ static void cypress_send(struct usb_serial_port *port) if (priv->cmd_ctrl) { priv->cmd_count++; - dbg("%s - line control command being issued", __FUNCTION__); + dbg("%s - line control command being issued", __func__); spin_unlock_irqrestore(&priv->lock, flags); goto send; } else @@ -838,7 +838,7 @@ static void cypress_send(struct usb_serial_port *port) port->interrupt_out_buffer[0] |= count; } - dbg("%s - count is %d", __FUNCTION__, count); + dbg("%s - count is %d", __func__, count); send: spin_lock_irqsave(&priv->lock, flags); @@ -851,7 +851,7 @@ send: actual_size = count + (priv->pkt_fmt == packet_format_1 ? 2 : 1); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, port->interrupt_out_size, + usb_serial_debug_data(debug, &port->dev, __func__, port->interrupt_out_size, port->interrupt_out_urb->transfer_buffer); usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev, @@ -860,7 +860,7 @@ send: cypress_write_int_callback, port, priv->write_urb_interval); result = usb_submit_urb (port->interrupt_out_urb, GFP_ATOMIC); if (result) { - dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, + dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result); priv->write_urb_in_use = 0; cypress_set_dead(port); @@ -884,13 +884,13 @@ static int cypress_write_room(struct usb_serial_port *port) int room = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); room = cypress_buf_space_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -902,7 +902,7 @@ static int cypress_tiocmget (struct usb_serial_port *port, struct file *file) unsigned int result = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); control = priv->line_control; @@ -916,7 +916,7 @@ static int cypress_tiocmget (struct usb_serial_port *port, struct file *file) | ((status & UART_RI) ? TIOCM_RI : 0) | ((status & UART_CD) ? TIOCM_CD : 0); - dbg("%s - result = %x", __FUNCTION__, result); + dbg("%s - result = %x", __func__, result); return result; } @@ -928,7 +928,7 @@ static int cypress_tiocmset (struct usb_serial_port *port, struct file *file, struct cypress_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); if (set & TIOCM_RTS) @@ -950,7 +950,7 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi { struct cypress_private *priv = usb_get_serial_port_data(port); - dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); switch (cmd) { /* This code comes from drivers/char/serial.c and ftdi_sio.c */ @@ -988,7 +988,7 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi break; } - dbg("%s - arg not supported - it was 0x%04x - check include/asm/ioctls.h", __FUNCTION__, cmd); + dbg("%s - arg not supported - it was 0x%04x - check include/asm/ioctls.h", __func__, cmd); return -ENOIOCTLCMD; } /* cypress_ioctl */ @@ -1005,7 +1005,7 @@ static void cypress_set_termios (struct usb_serial_port *port, __u8 oldlines; int linechange = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); tty = port->tty; @@ -1076,7 +1076,7 @@ static void cypress_set_termios (struct usb_serial_port *port, break; default: err("%s - CSIZE was set, but not CS5-CS8", - __FUNCTION__); + __func__); data_bits = 3; } } else @@ -1086,14 +1086,14 @@ static void cypress_set_termios (struct usb_serial_port *port, oldlines = priv->line_control; if ((cflag & CBAUD) == B0) { /* drop dtr and rts */ - dbg("%s - dropping the lines, baud rate 0bps", __FUNCTION__); + dbg("%s - dropping the lines, baud rate 0bps", __func__); priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); } else priv->line_control = (CONTROL_DTR | CONTROL_RTS); spin_unlock_irqrestore(&priv->lock, flags); dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, " - "%d data_bits (+5)", __FUNCTION__, stop_bits, + "%d data_bits (+5)", __func__, stop_bits, parity_enable, parity_type, data_bits); cypress_serial_control(port, tty_get_baud_rate(tty), data_bits, stop_bits, @@ -1154,13 +1154,13 @@ static int cypress_chars_in_buffer(struct usb_serial_port *port) int chars = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); chars = cypress_buf_data_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return chars; } @@ -1170,7 +1170,7 @@ static void cypress_throttle (struct usb_serial_port *port) struct cypress_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); priv->rx_flags = THROTTLED; @@ -1184,7 +1184,7 @@ static void cypress_unthrottle (struct usb_serial_port *port) int actually_throttled, result; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED; @@ -1200,7 +1200,7 @@ static void cypress_unthrottle (struct usb_serial_port *port) result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s - failed submitting read urb, " - "error %d\n", __FUNCTION__, result); + "error %d\n", __func__, result); cypress_set_dead(port); } } @@ -1221,7 +1221,7 @@ static void cypress_read_int_callback(struct urb *urb) int i = 0; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); switch (status) { case 0: /* success */ @@ -1237,14 +1237,14 @@ static void cypress_read_int_callback(struct urb *urb) default: /* something ugly is going on... */ dev_err(&urb->dev->dev,"%s - unexpected nonzero read status received: %d\n", - __FUNCTION__, status); + __func__, status); cypress_set_dead(port); return; } spin_lock_irqsave(&priv->lock, flags); if (priv->rx_flags & THROTTLED) { - dbg("%s - now throttling", __FUNCTION__); + dbg("%s - now throttling", __func__); priv->rx_flags |= ACTUALLY_THROTTLED; spin_unlock_irqrestore(&priv->lock, flags); return; @@ -1253,7 +1253,7 @@ static void cypress_read_int_callback(struct urb *urb) tty = port->tty; if (!tty) { - dbg("%s - bad tty pointer - exiting", __FUNCTION__); + dbg("%s - bad tty pointer - exiting", __func__); return; } @@ -1285,7 +1285,7 @@ static void cypress_read_int_callback(struct urb *urb) goto continue_read; } - usb_serial_debug_data (debug, &port->dev, __FUNCTION__, + usb_serial_debug_data (debug, &port->dev, __func__, urb->actual_length, data); spin_lock_irqsave(&priv->lock, flags); @@ -1302,7 +1302,7 @@ static void cypress_read_int_callback(struct urb *urb) * though */ if (tty && !(tty->termios->c_cflag & CLOCAL) && !(priv->current_status & UART_CD)) { - dbg("%s - calling hangup", __FUNCTION__); + dbg("%s - calling hangup", __func__); tty_hangup(tty); goto continue_read; } @@ -1315,7 +1315,7 @@ static void cypress_read_int_callback(struct urb *urb) if (priv->current_status & CYP_ERROR) { spin_unlock_irqrestore(&priv->lock, flags); tty_flag = TTY_PARITY; - dbg("%s - Parity Error detected", __FUNCTION__); + dbg("%s - Parity Error detected", __func__); } else spin_unlock_irqrestore(&priv->lock, flags); @@ -1349,7 +1349,7 @@ continue_read: result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result) { dev_err(&urb->dev->dev, "%s - failed resubmitting " - "read urb, error %d\n", __FUNCTION__, + "read urb, error %d\n", __func__, result); cypress_set_dead(port); } @@ -1366,7 +1366,7 @@ static void cypress_write_int_callback(struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); switch (status) { case 0: @@ -1377,7 +1377,7 @@ static void cypress_write_int_callback(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); priv->write_urb_in_use = 0; return; case -EPIPE: /* no break needed; clear halt and resubmit */ @@ -1386,19 +1386,19 @@ static void cypress_write_int_callback(struct urb *urb) usb_clear_halt(port->serial->dev, 0x02); /* error in the urb, so we have to resubmit it */ dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); port->interrupt_out_urb->transfer_buffer_length = 1; port->interrupt_out_urb->dev = port->serial->dev; result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); if (!result) return; dev_err(&urb->dev->dev, "%s - failed resubmitting write urb, error %d\n", - __FUNCTION__, result); + __func__, result); cypress_set_dead(port); break; default: dev_err(&urb->dev->dev,"%s - unexpected nonzero write status received: %d\n", - __FUNCTION__, status); + __func__, status); cypress_set_dead(port); break; } @@ -1603,7 +1603,7 @@ static int __init cypress_init(void) { int retval; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); retval = usb_serial_register(&cypress_earthmate_device); if (retval) @@ -1634,7 +1634,7 @@ failed_em_register: static void __exit cypress_exit (void) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); usb_deregister (&cypress_driver); usb_serial_deregister (&cypress_earthmate_device); diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 4e3d5993a8e..c7cbc02f1a7 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -659,7 +659,7 @@ static int digi_write_oob_command(struct usb_serial_port *port, } spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); if (ret) - err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret); + err("%s: usb_submit_urb failed, ret=%d", __func__, ret); return ret; } @@ -740,7 +740,7 @@ static int digi_write_inb_command(struct usb_serial_port *port, if (ret) err("%s: usb_submit_urb failed, ret=%d, port=%d", - __FUNCTION__, ret, priv->dp_port_num); + __func__, ret, priv->dp_port_num); return ret; } @@ -804,7 +804,7 @@ static int digi_set_modem_signals(struct usb_serial_port *port, spin_unlock(&port_priv->dp_port_lock); spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); if (ret) - err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret); + err("%s: usb_submit_urb failed, ret=%d", __func__, ret); return ret; } @@ -897,7 +897,7 @@ static void digi_rx_unthrottle(struct usb_serial_port *port) if (ret) err("%s: usb_submit_urb failed, ret=%d, port=%d", - __FUNCTION__, ret, priv->dp_port_num); + __func__, ret, priv->dp_port_num); } @@ -1107,7 +1107,7 @@ static int digi_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int val; unsigned long flags; - dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); + dbg("%s: TOP: port=%d", __func__, priv->dp_port_num); spin_lock_irqsave(&priv->dp_port_lock, flags); val = priv->dp_modem_signals; @@ -1123,7 +1123,7 @@ static int digi_tiocmset(struct usb_serial_port *port, struct file *file, unsigned int val; unsigned long flags; - dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); + dbg("%s: TOP: port=%d", __func__, priv->dp_port_num); spin_lock_irqsave(&priv->dp_port_lock, flags); val = (priv->dp_modem_signals & ~clear) | set; @@ -1218,7 +1218,7 @@ static int digi_write(struct usb_serial_port *port, const unsigned char *buf, in spin_unlock_irqrestore(&priv->dp_port_lock, flags); if (ret < 0) err("%s: usb_submit_urb failed, ret=%d, port=%d", - __FUNCTION__, ret, priv->dp_port_num); + __func__, ret, priv->dp_port_num); dbg("digi_write: returning %d", ret); return ret; @@ -1239,13 +1239,13 @@ static void digi_write_bulk_callback(struct urb *urb) /* port and serial sanity check */ if (port == NULL || (priv=usb_get_serial_port_data(port)) == NULL) { err("%s: port or port->private is NULL, status=%d", - __FUNCTION__, status); + __func__, status); return; } serial = port->serial; if (serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL) { err("%s: serial or serial->private is NULL, status=%d", - __FUNCTION__, status); + __func__, status); return; } @@ -1286,7 +1286,7 @@ static void digi_write_bulk_callback(struct urb *urb) spin_unlock(&priv->dp_port_lock); if (ret) err("%s: usb_submit_urb failed, ret=%d, port=%d", - __FUNCTION__, ret, priv->dp_port_num); + __func__, ret, priv->dp_port_num); } static int digi_write_room(struct usb_serial_port *port) @@ -1515,7 +1515,7 @@ static int digi_startup_device(struct usb_serial *serial) port->write_urb->dev = port->serial->dev; if ((ret = usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0) { err("%s: usb_submit_urb failed, ret=%d, port=%d", - __FUNCTION__, ret, i); + __func__, ret, i); break; } } @@ -1616,20 +1616,20 @@ static void digi_read_bulk_callback(struct urb *urb) /* port sanity check, do not resubmit if port is not valid */ if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { err("%s: port or port->private is NULL, status=%d", - __FUNCTION__, status); + __func__, status); return; } if (port->serial == NULL || (serial_priv=usb_get_serial_data(port->serial)) == NULL) { err("%s: serial is bad or serial->private is NULL, status=%d", - __FUNCTION__, status); + __func__, status); return; } /* do not resubmit urb if it has any status error */ if (status) { err("%s: nonzero read bulk status: status=%d, port=%d", - __FUNCTION__, status, priv->dp_port_num); + __func__, status, priv->dp_port_num); return; } @@ -1646,7 +1646,7 @@ static void digi_read_bulk_callback(struct urb *urb) urb->dev = port->serial->dev; if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { err("%s: failed resubmitting urb, ret=%d, port=%d", - __FUNCTION__, ret, priv->dp_port_num); + __func__, ret, priv->dp_port_num); } } @@ -1684,7 +1684,7 @@ static int digi_read_inb_callback(struct urb *urb) if (urb->actual_length != len + 2) { err("%s: INCOMPLETE OR MULTIPLE PACKET, urb->status=%d, " "port=%d, opcode=%d, len=%d, actual_length=%d, " - "status=%d", __FUNCTION__, status, priv->dp_port_num, + "status=%d", __func__, status, priv->dp_port_num, opcode, len, urb->actual_length, port_status); return -1; } @@ -1733,9 +1733,9 @@ static int digi_read_inb_callback(struct urb *urb) spin_unlock(&priv->dp_port_lock); if (opcode == DIGI_CMD_RECEIVE_DISABLE) - dbg("%s: got RECEIVE_DISABLE", __FUNCTION__); + dbg("%s: got RECEIVE_DISABLE", __func__); else if (opcode != DIGI_CMD_RECEIVE_DATA) - dbg("%s: unknown opcode: %d", __FUNCTION__, opcode); + dbg("%s: unknown opcode: %d", __func__, opcode); return(throttled ? 1 : 0); diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 2cf82177117..5f731d4912f 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c @@ -150,7 +150,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp) struct usb_serial *serial = port->serial; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* Force default termio settings */ empeg_set_termios (port, NULL) ; @@ -172,7 +172,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp) result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) - dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result); return result; } @@ -180,7 +180,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp) static void empeg_close (struct usb_serial_port *port, struct file * filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* shutdown our bulk read */ usb_kill_urb(port->read_urb); @@ -200,7 +200,7 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf, int bytes_sent = 0; int transfer_size; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); while (count > 0) { @@ -219,14 +219,14 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf, spin_unlock_irqrestore (&write_urb_pool_lock, flags); if (urb == NULL) { - dbg("%s - no more free urbs", __FUNCTION__); + dbg("%s - no more free urbs", __func__); goto exit; } if (urb->transfer_buffer == NULL) { urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); if (urb->transfer_buffer == NULL) { - dev_err(&port->dev, "%s no more kernel memory...\n", __FUNCTION__); + dev_err(&port->dev, "%s no more kernel memory...\n", __func__); goto exit; } } @@ -235,7 +235,7 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf, memcpy (urb->transfer_buffer, current_position, transfer_size); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, urb->transfer_buffer); /* build up our urb */ usb_fill_bulk_urb ( @@ -251,7 +251,7 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf, /* send it down the pipe */ status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { - dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __func__, status); bytes_sent = status; break; } @@ -275,7 +275,7 @@ static int empeg_write_room (struct usb_serial_port *port) int i; int room = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave (&write_urb_pool_lock, flags); @@ -288,7 +288,7 @@ static int empeg_write_room (struct usb_serial_port *port) spin_unlock_irqrestore (&write_urb_pool_lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return (room); @@ -301,7 +301,7 @@ static int empeg_chars_in_buffer (struct usb_serial_port *port) int i; int chars = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave (&write_urb_pool_lock, flags); @@ -314,7 +314,7 @@ static int empeg_chars_in_buffer (struct usb_serial_port *port) spin_unlock_irqrestore (&write_urb_pool_lock, flags); - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return (chars); @@ -326,11 +326,11 @@ static void empeg_write_bulk_callback (struct urb *urb) struct usb_serial_port *port = urb->context; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -346,15 +346,15 @@ static void empeg_read_bulk_callback (struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); tty = port->tty; @@ -379,7 +379,7 @@ static void empeg_read_bulk_callback (struct urb *urb) result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); return; @@ -388,7 +388,7 @@ static void empeg_read_bulk_callback (struct urb *urb) static void empeg_throttle (struct usb_serial_port *port) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); usb_kill_urb(port->read_urb); } @@ -397,14 +397,14 @@ static void empeg_unthrottle (struct usb_serial_port *port) { int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); port->read_urb->dev = port->serial->dev; result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result); return; } @@ -414,14 +414,14 @@ static int empeg_startup (struct usb_serial *serial) { int r; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (serial->dev->actconfig->desc.bConfigurationValue != 1) { err("active config #%d != 1 ??", serial->dev->actconfig->desc.bConfigurationValue); return -ENODEV; } - dbg("%s - reset config", __FUNCTION__); + dbg("%s - reset config", __func__); r = usb_reset_configuration (serial->dev); /* continue on with initialization */ @@ -432,13 +432,13 @@ static int empeg_startup (struct usb_serial *serial) static void empeg_shutdown (struct usb_serial *serial) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) { - dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); return -ENOIOCTLCMD; } @@ -447,7 +447,7 @@ static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsign static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) { struct ktermios *termios = port->tty->termios; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * The empeg-car player wants these particular tty settings. @@ -514,7 +514,7 @@ static int __init empeg_init (void) urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); if (!urb->transfer_buffer) { err("%s - out of memory for urb buffers.", - __FUNCTION__); + __func__); continue; } } diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c index 3f698baa0ab..cc4fbd9d60b 100644 --- a/drivers/usb/serial/ezusb.c +++ b/drivers/usb/serial/ezusb.c @@ -27,13 +27,13 @@ int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *da /* dbg("ezusb_writememory %x, %d", address, length); */ if (!serial->dev) { - err("%s - no physical device present, failing.", __FUNCTION__); + err("%s - no physical device present, failing.", __func__); return -ENODEV; } transfer_buffer = kmemdup(data, length, GFP_KERNEL); if (!transfer_buffer) { - dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, length); + dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __func__, length); return -ENOMEM; } result = usb_control_msg (serial->dev, usb_sndctrlpipe(serial->dev, 0), bRequest, 0x40, address, 0, transfer_buffer, length, 3000); @@ -45,10 +45,10 @@ int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit) { int response; - /* dbg("%s - %d", __FUNCTION__, reset_bit); */ + /* dbg("%s - %d", __func__, reset_bit); */ response = ezusb_writememory (serial, CPUCS_REG, &reset_bit, 1, 0xa0); if (response < 0) - dev_err(&serial->dev->dev, "%s- %d failed\n", __FUNCTION__, reset_bit); + dev_err(&serial->dev->dev, "%s- %d failed\n", __func__, reset_bit); return response; } diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 54b502f2924..8b531b377dc 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -525,7 +525,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned int rv; if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) { - dbg("%s - DTR|RTS not being set|cleared", __FUNCTION__); + dbg("%s - DTR|RTS not being set|cleared", __func__); return 0; /* no change */ } @@ -553,13 +553,13 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned kfree(buf); if (rv < 0) { err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s", - __FUNCTION__, + __func__, (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged", (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged"); } else { - dbg("%s - DTR %s, RTS %s", __FUNCTION__, + dbg("%s - DTR %s, RTS %s", __func__, (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged", (set & TIOCM_RTS) ? "HIGH" : @@ -639,7 +639,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) /* 1. Get the baud rate from the tty settings, this observes alt_speed hack */ baud = tty_get_baud_rate(port->tty); - dbg("%s - tty_get_baud_rate reports speed %d", __FUNCTION__, baud); + dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud); /* 2. Observe async-compatible custom_divisor hack, update baudrate if needed */ @@ -647,7 +647,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && (priv->custom_divisor)) { baud = priv->baud_base / priv->custom_divisor; - dbg("%s - custom divisor %d sets baud rate to %d", __FUNCTION__, priv->custom_divisor, baud); + dbg("%s - custom divisor %d sets baud rate to %d", __func__, priv->custom_divisor, baud); } /* 3. Convert baudrate to device-specific divisor */ @@ -668,7 +668,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) case 115200: div_value = ftdi_sio_b115200; break; } /* baud */ if (div_value == 0) { - dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); + dbg("%s - Baudrate (%d) requested is not supported", __func__, baud); div_value = ftdi_sio_b9600; baud = 9600; div_okay = 0; @@ -678,7 +678,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) if (baud <= 3000000) { div_value = ftdi_232am_baud_to_divisor(baud); } else { - dbg("%s - Baud rate too high!", __FUNCTION__); + dbg("%s - Baud rate too high!", __func__); baud = 9600; div_value = ftdi_232am_baud_to_divisor(9600); div_okay = 0; @@ -690,7 +690,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) if (baud <= 3000000) { div_value = ftdi_232bm_baud_to_divisor(baud); } else { - dbg("%s - Baud rate too high!", __FUNCTION__); + dbg("%s - Baud rate too high!", __func__); div_value = ftdi_232bm_baud_to_divisor(9600); div_okay = 0; baud = 9600; @@ -700,7 +700,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) if (div_okay) { dbg("%s - Baud rate set to %d (divisor 0x%lX) on chip %s", - __FUNCTION__, baud, (unsigned long)div_value, + __func__, baud, (unsigned long)div_value, ftdi_chip_name[priv->chip_type]); } @@ -801,7 +801,7 @@ static void ftdi_determine_type(struct usb_serial_port *port) version = le16_to_cpu(udev->descriptor.bcdDevice); interfaces = udev->actconfig->desc.bNumInterfaces; - dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __FUNCTION__, + dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __func__, version, interfaces); if (interfaces > 1) { int inter; @@ -819,7 +819,7 @@ static void ftdi_determine_type(struct usb_serial_port *port) * to 0x200 when iSerialNumber is 0. */ if (version < 0x500) { dbg("%s: something fishy - bcdDevice too low for multi-interface device", - __FUNCTION__); + __func__); } } else if (version < 0x200) { /* Old device. Assume its the original SIO. */ @@ -857,7 +857,7 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a int rv = 0; - dbg("%s",__FUNCTION__); + dbg("%s",__func__); rv = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), @@ -884,7 +884,7 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute * int v = simple_strtoul(valbuf, NULL, 10); int rv = 0; - dbg("%s: setting latency timer = %i", __FUNCTION__, v); + dbg("%s: setting latency timer = %i", __func__, v); rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -913,7 +913,7 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att int v = simple_strtoul(valbuf, NULL, 10); int rv = 0; - dbg("%s: setting event char = %i", __FUNCTION__, v); + dbg("%s: setting event char = %i", __func__, v); rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -938,7 +938,7 @@ static int create_sysfs_attrs(struct usb_serial_port *port) struct ftdi_private *priv = usb_get_serial_port_data(port); int retval = 0; - dbg("%s",__FUNCTION__); + dbg("%s",__func__); /* XXX I've no idea if the original SIO supports the event_char * sysfs parameter, so I'm playing it safe. */ @@ -960,7 +960,7 @@ static void remove_sysfs_attrs(struct usb_serial_port *port) { struct ftdi_private *priv = usb_get_serial_port_data(port); - dbg("%s",__FUNCTION__); + dbg("%s",__func__); /* XXX see create_sysfs_attrs */ if (priv->chip_type != SIO) { @@ -1002,11 +1002,11 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial); - dbg("%s",__FUNCTION__); + dbg("%s",__func__); priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); if (!priv){ - err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct ftdi_private)); + err("%s- kmalloc(%Zd) failed.", __func__, sizeof(struct ftdi_private)); return -ENOMEM; } @@ -1055,7 +1055,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) /* Called from usbserial:serial_probe */ static void ftdi_USB_UIRT_setup (struct ftdi_private *priv) { - dbg("%s",__FUNCTION__); + dbg("%s",__func__); priv->flags |= ASYNC_SPD_CUST; priv->custom_divisor = 77; @@ -1066,7 +1066,7 @@ static void ftdi_USB_UIRT_setup (struct ftdi_private *priv) * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv) { - dbg("%s",__FUNCTION__); + dbg("%s",__func__); priv->flags |= ASYNC_SPD_CUST; priv->custom_divisor = 240; @@ -1084,7 +1084,7 @@ static int ftdi_jtag_probe(struct usb_serial *serial) struct usb_device *udev = serial->dev; struct usb_interface *interface = serial->interface; - dbg("%s",__FUNCTION__); + dbg("%s",__func__); if (interface == udev->actconfig->interface[0]) { info("Ignoring serial port reserved for JTAG"); @@ -1120,14 +1120,14 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) */ static void ftdi_shutdown (struct usb_serial *serial) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static int ftdi_sio_port_remove(struct usb_serial_port *port) { struct ftdi_private *priv = usb_get_serial_port_data(port); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); remove_sysfs_attrs(port); @@ -1152,7 +1152,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) int result = 0; char buf[1]; /* Needed for the usb_control_msg I think */ - dbg("%s", __FUNCTION__); + dbg("%s", __func__); spin_lock_irqsave(&priv->tx_lock, flags); priv->tx_bytes = 0; @@ -1197,7 +1197,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) ftdi_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) - err("%s - failed submitting read urb, error %d", __FUNCTION__, result); + err("%s - failed submitting read urb, error %d", __func__, result); return result; @@ -1219,7 +1219,7 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp) struct ftdi_private *priv = usb_get_serial_port_data(port); char buf[1]; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); mutex_lock(&port->serial->disc_mutex); if (c_cflag & HUPCL && !port->serial->disconnected){ @@ -1266,7 +1266,7 @@ static int ftdi_write (struct usb_serial_port *port, int transfer_size; unsigned long flags; - dbg("%s port %d, %d bytes", __FUNCTION__, port->number, count); + dbg("%s port %d, %d bytes", __func__, port->number, count); if (count == 0) { dbg("write request of 0 bytes"); @@ -1275,7 +1275,7 @@ static int ftdi_write (struct usb_serial_port *port, spin_lock_irqsave(&priv->tx_lock, flags); if (priv->tx_outstanding_urbs > URB_UPPER_LIMIT) { spin_unlock_irqrestore(&priv->tx_lock, flags); - dbg("%s - write limit hit\n", __FUNCTION__); + dbg("%s - write limit hit\n", __func__); return 0; } priv->tx_outstanding_urbs++; @@ -1295,14 +1295,14 @@ static int ftdi_write (struct usb_serial_port *port, buffer = kmalloc (transfer_size, GFP_ATOMIC); if (!buffer) { - err("%s ran out of kernel memory for urb ...", __FUNCTION__); + err("%s ran out of kernel memory for urb ...", __func__); count = -ENOMEM; goto error_no_buffer; } urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) { - err("%s - no more free urbs", __FUNCTION__); + err("%s - no more free urbs", __func__); count = -ENOMEM; goto error_no_urb; } @@ -1334,7 +1334,7 @@ static int ftdi_write (struct usb_serial_port *port, memcpy (buffer, buf, count); } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, buffer); + usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, buffer); /* fill the buffer and send it */ usb_fill_bulk_urb(urb, port->serial->dev, @@ -1344,7 +1344,7 @@ static int ftdi_write (struct usb_serial_port *port, status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, status); + err("%s - failed submitting write urb, error %d", __func__, status); count = status; goto error; } else { @@ -1358,7 +1358,7 @@ static int ftdi_write (struct usb_serial_port *port, * really free it when it is finished with it */ usb_free_urb(urb); - dbg("%s write returning: %d", __FUNCTION__, count); + dbg("%s write returning: %d", __func__, count); return count; error: usb_free_urb(urb); @@ -1386,7 +1386,7 @@ static void ftdi_write_bulk_callback (struct urb *urb) /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree (urb->transfer_buffer); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("nonzero write bulk status received: %d", status); @@ -1395,7 +1395,7 @@ static void ftdi_write_bulk_callback (struct urb *urb) priv = usb_get_serial_port_data(port); if (!priv) { - dbg("%s - bad port private data pointer - exiting", __FUNCTION__); + dbg("%s - bad port private data pointer - exiting", __func__); return; } /* account for transferred data */ @@ -1420,7 +1420,7 @@ static int ftdi_write_room( struct usb_serial_port *port ) int room; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->tx_lock, flags); if (priv->tx_outstanding_urbs < URB_UPPER_LIMIT) { @@ -1444,13 +1444,13 @@ static int ftdi_chars_in_buffer (struct usb_serial_port *port) int buffered; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->tx_lock, flags); buffered = (int)priv->tx_outstanding_bytes; spin_unlock_irqrestore(&priv->tx_lock, flags); if (buffered < 0) { - err("%s outstanding tx bytes is negative!", __FUNCTION__); + err("%s outstanding tx bytes is negative!", __func__); buffered = 0; } return buffered; @@ -1468,30 +1468,30 @@ static void ftdi_read_bulk_callback (struct urb *urb) int status = urb->status; if (urb->number_of_packets > 0) { - err("%s transfer_buffer_length %d actual_length %d number of packets %d",__FUNCTION__, + err("%s transfer_buffer_length %d actual_length %d number of packets %d",__func__, urb->transfer_buffer_length, urb->actual_length, urb->number_of_packets ); - err("%s transfer_flags %x ", __FUNCTION__,urb->transfer_flags ); + err("%s transfer_flags %x ", __func__,urb->transfer_flags ); } - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (port->open_count <= 0) return; tty = port->tty; if (!tty) { - dbg("%s - bad tty pointer - exiting",__FUNCTION__); + dbg("%s - bad tty pointer - exiting",__func__); return; } priv = usb_get_serial_port_data(port); if (!priv) { - dbg("%s - bad port private data pointer - exiting", __FUNCTION__); + dbg("%s - bad port private data pointer - exiting", __func__); return; } if (urb != port->read_urb) { - err("%s - Not my urb!", __FUNCTION__); + err("%s - Not my urb!", __func__); } if (status) { @@ -1529,39 +1529,39 @@ static void ftdi_process_read (struct work_struct *work) int packet_offset; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (port->open_count <= 0) return; tty = port->tty; if (!tty) { - dbg("%s - bad tty pointer - exiting",__FUNCTION__); + dbg("%s - bad tty pointer - exiting",__func__); return; } priv = usb_get_serial_port_data(port); if (!priv) { - dbg("%s - bad port private data pointer - exiting", __FUNCTION__); + dbg("%s - bad port private data pointer - exiting", __func__); return; } urb = port->read_urb; if (!urb) { - dbg("%s - bad read_urb pointer - exiting", __FUNCTION__); + dbg("%s - bad read_urb pointer - exiting", __func__); return; } data = urb->transfer_buffer; if (priv->rx_processed) { - dbg("%s - already processed: %d bytes, %d remain", __FUNCTION__, + dbg("%s - already processed: %d bytes, %d remain", __func__, priv->rx_processed, urb->actual_length - priv->rx_processed); } else { /* The first two bytes of every read packet are status */ if (urb->actual_length > 2) { - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); } else { dbg("Status only: %03oo %03oo",data[0],data[1]); } @@ -1591,17 +1591,17 @@ static void ftdi_process_read (struct work_struct *work) length = min(PKTSZ, urb->actual_length-packet_offset)-2; if (length < 0) { - err("%s - bad packet length: %d", __FUNCTION__, length+2); + err("%s - bad packet length: %d", __func__, length+2); length = 0; } if (priv->rx_flags & THROTTLED) { - dbg("%s - throttled", __FUNCTION__); + dbg("%s - throttled", __func__); break; } if (tty_buffer_request_room(tty, length) < length) { /* break out & wait for throttling/unthrottling to happen */ - dbg("%s - receive room low", __FUNCTION__); + dbg("%s - receive room low", __func__); break; } @@ -1669,7 +1669,7 @@ static void ftdi_process_read (struct work_struct *work) /* not completely processed - record progress */ priv->rx_processed = packet_offset; dbg("%s - incomplete, %d bytes processed, %d remain", - __FUNCTION__, packet_offset, + __func__, packet_offset, urb->actual_length - packet_offset); /* check if we were throttled while processing */ spin_lock_irqsave(&priv->rx_lock, flags); @@ -1677,7 +1677,7 @@ static void ftdi_process_read (struct work_struct *work) priv->rx_flags |= ACTUALLY_THROTTLED; spin_unlock_irqrestore(&priv->rx_lock, flags); dbg("%s - deferring remainder until unthrottled", - __FUNCTION__); + __func__); return; } spin_unlock_irqrestore(&priv->rx_lock, flags); @@ -1686,7 +1686,7 @@ static void ftdi_process_read (struct work_struct *work) /* delay processing of remainder */ schedule_delayed_work(&priv->rx_work, 1); } else { - dbg("%s - port is closed", __FUNCTION__); + dbg("%s - port is closed", __func__); } return; } @@ -1704,7 +1704,7 @@ static void ftdi_process_read (struct work_struct *work) result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + err("%s - failed resubmitting read urb, error %d", __func__, result); } return; @@ -1733,10 +1733,10 @@ static void ftdi_break_ctl( struct usb_serial_port *port, int break_state ) FTDI_SIO_SET_DATA_REQUEST_TYPE, urb_value , priv->interface, buf, 0, WDR_TIMEOUT) < 0) { - err("%s FAILED to enable/disable break state (state was %d)", __FUNCTION__,break_state); + err("%s FAILED to enable/disable break state (state was %d)", __func__,break_state); } - dbg("%s break state is %d - urb is %d", __FUNCTION__,break_state, urb_value); + dbg("%s break state is %d - urb is %d", __func__,break_state, urb_value); } @@ -1760,18 +1760,18 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old unsigned char vstop; unsigned char vstart; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Force baud rate if this device requires it, unless it is set to B0. */ if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) { - dbg("%s: forcing baud rate for this device", __FUNCTION__); + dbg("%s: forcing baud rate for this device", __func__); tty_encode_baud_rate(port->tty, priv->force_baud, priv->force_baud); } /* Force RTS-CTS if this device requires it. */ if (priv->force_rtscts) { - dbg("%s: forcing rtscts for this device", __FUNCTION__); + dbg("%s: forcing rtscts for this device", __func__); termios->c_cflag |= CRTSCTS; } @@ -1815,7 +1815,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old FTDI_SIO_SET_DATA_REQUEST_TYPE, urb_value , priv->interface, buf, 0, WDR_SHORT_TIMEOUT) < 0) { - err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); + err("%s FAILED to set databits/stopbits/parity", __func__); } /* Now do the baudrate */ @@ -1826,14 +1826,14 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 0, priv->interface, buf, 0, WDR_TIMEOUT) < 0) { - err("%s error from disable flowcontrol urb", __FUNCTION__); + err("%s error from disable flowcontrol urb", __func__); } /* Drop RTS and DTR */ clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); } else { /* set the baudrate determined before */ if (change_speed(port)) { - err("%s urb failed to set baudrate", __FUNCTION__); + err("%s urb failed to set baudrate", __func__); } /* Ensure RTS and DTR are raised when baudrate changed from 0 */ if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) { @@ -1844,7 +1844,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old /* Set flow control */ /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ if (cflag & CRTSCTS) { - dbg("%s Setting to CRTSCTS flow control", __FUNCTION__); + dbg("%s Setting to CRTSCTS flow control", __func__); if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), FTDI_SIO_SET_FLOW_CTRL_REQUEST, @@ -1862,7 +1862,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old * if IXOFF is not set, the pre-xon/xoff code is executed. */ if (iflag & IXOFF) { - dbg("%s request to enable xonxoff iflag=%04x",__FUNCTION__,iflag); + dbg("%s request to enable xonxoff iflag=%04x",__func__,iflag); // Try to enable the XON/XOFF on the ftdi_sio // Set the vstart and vstop -- could have been done up above where // a lot of other dereferencing is done but that would be very @@ -1883,7 +1883,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old } else { /* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */ /* CHECKME Assuming XON/XOFF handled by tty stack - not by device */ - dbg("%s Turning off hardware flow control", __FUNCTION__); + dbg("%s Turning off hardware flow control", __func__); if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), FTDI_SIO_SET_FLOW_CTRL_REQUEST, @@ -1905,7 +1905,7 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) unsigned char buf[2]; int ret; - dbg("%s TIOCMGET", __FUNCTION__); + dbg("%s TIOCMGET", __func__); switch (priv->chip_type) { case SIO: /* Request the status from the device */ @@ -1915,7 +1915,7 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 0, 0, buf, 1, WDR_TIMEOUT)) < 0 ) { - err("%s Could not get modem status of device - err: %d", __FUNCTION__, + err("%s Could not get modem status of device - err: %d", __func__, ret); return(ret); } @@ -1932,7 +1932,7 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 0, priv->interface, buf, 2, WDR_TIMEOUT)) < 0 ) { - err("%s Could not get modem status of device - err: %d", __FUNCTION__, + err("%s Could not get modem status of device - err: %d", __func__, ret); return(ret); } @@ -1951,7 +1951,7 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) { - dbg("%s TIOCMSET", __FUNCTION__); + dbg("%s TIOCMSET", __func__); return update_mctrl(port, set, clear); } @@ -1960,7 +1960,7 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne { struct ftdi_private *priv = usb_get_serial_port_data(port); - dbg("%s cmd 0x%04x", __FUNCTION__, cmd); + dbg("%s cmd 0x%04x", __func__, cmd); /* Based on code from acm.c and others */ switch (cmd) { @@ -2019,7 +2019,7 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne /* This is not necessarily an error - turns out the higher layers will do * some ioctls itself (see comment above) */ - dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __FUNCTION__, cmd); + dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __func__, cmd); return(-ENOIOCTLCMD); } /* ftdi_ioctl */ @@ -2030,7 +2030,7 @@ static void ftdi_throttle (struct usb_serial_port *port) struct ftdi_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->rx_lock, flags); priv->rx_flags |= THROTTLED; @@ -2044,7 +2044,7 @@ static void ftdi_unthrottle (struct usb_serial_port *port) int actually_throttled; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->rx_lock, flags); actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED; @@ -2059,7 +2059,7 @@ static int __init ftdi_init (void) { int retval; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (vendor > 0 && product > 0) { /* Add user specified VID/PID to reserved element of table. */ int i; @@ -2088,7 +2088,7 @@ failed_sio_register: static void __exit ftdi_exit (void) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); usb_deregister (&ftdi_driver); usb_serial_deregister (&ftdi_sio_device); diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 87b77f92ae0..513d771adc4 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -280,7 +280,7 @@ static void send_to_tty(struct usb_serial_port *port, if (tty && actual_length) { usb_serial_debug_data(debug, &port->dev, - __FUNCTION__, actual_length, data); + __func__, actual_length, data); tty_buffer_request_room(tty, actual_length); tty_insert_flip_string(tty, data, actual_length); @@ -355,7 +355,7 @@ static void pkt_clear(struct garmin_data * garmin_data_p) unsigned long flags; struct garmin_packet *result = NULL; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); spin_lock_irqsave(&garmin_data_p->lock, flags); while (!list_empty(&garmin_data_p->pktlist)) { @@ -379,7 +379,7 @@ static int gsp_send_ack(struct garmin_data * garmin_data_p, __u8 pkt_id) __u8 *ptr = pkt; unsigned l = 0; - dbg("%s - pkt-id: 0x%X.", __FUNCTION__, 0xFF & pkt_id); + dbg("%s - pkt-id: 0x%X.", __func__, 0xFF & pkt_id); *ptr++ = DLE; *ptr++ = ACK; @@ -429,11 +429,11 @@ static int gsp_rec_packet(struct garmin_data * garmin_data_p, int count) int size = recpkt[1]; usb_serial_debug_data(debug, &garmin_data_p->port->dev, - __FUNCTION__, count-GSP_INITIAL_OFFSET, recpkt); + __func__, count-GSP_INITIAL_OFFSET, recpkt); if (size != (count-GSP_INITIAL_OFFSET-3)) { dbg("%s - invalid size, expected %d bytes, got %d", - __FUNCTION__, size, (count-GSP_INITIAL_OFFSET-3)); + __func__, size, (count-GSP_INITIAL_OFFSET-3)); return -EINVPKT; } @@ -443,7 +443,7 @@ static int gsp_rec_packet(struct garmin_data * garmin_data_p, int count) // sanity check, remove after test ... if ((__u8*)&(usbdata[3]) != recpkt) { dbg("%s - ptr mismatch %p - %p", - __FUNCTION__, &(usbdata[4]), recpkt); + __func__, &(usbdata[4]), recpkt); return -EINVPKT; } @@ -454,7 +454,7 @@ static int gsp_rec_packet(struct garmin_data * garmin_data_p, int count) if ((0xff & (cksum + *recpkt)) != 0) { dbg("%s - invalid checksum, expected %02x, got %02x", - __FUNCTION__, 0xff & -cksum, 0xff & *recpkt); + __func__, 0xff & -cksum, 0xff & *recpkt); return -EINVPKT; } @@ -519,7 +519,7 @@ static int gsp_receive(struct garmin_data * garmin_data_p, spin_unlock_irqrestore(&garmin_data_p->lock, flags); dbg("%s - dle=%d skip=%d size=%d count=%d", - __FUNCTION__, dleSeen, skip, size, count); + __func__, dleSeen, skip, size, count); if (size == 0) { size = GSP_INITIAL_OFFSET; @@ -578,7 +578,7 @@ static int gsp_receive(struct garmin_data * garmin_data_p, } if (size >= GPS_IN_BUFSIZ) { - dbg("%s - packet too large.", __FUNCTION__); + dbg("%s - packet too large.", __func__); skip = 1; size = GSP_INITIAL_OFFSET; dleSeen = 0; @@ -634,7 +634,7 @@ static int gsp_send(struct garmin_data * garmin_data_p, int i=0; int k; - dbg("%s - state %d - %d bytes.", __FUNCTION__, + dbg("%s - state %d - %d bytes.", __func__, garmin_data_p->state, count); k = garmin_data_p->outsize; @@ -658,13 +658,13 @@ static int gsp_send(struct garmin_data * garmin_data_p, return 0; } - dbg("%s - %d bytes in buffer, %d bytes in pkt.", __FUNCTION__, + dbg("%s - %d bytes in buffer, %d bytes in pkt.", __func__, k, i); /* garmin_data_p->outbuffer now contains a complete packet */ usb_serial_debug_data(debug, &garmin_data_p->port->dev, - __FUNCTION__, k, garmin_data_p->outbuffer); + __func__, k, garmin_data_p->outbuffer); garmin_data_p->outsize = 0; @@ -749,7 +749,7 @@ static void gsp_next_packet(struct garmin_data * garmin_data_p) struct garmin_packet *pkt = NULL; while ((pkt = pkt_pop(garmin_data_p)) != NULL) { - dbg("%s - next pkt: %d", __FUNCTION__, pkt->seq); + dbg("%s - next pkt: %d", __func__, pkt->seq); if (gsp_send(garmin_data_p, pkt->data, pkt->size) > 0) { kfree(pkt); return; @@ -794,7 +794,7 @@ static int nat_receive(struct garmin_data * garmin_data_p, if (len >= GPS_IN_BUFSIZ) { /* seem to be an invalid packet, ignore rest of input */ dbg("%s - packet size too large: %d", - __FUNCTION__, len); + __func__, len); garmin_data_p->insize = 0; count = 0; result = -EINVPKT; @@ -873,11 +873,11 @@ static int process_resetdev_request(struct usb_serial_port *port) spin_unlock_irqrestore(&garmin_data_p->lock, flags); usb_kill_urb (port->interrupt_in_urb); - dbg("%s - usb_reset_device", __FUNCTION__ ); + dbg("%s - usb_reset_device", __func__ ); status = usb_reset_device(port->serial->dev); if (status) dbg("%s - usb_reset_device failed: %d", - __FUNCTION__, status); + __func__, status); return status; } @@ -926,18 +926,18 @@ static int garmin_init_session(struct usb_serial_port *port) if (status == 0) { usb_kill_urb (port->interrupt_in_urb); - dbg("%s - adding interrupt input", __FUNCTION__); + dbg("%s - adding interrupt input", __func__); port->interrupt_in_urb->dev = serial->dev; status = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (status) dev_err(&serial->dev->dev, "%s - failed submitting interrupt urb," " error %d\n", - __FUNCTION__, status); + __func__, status); } if (status == 0) { - dbg("%s - starting session ...", __FUNCTION__); + dbg("%s - starting session ...", __func__); garmin_data_p->state = STATE_ACTIVE; status = garmin_write_bulk(port, GARMIN_START_SESSION_REQ, sizeof(GARMIN_START_SESSION_REQ), @@ -976,7 +976,7 @@ static int garmin_open (struct usb_serial_port *port, struct file *filp) int status = 0; struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * Force low_latency on so that our tty_push actually forces the data @@ -1013,7 +1013,7 @@ static void garmin_close (struct usb_serial_port *port, struct file * filp) struct usb_serial *serial = port->serial; struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); - dbg("%s - port %d - mode=%d state=%d flags=0x%X", __FUNCTION__, + dbg("%s - port %d - mode=%d state=%d flags=0x%X", __func__, port->number, garmin_data_p->mode, garmin_data_p->state, garmin_data_p->flags); @@ -1052,7 +1052,7 @@ static void garmin_write_bulk_callback (struct urb *urb) if (port) { struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (GARMIN_LAYERID_APPL == getLayerId(urb->transfer_buffer) && (garmin_data_p->mode == MODE_GARMIN_SERIAL)) { @@ -1061,7 +1061,7 @@ static void garmin_write_bulk_callback (struct urb *urb) if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, urb->status); + __func__, urb->status); spin_lock_irqsave(&garmin_data_p->lock, flags); garmin_data_p->flags |= CLEAR_HALT_REQUIRED; spin_unlock_irqrestore(&garmin_data_p->lock, flags); @@ -1088,7 +1088,7 @@ static int garmin_write_bulk (struct usb_serial_port *port, unsigned char *buffer; int status; - dbg("%s - port %d, state %d", __FUNCTION__, port->number, + dbg("%s - port %d, state %d", __func__, port->number, garmin_data_p->state); spin_lock_irqsave(&garmin_data_p->lock, flags); @@ -1110,7 +1110,7 @@ static int garmin_write_bulk (struct usb_serial_port *port, memcpy (buffer, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); usb_fill_bulk_urb (urb, serial->dev, usb_sndbulkpipe (serial->dev, @@ -1134,7 +1134,7 @@ static int garmin_write_bulk (struct usb_serial_port *port, dev_err(&port->dev, "%s - usb_submit_urb(write bulk) " "failed with status = %d\n", - __FUNCTION__, status); + __func__, status); count = status; } @@ -1154,7 +1154,7 @@ static int garmin_write (struct usb_serial_port *port, struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); __le32 *privpkt = (__le32 *)garmin_data_p->privpkt; - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, buf); + usb_serial_debug_data(debug, &port->dev, __func__, count, buf); /* check for our private packets */ if (count >= GARMIN_PKTHDR_LENGTH) { @@ -1172,7 +1172,7 @@ static int garmin_write (struct usb_serial_port *port, && GARMIN_LAYERID_PRIVATE == getLayerId(garmin_data_p->privpkt)) { dbg("%s - processing private request %d", - __FUNCTION__, pktid); + __func__, pktid); // drop all unfinished transfers garmin_clear(garmin_data_p); @@ -1184,7 +1184,7 @@ static int garmin_write (struct usb_serial_port *port, return -EINVPKT; debug = __le32_to_cpu(privpkt[3]); dbg("%s - debug level set to 0x%X", - __FUNCTION__, debug); + __func__, debug); break; case PRIV_PKTID_SET_MODE: @@ -1192,7 +1192,7 @@ static int garmin_write (struct usb_serial_port *port, return -EINVPKT; garmin_data_p->mode = __le32_to_cpu(privpkt[3]); dbg("%s - mode set to %d", - __FUNCTION__, garmin_data_p->mode); + __func__, garmin_data_p->mode); break; case PRIV_PKTID_INFO_REQ: @@ -1208,7 +1208,7 @@ static int garmin_write (struct usb_serial_port *port, return -EINVPKT; initial_mode = __le32_to_cpu(privpkt[3]); dbg("%s - initial_mode set to %d", - __FUNCTION__, + __func__, garmin_data_p->mode); break; } @@ -1255,7 +1255,7 @@ static void garmin_read_process(struct garmin_data * garmin_data_p, { if (garmin_data_p->flags & FLAGS_DROP_DATA) { /* abort-transfer cmd is actice */ - dbg("%s - pkt dropped", __FUNCTION__); + dbg("%s - pkt dropped", __func__); } else if (garmin_data_p->state != STATE_DISCONNECTED && garmin_data_p->state != STATE_RESET ) { @@ -1293,21 +1293,21 @@ static void garmin_read_bulk_callback (struct urb *urb) int status = urb->status; int retval; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!serial) { - dbg("%s - bad serial pointer, exiting", __FUNCTION__); + dbg("%s - bad serial pointer, exiting", __func__); return; } if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } usb_serial_debug_data(debug, &port->dev, - __FUNCTION__, urb->actual_length, data); + __func__, urb->actual_length, data); garmin_read_process(garmin_data_p, data, urb->actual_length); @@ -1320,7 +1320,7 @@ static void garmin_read_bulk_callback (struct urb *urb) if (retval) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", - __FUNCTION__, retval); + __func__, retval); } else if (urb->actual_length > 0) { /* Continue trying to read until nothing more is received */ if (0 == (garmin_data_p->flags & FLAGS_THROTTLED)) { @@ -1328,10 +1328,10 @@ static void garmin_read_bulk_callback (struct urb *urb) if (retval) dev_err(&port->dev, "%s - failed resubmitting read urb, " - "error %d\n", __FUNCTION__, retval); + "error %d\n", __func__, retval); } } else { - dbg("%s - end of bulk data", __FUNCTION__); + dbg("%s - end of bulk data", __func__); spin_lock_irqsave(&garmin_data_p->lock, flags); garmin_data_p->flags &= ~FLAGS_BULK_IN_ACTIVE; spin_unlock_irqrestore(&garmin_data_p->lock, flags); @@ -1359,22 +1359,22 @@ static void garmin_read_int_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, urb->transfer_buffer); if (urb->actual_length == sizeof(GARMIN_BULK_IN_AVAIL_REPLY) && 0 == memcmp(data, GARMIN_BULK_IN_AVAIL_REPLY, sizeof(GARMIN_BULK_IN_AVAIL_REPLY))) { - dbg("%s - bulk data available.", __FUNCTION__); + dbg("%s - bulk data available.", __func__); if (0 == (garmin_data_p->flags & FLAGS_BULK_IN_ACTIVE)) { @@ -1389,7 +1389,7 @@ static void garmin_read_int_callback (struct urb *urb) if (retval) { dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", - __FUNCTION__, retval); + __func__, retval); } else { spin_lock_irqsave(&garmin_data_p->lock, flags); garmin_data_p->flags |= FLAGS_BULK_IN_ACTIVE; @@ -1417,14 +1417,14 @@ static void garmin_read_int_callback (struct urb *urb) = __le32_to_cpup((__le32*)(data+GARMIN_PKTHDR_LENGTH)); dbg("%s - start-of-session reply seen - serial %u.", - __FUNCTION__, garmin_data_p->serial_num); + __func__, garmin_data_p->serial_num); } if (garmin_data_p->ignorePkts) { /* this reply belongs to a request generated by the driver, ignore it. */ dbg("%s - pkt ignored (%d)", - __FUNCTION__, garmin_data_p->ignorePkts); + __func__, garmin_data_p->ignorePkts); spin_lock_irqsave(&garmin_data_p->lock, flags); garmin_data_p->ignorePkts--; spin_unlock_irqrestore(&garmin_data_p->lock, flags); @@ -1437,7 +1437,7 @@ static void garmin_read_int_callback (struct urb *urb) if (retval) dev_err(&urb->dev->dev, "%s - Error %d submitting interrupt urb\n", - __FUNCTION__, retval); + __func__, retval); } @@ -1473,7 +1473,7 @@ static void garmin_throttle (struct usb_serial_port *port) unsigned long flags; struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* set flag, data received will be put into a queue for later processing */ spin_lock_irqsave(&garmin_data_p->lock, flags); @@ -1488,7 +1488,7 @@ static void garmin_unthrottle (struct usb_serial_port *port) struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&garmin_data_p->lock, flags); garmin_data_p->flags &= ~FLAGS_THROTTLED; spin_unlock_irqrestore(&garmin_data_p->lock, flags); @@ -1503,7 +1503,7 @@ static void garmin_unthrottle (struct usb_serial_port *port) if (status) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", - __FUNCTION__, status); + __func__, status); } } @@ -1532,11 +1532,11 @@ static int garmin_attach (struct usb_serial *serial) struct usb_serial_port *port = serial->port[0]; struct garmin_data * garmin_data_p = NULL; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); if (garmin_data_p == NULL) { - dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__); + dev_err(&port->dev, "%s - Out of memory\n", __func__); return -ENOMEM; } init_timer(&garmin_data_p->timer); @@ -1561,7 +1561,7 @@ static void garmin_shutdown (struct usb_serial *serial) struct usb_serial_port *port = serial->port[0]; struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); usb_kill_urb (port->interrupt_in_urb); del_timer_sync(&garmin_data_p->timer); diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 5b0952054de..2078667db4a 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -118,7 +118,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp) int result = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* force low_latency on so that our tty_push actually forces the data through, otherwise it is scheduled, and with high data rates (like with OHCI) data @@ -145,7 +145,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp) port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) - dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); } return result; @@ -156,7 +156,7 @@ static void generic_cleanup (struct usb_serial_port *port) { struct usb_serial *serial = port->serial; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (serial->dev) { /* shutdown any bulk reads that might be going on */ @@ -194,7 +194,7 @@ int usb_serial_generic_resume(struct usb_serial *serial) void usb_serial_generic_close (struct usb_serial_port *port, struct file * filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); generic_cleanup (port); } @@ -204,10 +204,10 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char * int result; unsigned char *data; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return (0); } @@ -217,7 +217,7 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char * spin_lock_irqsave(&port->lock, flags); if (port->write_urb_busy) { spin_unlock_irqrestore(&port->lock, flags); - dbg("%s - already writing", __FUNCTION__); + dbg("%s - already writing", __func__); return 0; } port->write_urb_busy = 1; @@ -227,7 +227,7 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char * memcpy (port->write_urb->transfer_buffer, buf, count); data = port->write_urb->transfer_buffer; - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, data); + usb_serial_debug_data(debug, &port->dev, __func__, count, data); /* set up our urb */ usb_fill_bulk_urb (port->write_urb, serial->dev, @@ -242,7 +242,7 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char * port->write_urb_busy = 1; result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result); /* don't have to grab the lock here, as we will retry if != 0 */ port->write_urb_busy = 0; } else @@ -260,14 +260,14 @@ int usb_serial_generic_write_room (struct usb_serial_port *port) struct usb_serial *serial = port->serial; int room = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (serial->num_bulk_out) { if (!(port->write_urb_busy)) room = port->bulk_out_size; } - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return (room); } @@ -276,14 +276,14 @@ int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port) struct usb_serial *serial = port->serial; int chars = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (serial->num_bulk_out) { if (port->write_urb_busy) chars = port->write_urb->transfer_buffer_length; } - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return (chars); } @@ -305,7 +305,7 @@ static void resubmit_read_urb(struct usb_serial_port *port, gfp_t mem_flags) usb_serial_generic_read_bulk_callback), port); result = usb_submit_urb(urb, mem_flags); if (result) - dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); } /* Push data to tty layer and resubmit the bulk read URB */ @@ -334,15 +334,15 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) int status = urb->status; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (unlikely(status != 0)) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* Throttle the device if requested by tty */ spin_lock_irqsave(&port->lock, flags); @@ -360,12 +360,12 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *)urb->context; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -377,7 +377,7 @@ void usb_serial_generic_throttle (struct usb_serial_port *port) { unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* Set the throttle request flag. It will be picked up * by usb_serial_generic_read_bulk_callback(). */ @@ -391,7 +391,7 @@ void usb_serial_generic_unthrottle (struct usb_serial_port *port) int was_throttled; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* Clear the throttle flags */ spin_lock_irqsave(&port->lock, flags); @@ -409,7 +409,7 @@ void usb_serial_generic_shutdown (struct usb_serial *serial) { int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* stop reads and writes on all ports */ for (i=0; i < serial->num_ports; ++i) { diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 3428ccc28da..2b676732e9f 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -371,7 +371,7 @@ static int get_string (struct usb_device *dev, int Id, char *string, int buflen) struct usb_string_descriptor StringDesc; struct usb_string_descriptor *pStringDesc; - dbg("%s - USB String ID = %d", __FUNCTION__, Id ); + dbg("%s - USB String ID = %d", __func__, Id ); if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc, sizeof(StringDesc))) { return 0; @@ -391,7 +391,7 @@ static int get_string (struct usb_device *dev, int Id, char *string, int buflen) unicode_to_ascii(string, buflen, pStringDesc->wData, pStringDesc->bLength/2); kfree(pStringDesc); - dbg("%s - USB String %s", __FUNCTION__, string); + dbg("%s - USB String %s", __func__, string); return strlen(string); } @@ -407,7 +407,7 @@ static int get_string_desc (struct usb_device *dev, int Id, struct usb_string_de struct usb_string_descriptor StringDesc; struct usb_string_descriptor *pStringDesc; - dbg("%s - USB String ID = %d", __FUNCTION__, Id ); + dbg("%s - USB String ID = %d", __func__, Id ); if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc, sizeof(StringDesc))) { return 0; @@ -537,7 +537,7 @@ static int get_epic_descriptor(struct edgeport_serial *ep) sizeof(struct edge_compatibility_descriptor), 300); - dbg("%s result = %d", __FUNCTION__, result); + dbg("%s result = %d", __func__, result); if (result > 0) { ep->is_epic = 1; @@ -601,7 +601,7 @@ static void edge_interrupt_callback (struct urb *urb) int result; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); switch (status) { case 0: @@ -612,35 +612,35 @@ static void edge_interrupt_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } // process this interrupt-read even if there are no ports open if (length) { - usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __FUNCTION__, length, data); + usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __func__, length, data); if (length > 1) { bytes_avail = data[0] | (data[1] << 8); if (bytes_avail) { spin_lock(&edge_serial->es_lock); edge_serial->rxBytesAvail += bytes_avail; - dbg("%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d", __FUNCTION__, bytes_avail, edge_serial->rxBytesAvail, edge_serial->read_in_progress); + dbg("%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d", __func__, bytes_avail, edge_serial->rxBytesAvail, edge_serial->read_in_progress); if (edge_serial->rxBytesAvail > 0 && !edge_serial->read_in_progress) { - dbg("%s - posting a read", __FUNCTION__); + dbg("%s - posting a read", __func__); edge_serial->read_in_progress = true; /* we have pending bytes on the bulk in pipe, send a request */ edge_serial->read_urb->dev = edge_serial->serial->dev; result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); if (result) { - dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __FUNCTION__, result); + dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __func__, result); edge_serial->read_in_progress = false; } } @@ -659,7 +659,7 @@ static void edge_interrupt_callback (struct urb *urb) spin_lock(&edge_port->ep_lock); edge_port->txCredits += txCredits; spin_unlock(&edge_port->ep_lock); - dbg("%s - txcredits for port%d = %d", __FUNCTION__, portNumber, edge_port->txCredits); + dbg("%s - txcredits for port%d = %d", __func__, portNumber, edge_port->txCredits); /* tell the tty driver that something has changed */ if (edge_port->port->tty) @@ -677,7 +677,7 @@ static void edge_interrupt_callback (struct urb *urb) exit: result = usb_submit_urb (urb, GFP_ATOMIC); if (result) { - dev_err(&urb->dev->dev, "%s - Error %d submitting control urb\n", __FUNCTION__, result); + dev_err(&urb->dev->dev, "%s - Error %d submitting control urb\n", __func__, result); } } @@ -695,43 +695,43 @@ static void edge_bulk_in_callback (struct urb *urb) __u16 raw_data_length; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); edge_serial->read_in_progress = false; return; } if (urb->actual_length == 0) { - dbg("%s - read bulk callback with no data", __FUNCTION__); + dbg("%s - read bulk callback with no data", __func__); edge_serial->read_in_progress = false; return; } raw_data_length = urb->actual_length; - usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __FUNCTION__, raw_data_length, data); + usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __func__, raw_data_length, data); spin_lock(&edge_serial->es_lock); /* decrement our rxBytes available by the number that we just got */ edge_serial->rxBytesAvail -= raw_data_length; - dbg("%s - Received = %d, rxBytesAvail %d", __FUNCTION__, raw_data_length, edge_serial->rxBytesAvail); + dbg("%s - Received = %d, rxBytesAvail %d", __func__, raw_data_length, edge_serial->rxBytesAvail); process_rcvd_data (edge_serial, data, urb->actual_length); /* check to see if there's any more data for us to read */ if (edge_serial->rxBytesAvail > 0) { - dbg("%s - posting a read", __FUNCTION__); + dbg("%s - posting a read", __func__); edge_serial->read_urb->dev = edge_serial->serial->dev; retval = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); if (retval) { dev_err(&urb->dev->dev, "%s - usb_submit_urb(read bulk) failed, " - "retval = %d\n", __FUNCTION__, retval); + "retval = %d\n", __func__, retval); edge_serial->read_in_progress = false; } } else { @@ -753,11 +753,11 @@ static void edge_bulk_out_data_callback (struct urb *urb) struct tty_struct *tty; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); } tty = edge_port->port->tty; @@ -786,10 +786,10 @@ static void edge_bulk_out_cmd_callback (struct urb *urb) struct tty_struct *tty; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); atomic_dec(&CmdUrbs); - dbg("%s - FREE URB %p (outstanding %d)", __FUNCTION__, urb, atomic_read(&CmdUrbs)); + dbg("%s - FREE URB %p (outstanding %d)", __func__, urb, atomic_read(&CmdUrbs)); /* clean up the transfer buffer */ @@ -799,7 +799,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb) usb_free_urb (urb); if (status) { - dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, status); + dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } @@ -833,7 +833,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) struct edgeport_serial *edge_serial; int response; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return -ENODEV; @@ -883,7 +883,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) * this interrupt will continue as long as the edgeport is connected */ response = usb_submit_urb (edge_serial->interrupt_read_urb, GFP_KERNEL); if (response) { - dev_err(&port->dev, "%s - Error %d submitting control urb\n", __FUNCTION__, response); + dev_err(&port->dev, "%s - Error %d submitting control urb\n", __func__, response); } } @@ -907,7 +907,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) response = send_iosp_ext_cmd (edge_port, IOSP_CMD_OPEN_PORT, 0); if (response < 0) { - dev_err(&port->dev, "%s - error sending open port command\n", __FUNCTION__); + dev_err(&port->dev, "%s - error sending open port command\n", __func__); edge_port->openPending = false; return -ENODEV; } @@ -917,7 +917,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) if (!edge_port->open) { /* open timed out */ - dbg("%s - open timedout", __FUNCTION__); + dbg("%s - open timedout", __func__); edge_port->openPending = false; return -ENODEV; } @@ -930,7 +930,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) edge_port->txfifo.fifo = kmalloc (edge_port->maxTxCredits, GFP_KERNEL); if (!edge_port->txfifo.fifo) { - dbg("%s - no memory", __FUNCTION__); + dbg("%s - no memory", __func__); edge_close (port, filp); return -ENOMEM; } @@ -940,14 +940,14 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) edge_port->write_in_progress = false; if (!edge_port->write_urb) { - dbg("%s - no memory", __FUNCTION__); + dbg("%s - no memory", __func__); edge_close (port, filp); return -ENOMEM; } - dbg("%s(%d) - Initialize TX fifo to %d bytes", __FUNCTION__, port->number, edge_port->maxTxCredits); + dbg("%s(%d) - Initialize TX fifo to %d bytes", __func__, port->number, edge_port->maxTxCredits); - dbg("%s exited", __FUNCTION__); + dbg("%s exited", __func__); return 0; } @@ -976,11 +976,11 @@ static void block_until_chase_response(struct edgeport_port *edge_port) // Did we get our Chase response if (!edge_port->chaseResponsePending) { - dbg("%s - Got Chase Response", __FUNCTION__); + dbg("%s - Got Chase Response", __func__); // did we get all of our credit back? if (edge_port->txCredits == edge_port->maxTxCredits ) { - dbg("%s - Got all credits", __FUNCTION__); + dbg("%s - Got all credits", __func__); return; } } @@ -995,12 +995,12 @@ static void block_until_chase_response(struct edgeport_port *edge_port) loop--; if (loop == 0) { edge_port->chaseResponsePending = false; - dbg("%s - Chase TIMEOUT", __FUNCTION__); + dbg("%s - Chase TIMEOUT", __func__); return; } } else { // Reset timeout value back to 10 seconds - dbg("%s - Last %d, Current %d", __FUNCTION__, lastCredits, edge_port->txCredits); + dbg("%s - Last %d, Current %d", __func__, lastCredits, edge_port->txCredits); loop = 10; } } @@ -1031,7 +1031,7 @@ static void block_until_tx_empty (struct edgeport_port *edge_port) // Is the Edgeport Buffer empty? if (lastCount == 0) { - dbg("%s - TX Buffer Empty", __FUNCTION__); + dbg("%s - TX Buffer Empty", __func__); return; } @@ -1040,13 +1040,13 @@ static void block_until_tx_empty (struct edgeport_port *edge_port) schedule_timeout(timeout); finish_wait(&edge_port->wait_chase, &wait); - dbg("%s wait", __FUNCTION__); + dbg("%s wait", __func__); if (lastCount == fifo->count) { // No activity.. count down. loop--; if (loop == 0) { - dbg("%s - TIMEOUT", __FUNCTION__); + dbg("%s - TIMEOUT", __func__); return; } } else { @@ -1067,7 +1067,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) struct edgeport_port *edge_port; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); edge_serial = usb_get_serial_data(port->serial); edge_port = usb_get_serial_port_data(port); @@ -1085,7 +1085,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) /* flush and chase */ edge_port->chaseResponsePending = true; - dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); + dbg("%s - Sending IOSP_CMD_CHASE_PORT", __func__); status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); if (status == 0) { // block until chase finished @@ -1099,7 +1099,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) ((edge_serial->is_epic) && (edge_serial->epic_descriptor.Supports.IOSPClose))) { /* close the port */ - dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __FUNCTION__); + dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __func__); send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0); } @@ -1119,7 +1119,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) kfree(edge_port->txfifo.fifo); edge_port->txfifo.fifo = NULL; - dbg("%s exited", __FUNCTION__); + dbg("%s exited", __func__); } /***************************************************************************** @@ -1139,7 +1139,7 @@ static int edge_write (struct usb_serial_port *port, const unsigned char *data, int secondhalf; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return -ENODEV; @@ -1152,12 +1152,12 @@ static int edge_write (struct usb_serial_port *port, const unsigned char *data, // calculate number of bytes to put in fifo copySize = min ((unsigned int)count, (edge_port->txCredits - fifo->count)); - dbg("%s(%d) of %d byte(s) Fifo room %d -- will copy %d bytes", __FUNCTION__, + dbg("%s(%d) of %d byte(s) Fifo room %d -- will copy %d bytes", __func__, port->number, count, edge_port->txCredits - fifo->count, copySize); /* catch writes of 0 bytes which the tty driver likes to give us, and when txCredits is empty */ if (copySize == 0) { - dbg("%s - copySize = Zero", __FUNCTION__); + dbg("%s - copySize = Zero", __func__); goto finish_write; } @@ -1169,11 +1169,11 @@ static int edge_write (struct usb_serial_port *port, const unsigned char *data, bytesleft = fifo->size - fifo->head; firsthalf = min (bytesleft, copySize); - dbg("%s - copy %d bytes of %d into fifo ", __FUNCTION__, firsthalf, bytesleft); + dbg("%s - copy %d bytes of %d into fifo ", __func__, firsthalf, bytesleft); /* now copy our data */ memcpy(&fifo->fifo[fifo->head], data, firsthalf); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, firsthalf, &fifo->fifo[fifo->head]); + usb_serial_debug_data(debug, &port->dev, __func__, firsthalf, &fifo->fifo[fifo->head]); // update the index and size fifo->head += firsthalf; @@ -1187,9 +1187,9 @@ static int edge_write (struct usb_serial_port *port, const unsigned char *data, secondhalf = copySize-firsthalf; if (secondhalf) { - dbg("%s - copy rest of data %d", __FUNCTION__, secondhalf); + dbg("%s - copy rest of data %d", __func__, secondhalf); memcpy(&fifo->fifo[fifo->head], &data[firsthalf], secondhalf); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, secondhalf, &fifo->fifo[fifo->head]); + usb_serial_debug_data(debug, &port->dev, __func__, secondhalf, &fifo->fifo[fifo->head]); // update the index and size fifo->count += secondhalf; fifo->head += secondhalf; @@ -1201,7 +1201,7 @@ finish_write: send_more_port_data((struct edgeport_serial *)usb_get_serial_data(port->serial), edge_port); - dbg("%s wrote %d byte(s) TxCredits %d, Fifo %d", __FUNCTION__, copySize, edge_port->txCredits, fifo->count); + dbg("%s wrote %d byte(s) TxCredits %d, Fifo %d", __func__, copySize, edge_port->txCredits, fifo->count); return copySize; } @@ -1232,14 +1232,14 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge int secondhalf; unsigned long flags; - dbg("%s(%d)", __FUNCTION__, edge_port->port->number); + dbg("%s(%d)", __func__, edge_port->port->number); spin_lock_irqsave(&edge_port->ep_lock, flags); if (edge_port->write_in_progress || !edge_port->open || (fifo->count == 0)) { - dbg("%s(%d) EXIT - fifo %d, PendingWrite = %d", __FUNCTION__, edge_port->port->number, fifo->count, edge_port->write_in_progress); + dbg("%s(%d) EXIT - fifo %d, PendingWrite = %d", __func__, edge_port->port->number, fifo->count, edge_port->write_in_progress); goto exit_send; } @@ -1251,7 +1251,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge // it's better to wait for more credits so we can do a larger // write. if (edge_port->txCredits < EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(edge_port->maxTxCredits,EDGE_FW_BULK_MAX_PACKET_SIZE)) { - dbg("%s(%d) Not enough credit - fifo %d TxCredit %d", __FUNCTION__, edge_port->port->number, fifo->count, edge_port->txCredits ); + dbg("%s(%d) Not enough credit - fifo %d TxCredit %d", __func__, edge_port->port->number, fifo->count, edge_port->txCredits ); goto exit_send; } @@ -1269,7 +1269,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge count = fifo->count; buffer = kmalloc (count+2, GFP_ATOMIC); if (buffer == NULL) { - dev_err(&edge_port->port->dev, "%s - no more kernel memory...\n", __FUNCTION__); + dev_err(&edge_port->port->dev, "%s - no more kernel memory...\n", __func__); edge_port->write_in_progress = false; goto exit_send; } @@ -1294,7 +1294,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge } if (count) - usb_serial_debug_data(debug, &edge_port->port->dev, __FUNCTION__, count, &buffer[2]); + usb_serial_debug_data(debug, &edge_port->port->dev, __func__, count, &buffer[2]); /* fill up the urb with all of our data and submit it */ usb_fill_bulk_urb (urb, edge_serial->serial->dev, @@ -1309,14 +1309,14 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { /* something went wrong */ - dev_err(&edge_port->port->dev, "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n", __FUNCTION__, status); + dev_err(&edge_port->port->dev, "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n", __func__, status); edge_port->write_in_progress = false; /* revert the credits as something bad happened. */ edge_port->txCredits += count; edge_port->icount.tx -= count; } - dbg("%s wrote %d byte(s) TxCredit %d, Fifo %d", __FUNCTION__, count, edge_port->txCredits, fifo->count); + dbg("%s wrote %d byte(s) TxCredit %d, Fifo %d", __func__, count, edge_port->txCredits, fifo->count); exit_send: spin_unlock_irqrestore(&edge_port->ep_lock, flags); @@ -1337,17 +1337,17 @@ static int edge_write_room (struct usb_serial_port *port) int room; unsigned long flags; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (edge_port == NULL) return -ENODEV; if (edge_port->closePending) return -ENODEV; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!edge_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return -EINVAL; } @@ -1356,7 +1356,7 @@ static int edge_write_room (struct usb_serial_port *port) room = edge_port->txCredits - edge_port->txfifo.count; spin_unlock_irqrestore(&edge_port->ep_lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -1376,7 +1376,7 @@ static int edge_chars_in_buffer (struct usb_serial_port *port) int num_chars; unsigned long flags; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (edge_port == NULL) return -ENODEV; @@ -1384,7 +1384,7 @@ static int edge_chars_in_buffer (struct usb_serial_port *port) return -ENODEV; if (!edge_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return -EINVAL; } @@ -1392,7 +1392,7 @@ static int edge_chars_in_buffer (struct usb_serial_port *port) num_chars = edge_port->maxTxCredits - edge_port->txCredits + edge_port->txfifo.count; spin_unlock_irqrestore(&edge_port->ep_lock, flags); if (num_chars) { - dbg("%s(port %d) - returns %d", __FUNCTION__, port->number, num_chars); + dbg("%s(port %d) - returns %d", __func__, port->number, num_chars); } return num_chars; @@ -1410,19 +1410,19 @@ static void edge_throttle (struct usb_serial_port *port) struct tty_struct *tty; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return; if (!edge_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } tty = port->tty; if (!tty) { - dbg ("%s - no tty available", __FUNCTION__); + dbg ("%s - no tty available", __func__); return; } @@ -1459,19 +1459,19 @@ static void edge_unthrottle (struct usb_serial_port *port) struct tty_struct *tty; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return; if (!edge_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } tty = port->tty; if (!tty) { - dbg ("%s - no tty available", __FUNCTION__); + dbg ("%s - no tty available", __func__); return; } @@ -1509,18 +1509,18 @@ static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old unsigned int cflag; cflag = tty->termios->c_cflag; - dbg("%s - clfag %08x iflag %08x", __FUNCTION__, + dbg("%s - clfag %08x iflag %08x", __func__, tty->termios->c_cflag, tty->termios->c_iflag); - dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, + dbg("%s - old clfag %08x old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return; if (!edge_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } @@ -1549,7 +1549,7 @@ static int get_lsr_info(struct edgeport_port *edge_port, unsigned int __user *va spin_lock_irqsave(&edge_port->ep_lock, flags); if (edge_port->maxTxCredits == edge_port->txCredits && edge_port->txfifo.count == 0) { - dbg("%s -- Empty", __FUNCTION__); + dbg("%s -- Empty", __func__); result = TIOCSER_TEMT; } spin_unlock_irqrestore(&edge_port->ep_lock, flags); @@ -1569,7 +1569,7 @@ static int get_number_bytes_avail(struct edgeport_port *edge_port, unsigned int result = tty->read_cnt; - dbg("%s(%d) = %d", __FUNCTION__, edge_port->port->number, result); + dbg("%s(%d) = %d", __func__, edge_port->port->number, result); if (copy_to_user(value, &result, sizeof(int))) return -EFAULT; //return 0; @@ -1581,7 +1581,7 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig struct edgeport_port *edge_port = usb_get_serial_port_data(port); unsigned int mcr; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); mcr = edge_port->shadowMCR; if (set & TIOCM_RTS) @@ -1612,7 +1612,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int msr; unsigned int mcr; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); msr = edge_port->shadowMSR; mcr = edge_port->shadowMCR; @@ -1624,7 +1624,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) | ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ - dbg("%s -- %x", __FUNCTION__, result); + dbg("%s -- %x", __func__, result); return result; } @@ -1670,30 +1670,30 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned struct async_icount cprev; struct serial_icounter_struct icount; - dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); switch (cmd) { // return number of bytes available case TIOCINQ: - dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number); + dbg("%s (%d) TIOCINQ", __func__, port->number); return get_number_bytes_avail(edge_port, (unsigned int __user *) arg); break; case TIOCSERGETLSR: - dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); + dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); return get_lsr_info(edge_port, (unsigned int __user *) arg); return 0; case TIOCGSERIAL: - dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number); + dbg("%s (%d) TIOCGSERIAL", __func__, port->number); return get_serial_info(edge_port, (struct serial_struct __user *) arg); case TIOCSSERIAL: - dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number); + dbg("%s (%d) TIOCSSERIAL", __func__, port->number); break; case TIOCMIWAIT: - dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number); + dbg("%s (%d) TIOCMIWAIT", __func__, port->number); cprev = edge_port->icount; while (1) { prepare_to_wait(&edge_port->delta_msr_wait, &wait, TASK_INTERRUPTIBLE); @@ -1732,7 +1732,7 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned icount.brk = cnow.brk; icount.buf_overrun = cnow.buf_overrun; - dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, port->number, icount.rx, icount.tx ); + dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, icount.rx, icount.tx ); if (copy_to_user((void __user *)arg, &icount, sizeof(icount))) return -EFAULT; return 0; @@ -1758,7 +1758,7 @@ static void edge_break (struct usb_serial_port *port, int break_state) /* flush and chase */ edge_port->chaseResponsePending = true; - dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); + dbg("%s - Sending IOSP_CMD_CHASE_PORT", __func__); status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); if (status == 0) { // block until chase finished @@ -1772,14 +1772,14 @@ static void edge_break (struct usb_serial_port *port, int break_state) ((edge_serial->is_epic) && (edge_serial->epic_descriptor.Supports.IOSPSetClrBreak))) { if (break_state == -1) { - dbg("%s - Sending IOSP_CMD_SET_BREAK", __FUNCTION__); + dbg("%s - Sending IOSP_CMD_SET_BREAK", __func__); status = send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_BREAK, 0); } else { - dbg("%s - Sending IOSP_CMD_CLEAR_BREAK", __FUNCTION__); + dbg("%s - Sending IOSP_CMD_CLEAR_BREAK", __func__); status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CLEAR_BREAK, 0); } if (status) { - dbg("%s - error sending break set/clear command.", __FUNCTION__); + dbg("%s - error sending break set/clear command.", __func__); } } @@ -1799,14 +1799,14 @@ static void process_rcvd_data (struct edgeport_serial *edge_serial, unsigned cha __u16 lastBufferLength; __u16 rxLen; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); lastBufferLength = bufferLength + 1; while (bufferLength > 0) { /* failsafe incase we get a message that we don't understand */ if (lastBufferLength == bufferLength) { - dbg("%s - stuck in loop, exiting it.", __FUNCTION__); + dbg("%s - stuck in loop, exiting it.", __func__); break; } lastBufferLength = bufferLength; @@ -1828,7 +1828,7 @@ static void process_rcvd_data (struct edgeport_serial *edge_serial, unsigned cha ++buffer; --bufferLength; - dbg("%s - Hdr1=%02X Hdr2=%02X", __FUNCTION__, edge_serial->rxHeader1, edge_serial->rxHeader2); + dbg("%s - Hdr1=%02X Hdr2=%02X", __func__, edge_serial->rxHeader1, edge_serial->rxHeader2); // Process depending on whether this header is // data or status @@ -1858,7 +1858,7 @@ static void process_rcvd_data (struct edgeport_serial *edge_serial, unsigned cha edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1); edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1, edge_serial->rxHeader2); - dbg("%s - Data for Port %u Len %u", __FUNCTION__, edge_serial->rxPort, edge_serial->rxBytesRemaining); + dbg("%s - Data for Port %u Len %u", __func__, edge_serial->rxPort, edge_serial->rxBytesRemaining); //ASSERT( DevExt->RxPort < DevExt->NumPorts ); //ASSERT( DevExt->RxBytesRemaining < IOSP_MAX_DATA_LENGTH ); @@ -1891,7 +1891,7 @@ static void process_rcvd_data (struct edgeport_serial *edge_serial, unsigned cha if (edge_port->open) { tty = edge_port->port->tty; if (tty) { - dbg("%s - Sending %d bytes to TTY for port %d", __FUNCTION__, rxLen, edge_serial->rxPort); + dbg("%s - Sending %d bytes to TTY for port %d", __func__, rxLen, edge_serial->rxPort); edge_tty_recv(&edge_serial->serial->dev->dev, tty, buffer, rxLen); } edge_port->icount.rx += rxLen; @@ -1930,17 +1930,17 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 port = edge_serial->serial->port[edge_serial->rxPort]; edge_port = usb_get_serial_port_data(port); if (edge_port == NULL) { - dev_err(&edge_serial->serial->dev->dev, "%s - edge_port == NULL for port %d\n", __FUNCTION__, edge_serial->rxPort); + dev_err(&edge_serial->serial->dev->dev, "%s - edge_port == NULL for port %d\n", __func__, edge_serial->rxPort); return; } - dbg("%s - port %d", __FUNCTION__, edge_serial->rxPort); + dbg("%s - port %d", __func__, edge_serial->rxPort); if (code == IOSP_EXT_STATUS) { switch (byte2) { case IOSP_EXT_STATUS_CHASE_RSP: // we want to do EXT status regardless of port open/closed - dbg("%s - Port %u EXT CHASE_RSP Data = %02x", __FUNCTION__, edge_serial->rxPort, byte3 ); + dbg("%s - Port %u EXT CHASE_RSP Data = %02x", __func__, edge_serial->rxPort, byte3 ); // Currently, the only EXT_STATUS is Chase, so process here instead of one more call // to one more subroutine. If/when more EXT_STATUS, there'll be more work to do. // Also, we currently clear flag and close the port regardless of content of above's Byte3. @@ -1951,7 +1951,7 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 return; case IOSP_EXT_STATUS_RX_CHECK_RSP: - dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============\n", __FUNCTION__, edge_serial->rxPort, byte3 ); + dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============\n", __func__, edge_serial->rxPort, byte3 ); //Port->RxCheckRsp = true; return; } @@ -1960,7 +1960,7 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 if (code == IOSP_STATUS_OPEN_RSP) { edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); edge_port->maxTxCredits = edge_port->txCredits; - dbg("%s - Port %u Open Response Inital MSR = %02x TxBufferSize = %d", __FUNCTION__, edge_serial->rxPort, byte2, edge_port->txCredits); + dbg("%s - Port %u Open Response Inital MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits); handle_new_msr (edge_port, byte2); /* send the current line settings to the port so we are in sync with any further termios calls */ @@ -1984,23 +1984,23 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 switch (code) { // Not currently sent by Edgeport case IOSP_STATUS_LSR: - dbg("%s - Port %u LSR Status = %02x", __FUNCTION__, edge_serial->rxPort, byte2); + dbg("%s - Port %u LSR Status = %02x", __func__, edge_serial->rxPort, byte2); handle_new_lsr(edge_port, false, byte2, 0); break; case IOSP_STATUS_LSR_DATA: - dbg("%s - Port %u LSR Status = %02x, Data = %02x", __FUNCTION__, edge_serial->rxPort, byte2, byte3); + dbg("%s - Port %u LSR Status = %02x, Data = %02x", __func__, edge_serial->rxPort, byte2, byte3); // byte2 is LSR Register // byte3 is broken data byte handle_new_lsr(edge_port, true, byte2, byte3); break; // // case IOSP_EXT_4_STATUS: - // dbg("%s - Port %u LSR Status = %02x Data = %02x", __FUNCTION__, edge_serial->rxPort, byte2, byte3); + // dbg("%s - Port %u LSR Status = %02x Data = %02x", __func__, edge_serial->rxPort, byte2, byte3); // break; // case IOSP_STATUS_MSR: - dbg("%s - Port %u MSR Status = %02x", __FUNCTION__, edge_serial->rxPort, byte2); + dbg("%s - Port %u MSR Status = %02x", __func__, edge_serial->rxPort, byte2); // Process this new modem status and generate appropriate // events, etc, based on the new status. This routine @@ -2009,7 +2009,7 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 break; default: - dbg("%s - Unrecognized IOSP status code %u\n", __FUNCTION__, code); + dbg("%s - Unrecognized IOSP status code %u\n", __func__, code); break; } @@ -2029,7 +2029,7 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c cnt = tty_buffer_request_room(tty, length); if (cnt < length) { dev_err(dev, "%s - dropping data, %d bytes lost\n", - __FUNCTION__, length - cnt); + __func__, length - cnt); if(cnt == 0) break; } @@ -2050,7 +2050,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) { struct async_icount *icount; - dbg("%s %02x", __FUNCTION__, newMsr); + dbg("%s %02x", __func__, newMsr); if (newMsr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { icount = &edge_port->icount; @@ -2087,7 +2087,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, __u8 l __u8 newLsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK)); struct async_icount *icount; - dbg("%s - %02x", __FUNCTION__, newLsr); + dbg("%s - %02x", __func__, newLsr); edge_port->shadowLSR = lsr; @@ -2136,11 +2136,11 @@ static int sram_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u __u16 current_length; unsigned char *transfer_buffer; - dbg("%s - %x, %x, %d", __FUNCTION__, extAddr, addr, length); + dbg("%s - %x, %x, %d", __func__, extAddr, addr, length); transfer_buffer = kmalloc (64, GFP_KERNEL); if (!transfer_buffer) { - dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); + dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __func__, 64); return -ENOMEM; } @@ -2152,7 +2152,7 @@ static int sram_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u } else { current_length = length; } -// dbg("%s - writing %x, %x, %d", __FUNCTION__, extAddr, addr, current_length); +// dbg("%s - writing %x, %x, %d", __func__, extAddr, addr, current_length); memcpy (transfer_buffer, data, current_length); result = usb_control_msg (serial->dev, usb_sndctrlpipe(serial->dev, 0), USB_REQUEST_ION_WRITE_RAM, 0x40, addr, extAddr, transfer_buffer, current_length, 300); @@ -2181,11 +2181,11 @@ static int rom_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u1 __u16 current_length; unsigned char *transfer_buffer; -// dbg("%s - %x, %x, %d", __FUNCTION__, extAddr, addr, length); +// dbg("%s - %x, %x, %d", __func__, extAddr, addr, length); transfer_buffer = kmalloc (64, GFP_KERNEL); if (!transfer_buffer) { - dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); + dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __func__, 64); return -ENOMEM; } @@ -2197,7 +2197,7 @@ static int rom_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u1 } else { current_length = length; } -// dbg("%s - writing %x, %x, %d", __FUNCTION__, extAddr, addr, current_length); +// dbg("%s - writing %x, %x, %d", __func__, extAddr, addr, current_length); memcpy (transfer_buffer, data, current_length); result = usb_control_msg (serial->dev, usb_sndctrlpipe(serial->dev, 0), USB_REQUEST_ION_WRITE_ROM, 0x40, addr, extAddr, transfer_buffer, current_length, 300); @@ -2226,11 +2226,11 @@ static int rom_read (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u16 __u16 current_length; unsigned char *transfer_buffer; - dbg("%s - %x, %x, %d", __FUNCTION__, extAddr, addr, length); + dbg("%s - %x, %x, %d", __func__, extAddr, addr, length); transfer_buffer = kmalloc (64, GFP_KERNEL); if (!transfer_buffer) { - dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); + dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __func__, 64); return -ENOMEM; } @@ -2242,7 +2242,7 @@ static int rom_read (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u16 } else { current_length = length; } -// dbg("%s - %x, %x, %d", __FUNCTION__, extAddr, addr, current_length); +// dbg("%s - %x, %x, %d", __func__, extAddr, addr, current_length); result = usb_control_msg (serial->dev, usb_rcvctrlpipe(serial->dev, 0), USB_REQUEST_ION_READ_ROM, 0xC0, addr, extAddr, transfer_buffer, current_length, 300); if (result < 0) @@ -2269,11 +2269,11 @@ static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u int length = 0; int status = 0; - dbg("%s - %d, %d", __FUNCTION__, command, param); + dbg("%s - %d, %d", __func__, command, param); buffer = kmalloc (10, GFP_ATOMIC); if (!buffer) { - dev_err(&edge_port->port->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 10); + dev_err(&edge_port->port->dev, "%s - kmalloc(%d) failed.\n", __func__, 10); return -ENOMEM; } @@ -2304,7 +2304,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer struct urb *urb; int timeout; - usb_serial_debug_data(debug, &edge_port->port->dev, __FUNCTION__, length, buffer); + usb_serial_debug_data(debug, &edge_port->port->dev, __func__, length, buffer); /* Allocate our next urb */ urb = usb_alloc_urb (0, GFP_ATOMIC); @@ -2312,7 +2312,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer return -ENOMEM; atomic_inc(&CmdUrbs); - dbg("%s - ALLOCATE URB %p (outstanding %d)", __FUNCTION__, urb, atomic_read(&CmdUrbs)); + dbg("%s - ALLOCATE URB %p (outstanding %d)", __func__, urb, atomic_read(&CmdUrbs)); usb_fill_bulk_urb (urb, edge_serial->serial->dev, usb_sndbulkpipe(edge_serial->serial->dev, edge_serial->bulk_out_endpoint), @@ -2323,7 +2323,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer if (status) { /* something went wrong */ - dev_err(&edge_port->port->dev, "%s - usb_submit_urb(write command) failed, status = %d\n", __FUNCTION__, status); + dev_err(&edge_port->port->dev, "%s - usb_submit_urb(write command) failed, status = %d\n", __func__, status); usb_kill_urb(urb); usb_free_urb(urb); atomic_dec(&CmdUrbs); @@ -2337,7 +2337,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer if (edge_port->commandPending) { /* command timed out */ - dbg("%s - command timed out", __FUNCTION__); + dbg("%s - command timed out", __func__); status = -EINVAL; } #endif @@ -2367,18 +2367,18 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa return 0; } - dbg("%s - port = %d, baud = %d", __FUNCTION__, edge_port->port->number, baudRate); + dbg("%s - port = %d, baud = %d", __func__, edge_port->port->number, baudRate); status = calc_baud_rate_divisor (baudRate, &divisor); if (status) { - dev_err(&edge_port->port->dev, "%s - bad baud rate\n", __FUNCTION__); + dev_err(&edge_port->port->dev, "%s - bad baud rate\n", __func__); return status; } // Alloc memory for the string of commands. cmdBuffer = kmalloc (0x100, GFP_ATOMIC); if (!cmdBuffer) { - dev_err(&edge_port->port->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 0x100); + dev_err(&edge_port->port->dev, "%s - kmalloc(%d) failed.\n", __func__, 0x100); return -ENOMEM; } currCmd = cmdBuffer; @@ -2414,7 +2414,7 @@ static int calc_baud_rate_divisor (int baudrate, int *divisor) __u16 custom; - dbg("%s - %d", __FUNCTION__, baudrate); + dbg("%s - %d", __func__, baudrate); for (i = 0; i < ARRAY_SIZE(divisor_table); i++) { if ( divisor_table[i].BaudRate == baudrate ) { @@ -2432,7 +2432,7 @@ static int calc_baud_rate_divisor (int baudrate, int *divisor) *divisor = custom; - dbg("%s - Baud %d = %d\n", __FUNCTION__, baudrate, custom); + dbg("%s - Baud %d = %d\n", __func__, baudrate, custom); return 0; } @@ -2452,7 +2452,7 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r unsigned long cmdLen = 0; int status; - dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); + dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __func__, regValue); if (edge_serial->is_epic && !edge_serial->epic_descriptor.Supports.IOSPWriteMCR && @@ -2513,29 +2513,29 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi __u8 txFlow; int status; - dbg("%s - port %d", __FUNCTION__, edge_port->port->number); + dbg("%s - port %d", __func__, edge_port->port->number); if (!edge_port->open && !edge_port->openPending) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } tty = edge_port->port->tty; if ((!tty) || (!tty->termios)) { - dbg("%s - no tty structures", __FUNCTION__); + dbg("%s - no tty structures", __func__); return; } cflag = tty->termios->c_cflag; switch (cflag & CSIZE) { - case CS5: lData = LCR_BITS_5; mask = 0x1f; dbg("%s - data bits = 5", __FUNCTION__); break; - case CS6: lData = LCR_BITS_6; mask = 0x3f; dbg("%s - data bits = 6", __FUNCTION__); break; - case CS7: lData = LCR_BITS_7; mask = 0x7f; dbg("%s - data bits = 7", __FUNCTION__); break; + case CS5: lData = LCR_BITS_5; mask = 0x1f; dbg("%s - data bits = 5", __func__); break; + case CS6: lData = LCR_BITS_6; mask = 0x3f; dbg("%s - data bits = 6", __func__); break; + case CS7: lData = LCR_BITS_7; mask = 0x7f; dbg("%s - data bits = 7", __func__); break; default: - case CS8: lData = LCR_BITS_8; dbg("%s - data bits = 8", __FUNCTION__); break; + case CS8: lData = LCR_BITS_8; dbg("%s - data bits = 8", __func__); break; } lParity = LCR_PAR_NONE; @@ -2543,28 +2543,28 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi if (cflag & CMSPAR) { if (cflag & PARODD) { lParity = LCR_PAR_MARK; - dbg("%s - parity = mark", __FUNCTION__); + dbg("%s - parity = mark", __func__); } else { lParity = LCR_PAR_SPACE; - dbg("%s - parity = space", __FUNCTION__); + dbg("%s - parity = space", __func__); } } else if (cflag & PARODD) { lParity = LCR_PAR_ODD; - dbg("%s - parity = odd", __FUNCTION__); + dbg("%s - parity = odd", __func__); } else { lParity = LCR_PAR_EVEN; - dbg("%s - parity = even", __FUNCTION__); + dbg("%s - parity = even", __func__); } } else { - dbg("%s - parity = none", __FUNCTION__); + dbg("%s - parity = none", __func__); } if (cflag & CSTOPB) { lStop = LCR_STOP_2; - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); } else { lStop = LCR_STOP_1; - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); } /* figure out the flow control settings */ @@ -2572,9 +2572,9 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi if (cflag & CRTSCTS) { rxFlow |= IOSP_RX_FLOW_RTS; txFlow |= IOSP_TX_FLOW_CTS; - dbg("%s - RTS/CTS is enabled", __FUNCTION__); + dbg("%s - RTS/CTS is enabled", __func__); } else { - dbg("%s - RTS/CTS is disabled", __FUNCTION__); + dbg("%s - RTS/CTS is disabled", __func__); } /* if we are implementing XON/XOFF, set the start and stop character in the device */ @@ -2592,17 +2592,17 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi /* if we are implementing INBOUND XON/XOFF */ if (I_IXOFF(tty)) { rxFlow |= IOSP_RX_FLOW_XON_XOFF; - dbg("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", __FUNCTION__, start_char, stop_char); + dbg("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", __func__, start_char, stop_char); } else { - dbg("%s - INBOUND XON/XOFF is disabled", __FUNCTION__); + dbg("%s - INBOUND XON/XOFF is disabled", __func__); } /* if we are implementing OUTBOUND XON/XOFF */ if (I_IXON(tty)) { txFlow |= IOSP_TX_FLOW_XON_XOFF; - dbg("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", __FUNCTION__, start_char, stop_char); + dbg("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", __func__, start_char, stop_char); } else { - dbg("%s - OUTBOUND XON/XOFF is disabled", __FUNCTION__); + dbg("%s - OUTBOUND XON/XOFF is disabled", __func__); } } @@ -2645,7 +2645,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi baud = 9600; } - dbg("%s - baud rate = %d", __FUNCTION__, baud); + dbg("%s - baud rate = %d", __func__, baud); status = send_cmd_write_baud_rate (edge_port, baud); if (status == -1) { /* Speed change was not possible - put back the old speed */ @@ -2843,7 +2843,7 @@ static int edge_startup (struct usb_serial *serial) /* create our private serial structure */ edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); if (edge_serial == NULL) { - dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); + dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); return -ENOMEM; } spin_lock_init(&edge_serial->es_lock); @@ -2885,19 +2885,19 @@ static int edge_startup (struct usb_serial *serial) serial->num_ports); } - dbg("%s - time 1 %ld", __FUNCTION__, jiffies); + dbg("%s - time 1 %ld", __func__, jiffies); /* If not an EPiC device */ if (!edge_serial->is_epic) { /* now load the application firmware into this device */ load_application_firmware (edge_serial); - dbg("%s - time 2 %ld", __FUNCTION__, jiffies); + dbg("%s - time 2 %ld", __func__, jiffies); /* Check current Edgeport EEPROM and update if necessary */ update_edgeport_E2PROM (edge_serial); - dbg("%s - time 3 %ld", __FUNCTION__, jiffies); + dbg("%s - time 3 %ld", __func__, jiffies); /* set the configuration to use #1 */ // dbg("set_configuration 1"); @@ -2911,7 +2911,7 @@ static int edge_startup (struct usb_serial *serial) for (i = 0; i < serial->num_ports; ++i) { edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); if (edge_port == NULL) { - dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); + dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); for (j = 0; j < i; ++j) { kfree (usb_get_serial_port_data(serial->port[j])); usb_set_serial_port_data(serial->port[j], NULL); @@ -3017,7 +3017,7 @@ static int edge_startup (struct usb_serial *serial) * continue as long as the edgeport is connected */ response = usb_submit_urb(edge_serial->interrupt_read_urb, GFP_KERNEL); if (response) - err("%s - Error %d submitting control urb", __FUNCTION__, response); + err("%s - Error %d submitting control urb", __func__, response); } return response; } @@ -3032,7 +3032,7 @@ static void edge_shutdown (struct usb_serial *serial) struct edgeport_serial *edge_serial = usb_get_serial_data(serial); int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* stop reads and writes on all ports */ for (i=0; i < serial->num_ports; ++i) { diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 856e4d9afd6..0d412ede839 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -290,7 +290,7 @@ static int TIReadVendorRequestSync (struct usb_device *dev, return status; if (status != size) { dbg ("%s - wanted to write %d, but only wrote %d", - __FUNCTION__, size, status); + __func__, size, status); return -ECOMM; } return 0; @@ -320,7 +320,7 @@ static int TISendVendorRequestSync (struct usb_device *dev, return status; if (status != size) { dbg ("%s - wanted to write %d, but only wrote %d", - __FUNCTION__, size, status); + __func__, size, status); return -ECOMM; } return 0; @@ -344,7 +344,7 @@ static int TIPurgeDataSync (struct usb_serial_port *port, __u16 mask) { int port_number = port->number - port->serial->minor; - dbg ("%s - port %d, mask %x", __FUNCTION__, port_number, mask); + dbg ("%s - port %d, mask %x", __func__, port_number, mask); return TIWriteCommandSync (port->serial->dev, UMPC_PURGE_PORT, @@ -369,7 +369,7 @@ static int TIReadDownloadMemory(struct usb_device *dev, int start_address, __u8 read_length; __be16 be_start_address; - dbg ("%s - @ %x for %d", __FUNCTION__, start_address, length); + dbg ("%s - @ %x for %d", __func__, start_address, length); /* Read in blocks of 64 bytes * (TI firmware can't handle more than 64 byte reads) @@ -381,7 +381,7 @@ static int TIReadDownloadMemory(struct usb_device *dev, int start_address, read_length = (__u8)length; if (read_length > 1) { - dbg ("%s - @ %x for %d", __FUNCTION__, + dbg ("%s - @ %x for %d", __func__, start_address, read_length); } be_start_address = cpu_to_be16 (start_address); @@ -393,12 +393,12 @@ static int TIReadDownloadMemory(struct usb_device *dev, int start_address, read_length); // TransferBufferLength if (status) { - dbg ("%s - ERROR %x", __FUNCTION__, status); + dbg ("%s - ERROR %x", __func__, status); return status; } if (read_length > 1) { - usb_serial_debug_data(debug, &dev->dev, __FUNCTION__, + usb_serial_debug_data(debug, &dev->dev, __func__, read_length, buffer); } @@ -434,13 +434,13 @@ static int TIReadBootMemory (struct edgeport_serial *serial, int start_address, &buffer[i], // TransferBuffer 0x01); // TransferBufferLength if (status) { - dbg ("%s - ERROR %x", __FUNCTION__, status); + dbg ("%s - ERROR %x", __func__, status); return status; } } - dbg ("%s - start_address = %x, length = %d", __FUNCTION__, start_address, length); - usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, length, buffer); + dbg ("%s - start_address = %x, length = %d", __func__, start_address, length); + usb_serial_debug_data(debug, &serial->serial->dev->dev, __func__, length, buffer); serial->TiReadI2C = 1; @@ -472,8 +472,8 @@ static int TIWriteBootMemory (struct edgeport_serial *serial, int start_address, return status; } - dbg ("%s - start_sddr = %x, length = %d", __FUNCTION__, start_address, length); - usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, length, buffer); + dbg ("%s - start_sddr = %x, length = %d", __func__, start_address, length); + usb_serial_debug_data(debug, &serial->serial->dev->dev, __func__, length, buffer); return status; } @@ -494,8 +494,8 @@ static int TIWriteDownloadI2C (struct edgeport_serial *serial, int start_address if (write_length > length) write_length = length; - dbg ("%s - BytesInFirstPage Addr = %x, length = %d", __FUNCTION__, start_address, write_length); - usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, write_length, buffer); + dbg ("%s - BytesInFirstPage Addr = %x, length = %d", __func__, start_address, write_length); + usb_serial_debug_data(debug, &serial->serial->dev->dev, __func__, write_length, buffer); /* Write first page */ be_start_address = cpu_to_be16 (start_address); @@ -506,7 +506,7 @@ static int TIWriteDownloadI2C (struct edgeport_serial *serial, int start_address buffer, // TransferBuffer write_length); if (status) { - dbg ("%s - ERROR %d", __FUNCTION__, status); + dbg ("%s - ERROR %d", __func__, status); return status; } @@ -521,8 +521,8 @@ static int TIWriteDownloadI2C (struct edgeport_serial *serial, int start_address else write_length = length; - dbg ("%s - Page Write Addr = %x, length = %d", __FUNCTION__, start_address, write_length); - usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, write_length, buffer); + dbg ("%s - Page Write Addr = %x, length = %d", __func__, start_address, write_length); + usb_serial_debug_data(debug, &serial->serial->dev->dev, __func__, write_length, buffer); /* Write next page */ be_start_address = cpu_to_be16 (start_address); @@ -533,7 +533,7 @@ static int TIWriteDownloadI2C (struct edgeport_serial *serial, int start_address buffer, // TransferBuffer write_length); // TransferBufferLength if (status) { - dev_err (&serial->serial->dev->dev, "%s - ERROR %d\n", __FUNCTION__, status); + dev_err (&serial->serial->dev->dev, "%s - ERROR %d\n", __func__, status); return status; } @@ -559,7 +559,7 @@ static int TIIsTxActive (struct edgeport_port *port) oedb = kmalloc (sizeof (* oedb), GFP_KERNEL); if (!oedb) { - dev_err (&port->port->dev, "%s - out of memory\n", __FUNCTION__); + dev_err (&port->port->dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -579,7 +579,7 @@ static int TIIsTxActive (struct edgeport_port *port) if (status) goto exit_is_tx_active; - dbg ("%s - XByteCount 0x%X", __FUNCTION__, oedb->XByteCount); + dbg ("%s - XByteCount 0x%X", __func__, oedb->XByteCount); /* and the LSR */ status = TIReadRam (port->port->serial->dev, @@ -589,7 +589,7 @@ static int TIIsTxActive (struct edgeport_port *port) if (status) goto exit_is_tx_active; - dbg ("%s - LSR = 0x%X", __FUNCTION__, *lsr); + dbg ("%s - LSR = 0x%X", __func__, *lsr); /* If either buffer has data or we are transmitting then return TRUE */ if ((oedb->XByteCount & 0x80 ) != 0 ) @@ -600,7 +600,7 @@ static int TIIsTxActive (struct edgeport_port *port) /* We return Not Active if we get any kind of error */ exit_is_tx_active: - dbg ("%s - return %d", __FUNCTION__, bytes_left ); + dbg ("%s - return %d", __func__, bytes_left ); kfree(lsr); kfree(oedb); @@ -664,11 +664,11 @@ static int TIChooseConfiguration (struct usb_device *dev) // we want. However, we just support one config at this point, // configuration # 1, which is Config Descriptor 0. - dbg ("%s - Number of Interfaces = %d", __FUNCTION__, dev->config->desc.bNumInterfaces); - dbg ("%s - MAX Power = %d", __FUNCTION__, dev->config->desc.bMaxPower*2); + dbg ("%s - Number of Interfaces = %d", __func__, dev->config->desc.bNumInterfaces); + dbg ("%s - MAX Power = %d", __func__, dev->config->desc.bMaxPower*2); if (dev->config->desc.bNumInterfaces != 1) { - dev_err (&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", __FUNCTION__); + dev_err (&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", __func__); return -ENODEV; } @@ -751,7 +751,7 @@ static int ValidChecksum(struct ti_i2c_desc *rom_desc, __u8 *buffer) cs = (__u8)(cs + buffer[i]); } if (cs != rom_desc->CheckSum) { - dbg ("%s - Mismatch %x - %x", __FUNCTION__, rom_desc->CheckSum, cs); + dbg ("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs); return -EINVAL; } return 0; @@ -769,12 +769,12 @@ static int TiValidateI2cImage (struct edgeport_serial *serial) rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); if (!rom_desc) { - dev_err (dev, "%s - out of memory\n", __FUNCTION__); + dev_err (dev, "%s - out of memory\n", __func__); return -ENOMEM; } buffer = kmalloc (TI_MAX_I2C_SIZE, GFP_KERNEL); if (!buffer) { - dev_err (dev, "%s - out of memory when allocating buffer\n", __FUNCTION__); + dev_err (dev, "%s - out of memory when allocating buffer\n", __func__); kfree (rom_desc); return -ENOMEM; } @@ -785,7 +785,7 @@ static int TiValidateI2cImage (struct edgeport_serial *serial) goto ExitTiValidateI2cImage; if (*buffer != UMP5152 && *buffer != UMP3410) { - dev_err (dev, "%s - invalid buffer signature\n", __FUNCTION__); + dev_err (dev, "%s - invalid buffer signature\n", __func__); status = -ENODEV; goto ExitTiValidateI2cImage; } @@ -801,11 +801,11 @@ static int TiValidateI2cImage (struct edgeport_serial *serial) if ((start_address + sizeof(struct ti_i2c_desc) + rom_desc->Size) > TI_MAX_I2C_SIZE) { status = -ENODEV; - dbg ("%s - structure too big, erroring out.", __FUNCTION__); + dbg ("%s - structure too big, erroring out.", __func__); break; } - dbg ("%s Type = 0x%x", __FUNCTION__, rom_desc->Type); + dbg ("%s Type = 0x%x", __func__, rom_desc->Type); // Skip type 2 record ttype = rom_desc->Type & 0x0f; @@ -845,13 +845,13 @@ static int TIReadManufDescriptor (struct edgeport_serial *serial, __u8 *buffer) rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); if (!rom_desc) { - dev_err (&serial->serial->dev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err (&serial->serial->dev->dev, "%s - out of memory\n", __func__); return -ENOMEM; } start_address = TIGetDescriptorAddress (serial, I2C_DESC_TYPE_ION, rom_desc); if (!start_address) { - dbg ("%s - Edge Descriptor not found in I2C", __FUNCTION__); + dbg ("%s - Edge Descriptor not found in I2C", __func__); status = -ENODEV; goto exit; } @@ -867,12 +867,12 @@ static int TIReadManufDescriptor (struct edgeport_serial *serial, __u8 *buffer) status = ValidChecksum(rom_desc, buffer); desc = (struct edge_ti_manuf_descriptor *)buffer; - dbg ( "%s - IonConfig 0x%x", __FUNCTION__, desc->IonConfig ); - dbg ( "%s - Version %d", __FUNCTION__, desc->Version ); - dbg ( "%s - Cpu/Board 0x%x", __FUNCTION__, desc->CpuRev_BoardRev ); - dbg ( "%s - NumPorts %d", __FUNCTION__, desc->NumPorts ); - dbg ( "%s - NumVirtualPorts %d", __FUNCTION__, desc->NumVirtualPorts ); - dbg ( "%s - TotalPorts %d", __FUNCTION__, desc->TotalPorts ); + dbg ( "%s - IonConfig 0x%x", __func__, desc->IonConfig ); + dbg ( "%s - Version %d", __func__, desc->Version ); + dbg ( "%s - Cpu/Board 0x%x", __func__, desc->CpuRev_BoardRev ); + dbg ( "%s - NumPorts %d", __func__, desc->NumPorts ); + dbg ( "%s - NumVirtualPorts %d", __func__, desc->NumVirtualPorts ); + dbg ( "%s - TotalPorts %d", __func__, desc->TotalPorts ); exit: kfree (rom_desc); @@ -902,7 +902,7 @@ static int BuildI2CFirmwareHeader (__u8 *header, struct device *dev) buffer = kmalloc (buffer_size, GFP_KERNEL); if (!buffer) { - dev_err (dev, "%s - out of memory\n", __FUNCTION__); + dev_err (dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -955,11 +955,11 @@ static int TIGetI2cTypeInBootMode (struct edgeport_serial *serial) &data, // TransferBuffer 0x01); // TransferBufferLength if (status) - dbg ("%s - read 2 status error = %d", __FUNCTION__, status); + dbg ("%s - read 2 status error = %d", __func__, status); else - dbg ("%s - read 2 data = 0x%x", __FUNCTION__, data); + dbg ("%s - read 2 data = 0x%x", __func__, data); if ((!status) && (data == UMP5152 || data == UMP3410)) { - dbg ("%s - ROM_TYPE_II", __FUNCTION__); + dbg ("%s - ROM_TYPE_II", __func__); serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; return 0; } @@ -972,16 +972,16 @@ static int TIGetI2cTypeInBootMode (struct edgeport_serial *serial) &data, // TransferBuffer 0x01); // TransferBufferLength if (status) - dbg ("%s - read 3 status error = %d", __FUNCTION__, status); + dbg ("%s - read 3 status error = %d", __func__, status); else - dbg ("%s - read 2 data = 0x%x", __FUNCTION__, data); + dbg ("%s - read 2 data = 0x%x", __func__, data); if ((!status) && (data == UMP5152 || data == UMP3410)) { - dbg ("%s - ROM_TYPE_III", __FUNCTION__); + dbg ("%s - ROM_TYPE_III", __func__); serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; return 0; } - dbg ("%s - Unknown", __FUNCTION__); + dbg ("%s - Unknown", __func__); serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; return -ENODEV; } @@ -1063,7 +1063,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) interface = &serial->serial->interface->cur_altsetting->desc; if (!interface) { - dev_err (dev, "%s - no interface set, error!\n", __FUNCTION__); + dev_err (dev, "%s - no interface set, error!\n", __func__); return -ENODEV; } @@ -1099,7 +1099,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) */ ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL); if (!ti_manuf_desc) { - dev_err (dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (dev, "%s - out of memory.\n", __func__); return -ENOMEM; } status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc); @@ -1110,7 +1110,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) // Check version number of ION descriptor if (!ignore_cpu_rev && TI_GET_CPU_REVISION(ti_manuf_desc->CpuRev_BoardRev) < 2) { - dbg ( "%s - Wrong CPU Rev %d (Must be 2)", __FUNCTION__, + dbg ( "%s - Wrong CPU Rev %d (Must be 2)", __func__, TI_GET_CPU_REVISION(ti_manuf_desc->CpuRev_BoardRev)); kfree (ti_manuf_desc); return -EINVAL; @@ -1118,7 +1118,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); if (!rom_desc) { - dev_err (dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (dev, "%s - out of memory.\n", __func__); kfree (ti_manuf_desc); return -ENOMEM; } @@ -1128,11 +1128,11 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) struct ti_i2c_firmware_rec *firmware_version; __u8 record; - dbg ("%s - Found Type FIRMWARE (Type 2) record", __FUNCTION__); + dbg ("%s - Found Type FIRMWARE (Type 2) record", __func__); firmware_version = kmalloc (sizeof (*firmware_version), GFP_KERNEL); if (!firmware_version) { - dev_err (dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (dev, "%s - out of memory.\n", __func__); kfree (rom_desc); kfree (ti_manuf_desc); return -ENOMEM; @@ -1158,7 +1158,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) (OperationalCodeImageVersion.MinorVersion); dbg ("%s - >>>Firmware Versions Device %d.%d Driver %d.%d", - __FUNCTION__, + __func__, firmware_version->Ver_Major, firmware_version->Ver_Minor, OperationalCodeImageVersion.MajorVersion, @@ -1167,7 +1167,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) // Check if we have an old version in the I2C and update if necessary if (download_cur_ver != download_new_ver) { dbg ("%s - Update I2C Download from %d.%d to %d.%d", - __FUNCTION__, + __func__, firmware_version->Ver_Major, firmware_version->Ver_Minor, OperationalCodeImageVersion.MajorVersion, @@ -1209,14 +1209,14 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) } if (record != I2C_DESC_TYPE_FIRMWARE_BLANK) { - dev_err (dev, "%s - error resetting device\n", __FUNCTION__); + dev_err (dev, "%s - error resetting device\n", __func__); kfree (firmware_version); kfree (rom_desc); kfree (ti_manuf_desc); return -ENODEV; } - dbg ("%s - HARDWARE RESET", __FUNCTION__); + dbg ("%s - HARDWARE RESET", __func__); // Reset UMP -- Back to BOOT MODE status = TISendVendorRequestSync (serial->serial->dev, @@ -1226,7 +1226,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) NULL, // TransferBuffer 0); // TransferBufferLength - dbg ( "%s - HARDWARE RESET return %d", __FUNCTION__, status); + dbg ( "%s - HARDWARE RESET return %d", __func__, status); /* return an error on purpose. */ kfree (firmware_version); @@ -1244,7 +1244,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) header = kmalloc (HEADER_SIZE, GFP_KERNEL); if (!header) { - dev_err (dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (dev, "%s - out of memory.\n", __func__); kfree (rom_desc); kfree (ti_manuf_desc); return -ENOMEM; @@ -1252,14 +1252,14 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) vheader = kmalloc (HEADER_SIZE, GFP_KERNEL); if (!vheader) { - dev_err (dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (dev, "%s - out of memory.\n", __func__); kfree (header); kfree (rom_desc); kfree (ti_manuf_desc); return -ENOMEM; } - dbg ("%s - Found Type BLANK FIRMWARE (Type F2) record", __FUNCTION__); + dbg ("%s - Found Type BLANK FIRMWARE (Type F2) record", __func__); // In order to update the I2C firmware we must change the type 2 record to type 0xF2. // This will force the UMP to come up in Boot Mode. Then while in boot mode, the driver @@ -1297,7 +1297,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) vheader); if (status) { - dbg ("%s - can't read header back", __FUNCTION__); + dbg ("%s - can't read header back", __func__); kfree (vheader); kfree (header); kfree (rom_desc); @@ -1305,7 +1305,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) return status; } if (memcmp(vheader, header, HEADER_SIZE)) { - dbg ("%s - write download record failed", __FUNCTION__); + dbg ("%s - write download record failed", __func__); kfree (vheader); kfree (header); kfree (rom_desc); @@ -1316,7 +1316,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) kfree (vheader); kfree (header); - dbg ("%s - Start firmware update", __FUNCTION__); + dbg ("%s - Start firmware update", __func__); // Tell firmware to copy download image into I2C status = TISendVendorRequestSync (serial->serial->dev, @@ -1326,9 +1326,9 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) NULL, // TransferBuffer 0); // TransferBufferLength - dbg ("%s - Update complete 0x%x", __FUNCTION__, status); + dbg ("%s - Update complete 0x%x", __func__, status); if (status) { - dev_err (dev, "%s - UMPC_COPY_DNLD_TO_I2C failed\n", __FUNCTION__); + dev_err (dev, "%s - UMPC_COPY_DNLD_TO_I2C failed\n", __func__); kfree (rom_desc); kfree (ti_manuf_desc); return status; @@ -1352,7 +1352,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) return status; if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) != USB_VENDOR_ID_ION) { - dbg ("%s - VID = 0x%x", __FUNCTION__, + dbg ("%s - VID = 0x%x", __func__, le16_to_cpu(serial->serial->dev->descriptor.idVendor)); serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; goto StayInBootMode; @@ -1366,7 +1366,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) // Registry variable set? if (TIStayInBootMode) { - dbg ("%s - TIStayInBootMode", __FUNCTION__); + dbg ("%s - TIStayInBootMode", __func__); goto StayInBootMode; } @@ -1383,7 +1383,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) */ ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL); if (!ti_manuf_desc) { - dev_err (dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (dev, "%s - out of memory.\n", __func__); return -ENOMEM; } status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc); @@ -1394,7 +1394,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) // Check for version 2 if (!ignore_cpu_rev && TI_GET_CPU_REVISION(ti_manuf_desc->CpuRev_BoardRev) < 2) { - dbg ("%s - Wrong CPU Rev %d (Must be 2)", __FUNCTION__, + dbg ("%s - Wrong CPU Rev %d (Must be 2)", __func__, TI_GET_CPU_REVISION(ti_manuf_desc->CpuRev_BoardRev)); kfree (ti_manuf_desc); goto StayInBootMode; @@ -1418,7 +1418,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) buffer_size = (((1024 * 16) - 512) + sizeof(struct ti_i2c_image_header)); buffer = kmalloc (buffer_size, GFP_KERNEL); if (!buffer) { - dev_err (dev, "%s - out of memory\n", __FUNCTION__); + dev_err (dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -1438,20 +1438,20 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) header->CheckSum = cs; // Download the operational code - dbg ("%s - Downloading operational code image (TI UMP)", __FUNCTION__); + dbg ("%s - Downloading operational code image (TI UMP)", __func__); status = TIDownloadCodeImage (serial, buffer, buffer_size); kfree (buffer); if (status) { - dbg ("%s - Error downloading operational code image", __FUNCTION__); + dbg ("%s - Error downloading operational code image", __func__); return status; } // Device will reboot serial->product_info.TiMode = TI_MODE_TRANSITIONING; - dbg ("%s - Download successful -- Device rebooting...", __FUNCTION__); + dbg ("%s - Download successful -- Device rebooting...", __func__); /* return an error on purpose */ return -ENODEV; @@ -1470,7 +1470,7 @@ static int TISetDtr (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); port->shadow_mcr |= MCR_DTR; return TIWriteCommandSync (port->port->serial->dev, @@ -1485,7 +1485,7 @@ static int TIClearDtr (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); port->shadow_mcr &= ~MCR_DTR; return TIWriteCommandSync (port->port->serial->dev, @@ -1500,7 +1500,7 @@ static int TISetRts (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); port->shadow_mcr |= MCR_RTS; return TIWriteCommandSync (port->port->serial->dev, @@ -1515,7 +1515,7 @@ static int TIClearRts (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); port->shadow_mcr &= ~MCR_RTS; return TIWriteCommandSync (port->port->serial->dev, @@ -1530,7 +1530,7 @@ static int TISetLoopBack (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); return TIWriteCommandSync (port->port->serial->dev, UMPC_SET_CLR_LOOPBACK, @@ -1544,7 +1544,7 @@ static int TIClearLoopBack (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); return TIWriteCommandSync (port->port->serial->dev, UMPC_SET_CLR_LOOPBACK, @@ -1558,7 +1558,7 @@ static int TISetBreak (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); return TIWriteCommandSync (port->port->serial->dev, UMPC_SET_CLR_BREAK, @@ -1572,7 +1572,7 @@ static int TIClearBreak (struct edgeport_port *port) { int port_number = port->port->number - port->port->serial->minor; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); return TIWriteCommandSync (port->port->serial->dev, UMPC_SET_CLR_BREAK, @@ -1586,7 +1586,7 @@ static int TIRestoreMCR (struct edgeport_port *port, __u8 mcr) { int status = 0; - dbg ("%s - %x", __FUNCTION__, mcr); + dbg ("%s - %x", __func__, mcr); if (mcr & MCR_DTR) status = TISetDtr (port); @@ -1640,7 +1640,7 @@ static void handle_new_msr (struct edgeport_port *edge_port, __u8 msr) struct async_icount *icount; struct tty_struct *tty; - dbg ("%s - %02x", __FUNCTION__, msr); + dbg ("%s - %02x", __func__, msr); if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { icount = &edge_port->icount; @@ -1679,7 +1679,7 @@ static void handle_new_lsr (struct edgeport_port *edge_port, int lsr_data, __u8 struct async_icount *icount; __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK)); - dbg ("%s - %02x", __FUNCTION__, new_lsr); + dbg ("%s - %02x", __func__, new_lsr); edge_port->shadow_lsr = lsr; @@ -1722,7 +1722,7 @@ static void edge_interrupt_callback (struct urb *urb) __u8 msr; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); switch (status) { case 0: @@ -1733,34 +1733,34 @@ static void edge_interrupt_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dev_err(&urb->dev->dev, "%s - nonzero urb status received: " - "%d\n", __FUNCTION__, status); + "%d\n", __func__, status); goto exit; } if (!length) { - dbg ("%s - no data in urb", __FUNCTION__); + dbg ("%s - no data in urb", __func__); goto exit; } - usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __FUNCTION__, length, data); + usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __func__, length, data); if (length != 2) { - dbg ("%s - expecting packet of size 2, got %d", __FUNCTION__, length); + dbg ("%s - expecting packet of size 2, got %d", __func__, length); goto exit; } port_number = TIUMP_GET_PORT_FROM_CODE (data[0]); function = TIUMP_GET_FUNC_FROM_CODE (data[0]); dbg ("%s - port_number %d, function %d, info 0x%x", - __FUNCTION__, port_number, function, data[1]); + __func__, port_number, function, data[1]); port = edge_serial->serial->port[port_number]; edge_port = usb_get_serial_port_data(port); if (!edge_port) { - dbg ("%s - edge_port not found", __FUNCTION__); + dbg ("%s - edge_port not found", __func__); return; } switch (function) { @@ -1769,12 +1769,12 @@ static void edge_interrupt_callback (struct urb *urb) if (lsr & UMP_UART_LSR_DATA_MASK) { /* Save the LSR event for bulk read completion routine */ dbg ("%s - LSR Event Port %u LSR Status = %02x", - __FUNCTION__, port_number, lsr); + __func__, port_number, lsr); edge_port->lsr_event = 1; edge_port->lsr_mask = lsr; } else { dbg ("%s - ===== Port %d LSR Status = %02x ======", - __FUNCTION__, port_number, lsr); + __func__, port_number, lsr); handle_new_lsr (edge_port, 0, lsr, 0); } break; @@ -1783,13 +1783,13 @@ static void edge_interrupt_callback (struct urb *urb) /* Copy MSR from UMP */ msr = data[1]; dbg ("%s - ===== Port %u MSR Status = %02x ======\n", - __FUNCTION__, port_number, msr); + __func__, port_number, msr); handle_new_msr (edge_port, msr); break; default: dev_err (&urb->dev->dev, "%s - Unknown Interrupt code from UMP %x\n", - __FUNCTION__, data[1]); + __func__, data[1]); break; } @@ -1798,7 +1798,7 @@ exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) dev_err (&urb->dev->dev, "%s - usb_submit_urb failed with result %d\n", - __FUNCTION__, retval); + __func__, retval); } static void edge_bulk_in_callback (struct urb *urb) @@ -1810,7 +1810,7 @@ static void edge_bulk_in_callback (struct urb *urb) int port_number; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); switch (status) { case 0: @@ -1821,18 +1821,18 @@ static void edge_bulk_in_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dev_err (&urb->dev->dev,"%s - nonzero read bulk status received: %d\n", - __FUNCTION__, status); + __func__, status); } if (status == -EPIPE) goto exit; if (status) { - dev_err(&urb->dev->dev,"%s - stopping read!\n", __FUNCTION__); + dev_err(&urb->dev->dev,"%s - stopping read!\n", __func__); return; } @@ -1841,7 +1841,7 @@ static void edge_bulk_in_callback (struct urb *urb) if (edge_port->lsr_event) { edge_port->lsr_event = 0; dbg ("%s ===== Port %u LSR Status = %02x, Data = %02x ======", - __FUNCTION__, port_number, edge_port->lsr_mask, *data); + __func__, port_number, edge_port->lsr_mask, *data); handle_new_lsr (edge_port, 1, edge_port->lsr_mask, *data); /* Adjust buffer length/pointer */ --urb->actual_length; @@ -1850,10 +1850,10 @@ static void edge_bulk_in_callback (struct urb *urb) tty = edge_port->port->tty; if (tty && urb->actual_length) { - usb_serial_debug_data(debug, &edge_port->port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &edge_port->port->dev, __func__, urb->actual_length, data); if (edge_port->close_pending) { - dbg ("%s - close is pending, dropping data on the floor.", __FUNCTION__); + dbg ("%s - close is pending, dropping data on the floor.", __func__); } else { edge_tty_recv(&edge_port->port->dev, tty, data, urb->actual_length); } @@ -1872,7 +1872,7 @@ exit: spin_unlock(&edge_port->ep_lock); if (retval) dev_err (&urb->dev->dev, "%s - usb_submit_urb failed with result %d\n", - __FUNCTION__, retval); + __func__, retval); } static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned char *data, int length) @@ -1883,7 +1883,7 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c cnt = tty_buffer_request_room(tty, length); if (cnt < length) { dev_err(dev, "%s - dropping data, %d bytes lost\n", - __FUNCTION__, length - cnt); + __func__, length - cnt); if(cnt == 0) break; } @@ -1901,7 +1901,7 @@ static void edge_bulk_out_callback (struct urb *urb) struct edgeport_port *edge_port = usb_get_serial_port_data(port); int status = urb->status; - dbg ("%s - port %d", __FUNCTION__, port->number); + dbg ("%s - port %d", __func__, port->number); edge_port->ep_write_urb_in_use = 0; @@ -1914,11 +1914,11 @@ static void edge_bulk_out_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dev_err(&urb->dev->dev, "%s - nonzero write bulk status " - "received: %d\n", __FUNCTION__, status); + "received: %d\n", __func__, status); } /* send any buffered data */ @@ -1936,7 +1936,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) u16 open_settings; u8 transaction_timeout; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return -ENODEV; @@ -1959,7 +1959,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) } dbg ("%s - port_number = %d, uart_base = %04x, dma_address = %04x", - __FUNCTION__, port_number, edge_port->uart_base, edge_port->dma_address); + __func__, port_number, edge_port->uart_base, edge_port->dma_address); dev = port->serial->dev; @@ -1970,7 +1970,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) status = TIClearLoopBack (edge_port); if (status) { dev_err(&port->dev,"%s - cannot send clear loopback command, %d\n", - __FUNCTION__, status); + __func__, status); return status; } @@ -1989,7 +1989,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) UMP_PIPE_TRANS_TIMEOUT_ENA | (transaction_timeout << 2)); - dbg ("%s - Sending UMPC_OPEN_PORT", __FUNCTION__); + dbg ("%s - Sending UMPC_OPEN_PORT", __func__); /* Tell TI to open and start the port */ status = TIWriteCommandSync (dev, @@ -1999,7 +1999,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) NULL, 0); if (status) { - dev_err(&port->dev,"%s - cannot send open command, %d\n", __FUNCTION__, status); + dev_err(&port->dev,"%s - cannot send open command, %d\n", __func__, status); return status; } @@ -2011,14 +2011,14 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) NULL, 0); if (status) { - dev_err(&port->dev,"%s - cannot send start DMA command, %d\n", __FUNCTION__, status); + dev_err(&port->dev,"%s - cannot send start DMA command, %d\n", __func__, status); return status; } /* Clear TX and RX buffers in UMP */ status = TIPurgeDataSync (port, UMP_PORT_DIR_OUT | UMP_PORT_DIR_IN); if (status) { - dev_err(&port->dev,"%s - cannot send clear buffers command, %d\n", __FUNCTION__, status); + dev_err(&port->dev,"%s - cannot send clear buffers command, %d\n", __func__, status); return status; } @@ -2030,7 +2030,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) &edge_port->shadow_msr, // TransferBuffer 1); // TransferBufferLength if (status) { - dev_err(&port->dev,"%s - cannot send read MSR command, %d\n", __FUNCTION__, status); + dev_err(&port->dev,"%s - cannot send read MSR command, %d\n", __func__, status); return status; } @@ -2047,7 +2047,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) /* we are the first port to be opened, let's post the interrupt urb */ urb = edge_serial->serial->port[0]->interrupt_in_urb; if (!urb) { - dev_err (&port->dev, "%s - no interrupt urb present, exiting\n", __FUNCTION__); + dev_err (&port->dev, "%s - no interrupt urb present, exiting\n", __func__); status = -EINVAL; goto release_es_lock; } @@ -2056,7 +2056,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) urb->dev = dev; status = usb_submit_urb (urb, GFP_KERNEL); if (status) { - dev_err (&port->dev, "%s - usb_submit_urb failed with value %d\n", __FUNCTION__, status); + dev_err (&port->dev, "%s - usb_submit_urb failed with value %d\n", __func__, status); goto release_es_lock; } } @@ -2071,7 +2071,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) /* start up our bulk read urb */ urb = port->read_urb; if (!urb) { - dev_err (&port->dev, "%s - no read urb present, exiting\n", __FUNCTION__); + dev_err (&port->dev, "%s - no read urb present, exiting\n", __func__); status = -EINVAL; goto unlink_int_urb; } @@ -2081,13 +2081,13 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) urb->dev = dev; status = usb_submit_urb (urb, GFP_KERNEL); if (status) { - dev_err (&port->dev, "%s - read bulk usb_submit_urb failed with value %d\n", __FUNCTION__, status); + dev_err (&port->dev, "%s - read bulk usb_submit_urb failed with value %d\n", __func__, status); goto unlink_int_urb; } ++edge_serial->num_ports_open; - dbg("%s - exited", __FUNCTION__); + dbg("%s - exited", __func__); goto release_es_lock; @@ -2106,7 +2106,7 @@ static void edge_close (struct usb_serial_port *port, struct file *filp) int port_number; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); edge_serial = usb_get_serial_data(port->serial); edge_port = usb_get_serial_port_data(port); @@ -2126,7 +2126,7 @@ static void edge_close (struct usb_serial_port *port, struct file *filp) /* assuming we can still talk to the device, * send a close port command to it */ - dbg("%s - send umpc_close_port", __FUNCTION__); + dbg("%s - send umpc_close_port", __func__); port_number = port->number - port->serial->minor; status = TIWriteCommandSync (port->serial->dev, UMPC_CLOSE_PORT, @@ -2144,7 +2144,7 @@ static void edge_close (struct usb_serial_port *port, struct file *filp) mutex_unlock(&edge_serial->es_lock); edge_port->close_pending = 0; - dbg("%s - exited", __FUNCTION__); + dbg("%s - exited", __func__); } static int edge_write (struct usb_serial_port *port, const unsigned char *data, int count) @@ -2152,10 +2152,10 @@ static int edge_write (struct usb_serial_port *port, const unsigned char *data, struct edgeport_port *edge_port = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return 0; } @@ -2181,7 +2181,7 @@ static void edge_send(struct usb_serial_port *port) unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&edge_port->ep_lock, flags); @@ -2203,7 +2203,7 @@ static void edge_send(struct usb_serial_port *port) spin_unlock_irqrestore(&edge_port->ep_lock, flags); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); /* set up our urb */ usb_fill_bulk_urb (port->write_urb, port->serial->dev, @@ -2216,7 +2216,7 @@ static void edge_send(struct usb_serial_port *port) /* send the data out the bulk port */ result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result); edge_port->ep_write_urb_in_use = 0; // TODO: reschedule edge_send } else { @@ -2237,7 +2237,7 @@ static int edge_write_room (struct usb_serial_port *port) int room = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return -ENODEV; @@ -2248,7 +2248,7 @@ static int edge_write_room (struct usb_serial_port *port) room = edge_buf_space_avail(edge_port->ep_out_buf); spin_unlock_irqrestore(&edge_port->ep_lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -2258,7 +2258,7 @@ static int edge_chars_in_buffer (struct usb_serial_port *port) int chars = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return -ENODEV; @@ -2269,7 +2269,7 @@ static int edge_chars_in_buffer (struct usb_serial_port *port) chars = edge_buf_data_avail(edge_port->ep_out_buf); spin_unlock_irqrestore(&edge_port->ep_lock, flags); - dbg ("%s - returns %d", __FUNCTION__, chars); + dbg ("%s - returns %d", __func__, chars); return chars; } @@ -2279,14 +2279,14 @@ static void edge_throttle (struct usb_serial_port *port) struct tty_struct *tty; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return; tty = port->tty; if (!tty) { - dbg ("%s - no tty available", __FUNCTION__); + dbg ("%s - no tty available", __func__); return; } @@ -2295,7 +2295,7 @@ static void edge_throttle (struct usb_serial_port *port) unsigned char stop_char = STOP_CHAR(tty); status = edge_write (port, &stop_char, 1); if (status <= 0) { - dev_err(&port->dev, "%s - failed to write stop character, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - failed to write stop character, %d\n", __func__, status); } } @@ -2312,14 +2312,14 @@ static void edge_unthrottle (struct usb_serial_port *port) struct tty_struct *tty; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return; tty = port->tty; if (!tty) { - dbg ("%s - no tty available", __FUNCTION__); + dbg ("%s - no tty available", __func__); return; } @@ -2328,7 +2328,7 @@ static void edge_unthrottle (struct usb_serial_port *port) unsigned char start_char = START_CHAR(tty); status = edge_write (port, &start_char, 1); if (status <= 0) { - dev_err(&port->dev, "%s - failed to write start character, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - failed to write start character, %d\n", __func__, status); } } @@ -2337,7 +2337,7 @@ static void edge_unthrottle (struct usb_serial_port *port) if (C_CRTSCTS(tty)) { status = restart_read(edge_port); if (status) - dev_err(&port->dev, "%s - read bulk usb_submit_urb failed with value %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - read bulk usb_submit_urb failed with value %d\n", __func__, status); } } @@ -2387,13 +2387,13 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi int status; int port_number = edge_port->port->number - edge_port->port->serial->minor; - dbg("%s - port %d", __FUNCTION__, edge_port->port->number); + dbg("%s - port %d", __func__, edge_port->port->number); tty = edge_port->port->tty; config = kmalloc (sizeof (*config), GFP_KERNEL); if (!config) { - dev_err (&edge_port->port->dev, "%s - out of memory\n", __FUNCTION__); + dev_err (&edge_port->port->dev, "%s - out of memory\n", __func__); return; } @@ -2409,20 +2409,20 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi switch (cflag & CSIZE) { case CS5: config->bDataBits = UMP_UART_CHAR5BITS; - dbg ("%s - data bits = 5", __FUNCTION__); + dbg ("%s - data bits = 5", __func__); break; case CS6: config->bDataBits = UMP_UART_CHAR6BITS; - dbg ("%s - data bits = 6", __FUNCTION__); + dbg ("%s - data bits = 6", __func__); break; case CS7: config->bDataBits = UMP_UART_CHAR7BITS; - dbg ("%s - data bits = 7", __FUNCTION__); + dbg ("%s - data bits = 7", __func__); break; default: case CS8: config->bDataBits = UMP_UART_CHAR8BITS; - dbg ("%s - data bits = 8", __FUNCTION__); + dbg ("%s - data bits = 8", __func__); break; } @@ -2430,32 +2430,32 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi if (cflag & PARODD) { config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; config->bParity = UMP_UART_ODDPARITY; - dbg("%s - parity = odd", __FUNCTION__); + dbg("%s - parity = odd", __func__); } else { config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; config->bParity = UMP_UART_EVENPARITY; - dbg("%s - parity = even", __FUNCTION__); + dbg("%s - parity = even", __func__); } } else { config->bParity = UMP_UART_NOPARITY; - dbg("%s - parity = none", __FUNCTION__); + dbg("%s - parity = none", __func__); } if (cflag & CSTOPB) { config->bStopBits = UMP_UART_STOPBIT2; - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); } else { config->bStopBits = UMP_UART_STOPBIT1; - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); } /* figure out the flow control settings */ if (cflag & CRTSCTS) { config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW; config->wFlags |= UMP_MASK_UART_FLAGS_RTS_FLOW; - dbg("%s - RTS/CTS is enabled", __FUNCTION__); + dbg("%s - RTS/CTS is enabled", __func__); } else { - dbg("%s - RTS/CTS is disabled", __FUNCTION__); + dbg("%s - RTS/CTS is disabled", __func__); tty->hw_stopped = 0; restart_read(edge_port); } @@ -2469,18 +2469,18 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi if (I_IXOFF(tty)) { config->wFlags |= UMP_MASK_UART_FLAGS_IN_X; dbg ("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", - __FUNCTION__, config->cXon, config->cXoff); + __func__, config->cXon, config->cXoff); } else { - dbg ("%s - INBOUND XON/XOFF is disabled", __FUNCTION__); + dbg ("%s - INBOUND XON/XOFF is disabled", __func__); } /* if we are implementing OUTBOUND XON/XOFF */ if (I_IXON(tty)) { config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X; dbg ("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", - __FUNCTION__, config->cXon, config->cXoff); + __func__, config->cXon, config->cXoff); } else { - dbg ("%s - OUTBOUND XON/XOFF is disabled", __FUNCTION__); + dbg ("%s - OUTBOUND XON/XOFF is disabled", __func__); } } @@ -2499,7 +2499,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi /* FIXME: Recompute actual baud from divisor here */ - dbg ("%s - baud rate = %d, wBaudRate = %d", __FUNCTION__, baud, config->wBaudRate); + dbg ("%s - baud rate = %d, wBaudRate = %d", __func__, baud, config->wBaudRate); dbg ("wBaudRate: %d", (int)(461550L / config->wBaudRate)); dbg ("wFlags: 0x%x", config->wFlags); @@ -2522,7 +2522,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi sizeof(*config)); if (status) { dbg ("%s - error %d when trying to write config to device", - __FUNCTION__, status); + __func__, status); } kfree (config); @@ -2538,12 +2538,12 @@ static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old cflag = tty->termios->c_cflag; - dbg("%s - clfag %08x iflag %08x", __FUNCTION__, + dbg("%s - clfag %08x iflag %08x", __func__, tty->termios->c_cflag, tty->termios->c_iflag); - dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, + dbg("%s - old clfag %08x old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (edge_port == NULL) return; @@ -2560,7 +2560,7 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig unsigned int mcr; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&edge_port->ep_lock, flags); mcr = edge_port->shadow_mcr; @@ -2594,7 +2594,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int mcr; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&edge_port->ep_lock, flags); @@ -2608,7 +2608,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) | ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ - dbg("%s -- %x", __FUNCTION__, result); + dbg("%s -- %x", __func__, result); spin_unlock_irqrestore(&edge_port->ep_lock, flags); return result; @@ -2648,30 +2648,30 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned struct async_icount cnow; struct async_icount cprev; - dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); switch (cmd) { case TIOCINQ: - dbg("%s - (%d) TIOCINQ", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCINQ", __func__, port->number); // return get_number_bytes_avail(edge_port, (unsigned int *) arg); break; case TIOCSERGETLSR: - dbg("%s - (%d) TIOCSERGETLSR", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCSERGETLSR", __func__, port->number); // return get_lsr_info(edge_port, (unsigned int *) arg); break; case TIOCGSERIAL: - dbg("%s - (%d) TIOCGSERIAL", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); return get_serial_info(edge_port, (struct serial_struct __user *) arg); break; case TIOCSSERIAL: - dbg("%s - (%d) TIOCSSERIAL", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCSSERIAL", __func__, port->number); break; case TIOCMIWAIT: - dbg("%s - (%d) TIOCMIWAIT", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); cprev = edge_port->icount; while (1) { interruptible_sleep_on(&edge_port->delta_msr_wait); @@ -2694,7 +2694,7 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned break; case TIOCGICOUNT: - dbg ("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, + dbg ("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, edge_port->icount.rx, edge_port->icount.tx); if (copy_to_user((void __user *)arg, &edge_port->icount, sizeof(edge_port->icount))) return -EFAULT; @@ -2709,7 +2709,7 @@ static void edge_break (struct usb_serial_port *port, int break_state) struct edgeport_port *edge_port = usb_get_serial_port_data(port); int status; - dbg ("%s - state = %d", __FUNCTION__, break_state); + dbg ("%s - state = %d", __func__, break_state); /* chase the port close */ TIChasePort (edge_port, 0, 0); @@ -2721,7 +2721,7 @@ static void edge_break (struct usb_serial_port *port, int break_state) } if (status) { dbg ("%s - error %d sending break set/clear command.", - __FUNCTION__, status); + __func__, status); } } @@ -2738,7 +2738,7 @@ static int edge_startup (struct usb_serial *serial) /* create our private serial structure */ edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); if (edge_serial == NULL) { - dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); + dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); return -ENOMEM; } mutex_init(&edge_serial->es_lock); @@ -2755,13 +2755,13 @@ static int edge_startup (struct usb_serial *serial) for (i = 0; i < serial->num_ports; ++i) { edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL); if (edge_port == NULL) { - dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); + dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); goto cleanup; } spin_lock_init(&edge_port->ep_lock); edge_port->ep_out_buf = edge_buf_alloc(EDGE_OUT_BUF_SIZE); if (edge_port->ep_out_buf == NULL) { - dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); + dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); kfree(edge_port); goto cleanup; } @@ -2790,7 +2790,7 @@ static void edge_shutdown (struct usb_serial *serial) int i; struct edgeport_port *edge_port; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); for (i = 0; i < serial->num_ports; ++i) { edge_port = usb_get_serial_port_data(serial->port[i]); @@ -2822,12 +2822,12 @@ static ssize_t store_uart_mode(struct device *dev, struct edgeport_port *edge_port = usb_get_serial_port_data(port); unsigned int v = simple_strtoul(valbuf, NULL, 0); - dbg("%s: setting uart_mode = %d", __FUNCTION__, v); + dbg("%s: setting uart_mode = %d", __func__, v); if (v < 256) edge_port->bUartMode = v; else - dev_err(dev, "%s - uart_mode %d is invalid\n", __FUNCTION__, v); + dev_err(dev, "%s - uart_mode %d is invalid\n", __func__, v); return count; } diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 1711dda0ea6..c90436ea806 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -594,13 +594,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) int i, result = 0; int retries = connect_retries; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); bytes_in = 0; bytes_out = 0; priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); if (priv == NULL) { - err("%s - Out of memory", __FUNCTION__); + err("%s - Out of memory", __func__); return -ENOMEM; } usb_set_serial_port_data(port, priv); @@ -679,7 +679,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) } if (!retries && result) { - err("%s - failed doing control urb, error %d", __FUNCTION__, + err("%s - failed doing control urb, error %d", __func__, result); goto error; } @@ -692,7 +692,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) { - err("%s - failed submitting read urb, error %d", __FUNCTION__, result); + err("%s - failed submitting read urb, error %d", __func__, result); goto error; } @@ -700,7 +700,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) enomem: result = -ENOMEM; - err("%s - Out of memory", __FUNCTION__); + err("%s - Out of memory", __func__); error: ipaq_destroy_lists(port); kfree(priv); @@ -712,7 +712,7 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp) { struct ipaq_private *priv = usb_get_serial_port_data(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * shut down bulk read and write @@ -735,15 +735,15 @@ static void ipaq_read_bulk_callback(struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); tty = port->tty; if (tty && urb->actual_length) { @@ -760,7 +760,7 @@ static void ipaq_read_bulk_callback(struct urb *urb) ipaq_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + err("%s - failed resubmitting read urb, error %d", __func__, result); return; } @@ -771,7 +771,7 @@ static int ipaq_write(struct usb_serial_port *port, const unsigned char *buf, int bytes_sent = 0; int transfer_size; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); while (count > 0) { transfer_size = min(count, PACKET_SIZE); @@ -796,7 +796,7 @@ static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *bu unsigned long flags; if (priv->free_len <= 0) { - dbg("%s - we're stuffed", __FUNCTION__); + dbg("%s - we're stuffed", __func__); return -EAGAIN; } @@ -808,12 +808,12 @@ static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *bu } spin_unlock_irqrestore(&write_list_lock, flags); if (pkt == NULL) { - dbg("%s - we're stuffed", __FUNCTION__); + dbg("%s - we're stuffed", __func__); return -EAGAIN; } memcpy(pkt->data, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, pkt->data); + usb_serial_debug_data(debug, &port->dev, __func__, count, pkt->data); pkt->len = count; pkt->written = 0; @@ -826,7 +826,7 @@ static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *bu spin_unlock_irqrestore(&write_list_lock, flags); result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); } } else { spin_unlock_irqrestore(&write_list_lock, flags); @@ -875,11 +875,11 @@ static void ipaq_write_bulk_callback(struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -889,7 +889,7 @@ static void ipaq_write_bulk_callback(struct urb *urb) spin_unlock_irqrestore(&write_list_lock, flags); result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); } } else { priv->active = 0; @@ -903,7 +903,7 @@ static int ipaq_write_room(struct usb_serial_port *port) { struct ipaq_private *priv = usb_get_serial_port_data(port); - dbg("%s - freelen %d", __FUNCTION__, priv->free_len); + dbg("%s - freelen %d", __func__, priv->free_len); return priv->free_len; } @@ -911,7 +911,7 @@ static int ipaq_chars_in_buffer(struct usb_serial_port *port) { struct ipaq_private *priv = usb_get_serial_port_data(port); - dbg("%s - queuelen %d", __FUNCTION__, priv->queue_len); + dbg("%s - queuelen %d", __func__, priv->queue_len); return priv->queue_len; } @@ -933,7 +933,7 @@ static void ipaq_destroy_lists(struct usb_serial_port *port) static int ipaq_startup(struct usb_serial *serial) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (serial->dev->actconfig->desc.bConfigurationValue != 1) { err("active config #%d != 1 ??", serial->dev->actconfig->desc.bConfigurationValue); @@ -944,7 +944,7 @@ static int ipaq_startup(struct usb_serial *serial) static void ipaq_shutdown(struct usb_serial *serial) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static int __init ipaq_init(void) diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index ec0ccd14e18..bc85ca5c1c3 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -169,15 +169,15 @@ static void ipw_read_bulk_callback(struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); tty = port->tty; if (tty && urb->actual_length) { @@ -195,7 +195,7 @@ static void ipw_read_bulk_callback(struct urb *urb) ipw_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); return; } @@ -206,7 +206,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) u8 *buf_flow_init; int result; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); buf_flow_init = kmemdup(buf_flow_static, 16, GFP_KERNEL); if (!buf_flow_init) @@ -217,7 +217,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) /* --1: Tell the modem to initialize (we think) From sniffs this is always the * first thing that gets sent to the modem during opening of the device */ - dbg("%s: Sending SIO_INIT (we guess)",__FUNCTION__); + dbg("%s: Sending SIO_INIT (we guess)",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev,0), IPW_SIO_INIT, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, @@ -234,7 +234,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) usb_clear_halt(dev, usb_sndbulkpipe(dev, port->bulk_out_endpointAddress)); /*--2: Start reading from the device */ - dbg("%s: setting up bulk read callback",__FUNCTION__); + dbg("%s: setting up bulk read callback",__func__); usb_fill_bulk_urb(port->read_urb, dev, usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), port->bulk_in_buffer, @@ -242,10 +242,10 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) ipw_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result < 0) - dbg("%s - usb_submit_urb(read bulk) failed with status %d", __FUNCTION__, result); + dbg("%s - usb_submit_urb(read bulk) failed with status %d", __func__, result); /*--3: Tell the modem to open the floodgates on the rx bulk channel */ - dbg("%s:asking modem for RxRead (RXBULK_ON)",__FUNCTION__); + dbg("%s:asking modem for RxRead (RXBULK_ON)",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_RXCTL, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, @@ -258,7 +258,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)\n", result); /*--4: setup the initial flowcontrol */ - dbg("%s:setting init flowcontrol (%s)",__FUNCTION__,buf_flow_init); + dbg("%s:setting init flowcontrol (%s)",__func__,buf_flow_init); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_HANDFLOW, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, @@ -272,7 +272,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) /*--5: raise the dtr */ - dbg("%s:raising dtr",__FUNCTION__); + dbg("%s:raising dtr",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, @@ -285,7 +285,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); /*--6: raise the rts */ - dbg("%s:raising rts",__FUNCTION__); + dbg("%s:raising rts",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, @@ -307,12 +307,12 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) int result; if (tty_hung_up_p(filp)) { - dbg("%s: tty_hung_up_p ...", __FUNCTION__); + dbg("%s: tty_hung_up_p ...", __func__); return; } /*--1: drop the dtr */ - dbg("%s:dropping dtr",__FUNCTION__); + dbg("%s:dropping dtr",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, @@ -325,7 +325,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) dev_err(&port->dev, "dropping dtr failed (error = %d)\n", result); /*--2: drop the rts */ - dbg("%s:dropping rts",__FUNCTION__); + dbg("%s:dropping rts",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, IPW_PIN_CLRRTS, @@ -338,7 +338,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) /*--3: purge */ - dbg("%s:sending purge",__FUNCTION__); + dbg("%s:sending purge",__func__); result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), IPW_SIO_PURGE, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, 0x03, @@ -373,13 +373,13 @@ static void ipw_write_bulk_callback(struct urb *urb) struct usb_serial_port *port = urb->context; int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); port->write_urb_busy = 0; if (status) dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); usb_serial_port_softint(port); } @@ -389,18 +389,18 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int struct usb_device *dev = port->serial->dev; int ret; - dbg("%s: TOP: count=%d, in_interrupt=%ld", __FUNCTION__, + dbg("%s: TOP: count=%d, in_interrupt=%ld", __func__, count, in_interrupt() ); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return 0; } spin_lock_bh(&port->lock); if (port->write_urb_busy) { spin_unlock_bh(&port->lock); - dbg("%s - already writing", __FUNCTION__); + dbg("%s - already writing", __func__); return 0; } port->write_urb_busy = 1; @@ -409,7 +409,7 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count = min(count, port->bulk_out_size); memcpy(port->bulk_out_buffer, buf, count); - dbg("%s count now:%d", __FUNCTION__, count); + dbg("%s count now:%d", __func__, count); usb_fill_bulk_urb(port->write_urb, dev, usb_sndbulkpipe(dev, port->bulk_out_endpointAddress), @@ -421,11 +421,11 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (ret != 0) { port->write_urb_busy = 0; - dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __FUNCTION__, ret); + dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __func__, ret); return ret; } - dbg("%s returning %d", __FUNCTION__, count); + dbg("%s returning %d", __func__, count); return count; } diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 82e12f8d600..496009cff3a 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -195,16 +195,16 @@ static struct irda_class_desc *irda_usb_find_class_desc(struct usb_device *dev, USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, ifnum, desc, sizeof(*desc), 1000); - dbg("%s - ret=%d", __FUNCTION__, ret); + dbg("%s - ret=%d", __func__, ret); if (ret < sizeof(*desc)) { dbg("%s - class descriptor read %s (%d)", - __FUNCTION__, + __func__, (ret<0) ? "failed" : "too short", ret); goto error; } if (desc->bDescriptorType != USB_DT_IRDA) { - dbg("%s - bad class descriptor type", __FUNCTION__); + dbg("%s - bad class descriptor type", __func__); goto error; } @@ -248,7 +248,7 @@ static int ir_startup (struct usb_serial *serial) } dbg ("%s - Baud rates supported:%s%s%s%s%s%s%s%s%s", - __FUNCTION__, + __func__, (irda_desc->wBaudRate & 0x0001) ? " 2400" : "", (irda_desc->wBaudRate & 0x0002) ? " 9600" : "", (irda_desc->wBaudRate & 0x0004) ? " 19200" : "", @@ -281,13 +281,13 @@ static int ir_open (struct usb_serial_port *port, struct file *filp) char *buffer; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (buffer_size) { /* override the default buffer sizes */ buffer = kmalloc (buffer_size, GFP_KERNEL); if (!buffer) { - dev_err (&port->dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (&port->dev, "%s - out of memory.\n", __func__); return -ENOMEM; } kfree (port->read_urb->transfer_buffer); @@ -296,7 +296,7 @@ static int ir_open (struct usb_serial_port *port, struct file *filp) buffer = kmalloc (buffer_size, GFP_KERNEL); if (!buffer) { - dev_err (&port->dev, "%s - out of memory.\n", __FUNCTION__); + dev_err (&port->dev, "%s - out of memory.\n", __func__); return -ENOMEM; } kfree (port->write_urb->transfer_buffer); @@ -316,14 +316,14 @@ static int ir_open (struct usb_serial_port *port, struct file *filp) port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) - dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result); return result; } static void ir_close (struct usb_serial_port *port, struct file * filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* shutdown our bulk read */ usb_kill_urb(port->read_urb); @@ -335,10 +335,10 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int int result; int transfer_size; - dbg("%s - port = %d, count = %d", __FUNCTION__, port->number, count); + dbg("%s - port = %d, count = %d", __func__, port->number, count); if (!port->tty) { - dev_err (&port->dev, "%s - no tty???\n", __FUNCTION__); + dev_err (&port->dev, "%s - no tty???\n", __func__); return 0; } @@ -348,7 +348,7 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int spin_lock_bh(&port->lock); if (port->write_urb_busy) { spin_unlock_bh(&port->lock); - dbg("%s - already writing", __FUNCTION__); + dbg("%s - already writing", __func__); return 0; } port->write_urb_busy = 1; @@ -384,7 +384,7 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int result = usb_submit_urb (port->write_urb, GFP_ATOMIC); if (result) { port->write_urb_busy = 0; - dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result); } else result = transfer_size; @@ -396,19 +396,19 @@ static void ir_write_bulk_callback (struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *)urb->context; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } usb_serial_debug_data ( debug, &port->dev, - __FUNCTION__, + __func__, urb->actual_length, urb->transfer_buffer); @@ -423,10 +423,10 @@ static void ir_read_bulk_callback (struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port closed.", __FUNCTION__); + dbg("%s - port closed.", __func__); return; } @@ -444,7 +444,7 @@ static void ir_read_bulk_callback (struct urb *urb) usb_serial_debug_data ( debug, &port->dev, - __FUNCTION__, + __func__, urb->actual_length, data); @@ -477,13 +477,13 @@ static void ir_read_bulk_callback (struct urb *urb) result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", - __FUNCTION__, result); + __func__, result); break ; default: dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, + __func__, status); break ; @@ -499,7 +499,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t speed_t baud; int ir_baud; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); baud = tty_get_baud_rate(port->tty); @@ -551,7 +551,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t result = usb_submit_urb (port->write_urb, GFP_KERNEL); if (result) - dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result); /* Only speed changes are supported */ tty_termios_copy_hw(port->tty->termios, old_termios); diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 7fee53441c2..b486a54c6f4 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -98,10 +98,10 @@ static int iuu_alloc_buf(struct iuu_private *priv) priv->writebuf = kzalloc(256, GFP_KERNEL); if (!priv->buf || !priv->dbgbuf || !priv->writebuf) { iuu_free_buf(priv); - dbg("%s problem allocation buffer", __FUNCTION__); + dbg("%s problem allocation buffer", __func__); return -ENOMEM; } - dbg("%s - Privates buffers allocation success", __FUNCTION__); + dbg("%s - Privates buffers allocation success", __func__); return 0; } @@ -109,7 +109,7 @@ static int iuu_startup(struct usb_serial *serial) { struct iuu_private *priv; priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); - dbg("%s- priv allocation success", __FUNCTION__); + dbg("%s- priv allocation success", __func__); if (!priv) return -ENOMEM; if (iuu_alloc_buf(priv)) { @@ -130,17 +130,17 @@ static void iuu_shutdown(struct usb_serial *serial) if (!port) return; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (priv) { iuu_free_buf(priv); - dbg("%s - I will free all", __FUNCTION__); + dbg("%s - I will free all", __func__); usb_set_serial_port_data(port, NULL); - dbg("%s - priv is not anymore in port structure", __FUNCTION__); + dbg("%s - priv is not anymore in port structure", __func__); kfree(priv); - dbg("%s priv is now kfree", __FUNCTION__); + dbg("%s priv is now kfree", __func__); } } @@ -151,7 +151,7 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, unsigned long flags; /* FIXME: locking on tiomstatus */ - dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __FUNCTION__, + dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __func__, port->number, set, clear); spin_lock_irqsave(&priv->lock, flags); @@ -159,7 +159,7 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, priv->tiostatus = TIOCM_RTS; if (!(set & TIOCM_RTS) && priv->tiostatus == TIOCM_RTS) { - dbg("%s TIOCMSET RESET called !!!", __FUNCTION__); + dbg("%s TIOCMSET RESET called !!!", __func__); priv->reset = 1; } spin_unlock_irqrestore(&priv->lock, flags); @@ -188,10 +188,10 @@ static void iuu_rxcmd(struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; int result; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (urb->status) { - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); /* error stop all */ return; } @@ -211,7 +211,7 @@ static int iuu_reset(struct usb_serial_port *port, u8 wt) struct iuu_private *priv = usb_get_serial_port_data(port); int result; char *buf_ptr = port->write_urb->transfer_buffer; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); /* Prepare the reset sequence */ @@ -243,16 +243,16 @@ static void iuu_update_status_callback(struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct iuu_private *priv = usb_get_serial_port_data(port); u8 *st; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (urb->status) { - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); /* error stop all */ return; } st = urb->transfer_buffer; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (urb->actual_length == 1) { switch (st[0]) { case 0x1: @@ -272,9 +272,9 @@ static void iuu_status_callback(struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; int result; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); usb_fill_bulk_urb(port->read_urb, port->serial->dev, usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), @@ -287,7 +287,7 @@ static int iuu_status(struct usb_serial_port *port) { int result; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); memset(port->write_urb->transfer_buffer, IUU_GET_STATE_REGISTER, 1); usb_fill_bulk_urb(port->write_urb, port->serial->dev, @@ -306,7 +306,7 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count) struct usb_serial *serial = port->serial; int actual = 0; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); /* send the data out the bulk port */ @@ -317,9 +317,9 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count) count, &actual, HZ * 1); if (status != IUU_OPERATION_OK) { - dbg("%s - error = %2x", __FUNCTION__, status); + dbg("%s - error = %2x", __func__, status); } else { - dbg("%s - write OK !", __FUNCTION__); + dbg("%s - write OK !", __func__); } return status; } @@ -330,7 +330,7 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count) struct usb_serial *serial = port->serial; int actual = 0; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); /* send the data out the bulk port */ @@ -341,9 +341,9 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count) count, &actual, HZ * 1); if (status != IUU_OPERATION_OK) { - dbg("%s - error = %2x", __FUNCTION__, status); + dbg("%s - error = %2x", __func__, status); } else { - dbg("%s - read OK !", __FUNCTION__); + dbg("%s - read OK !", __func__); } return status; @@ -358,7 +358,7 @@ static int iuu_led(struct usb_serial_port *port, unsigned int R, if (!buf) return -ENOMEM; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); buf[0] = IUU_SET_LED; buf[1] = R & 0xFF; @@ -371,9 +371,9 @@ static int iuu_led(struct usb_serial_port *port, unsigned int R, status = bulk_immediate(port, buf, 8); kfree(buf); if (status != IUU_OPERATION_OK) - dbg("%s - led error status = %2x", __FUNCTION__, status); + dbg("%s - led error status = %2x", __func__, status); else - dbg("%s - led OK !", __FUNCTION__); + dbg("%s - led OK !", __func__); return IUU_OPERATION_OK; } @@ -451,7 +451,7 @@ static int iuu_clk(struct usb_serial_port *port, int dwFrq) unsigned int P2 = 0; int frq = (int)dwFrq; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (frq == 0) { priv->buf[Count++] = IUU_UART_WRITE_I2C; @@ -461,7 +461,7 @@ static int iuu_clk(struct usb_serial_port *port, int dwFrq) status = bulk_immediate(port, (u8 *) priv->buf, Count); if (status != 0) { - dbg("%s - write error ", __FUNCTION__); + dbg("%s - write error ", __func__); return status; } } else if (frq == 3579000) { @@ -570,7 +570,7 @@ static int iuu_clk(struct usb_serial_port *port, int dwFrq) status = bulk_immediate(port, (u8 *) priv->buf, Count); if (status != IUU_OPERATION_OK) - dbg("%s - write error ", __FUNCTION__); + dbg("%s - write error ", __func__); return status; } @@ -581,7 +581,7 @@ static int iuu_uart_flush(struct usb_serial_port *port) u8 rxcmd = IUU_UART_RX; struct iuu_private *priv = usb_get_serial_port_data(port); - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (iuu_led(port, 0xF000, 0, 0, 0xFF) < 0) return -EIO; @@ -589,27 +589,27 @@ static int iuu_uart_flush(struct usb_serial_port *port) for (i = 0; i < 2; i++) { status = bulk_immediate(port, &rxcmd, 1); if (status != IUU_OPERATION_OK) { - dbg("%s - uart_flush_write error", __FUNCTION__); + dbg("%s - uart_flush_write error", __func__); return status; } status = read_immediate(port, &priv->len, 1); if (status != IUU_OPERATION_OK) { - dbg("%s - uart_flush_read error", __FUNCTION__); + dbg("%s - uart_flush_read error", __func__); return status; } if (priv->len > 0) { - dbg("%s - uart_flush datalen is : %i ", __FUNCTION__, + dbg("%s - uart_flush datalen is : %i ", __func__, priv->len); status = read_immediate(port, priv->buf, priv->len); if (status != IUU_OPERATION_OK) { - dbg("%s - uart_flush_read error", __FUNCTION__); + dbg("%s - uart_flush_read error", __func__); return status; } } } - dbg("%s - uart_flush_read OK!", __FUNCTION__); + dbg("%s - uart_flush_read OK!", __func__); iuu_led(port, 0, 0xF000, 0, 0xFF); return status; } @@ -619,20 +619,20 @@ static void read_buf_callback(struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *)urb->context; unsigned char *data = urb->transfer_buffer; struct tty_struct *tty; - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); if (urb->status) { - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); if (urb->status == -EPROTO) { /* reschedule needed */ } return; } - dbg("%s - %i chars to write", __FUNCTION__, urb->actual_length); + dbg("%s - %i chars to write", __func__, urb->actual_length); tty = port->tty; if (data == NULL) - dbg("%s - data is NULL !!!", __FUNCTION__); + dbg("%s - data is NULL !!!", __func__); if (tty && urb->actual_length && data) { tty_insert_flip_string(tty, data, urb->actual_length); tty_flip_buffer_push(tty); @@ -647,7 +647,7 @@ static int iuu_bulk_write(struct usb_serial_port *port) int result; int i; char *buf_ptr = port->write_urb->transfer_buffer; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); *buf_ptr++ = IUU_UART_ESC; *buf_ptr++ = IUU_UART_TX; @@ -660,7 +660,7 @@ static int iuu_bulk_write(struct usb_serial_port *port) sprintf(priv->dbgbuf + i*2 , "%02X", priv->writebuf[i]); priv->dbgbuf[priv->writelen+i*2] = 0; - dbg("%s - writing %i chars : %s", __FUNCTION__, + dbg("%s - writing %i chars : %s", __func__, priv->writelen, priv->dbgbuf); } usb_fill_bulk_urb(port->write_urb, port->serial->dev, @@ -679,7 +679,7 @@ static int iuu_bulk_write(struct usb_serial_port *port) static int iuu_read_buf(struct usb_serial_port *port, int len) { int result; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); usb_fill_bulk_urb(port->read_urb, port->serial->dev, usb_rcvbulkpipe(port->serial->dev, @@ -701,21 +701,21 @@ static void iuu_uart_read_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; priv->poll++; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (urb->status) { - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); /* error stop all */ return; } if (data == NULL) - dbg("%s - data is NULL !!!", __FUNCTION__); + dbg("%s - data is NULL !!!", __func__); if (urb->actual_length == 1 && data != NULL) len = (int) data[0]; if (urb->actual_length > 1) { - dbg("%s - urb->actual_length = %i", __FUNCTION__, + dbg("%s - urb->actual_length = %i", __func__, urb->actual_length); error = 1; return; @@ -724,7 +724,7 @@ static void iuu_uart_read_callback(struct urb *urb) if (len > 0 && error == 0) { dbg("%s - call read buf - len to read is %i ", - __FUNCTION__, len); + __func__, len); status = iuu_read_buf(port, len); return; } @@ -750,7 +750,7 @@ static void iuu_uart_read_callback(struct urb *urb) } spin_unlock_irqrestore(&priv->lock, flags); /* if nothing to write call again rxcmd */ - dbg("%s - rxcmd recall", __FUNCTION__); + dbg("%s - rxcmd recall", __func__); iuu_led_activity_off(urb); return; } @@ -760,7 +760,7 @@ static int iuu_uart_write(struct usb_serial_port *port, const u8 *buf, { struct iuu_private *priv = usb_get_serial_port_data(port); unsigned int flags; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); if (count > 256) return -ENOMEM; @@ -783,12 +783,12 @@ static void read_rxcmd_callback(struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; int result; - dbg("%s - enter", __FUNCTION__); + dbg("%s - enter", __func__); - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); if (urb->status) { - dbg("%s - urb->status = %d", __FUNCTION__, urb->status); + dbg("%s - urb->status = %d", __func__, urb->status); /* error stop all */ return; } @@ -799,7 +799,7 @@ static void read_rxcmd_callback(struct urb *urb) port->read_urb->transfer_buffer, 256, iuu_uart_read_callback, port); result = usb_submit_urb(port->read_urb, GFP_ATOMIC); - dbg("%s - submit result = %d", __FUNCTION__, result); + dbg("%s - submit result = %d", __func__, result); return; } @@ -820,13 +820,13 @@ static int iuu_uart_on(struct usb_serial_port *port) status = bulk_immediate(port, buf, 4); if (status != IUU_OPERATION_OK) { - dbg("%s - uart_on error", __FUNCTION__); + dbg("%s - uart_on error", __func__); goto uart_enable_failed; } /* iuu_reset() the card after iuu_uart_on() */ status = iuu_uart_flush(port); if (status != IUU_OPERATION_OK) - dbg("%s - uart_flush error", __FUNCTION__); + dbg("%s - uart_flush error", __func__); uart_enable_failed: kfree(buf); return status; @@ -844,7 +844,7 @@ static int iuu_uart_off(struct usb_serial_port *port) status = bulk_immediate(port, buf, 1); if (status != IUU_OPERATION_OK) - dbg("%s - uart_off error", __FUNCTION__); + dbg("%s - uart_off error", __func__); kfree(buf); return status; @@ -938,7 +938,7 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud, status = bulk_immediate(port, dataout, DataCount); if (status != IUU_OPERATION_OK) - dbg("%s - uart_off error", __FUNCTION__); + dbg("%s - uart_off error", __func__); kfree(dataout); return status; } @@ -960,7 +960,7 @@ static void iuu_close(struct usb_serial_port *port, struct file *filp) if (!serial) return; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); iuu_uart_off(port); if (serial->dev) { @@ -977,7 +977,7 @@ static void iuu_close(struct usb_serial_port *port, struct file *filp) } /* free writebuf */ /* shutdown our urbs */ - dbg("%s - shutting down urbs", __FUNCTION__); + dbg("%s - shutting down urbs", __func__); usb_kill_urb(port->write_urb); usb_kill_urb(port->read_urb); usb_kill_urb(port->interrupt_in_urb); @@ -998,7 +998,7 @@ static int iuu_open(struct usb_serial_port *port, struct file *filp) unsigned long flags; struct iuu_private *priv = usb_get_serial_port_data(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); usb_clear_halt(serial->dev, port->write_urb->pipe); usb_clear_halt(serial->dev, port->read_urb->pipe); @@ -1135,7 +1135,7 @@ static int iuu_open(struct usb_serial_port *port, struct file *filp) iuu_uart_flush(port); - dbg("%s - initialization done", __FUNCTION__); + dbg("%s - initialization done", __func__); memset(port->write_urb->transfer_buffer, IUU_UART_RX, 1); usb_fill_bulk_urb(port->write_urb, port->serial->dev, @@ -1147,11 +1147,11 @@ static int iuu_open(struct usb_serial_port *port, struct file *filp) if (result) { dev_err(&port->dev, "%s - failed submitting read urb," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); iuu_close(port, NULL); return -EPROTO; } else { - dbg("%s - rxcmd OK", __FUNCTION__); + dbg("%s - rxcmd OK", __func__); } return result; } diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index ea7bba69f4d..857c5312555 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -244,13 +244,13 @@ module_exit(keyspan_exit); static void keyspan_rx_throttle (struct usb_serial_port *port) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); } static void keyspan_rx_unthrottle (struct usb_serial_port *port) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); } @@ -258,7 +258,7 @@ static void keyspan_break_ctl (struct usb_serial_port *port, int break_state) { struct keyspan_port_private *p_priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); p_priv = usb_get_serial_port_data(port); @@ -280,7 +280,7 @@ static void keyspan_set_termios (struct usb_serial_port *port, unsigned int cflag; struct tty_struct *tty = port->tty; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); p_priv = usb_get_serial_port_data(port); d_details = p_priv->device_details; @@ -377,7 +377,7 @@ static int keyspan_write(struct usb_serial_port *port, } dbg("%s - for port %d (%d chars), flip=%d", - __FUNCTION__, port->number, count, p_priv->out_flip); + __func__, port->number, count, p_priv->out_flip); for (left = count; left > 0; left -= todo) { todo = left; @@ -389,11 +389,11 @@ static int keyspan_write(struct usb_serial_port *port, /* Check we have a valid urb/endpoint before we use it... */ if ((this_urb = p_priv->out_urbs[flip]) == NULL) { /* no bulk out, so return 0 bytes written */ - dbg("%s - no output urb :(", __FUNCTION__); + dbg("%s - no output urb :(", __func__); return count; } - dbg("%s - endpoint %d flip %d", __FUNCTION__, usb_pipeendpoint(this_urb->pipe), flip); + dbg("%s - endpoint %d flip %d", __func__, usb_pipeendpoint(this_urb->pipe), flip); if (this_urb->status == -EINPROGRESS) { if (time_before(jiffies, p_priv->tx_start_time[flip] + 10 * HZ)) @@ -435,13 +435,13 @@ static void usa26_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); endpoint = usb_pipeendpoint(urb->pipe); if (status) { dbg("%s - nonzero status: %x on endpoint %d.", - __FUNCTION__, status, endpoint); + __func__, status, endpoint); return; } @@ -459,7 +459,7 @@ static void usa26_indat_callback(struct urb *urb) } } else { /* some bytes had errors, every byte has status */ - dbg("%s - RX error!!!!", __FUNCTION__); + dbg("%s - RX error!!!!", __func__); for (i = 0; i + 1 < urb->actual_length; i += 2) { int stat = data[i], flag = 0; if (stat & RXERROR_OVERRUN) @@ -479,7 +479,7 @@ static void usa26_indat_callback(struct urb *urb) urb->dev = port->serial->dev; if (port->open_count) if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } return; } @@ -492,7 +492,7 @@ static void usa2x_outdat_callback(struct urb *urb) port = (struct usb_serial_port *) urb->context; p_priv = usb_get_serial_port_data(port); - dbg ("%s - urb %d", __FUNCTION__, urb == p_priv->out_urbs[1]); + dbg ("%s - urb %d", __func__, urb == p_priv->out_urbs[1]); if (port->open_count) usb_serial_port_softint(port); @@ -500,7 +500,7 @@ static void usa2x_outdat_callback(struct urb *urb) static void usa26_inack_callback(struct urb *urb) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } @@ -513,7 +513,7 @@ static void usa26_outcont_callback(struct urb *urb) p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { - dbg ("%s - sending setup", __FUNCTION__); + dbg ("%s - sending setup", __func__); keyspan_usa26_send_setup(port->serial, port, p_priv->resend_cont - 1); } } @@ -531,11 +531,11 @@ static void usa26_instat_callback(struct urb *urb) serial = (struct usb_serial *) urb->context; if (status) { - dbg("%s - nonzero status: %x", __FUNCTION__, status); + dbg("%s - nonzero status: %x", __func__, status); return; } if (urb->actual_length != 9) { - dbg("%s - %d byte report??", __FUNCTION__, urb->actual_length); + dbg("%s - %d byte report??", __func__, urb->actual_length); goto exit; } @@ -543,7 +543,7 @@ static void usa26_instat_callback(struct urb *urb) #if 0 dbg("%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d", - __FUNCTION__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr, msg->ri, msg->_txOff, + __func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr, msg->ri, msg->_txOff, msg->_txXoff, msg->rxEnabled, msg->controlResponse); #endif @@ -552,7 +552,7 @@ static void usa26_instat_callback(struct urb *urb) /* Check port number from message and retrieve private data */ if (msg->port >= serial->num_ports) { - dbg ("%s - Unexpected port number %d", __FUNCTION__, msg->port); + dbg ("%s - Unexpected port number %d", __func__, msg->port); goto exit; } port = serial->port[msg->port]; @@ -576,14 +576,14 @@ static void usa26_instat_callback(struct urb *urb) /* Resubmit urb so we continue receiving */ urb->dev = serial->dev; if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } exit: ; } static void usa26_glocont_callback(struct urb *urb) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } @@ -597,7 +597,7 @@ static void usa28_indat_callback(struct urb *urb) struct keyspan_port_private *p_priv; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); port = (struct usb_serial_port *) urb->context; p_priv = usb_get_serial_port_data(port); @@ -609,7 +609,7 @@ static void usa28_indat_callback(struct urb *urb) do { if (status) { dbg("%s - nonzero status: %x on endpoint %d.", - __FUNCTION__, status, usb_pipeendpoint(urb->pipe)); + __func__, status, usb_pipeendpoint(urb->pipe)); return; } @@ -629,7 +629,7 @@ static void usa28_indat_callback(struct urb *urb) urb->dev = port->serial->dev; if (port->open_count) if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } p_priv->in_flip ^= 1; @@ -639,7 +639,7 @@ static void usa28_indat_callback(struct urb *urb) static void usa28_inack_callback(struct urb *urb) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } static void usa28_outcont_callback(struct urb *urb) @@ -651,7 +651,7 @@ static void usa28_outcont_callback(struct urb *urb) p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { - dbg ("%s - sending setup", __FUNCTION__); + dbg ("%s - sending setup", __func__); keyspan_usa28_send_setup(port->serial, port, p_priv->resend_cont - 1); } } @@ -670,16 +670,16 @@ static void usa28_instat_callback(struct urb *urb) serial = (struct usb_serial *) urb->context; if (status) { - dbg("%s - nonzero status: %x", __FUNCTION__, status); + dbg("%s - nonzero status: %x", __func__, status); return; } if (urb->actual_length != sizeof(struct keyspan_usa28_portStatusMessage)) { - dbg("%s - bad length %d", __FUNCTION__, urb->actual_length); + dbg("%s - bad length %d", __func__, urb->actual_length); goto exit; } - /*dbg("%s %x %x %x %x %x %x %x %x %x %x %x %x", __FUNCTION__ + /*dbg("%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__ data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11]);*/ @@ -689,7 +689,7 @@ static void usa28_instat_callback(struct urb *urb) /* Check port number from message and retrieve private data */ if (msg->port >= serial->num_ports) { - dbg ("%s - Unexpected port number %d", __FUNCTION__, msg->port); + dbg ("%s - Unexpected port number %d", __func__, msg->port); goto exit; } port = serial->port[msg->port]; @@ -713,14 +713,14 @@ static void usa28_instat_callback(struct urb *urb) /* Resubmit urb so we continue receiving */ urb->dev = serial->dev; if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } exit: ; } static void usa28_glocont_callback(struct urb *urb) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } @@ -731,7 +731,7 @@ static void usa49_glocont_callback(struct urb *urb) struct keyspan_port_private *p_priv; int i; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); serial = (struct usb_serial *) urb->context; for (i = 0; i < serial->num_ports; ++i) { @@ -739,7 +739,7 @@ static void usa49_glocont_callback(struct urb *urb) p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { - dbg ("%s - sending setup", __FUNCTION__); + dbg ("%s - sending setup", __func__); keyspan_usa49_send_setup(serial, port, p_priv->resend_cont - 1); break; } @@ -759,21 +759,21 @@ static void usa49_instat_callback(struct urb *urb) int old_dcd_state; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); serial = (struct usb_serial *) urb->context; if (status) { - dbg("%s - nonzero status: %x", __FUNCTION__, status); + dbg("%s - nonzero status: %x", __func__, status); return; } if (urb->actual_length != sizeof(struct keyspan_usa49_portStatusMessage)) { - dbg("%s - bad length %d", __FUNCTION__, urb->actual_length); + dbg("%s - bad length %d", __func__, urb->actual_length); goto exit; } - /*dbg(" %x %x %x %x %x %x %x %x %x %x %x", __FUNCTION__, + /*dbg(" %x %x %x %x %x %x %x %x %x %x %x", __func__, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10]);*/ @@ -782,7 +782,7 @@ static void usa49_instat_callback(struct urb *urb) /* Check port number from message and retrieve private data */ if (msg->portNumber >= serial->num_ports) { - dbg ("%s - Unexpected port number %d", __FUNCTION__, msg->portNumber); + dbg ("%s - Unexpected port number %d", __func__, msg->portNumber); goto exit; } port = serial->port[msg->portNumber]; @@ -807,14 +807,14 @@ static void usa49_instat_callback(struct urb *urb) urb->dev = serial->dev; if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } exit: ; } static void usa49_inack_callback(struct urb *urb) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } static void usa49_indat_callback(struct urb *urb) @@ -826,12 +826,12 @@ static void usa49_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); endpoint = usb_pipeendpoint(urb->pipe); if (status) { - dbg("%s - nonzero status: %x on endpoint %d.", __FUNCTION__, + dbg("%s - nonzero status: %x on endpoint %d.", __func__, status, endpoint); return; } @@ -866,7 +866,7 @@ static void usa49_indat_callback(struct urb *urb) urb->dev = port->serial->dev; if (port->open_count) if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } } @@ -879,12 +879,12 @@ static void usa49wg_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); serial = urb->context; if (status) { - dbg("%s - nonzero status: %x", __FUNCTION__, status); + dbg("%s - nonzero status: %x", __func__, status); return; } @@ -898,7 +898,7 @@ static void usa49wg_indat_callback(struct urb *urb) /* Check port number from message*/ if (data[i] >= serial->num_ports) { dbg ("%s - Unexpected port number %d", - __FUNCTION__, data[i]); + __func__, data[i]); return; } port = serial->port[data[i++]]; @@ -944,13 +944,13 @@ static void usa49wg_indat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err != 0) - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } /* not used, usa-49 doesn't have per-port control endpoints */ static void usa49_outcont_callback(struct urb *urb) { - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); } static void usa90_indat_callback(struct urb *urb) @@ -963,13 +963,13 @@ static void usa90_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); endpoint = usb_pipeendpoint(urb->pipe); if (status) { dbg("%s - nonzero status: %x on endpoint %d.", - __FUNCTION__, status, endpoint); + __func__, status, endpoint); return; } @@ -1000,7 +1000,7 @@ static void usa90_indat_callback(struct urb *urb) } else { /* some bytes had errors, every byte has status */ - dbg("%s - RX error!!!!", __FUNCTION__); + dbg("%s - RX error!!!!", __func__); for (i = 0; i + 1 < urb->actual_length; i += 2) { int stat = data[i], flag = 0; if (stat & RXERROR_OVERRUN) @@ -1021,7 +1021,7 @@ static void usa90_indat_callback(struct urb *urb) urb->dev = port->serial->dev; if (port->open_count) if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } return; } @@ -1040,11 +1040,11 @@ static void usa90_instat_callback(struct urb *urb) serial = (struct usb_serial *) urb->context; if (status) { - dbg("%s - nonzero status: %x", __FUNCTION__, status); + dbg("%s - nonzero status: %x", __func__, status); return; } if (urb->actual_length < 14) { - dbg("%s - %d byte report??", __FUNCTION__, urb->actual_length); + dbg("%s - %d byte report??", __func__, urb->actual_length); goto exit; } @@ -1073,7 +1073,7 @@ static void usa90_instat_callback(struct urb *urb) /* Resubmit urb so we continue receiving */ urb->dev = serial->dev; if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } exit: ; @@ -1088,7 +1088,7 @@ static void usa90_outcont_callback(struct urb *urb) p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { - dbg ("%s - sending setup", __FUNCTION__); + dbg ("%s - sending setup", __func__); keyspan_usa90_send_setup(port->serial, port, p_priv->resend_cont - 1); } } @@ -1105,17 +1105,17 @@ static void usa67_instat_callback(struct urb *urb) int old_dcd_state; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); serial = urb->context; if (status) { - dbg("%s - nonzero status: %x", __FUNCTION__, status); + dbg("%s - nonzero status: %x", __func__, status); return; } if (urb->actual_length != sizeof(struct keyspan_usa67_portStatusMessage)) { - dbg("%s - bad length %d", __FUNCTION__, urb->actual_length); + dbg("%s - bad length %d", __func__, urb->actual_length); return; } @@ -1125,7 +1125,7 @@ static void usa67_instat_callback(struct urb *urb) /* Check port number from message and retrieve private data */ if (msg->port >= serial->num_ports) { - dbg ("%s - Unexpected port number %d", __FUNCTION__, msg->port); + dbg ("%s - Unexpected port number %d", __func__, msg->port); return; } @@ -1149,7 +1149,7 @@ static void usa67_instat_callback(struct urb *urb) urb->dev = serial->dev; err = usb_submit_urb(urb, GFP_ATOMIC); if (err != 0) - dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err); + dbg("%s - resubmit read urb failed. (%d)", __func__, err); } static void usa67_glocont_callback(struct urb *urb) @@ -1159,7 +1159,7 @@ static void usa67_glocont_callback(struct urb *urb) struct keyspan_port_private *p_priv; int i; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); serial = urb->context; for (i = 0; i < serial->num_ports; ++i) { @@ -1167,7 +1167,7 @@ static void usa67_glocont_callback(struct urb *urb) p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { - dbg ("%s - sending setup", __FUNCTION__); + dbg ("%s - sending setup", __func__); keyspan_usa67_send_setup(serial, port, p_priv->resend_cont - 1); break; @@ -1183,7 +1183,7 @@ static int keyspan_write_room (struct usb_serial_port *port) int data_len; struct urb *this_urb; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); p_priv = usb_get_serial_port_data(port); d_details = p_priv->device_details; @@ -1228,7 +1228,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) p_priv = usb_get_serial_port_data(port); d_details = p_priv->device_details; - dbg("%s - port%d.", __FUNCTION__, port->number); + dbg("%s - port%d.", __func__, port->number); /* Set some sane defaults */ p_priv->rts_state = 1; @@ -1253,7 +1253,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) usb_clear_halt(urb->dev, urb->pipe); if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { - dbg("%s - submit urb %d failed (%d)", __FUNCTION__, i, err); + dbg("%s - submit urb %d failed (%d)", __func__, i, err); } } @@ -1305,7 +1305,7 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp) struct keyspan_serial_private *s_priv; struct keyspan_port_private *p_priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); s_priv = usb_get_serial_data(serial); p_priv = usb_get_serial_port_data(port); @@ -1320,7 +1320,7 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp) } /*while (p_priv->outcont_urb->status == -EINPROGRESS) { - dbg("%s - urb in progress", __FUNCTION__); + dbg("%s - urb in progress", __func__); }*/ p_priv->out_flip = 0; @@ -1484,10 +1484,10 @@ static struct urb *keyspan_setup_urb (struct usb_serial *serial, int endpoint, if (endpoint == -1) return NULL; /* endpoint not needed */ - dbg ("%s - alloc for endpoint %d.", __FUNCTION__, endpoint); + dbg ("%s - alloc for endpoint %d.", __func__, endpoint); urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ if (urb == NULL) { - dbg ("%s - alloc for endpoint %d failed.", __FUNCTION__, endpoint); + dbg ("%s - alloc for endpoint %d failed.", __func__, endpoint); return NULL; } @@ -1588,7 +1588,7 @@ static void keyspan_setup_urbs(struct usb_serial *serial) struct callbacks *cback; int endp; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); s_priv = usb_get_serial_data(serial); d_details = s_priv->device_details; @@ -1662,7 +1662,7 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, div, /* divisor */ cnt; /* inverse of divisor (programmed into 8051) */ - dbg ("%s - %d.", __FUNCTION__, baud_rate); + dbg ("%s - %d.", __func__, baud_rate); /* prevent divide by zero... */ if( (b16 = (baud_rate * 16L)) == 0) { @@ -1695,7 +1695,7 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, *rate_hi = (u8) ((cnt >> 8) & 0xff); } if (rate_low && rate_hi) { - dbg ("%s - %d %02x %02x.", __FUNCTION__, baud_rate, *rate_hi, *rate_low); + dbg ("%s - %d %02x %02x.", __func__, baud_rate, *rate_hi, *rate_low); } return (KEYSPAN_BAUD_RATE_OK); @@ -1708,7 +1708,7 @@ static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, u32 b16, /* baud rate times 16 (actual rate used internally) */ div; /* divisor */ - dbg ("%s - %d.", __FUNCTION__, baud_rate); + dbg ("%s - %d.", __func__, baud_rate); /* prevent divide by zero... */ if( (b16 = (baud_rate * 16L)) == 0) @@ -1731,7 +1731,7 @@ static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, *rate_hi = (u8) ((div >> 8) & 0xff); if (rate_low && rate_hi) - dbg ("%s - %d %02x %02x.", __FUNCTION__, baud_rate, *rate_hi, *rate_low); + dbg ("%s - %d %02x %02x.", __func__, baud_rate, *rate_hi, *rate_low); return (KEYSPAN_BAUD_RATE_OK); } @@ -1748,7 +1748,7 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, u8 best_prescaler; int i; - dbg ("%s - %d.", __FUNCTION__, baud_rate); + dbg ("%s - %d.", __func__, baud_rate); /* prevent divide by zero */ if( (b16 = baud_rate * 16L) == 0) { @@ -1796,7 +1796,7 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, } if (prescaler) { *prescaler = best_prescaler; - /* dbg("%s - %d %d", __FUNCTION__, *prescaler, div); */ + /* dbg("%s - %d %d", __func__, *prescaler, div); */ } return (KEYSPAN_BAUD_RATE_OK); } @@ -1809,7 +1809,7 @@ static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, div, /* divisor */ cnt; /* inverse of divisor (programmed into 8051) */ - dbg ("%s - %d.", __FUNCTION__, baud_rate); + dbg ("%s - %d.", __func__, baud_rate); /* prevent divide by zero */ if ((b16 = baud_rate * 16L) == 0) @@ -1848,7 +1848,7 @@ static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, if (rate_hi) { *rate_hi = (u8) ((cnt >> 8) & 0xff); } - dbg ("%s - %d OK.", __FUNCTION__, baud_rate); + dbg ("%s - %d OK.", __func__, baud_rate); return (KEYSPAN_BAUD_RATE_OK); } @@ -1864,7 +1864,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, struct urb *this_urb; int device_port, err; - dbg ("%s reset=%d", __FUNCTION__, reset_port); + dbg ("%s reset=%d", __func__, reset_port); s_priv = usb_get_serial_data(serial); p_priv = usb_get_serial_port_data(port); @@ -1874,11 +1874,11 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, outcont_urb = d_details->outcont_endpoints[port->number]; this_urb = p_priv->outcont_urb; - dbg("%s - endpoint %d", __FUNCTION__, usb_pipeendpoint(this_urb->pipe)); + dbg("%s - endpoint %d", __func__, usb_pipeendpoint(this_urb->pipe)); /* Make sure we have an urb then send the message */ if (this_urb == NULL) { - dbg("%s - oops no urb.", __FUNCTION__); + dbg("%s - oops no urb.", __func__); return -1; } @@ -1887,7 +1887,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, if ((reset_port + 1) > p_priv->resend_cont) p_priv->resend_cont = reset_port + 1; if (this_urb->status == -EINPROGRESS) { - /* dbg ("%s - already writing", __FUNCTION__); */ + /* dbg ("%s - already writing", __func__); */ mdelay(5); return(-1); } @@ -1901,7 +1901,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, if (d_details->calculate_baud_rate (p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE ) { - dbg("%s - Invalid baud rate %d requested, using 9600.", __FUNCTION__, + dbg("%s - Invalid baud rate %d requested, using 9600.", __func__, p_priv->baud); msg.baudLo = 0; msg.baudHi = 125; /* Values for 9600 baud */ @@ -1996,11 +1996,11 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, this_urb->dev = serial->dev; if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { - dbg("%s - usb_submit_urb(setup) failed (%d)", __FUNCTION__, err); + dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); } #if 0 else { - dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __FUNCTION__ + dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__ outcont_urb, this_urb->transfer_buffer_length, usb_pipeendpoint(this_urb->pipe)); } @@ -2020,7 +2020,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, struct urb *this_urb; int device_port, err; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); s_priv = usb_get_serial_data(serial); p_priv = usb_get_serial_port_data(port); @@ -2029,7 +2029,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, /* only do something if we have a bulk out endpoint */ if ((this_urb = p_priv->outcont_urb) == NULL) { - dbg("%s - oops no urb.", __FUNCTION__); + dbg("%s - oops no urb.", __func__); return -1; } @@ -2038,7 +2038,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, if ((reset_port + 1) > p_priv->resend_cont) p_priv->resend_cont = reset_port + 1; if (this_urb->status == -EINPROGRESS) { - dbg ("%s already writing", __FUNCTION__); + dbg ("%s already writing", __func__); mdelay(5); return(-1); } @@ -2048,7 +2048,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, msg.setBaudRate = 1; if (d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudLo, NULL, device_port) == KEYSPAN_INVALID_BAUD_RATE ) { - dbg("%s - Invalid baud rate requested %d.", __FUNCTION__, p_priv->baud); + dbg("%s - Invalid baud rate requested %d.", __func__, p_priv->baud); msg.baudLo = 0xff; msg.baudHi = 0xb2; /* Values for 9600 baud */ } @@ -2122,11 +2122,11 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, this_urb->dev = serial->dev; if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { - dbg("%s - usb_submit_urb(setup) failed", __FUNCTION__); + dbg("%s - usb_submit_urb(setup) failed", __func__); } #if 0 else { - dbg("%s - usb_submit_urb(setup) OK %d bytes", __FUNCTION__, + dbg("%s - usb_submit_urb(setup) OK %d bytes", __func__, this_urb->transfer_buffer_length); } #endif @@ -2146,7 +2146,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, struct urb *this_urb; int err, device_port; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); s_priv = usb_get_serial_data(serial); p_priv = usb_get_serial_port_data(port); @@ -2157,11 +2157,11 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, /* Work out which port within the device is being setup */ device_port = port->number - port->serial->minor; - dbg("%s - endpoint %d port %d (%d)",__FUNCTION__, usb_pipeendpoint(this_urb->pipe), port->number, device_port); + dbg("%s - endpoint %d port %d (%d)",__func__, usb_pipeendpoint(this_urb->pipe), port->number, device_port); /* Make sure we have an urb then send the message */ if (this_urb == NULL) { - dbg("%s - oops no urb for port %d.", __FUNCTION__, port->number); + dbg("%s - oops no urb for port %d.", __func__, port->number); return -1; } @@ -2171,7 +2171,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, p_priv->resend_cont = reset_port + 1; if (this_urb->status == -EINPROGRESS) { - /* dbg ("%s - already writing", __FUNCTION__); */ + /* dbg ("%s - already writing", __func__); */ mdelay(5); return(-1); } @@ -2188,7 +2188,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, if (d_details->calculate_baud_rate (p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE ) { - dbg("%s - Invalid baud rate %d requested, using 9600.", __FUNCTION__, + dbg("%s - Invalid baud rate %d requested, using 9600.", __func__, p_priv->baud); msg.baudLo = 0; msg.baudHi = 125; /* Values for 9600 baud */ @@ -2307,11 +2307,11 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, this_urb->dev = serial->dev; } if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { - dbg("%s - usb_submit_urb(setup) failed (%d)", __FUNCTION__, err); + dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); } #if 0 else { - dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __FUNCTION__, + dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__, outcont_urb, this_urb->transfer_buffer_length, usb_pipeendpoint(this_urb->pipe)); } @@ -2332,7 +2332,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, int err; u8 prescaler; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); s_priv = usb_get_serial_data(serial); p_priv = usb_get_serial_port_data(port); @@ -2340,7 +2340,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, /* only do something if we have a bulk out endpoint */ if ((this_urb = p_priv->outcont_urb) == NULL) { - dbg("%s - oops no urb.", __FUNCTION__); + dbg("%s - oops no urb.", __func__); return -1; } @@ -2349,7 +2349,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, if ((reset_port + 1) > p_priv->resend_cont) p_priv->resend_cont = reset_port + 1; if (this_urb->status == -EINPROGRESS) { - dbg ("%s already writing", __FUNCTION__); + dbg ("%s already writing", __func__); mdelay(5); return(-1); } @@ -2363,7 +2363,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, if (d_details->calculate_baud_rate (p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE ) { - dbg("%s - Invalid baud rate %d requested, using 9600.", __FUNCTION__, + dbg("%s - Invalid baud rate %d requested, using 9600.", __func__, p_priv->baud); p_priv->baud = 9600; d_details->calculate_baud_rate (p_priv->baud, d_details->baudclk, @@ -2453,7 +2453,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, this_urb->dev = serial->dev; if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { - dbg("%s - usb_submit_urb(setup) failed (%d)", __FUNCTION__, err); + dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); } return (0); } @@ -2469,7 +2469,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, struct urb *this_urb; int err, device_port; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); s_priv = usb_get_serial_data(serial); p_priv = usb_get_serial_port_data(port); @@ -2482,7 +2482,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, /* Make sure we have an urb then send the message */ if (this_urb == NULL) { - dbg("%s - oops no urb for port %d.", __FUNCTION__, + dbg("%s - oops no urb for port %d.", __func__, port->number); return -1; } @@ -2492,7 +2492,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, if ((reset_port + 1) > p_priv->resend_cont) p_priv->resend_cont = reset_port + 1; if (this_urb->status == -EINPROGRESS) { - /* dbg ("%s - already writing", __FUNCTION__); */ + /* dbg ("%s - already writing", __func__); */ mdelay(5); return(-1); } @@ -2508,7 +2508,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, if (d_details->calculate_baud_rate (p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE ) { - dbg("%s - Invalid baud rate %d requested, using 9600.", __FUNCTION__, + dbg("%s - Invalid baud rate %d requested, using 9600.", __func__, p_priv->baud); msg.baudLo = 0; msg.baudHi = 125; /* Values for 9600 baud */ @@ -2601,7 +2601,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, err = usb_submit_urb(this_urb, GFP_ATOMIC); if (err != 0) - dbg("%s - usb_submit_urb(setup) failed (%d)", __FUNCTION__, + dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); return (0); } @@ -2612,7 +2612,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) struct keyspan_serial_private *s_priv; const struct keyspan_device_details *d_details; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); s_priv = usb_get_serial_data(serial); d_details = s_priv->device_details; @@ -2647,20 +2647,20 @@ static int keyspan_startup (struct usb_serial *serial) struct keyspan_port_private *p_priv; const struct keyspan_device_details *d_details; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) if (d_details->product_id == le16_to_cpu(serial->dev->descriptor.idProduct)) break; if (d_details == NULL) { - dev_err(&serial->dev->dev, "%s - unknown product id %x\n", __FUNCTION__, le16_to_cpu(serial->dev->descriptor.idProduct)); + dev_err(&serial->dev->dev, "%s - unknown product id %x\n", __func__, le16_to_cpu(serial->dev->descriptor.idProduct)); return 1; } /* Setup private data for serial driver */ s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); if (!s_priv) { - dbg("%s - kmalloc for keyspan_serial_private failed.", __FUNCTION__); + dbg("%s - kmalloc for keyspan_serial_private failed.", __func__); return -ENOMEM; } @@ -2672,7 +2672,7 @@ static int keyspan_startup (struct usb_serial *serial) port = serial->port[i]; p_priv = kzalloc(sizeof(struct keyspan_port_private), GFP_KERNEL); if (!p_priv) { - dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __FUNCTION__, i); + dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __func__, i); return (1); } p_priv->device_details = d_details; @@ -2685,14 +2685,14 @@ static int keyspan_startup (struct usb_serial *serial) s_priv->instat_urb->dev = serial->dev; err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL); if (err != 0) - dbg("%s - submit instat urb failed %d", __FUNCTION__, + dbg("%s - submit instat urb failed %d", __func__, err); } if (s_priv->indat_urb != NULL) { s_priv->indat_urb->dev = serial->dev; err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL); if (err != 0) - dbg("%s - submit indat urb failed %d", __FUNCTION__, + dbg("%s - submit indat urb failed %d", __func__, err); } @@ -2706,7 +2706,7 @@ static void keyspan_shutdown (struct usb_serial *serial) struct keyspan_serial_private *s_priv; struct keyspan_port_private *p_priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); s_priv = usb_get_serial_data(serial); diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 03984779518..6ce292ef1c4 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -208,7 +208,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) 2000); if (result < 0) dbg("%s - error %d from usb_control_msg", - __FUNCTION__, result); + __func__, result); } @@ -232,11 +232,11 @@ static void keyspan_pda_rx_interrupt (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } @@ -274,7 +274,7 @@ exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } @@ -358,7 +358,7 @@ static void keyspan_pda_break_ctl (struct usb_serial_port *port, int break_state value, 0, NULL, 0, 2000); if (result < 0) dbg("%s - error %d from usb_control_msg", - __FUNCTION__, result); + __func__, result); /* there is something funky about this.. the TCSBRK that 'cu' performs ought to translate into a break_ctl(-1),break_ctl(0) pair HZ/4 seconds apart, but it feels like the break sent isn't as long as it @@ -665,11 +665,11 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) 1, 2000); if (rc < 0) { - dbg("%s - roomquery failed", __FUNCTION__); + dbg("%s - roomquery failed", __func__); goto error; } if (rc == 0) { - dbg("%s - roomquery returned 0 bytes", __FUNCTION__); + dbg("%s - roomquery returned 0 bytes", __func__); rc = -EIO; goto error; } @@ -688,7 +688,7 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) port->interrupt_in_urb->dev = serial->dev; rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (rc) { - dbg("%s - usb_submit_urb(read int) failed", __FUNCTION__); + dbg("%s - usb_submit_urb(read int) failed", __func__); goto error; } @@ -732,7 +732,7 @@ static int keyspan_pda_fake_startup (struct usb_serial *serial) record = &xircom_pgs_firmware[0]; #endif if (record == NULL) { - err("%s: unknown vendor, aborting.", __FUNCTION__); + err("%s: unknown vendor, aborting.", __func__); return -ENODEV; } @@ -779,7 +779,7 @@ static int keyspan_pda_startup (struct usb_serial *serial) static void keyspan_pda_shutdown (struct usb_serial *serial) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); kfree(usb_get_serial_port_data(serial->port[0])); } diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index d7100428390..160e19263e2 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -191,7 +191,7 @@ static int klsi_105_chg_port_settings(struct usb_serial_port *port, if (rc < 0) err("Change port settings failed (error = %d)", rc); info("%s - %d byte block, baudrate %x, databits %d, u1 %d, u2 %d", - __FUNCTION__, + __func__, settings->pktlen, settings->baudrate, settings->databits, settings->unknown1, settings->unknown2); @@ -222,7 +222,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, __u8 status_buf[KLSI_STATUSBUF_LEN] = { -1,-1}; __u16 status; - info("%s - sending SIO Poll request", __FUNCTION__); + info("%s - sending SIO Poll request", __func__); rc = usb_control_msg(port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0), KL5KUSB105A_SIO_POLL, @@ -237,7 +237,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, else { status = le16_to_cpu(*(u16 *)status_buf); - info("%s - read status %x %x", __FUNCTION__, + info("%s - read status %x %x", __func__, status_buf[0], status_buf[1]); *line_state_p = klsi_105_status2linestate(status); @@ -265,7 +265,7 @@ static int klsi_105_startup (struct usb_serial *serial) priv = kmalloc(sizeof(struct klsi_105_private), GFP_KERNEL); if (!priv) { - dbg("%skmalloc for klsi_105_private failed.", __FUNCTION__); + dbg("%skmalloc for klsi_105_private failed.", __func__); i--; goto err_cleanup; } @@ -295,7 +295,7 @@ static int klsi_105_startup (struct usb_serial *serial) urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); if (!urb->transfer_buffer) { - err("%s - out of memory for urb buffers.", __FUNCTION__); + err("%s - out of memory for urb buffers.", __func__); goto err_cleanup; } } @@ -325,7 +325,7 @@ static void klsi_105_shutdown (struct usb_serial *serial) { int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* stop reads and writes on all ports */ for (i=0; i < serial->num_ports; ++i) { @@ -370,7 +370,7 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp) struct klsi_105_port_settings cfg; unsigned long flags; - dbg("%s port %d", __FUNCTION__, port->number); + dbg("%s port %d", __func__, port->number); /* force low_latency on so that our tty_push actually forces * the data through @@ -416,7 +416,7 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp) rc = usb_submit_urb(port->read_urb, GFP_KERNEL); if (rc) { - err("%s - failed submitting read urb, error %d", __FUNCTION__, rc); + err("%s - failed submitting read urb, error %d", __func__, rc); retval = rc; goto exit; } @@ -434,14 +434,14 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp) err("Enabling read failed (error = %d)", rc); retval = rc; } else - dbg("%s - enabled reading", __FUNCTION__); + dbg("%s - enabled reading", __func__); rc = klsi_105_get_line_state(port, &line_state); if (rc >= 0) { spin_lock_irqsave (&priv->lock, flags); priv->line_state = line_state; spin_unlock_irqrestore (&priv->lock, flags); - dbg("%s - read line state 0x%lx", __FUNCTION__, line_state); + dbg("%s - read line state 0x%lx", __func__, line_state); retval = 0; } else retval = rc; @@ -456,7 +456,7 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp) struct klsi_105_private *priv = usb_get_serial_port_data(port); int rc; - dbg("%s port %d", __FUNCTION__, port->number); + dbg("%s port %d", __func__, port->number); mutex_lock(&port->serial->disc_mutex); if (!port->serial->disconnected) { @@ -499,7 +499,7 @@ static int klsi_105_write (struct usb_serial_port *port, int result, size; int bytes_sent=0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); while (count > 0) { /* try to find a free urb (write 0 bytes if none) */ @@ -511,21 +511,21 @@ static int klsi_105_write (struct usb_serial_port *port, for (i=0; iwrite_urb_pool[i]->status != -EINPROGRESS) { urb = priv->write_urb_pool[i]; - dbg("%s - using pool URB %d", __FUNCTION__, i); + dbg("%s - using pool URB %d", __func__, i); break; } } spin_unlock_irqrestore (&priv->lock, flags); if (urb==NULL) { - dbg("%s - no more free urbs", __FUNCTION__); + dbg("%s - no more free urbs", __func__); goto exit; } if (urb->transfer_buffer == NULL) { urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); if (urb->transfer_buffer == NULL) { - err("%s - no more kernel memory...", __FUNCTION__); + err("%s - no more kernel memory...", __func__); goto exit; } } @@ -551,7 +551,7 @@ static int klsi_105_write (struct usb_serial_port *port, /* send the data out the bulk port */ result = usb_submit_urb(urb, GFP_ATOMIC); if (result) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); goto exit; } buf += size; @@ -570,10 +570,10 @@ static void klsi_105_write_bulk_callback ( struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *)urb->context; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { - dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, + dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } @@ -600,7 +600,7 @@ static int klsi_105_chars_in_buffer (struct usb_serial_port *port) spin_unlock_irqrestore (&priv->lock, flags); - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return (chars); } @@ -620,7 +620,7 @@ static int klsi_105_write_room (struct usb_serial_port *port) spin_unlock_irqrestore (&priv->lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return (room); } @@ -635,11 +635,11 @@ static void klsi_105_read_bulk_callback (struct urb *urb) int rc; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* The urb might have been killed. */ if (status) { - dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, + dbg("%s - nonzero read bulk status received: %d", __func__, status); return; } @@ -649,12 +649,12 @@ static void klsi_105_read_bulk_callback (struct urb *urb) */ if (urb->actual_length == 0) { /* empty urbs seem to happen, we ignore them */ - /* dbg("%s - emtpy URB", __FUNCTION__); */ + /* dbg("%s - emtpy URB", __func__); */ ; } else if (urb->actual_length <= 2) { - dbg("%s - size %d URB not understood", __FUNCTION__, + dbg("%s - size %d URB not understood", __func__, urb->actual_length); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); } else { int bytes_sent = ((__u8 *) data)[0] + @@ -666,12 +666,12 @@ static void klsi_105_read_bulk_callback (struct urb *urb) * intermixed tty_flip_buffer_push()s * FIXME */ - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); if (bytes_sent + 2 > urb->actual_length) { dbg("%s - trying to read more data than available" - " (%d vs. %d)", __FUNCTION__, + " (%d vs. %d)", __func__, bytes_sent+2, urb->actual_length); /* cap at implied limit */ bytes_sent = urb->actual_length - 2; @@ -694,7 +694,7 @@ static void klsi_105_read_bulk_callback (struct urb *urb) port); rc = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (rc) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, rc); + err("%s - failed resubmitting read urb, error %d", __func__, rc); } /* klsi_105_read_bulk_callback */ @@ -718,7 +718,7 @@ static void klsi_105_set_termios (struct usb_serial_port *port, if( (cflag & CBAUD) != (old_cflag & CBAUD) ) { /* reassert DTR and (maybe) RTS on transition from B0 */ if( (old_cflag & CBAUD) == B0 ) { - dbg("%s: baud was B0", __FUNCTION__); + dbg("%s: baud was B0", __func__); #if 0 priv->control_state |= TIOCM_DTR; /* don't set RTS if using hardware flow control */ @@ -764,7 +764,7 @@ static void klsi_105_set_termios (struct usb_serial_port *port, break; } if ((cflag & CBAUD) == B0 ) { - dbg("%s: baud is B0", __FUNCTION__); + dbg("%s: baud is B0", __func__); /* Drop RTS and DTR */ /* maybe this should be simulated by sending read * disable and read enable messages? @@ -781,11 +781,11 @@ static void klsi_105_set_termios (struct usb_serial_port *port, /* set the number of data bits */ switch (cflag & CSIZE) { case CS5: - dbg("%s - 5 bits/byte not supported", __FUNCTION__); + dbg("%s - 5 bits/byte not supported", __func__); spin_unlock_irqrestore (&priv->lock, flags); return ; case CS6: - dbg("%s - 6 bits/byte not supported", __FUNCTION__); + dbg("%s - 6 bits/byte not supported", __func__); spin_unlock_irqrestore (&priv->lock, flags); return ; case CS7: @@ -859,7 +859,7 @@ static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state ) struct mct_u232_private *priv = (struct mct_u232_private *)port->private; unsigned char lcr = priv->last_lcr; - dbg("%sstate=%d", __FUNCTION__, break_state); + dbg("%sstate=%d", __func__, break_state); if (break_state) lcr |= MCT_U232_SET_BREAK; @@ -874,7 +874,7 @@ static int klsi_105_tiocmget (struct usb_serial_port *port, struct file *file) unsigned long flags; int rc; unsigned long line_state; - dbg("%s - request, just guessing", __FUNCTION__); + dbg("%s - request, just guessing", __func__); rc = klsi_105_get_line_state(port, &line_state); if (rc < 0) { @@ -886,7 +886,7 @@ static int klsi_105_tiocmget (struct usb_serial_port *port, struct file *file) spin_lock_irqsave (&priv->lock, flags); priv->line_state = line_state; spin_unlock_irqrestore (&priv->lock, flags); - dbg("%s - read line state 0x%lx", __FUNCTION__, line_state); + dbg("%s - read line state 0x%lx", __func__, line_state); return (int)line_state; } @@ -895,7 +895,7 @@ static int klsi_105_tiocmset (struct usb_serial_port *port, struct file *file, { int retval = -EINVAL; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* if this ever gets implemented, it should be done something like this: struct usb_serial *serial = port->serial; @@ -921,7 +921,7 @@ static int klsi_105_tiocmset (struct usb_serial_port *port, struct file *file, static void klsi_105_throttle (struct usb_serial_port *port) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); usb_kill_urb(port->read_urb); } @@ -929,12 +929,12 @@ static void klsi_105_unthrottle (struct usb_serial_port *port) { int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); port->read_urb->dev = port->serial->dev; result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - err("%s - failed submitting read urb, error %d", __FUNCTION__, + err("%s - failed submitting read urb, error %d", __func__, result); } diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 78458c807ea..693f00da7c0 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -183,11 +183,11 @@ static int kobil_startup (struct usb_serial *serial) for (i = 0; i < altsetting->desc.bNumEndpoints; i++) { endpoint = &altsetting->endpoint[i]; if (usb_endpoint_is_int_out(&endpoint->desc)) { - dbg("%s Found interrupt out endpoint. Address: %d", __FUNCTION__, endpoint->desc.bEndpointAddress); + dbg("%s Found interrupt out endpoint. Address: %d", __func__, endpoint->desc.bEndpointAddress); priv->write_int_endpoint_address = endpoint->desc.bEndpointAddress; } if (usb_endpoint_is_int_in(&endpoint->desc)) { - dbg("%s Found interrupt in endpoint. Address: %d", __FUNCTION__, endpoint->desc.bEndpointAddress); + dbg("%s Found interrupt in endpoint. Address: %d", __func__, endpoint->desc.bEndpointAddress); priv->read_int_endpoint_address = endpoint->desc.bEndpointAddress; } } @@ -198,7 +198,7 @@ static int kobil_startup (struct usb_serial *serial) static void kobil_shutdown (struct usb_serial *serial) { int i; - dbg("%s - port %d", __FUNCTION__, serial->port[0]->number); + dbg("%s - port %d", __func__, serial->port[0]->number); for (i=0; i < serial->num_ports; ++i) { while (serial->port[i]->open_count > 0) { @@ -218,7 +218,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) int transfer_buffer_length = 8; int write_urb_transfer_buffer_length = 8; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); priv = usb_get_serial_port_data(port); // someone sets the dev to 0 if the close method has been called @@ -245,10 +245,10 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) // allocate write_urb if (!port->write_urb) { - dbg("%s - port %d Allocating port->write_urb", __FUNCTION__, port->number); + dbg("%s - port %d Allocating port->write_urb", __func__, port->number); port->write_urb = usb_alloc_urb(0, GFP_KERNEL); if (!port->write_urb) { - dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number); + dbg("%s - port %d usb_alloc_urb failed", __func__, port->number); kfree(transfer_buffer); return -ENOMEM; } @@ -274,7 +274,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) transfer_buffer_length, KOBIL_TIMEOUT ); - dbg("%s - port %d Send get_HW_version URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send get_HW_version URB returns: %i", __func__, port->number, result); dbg("Harware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] ); // get firmware version @@ -288,7 +288,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) transfer_buffer_length, KOBIL_TIMEOUT ); - dbg("%s - port %d Send get_FW_version URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send get_FW_version URB returns: %i", __func__, port->number, result); dbg("Firmware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] ); if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { @@ -303,7 +303,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) 0, KOBIL_TIMEOUT ); - dbg("%s - port %d Send set_baudrate URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send set_baudrate URB returns: %i", __func__, port->number, result); // reset all queues result = usb_control_msg( port->serial->dev, @@ -316,13 +316,13 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) 0, KOBIL_TIMEOUT ); - dbg("%s - port %d Send reset_all_queues URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send reset_all_queues URB returns: %i", __func__, port->number, result); } if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) { // start reading (Adapter B 'cause PNP string) result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC ); - dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send read URB returns: %i", __func__, port->number, result); } kfree(transfer_buffer); @@ -332,7 +332,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) static void kobil_close (struct usb_serial_port *port, struct file *filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (port->write_urb) { usb_kill_urb(port->write_urb); @@ -352,11 +352,11 @@ static void kobil_read_int_callback(struct urb *urb) int status = urb->status; // char *dbg_data; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - port %d Read int status not zero: %d", - __FUNCTION__, port->number, status); + __func__, port->number, status); return; } @@ -386,7 +386,7 @@ static void kobil_read_int_callback(struct urb *urb) port->interrupt_in_urb->dev = port->serial->dev; result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); - dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send read URB returns: %i", __func__, port->number, result); } @@ -404,21 +404,21 @@ static int kobil_write (struct usb_serial_port *port, struct kobil_private * priv; if (count == 0) { - dbg("%s - port %d write request of 0 bytes", __FUNCTION__, port->number); + dbg("%s - port %d write request of 0 bytes", __func__, port->number); return 0; } priv = usb_get_serial_port_data(port); if (count > (KOBIL_BUF_LENGTH - priv->filled)) { - dbg("%s - port %d Error: write request bigger than buffer size", __FUNCTION__, port->number); + dbg("%s - port %d Error: write request bigger than buffer size", __func__, port->number); return -ENOMEM; } // Copy data to buffer memcpy (priv->buf + priv->filled, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, priv->buf + priv->filled); + usb_serial_debug_data(debug, &port->dev, __func__, count, priv->buf + priv->filled); priv->filled = priv->filled + count; @@ -450,7 +450,7 @@ static int kobil_write (struct usb_serial_port *port, priv->cur_pos = priv->cur_pos + length; result = usb_submit_urb( port->write_urb, GFP_NOIO ); - dbg("%s - port %d Send write URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send write URB returns: %i", __func__, port->number, result); todo = priv->filled - priv->cur_pos; if (todo > 0) { @@ -471,7 +471,7 @@ static int kobil_write (struct usb_serial_port *port, port->interrupt_in_urb->dev = port->serial->dev; result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO ); - dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send read URB returns: %i", __func__, port->number, result); } } return count; @@ -480,7 +480,7 @@ static int kobil_write (struct usb_serial_port *port, static int kobil_write_room (struct usb_serial_port *port) { - //dbg("%s - port %d", __FUNCTION__, port->number); + //dbg("%s - port %d", __func__, port->number); return 8; } @@ -515,7 +515,7 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file) KOBIL_TIMEOUT); dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x", - __FUNCTION__, port->number, result, transfer_buffer[0]); + __func__, port->number, result, transfer_buffer[0]); result = 0; if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) @@ -558,9 +558,9 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file, if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) { if (dtr != 0) - dbg("%s - port %d Setting DTR", __FUNCTION__, port->number); + dbg("%s - port %d Setting DTR", __func__, port->number); else - dbg("%s - port %d Clearing DTR", __FUNCTION__, port->number); + dbg("%s - port %d Clearing DTR", __func__, port->number); result = usb_control_msg( port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0 ), SUSBCRequest_SetStatusLinesOrQueues, @@ -572,9 +572,9 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file, KOBIL_TIMEOUT); } else { if (rts != 0) - dbg("%s - port %d Setting RTS", __FUNCTION__, port->number); + dbg("%s - port %d Setting RTS", __func__, port->number); else - dbg("%s - port %d Clearing RTS", __FUNCTION__, port->number); + dbg("%s - port %d Clearing RTS", __func__, port->number); result = usb_control_msg( port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0 ), SUSBCRequest_SetStatusLinesOrQueues, @@ -585,7 +585,7 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file, 0, KOBIL_TIMEOUT); } - dbg("%s - port %d Send set_status_line URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send set_status_line URB returns: %i", __func__, port->number, result); kfree(transfer_buffer); return (result < 0) ? result : 0; } @@ -678,7 +678,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file * file, unsigne KOBIL_TIMEOUT ); - dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __FUNCTION__, port->number, result); + dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __func__, port->number, result); kfree(transfer_buffer); return (result < 0) ? -EFAULT : 0; default: diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index b9e0fbacc8a..e25c0c2791e 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -399,7 +399,7 @@ static void mct_u232_shutdown (struct usb_serial *serial) struct mct_u232_private *priv; int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i=0; i < serial->num_ports; ++i) { /* My special items, the standard routines free my urbs */ @@ -421,7 +421,7 @@ static int mct_u232_open (struct usb_serial_port *port, struct file *filp) unsigned char last_lcr; unsigned char last_msr; - dbg("%s port %d", __FUNCTION__, port->number); + dbg("%s port %d", __func__, port->number); /* Compensate for a hardware bug: although the Sitecom U232-P25 * device reports a maximum output packet size of 32 bytes, @@ -486,7 +486,7 @@ static void mct_u232_close (struct usb_serial_port *port, struct file *filp) unsigned int c_cflag; unsigned int control_state; struct mct_u232_private *priv = usb_get_serial_port_data(port); - dbg("%s port %d", __FUNCTION__, port->number); + dbg("%s port %d", __func__, port->number); if (port->tty) { c_cflag = port->tty->termios->c_cflag; @@ -532,21 +532,21 @@ static void mct_u232_read_int_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } if (!serial) { - dbg("%s - bad serial pointer, exiting", __FUNCTION__); + dbg("%s - bad serial pointer, exiting", __func__); return; } - dbg("%s - port %d", __FUNCTION__, port->number); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + dbg("%s - port %d", __func__, port->number); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* * Work-a-round: handle the 'usual' bulk-in pipe here @@ -603,7 +603,7 @@ exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } /* mct_u232_read_int_callback */ static void mct_u232_set_termios (struct usb_serial_port *port, @@ -633,7 +633,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port, /* reassert DTR and RTS on transition from B0 */ if ((old_cflag & CBAUD) == B0) { - dbg("%s: baud was B0", __FUNCTION__); + dbg("%s: baud was B0", __func__); control_state |= TIOCM_DTR | TIOCM_RTS; mct_u232_set_modem_ctrl(serial, control_state); } @@ -641,7 +641,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port, mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port->tty)); if ((cflag & CBAUD) == B0 ) { - dbg("%s: baud is B0", __FUNCTION__); + dbg("%s: baud is B0", __func__); /* Drop RTS and DTR */ control_state &= ~(TIOCM_DTR | TIOCM_RTS); mct_u232_set_modem_ctrl(serial, control_state); @@ -696,7 +696,7 @@ static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state ) unsigned char lcr; unsigned long flags; - dbg("%sstate=%d", __FUNCTION__, break_state); + dbg("%sstate=%d", __func__, break_state); spin_lock_irqsave(&priv->lock, flags); lcr = priv->last_lcr; @@ -715,7 +715,7 @@ static int mct_u232_tiocmget (struct usb_serial_port *port, struct file *file) unsigned int control_state; unsigned long flags; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); spin_lock_irqsave(&priv->lock, flags); control_state = priv->control_state; @@ -732,7 +732,7 @@ static int mct_u232_tiocmset (struct usb_serial_port *port, struct file *file, unsigned int control_state; unsigned long flags; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); spin_lock_irqsave(&priv->lock, flags); control_state = priv->control_state; @@ -754,7 +754,7 @@ static int mct_u232_tiocmset (struct usb_serial_port *port, struct file *file, static int mct_u232_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) { - dbg("%scmd=0x%x", __FUNCTION__, cmd); + dbg("%scmd=0x%x", __func__, cmd); /* Based on code from acm.c and others */ switch (cmd) { @@ -769,7 +769,7 @@ static int mct_u232_ioctl (struct usb_serial_port *port, struct file * file, return 0; default: - dbg("%s: arg not supported - 0x%04x", __FUNCTION__,cmd); + dbg("%s: arg not supported - 0x%04x", __func__,cmd); return(-ENOIOCTLCMD); break; } @@ -784,7 +784,7 @@ static void mct_u232_throttle (struct usb_serial_port *port) struct tty_struct *tty; tty = port->tty; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); priv->rx_flags |= THROTTLED; @@ -806,7 +806,7 @@ static void mct_u232_unthrottle (struct usb_serial_port *port) unsigned int control_state; struct tty_struct *tty; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); tty = port->tty; spin_lock_irqsave(&priv->lock, flags); diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 2e14fdd0846..74b889bf19c 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -118,11 +118,11 @@ static void mos7720_interrupt_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } @@ -183,7 +183,7 @@ exit: if (result) dev_err(&urb->dev->dev, "%s - Error %d submitting control urb\n", - __FUNCTION__, result); + __func__, result); return; } @@ -214,7 +214,7 @@ static void mos7720_bulk_in_callback(struct urb *urb) port = mos7720_port->port; - dbg("Entering...%s", __FUNCTION__); + dbg("Entering...%s", __func__); data = urb->transfer_buffer; @@ -362,7 +362,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp) urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); if (!urb->transfer_buffer) { - err("%s-out of memory for urb buffers.", __FUNCTION__); + err("%s-out of memory for urb buffers.", __func__); usb_free_urb(mos7720_port->write_urb_pool[j]); mos7720_port->write_urb_pool[j] = NULL; continue; @@ -479,7 +479,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp) if (response) dev_err(&port->dev, "%s - Error %d submitting control urb\n", - __FUNCTION__, response); + __func__, response); } /* set up our bulk in urb */ @@ -492,7 +492,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp) response = usb_submit_urb(port->read_urb, GFP_KERNEL); if (response) dev_err(&port->dev, - "%s - Error %d submitting read urb\n", __FUNCTION__, response); + "%s - Error %d submitting read urb\n", __func__, response); /* initialize our icount structure */ memset(&(mos7720_port->icount), 0x00, sizeof(mos7720_port->icount)); @@ -521,11 +521,11 @@ static int mos7720_chars_in_buffer(struct usb_serial_port *port) int chars = 0; struct moschip_port *mos7720_port; - dbg("%s:entering ...........", __FUNCTION__); + dbg("%s:entering ...........", __func__); mos7720_port = usb_get_serial_port_data(port); if (mos7720_port == NULL) { - dbg("%s:leaving ...........", __FUNCTION__); + dbg("%s:leaving ...........", __func__); return -ENODEV; } @@ -533,7 +533,7 @@ static int mos7720_chars_in_buffer(struct usb_serial_port *port) if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) chars += URB_TRANSFER_BUFFER_SIZE; } - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return chars; } @@ -585,7 +585,7 @@ static void mos7720_close(struct usb_serial_port *port, struct file *filp) mutex_unlock(&serial->disc_mutex); mos7720_port->open = 0; - dbg("Leaving %s", __FUNCTION__); + dbg("Leaving %s", __func__); } static void mos7720_break(struct usb_serial_port *port, int break_state) @@ -594,7 +594,7 @@ static void mos7720_break(struct usb_serial_port *port, int break_state) struct usb_serial *serial; struct moschip_port *mos7720_port; - dbg("Entering %s", __FUNCTION__); + dbg("Entering %s", __func__); serial = port->serial; @@ -627,11 +627,11 @@ static int mos7720_write_room(struct usb_serial_port *port) int room = 0; int i; - dbg("%s:entering ...........", __FUNCTION__); + dbg("%s:entering ...........", __func__); mos7720_port = usb_get_serial_port_data(port); if (mos7720_port == NULL) { - dbg("%s:leaving ...........", __FUNCTION__); + dbg("%s:leaving ...........", __func__); return -ENODEV; } @@ -640,7 +640,7 @@ static int mos7720_write_room(struct usb_serial_port *port) room += URB_TRANSFER_BUFFER_SIZE; } - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -657,7 +657,7 @@ static int mos7720_write(struct usb_serial_port *port, struct urb *urb; const unsigned char *current_position = data; - dbg("%s:entering ...........", __FUNCTION__); + dbg("%s:entering ...........", __func__); serial = port->serial; @@ -679,7 +679,7 @@ static int mos7720_write(struct usb_serial_port *port, } if (urb == NULL) { - dbg("%s - no more free urbs", __FUNCTION__); + dbg("%s - no more free urbs", __func__); goto exit; } @@ -687,14 +687,14 @@ static int mos7720_write(struct usb_serial_port *port, urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); if (urb->transfer_buffer == NULL) { - err("%s no more kernel memory...", __FUNCTION__); + err("%s no more kernel memory...", __func__); goto exit; } } transfer_size = min (count, URB_TRANSFER_BUFFER_SIZE); memcpy(urb->transfer_buffer, current_position, transfer_size); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, + usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, urb->transfer_buffer); /* fill urb with data and submit */ @@ -708,7 +708,7 @@ static int mos7720_write(struct usb_serial_port *port, status = usb_submit_urb(urb,GFP_ATOMIC); if (status) { err("%s - usb_submit_urb(write bulk) failed with status = %d", - __FUNCTION__, status); + __func__, status); bytes_sent = status; goto exit; } @@ -724,7 +724,7 @@ static void mos7720_throttle(struct usb_serial_port *port) struct tty_struct *tty; int status; - dbg("%s- port %d\n", __FUNCTION__, port->number); + dbg("%s- port %d\n", __func__, port->number); mos7720_port = usb_get_serial_port_data(port); @@ -736,11 +736,11 @@ static void mos7720_throttle(struct usb_serial_port *port) return; } - dbg("%s: Entering ..........", __FUNCTION__); + dbg("%s: Entering ..........", __func__); tty = port->tty; if (!tty) { - dbg("%s - no tty available", __FUNCTION__); + dbg("%s - no tty available", __func__); return; } @@ -773,15 +773,15 @@ static void mos7720_unthrottle(struct usb_serial_port *port) return; if (!mos7720_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } - dbg("%s: Entering ..........", __FUNCTION__); + dbg("%s: Entering ..........", __func__); tty = port->tty; if (!tty) { - dbg("%s - no tty available", __FUNCTION__); + dbg("%s - no tty available", __func__); return; } @@ -922,7 +922,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor) __u16 round; - dbg("%s - %d", __FUNCTION__, baudrate); + dbg("%s - %d", __func__, baudrate); for (i = 0; i < ARRAY_SIZE(divisor_table); i++) { if (divisor_table[i].baudrate == baudrate) { @@ -973,15 +973,15 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, port = mos7720_port->port; serial = port->serial; - dbg("%s: Entering ..........", __FUNCTION__); + dbg("%s: Entering ..........", __func__); number = port->number - port->serial->minor; - dbg("%s - port = %d, baud = %d", __FUNCTION__, port->number, baudrate); + dbg("%s - port = %d, baud = %d", __func__, port->number, baudrate); /* Calculate the Divisor */ status = calc_baud_rate_divisor(baudrate, &divisor); if (status) { - err("%s - bad baud rate", __FUNCTION__); + err("%s - bad baud rate", __func__); return status; } @@ -1034,16 +1034,16 @@ static void change_port_settings(struct moschip_port *mos7720_port, serial = port->serial; port_number = port->number - port->serial->minor; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!mos7720_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } tty = mos7720_port->port->tty; - dbg("%s: Entering ..........", __FUNCTION__); + dbg("%s: Entering ..........", __func__); lData = UART_LCR_WLEN8; lStop = 0x00; /* 1 stop bit */ @@ -1078,14 +1078,14 @@ static void change_port_settings(struct moschip_port *mos7720_port, if (cflag & PARENB) { if (cflag & PARODD) { lParity = UART_LCR_PARITY; - dbg("%s - parity = odd", __FUNCTION__); + dbg("%s - parity = odd", __func__); } else { lParity = (UART_LCR_EPAR | UART_LCR_PARITY); - dbg("%s - parity = even", __FUNCTION__); + dbg("%s - parity = even", __func__); } } else { - dbg("%s - parity = none", __FUNCTION__); + dbg("%s - parity = none", __func__); } if (cflag & CMSPAR) @@ -1094,10 +1094,10 @@ static void change_port_settings(struct moschip_port *mos7720_port, /* Change the Stop bit */ if (cflag & CSTOPB) { lStop = UART_LCR_STOP; - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); } else { lStop = 0x00; - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); } #define LCR_BITS_MASK 0x03 /* Mask for bits/char field */ @@ -1171,7 +1171,7 @@ static void change_port_settings(struct moschip_port *mos7720_port, return; } - dbg("%s - baud rate = %d", __FUNCTION__, baud); + dbg("%s - baud rate = %d", __func__, baud); status = send_cmd_write_baud_rate(mos7720_port, baud); /* FIXME: needs to write actual resulting baud back not just blindly do so */ @@ -1217,7 +1217,7 @@ static void mos7720_set_termios(struct usb_serial_port *port, if (!mos7720_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } @@ -1225,15 +1225,15 @@ static void mos7720_set_termios(struct usb_serial_port *port, cflag = tty->termios->c_cflag; - dbg("%s - cflag %08x iflag %08x", __FUNCTION__, + dbg("%s - cflag %08x iflag %08x", __func__, tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); - dbg("%s - old cflag %08x old iflag %08x", __FUNCTION__, + dbg("%s - old cflag %08x old iflag %08x", __func__, old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* change the port settings to the new ones specified */ change_port_settings(mos7720_port, old_termios); @@ -1271,7 +1271,7 @@ static int get_lsr_info(struct moschip_port *mos7720_port, count = mos7720_chars_in_buffer(mos7720_port->port); if (count == 0) { - dbg("%s -- Empty", __FUNCTION__); + dbg("%s -- Empty", __func__); result = TIOCSER_TEMT; } @@ -1296,7 +1296,7 @@ static int get_number_bytes_avail(struct moschip_port *mos7720_port, result = tty->read_cnt; - dbg("%s(%d) = %d", __FUNCTION__, mos7720_port->port->number, result); + dbg("%s(%d) = %d", __func__, mos7720_port->port->number, result); if (copy_to_user(value, &result, sizeof(int))) return -EFAULT; @@ -1374,7 +1374,7 @@ static int get_modem_info(struct moschip_port *mos7720_port, | ((msr & UART_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ - dbg("%s -- %x", __FUNCTION__, result); + dbg("%s -- %x", __func__, result); if (copy_to_user(value, &result, sizeof(int))) return -EFAULT; @@ -1418,45 +1418,45 @@ static int mos7720_ioctl(struct usb_serial_port *port, struct file *file, if (mos7720_port == NULL) return -ENODEV; - dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); switch (cmd) { case TIOCINQ: /* return number of bytes available */ - dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number); + dbg("%s (%d) TIOCINQ", __func__, port->number); return get_number_bytes_avail(mos7720_port, (unsigned int __user *)arg); break; case TIOCSERGETLSR: - dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); + dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); return get_lsr_info(mos7720_port, (unsigned int __user *)arg); return 0; case TIOCMBIS: case TIOCMBIC: case TIOCMSET: - dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, + dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __func__, port->number); return set_modem_info(mos7720_port, cmd, (unsigned int __user *)arg); case TIOCMGET: - dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number); + dbg("%s (%d) TIOCMGET", __func__, port->number); return get_modem_info(mos7720_port, (unsigned int __user *)arg); case TIOCGSERIAL: - dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number); + dbg("%s (%d) TIOCGSERIAL", __func__, port->number); return get_serial_info(mos7720_port, (struct serial_struct __user *)arg); case TIOCSSERIAL: - dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number); + dbg("%s (%d) TIOCSSERIAL", __func__, port->number); break; case TIOCMIWAIT: - dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number); + dbg("%s (%d) TIOCMIWAIT", __func__, port->number); cprev = mos7720_port->icount; while (1) { if (signal_pending(current)) @@ -1490,7 +1490,7 @@ static int mos7720_ioctl(struct usb_serial_port *port, struct file *file, icount.brk = cnow.brk; icount.buf_overrun = cnow.buf_overrun; - dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, + dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, icount.rx, icount.tx ); if (copy_to_user((void __user *)arg, &icount, sizeof(icount))) return -EFAULT; @@ -1508,7 +1508,7 @@ static int mos7720_startup(struct usb_serial *serial) int i; char data; - dbg("%s: Entering ..........", __FUNCTION__); + dbg("%s: Entering ..........", __func__); if (!serial) { dbg("Invalid Handler"); @@ -1520,7 +1520,7 @@ static int mos7720_startup(struct usb_serial *serial) /* create our private serial structure */ mos7720_serial = kzalloc(sizeof(struct moschip_serial), GFP_KERNEL); if (mos7720_serial == NULL) { - err("%s - Out of memory", __FUNCTION__); + err("%s - Out of memory", __func__); return -ENOMEM; } @@ -1533,7 +1533,7 @@ static int mos7720_startup(struct usb_serial *serial) for (i = 0; i < serial->num_ports; ++i) { mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); if (mos7720_port == NULL) { - err("%s - Out of memory", __FUNCTION__); + err("%s - Out of memory", __func__); usb_set_serial_data(serial, NULL); kfree(mos7720_serial); return -ENOMEM; @@ -1617,7 +1617,7 @@ static int __init moschip7720_init(void) { int retval; - dbg("%s: Entering ..........", __FUNCTION__); + dbg("%s: Entering ..........", __func__); /* Register with the usb serial */ retval = usb_serial_register(&moschip7720_2port_driver); diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 37c4f0736bc..7823222570b 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -403,7 +403,7 @@ static void mos7840_handle_new_lsr(struct moschip_port *port, __u8 new_lsr) { struct async_icount *icount; - dbg("%s - %02x", __FUNCTION__, new_lsr); + dbg("%s - %02x", __func__, new_lsr); if (new_lsr & SERIAL_LSR_BI) { // @@ -459,21 +459,21 @@ static void mos7840_control_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } - dbg("%s urb buffer size is %d\n", __FUNCTION__, urb->actual_length); - dbg("%s mos7840_port->MsrLsr is %d port %d\n", __FUNCTION__, + dbg("%s urb buffer size is %d\n", __func__, urb->actual_length); + dbg("%s mos7840_port->MsrLsr is %d port %d\n", __func__, mos7840_port->MsrLsr, mos7840_port->port_num); data = urb->transfer_buffer; regval = (__u8) data[0]; - dbg("%s data is %x\n", __FUNCTION__, regval); + dbg("%s data is %x\n", __func__, regval); if (mos7840_port->MsrLsr == 0) mos7840_handle_new_msr(mos7840_port, regval); else if (mos7840_port->MsrLsr == 1) @@ -487,7 +487,7 @@ exit: if (result) { dev_err(&urb->dev->dev, "%s - Error %d submitting interrupt urb\n", - __FUNCTION__, result); + __func__, result); } } @@ -542,11 +542,11 @@ static void mos7840_interrupt_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } @@ -614,7 +614,7 @@ exit: if (result) { dev_err(&urb->dev->dev, "%s - Error %d submitting interrupt urb\n", - __FUNCTION__, result); + __func__, result); } } @@ -692,12 +692,12 @@ static void mos7840_bulk_in_callback(struct urb *urb) } port = (struct usb_serial_port *)mos7840_port->port; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Port Paranoia failed \n"); return; } - serial = mos7840_get_usb_serial(port, __FUNCTION__); + serial = mos7840_get_usb_serial(port, __func__); if (!serial) { dbg("%s\n", "Bad serial pointer "); return; @@ -767,7 +767,7 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) return; } - if (mos7840_port_paranoia_check(mos7840_port->port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(mos7840_port->port, __func__)) { dbg("%s", "Port Paranoia failed \n"); return; } @@ -815,14 +815,14 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp) struct moschip_port *mos7840_port; struct moschip_port *port0; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Port Paranoia failed \n"); return -ENODEV; } serial = port->serial; - if (mos7840_serial_paranoia_check(serial, __FUNCTION__)) { + if (mos7840_serial_paranoia_check(serial, __func__)) { dbg("%s", "Serial Paranoia failed \n"); return -ENODEV; } @@ -851,7 +851,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp) if (!urb->transfer_buffer) { usb_free_urb(urb); mos7840_port->write_urb_pool[j] = NULL; - err("%s-out of memory for urb buffers.", __FUNCTION__); + err("%s-out of memory for urb buffers.", __func__); continue; } } @@ -1039,7 +1039,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp) GFP_KERNEL); if (response) { err("%s - Error %d submitting interrupt urb", - __FUNCTION__, response); + __func__, response); } } @@ -1072,7 +1072,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp) port->bulk_in_endpointAddress); response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); if (response) { - err("%s - Error %d submitting control urb", __FUNCTION__, + err("%s - Error %d submitting control urb", __func__, response); } @@ -1116,7 +1116,7 @@ static int mos7840_chars_in_buffer(struct usb_serial_port *port) dbg("%s \n", " mos7840_chars_in_buffer:entering ..........."); - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return -1; } @@ -1134,7 +1134,7 @@ static int mos7840_chars_in_buffer(struct usb_serial_port *port) } } spin_unlock_irqrestore(&mos7840_port->pool_lock,flags); - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return chars; } @@ -1171,7 +1171,7 @@ static void mos7840_block_until_tx_empty(struct moschip_port *mos7840_port) /* No activity.. count down section */ wait--; if (wait == 0) { - dbg("%s - TIMEOUT", __FUNCTION__); + dbg("%s - TIMEOUT", __func__); return; } else { /* Reset timeout value back to seconds */ @@ -1195,12 +1195,12 @@ static void mos7840_close(struct usb_serial_port *port, struct file *filp) dbg("%s\n", "mos7840_close:entering..."); - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Port Paranoia failed \n"); return; } - serial = mos7840_get_usb_serial(port, __FUNCTION__); + serial = mos7840_get_usb_serial(port, __func__); if (!serial) { dbg("%s", "Serial Paranoia failed \n"); return; @@ -1314,7 +1314,7 @@ static void mos7840_block_until_chase_response(struct moschip_port /* No activity.. count down section */ wait--; if (wait == 0) { - dbg("%s - TIMEOUT", __FUNCTION__); + dbg("%s - TIMEOUT", __func__); return; } else { /* Reset timeout value back to seconds */ @@ -1337,12 +1337,12 @@ static void mos7840_break(struct usb_serial_port *port, int break_state) dbg("%s \n", "Entering ..........."); dbg("mos7840_break: Start\n"); - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Port Paranoia failed \n"); return; } - serial = mos7840_get_usb_serial(port, __FUNCTION__); + serial = mos7840_get_usb_serial(port, __func__); if (!serial) { dbg("%s", "Serial Paranoia failed \n"); return; @@ -1392,7 +1392,7 @@ static int mos7840_write_room(struct usb_serial_port *port) dbg("%s \n", " mos7840_write_room:entering ..........."); - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); dbg("%s \n", " mos7840_write_room:leaving ..........."); return -1; @@ -1413,7 +1413,7 @@ static int mos7840_write_room(struct usb_serial_port *port) spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); room = (room == 0) ? 0 : room - URB_TRANSFER_BUFFER_SIZE + 1; - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -1480,13 +1480,13 @@ static int mos7840_write(struct usb_serial_port *port, status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data); #endif - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Port Paranoia failed \n"); return -1; } serial = port->serial; - if (mos7840_serial_paranoia_check(serial, __FUNCTION__)) { + if (mos7840_serial_paranoia_check(serial, __func__)) { dbg("%s", "Serial Paranoia failed \n"); return -1; } @@ -1512,7 +1512,7 @@ static int mos7840_write(struct usb_serial_port *port, spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); if (urb == NULL) { - dbg("%s - no more free urbs", __FUNCTION__); + dbg("%s - no more free urbs", __func__); goto exit; } @@ -1521,7 +1521,7 @@ static int mos7840_write(struct usb_serial_port *port, kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); if (urb->transfer_buffer == NULL) { - err("%s no more kernel memory...", __FUNCTION__); + err("%s no more kernel memory...", __func__); goto exit; } } @@ -1547,7 +1547,7 @@ static int mos7840_write(struct usb_serial_port *port, if (status) { mos7840_port->busy[i] = 0; err("%s - usb_submit_urb(write bulk) failed with status = %d", - __FUNCTION__, status); + __func__, status); bytes_sent = status; goto exit; } @@ -1573,7 +1573,7 @@ static void mos7840_throttle(struct usb_serial_port *port) struct tty_struct *tty; int status; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return; } @@ -1594,7 +1594,7 @@ static void mos7840_throttle(struct usb_serial_port *port) tty = port->tty; if (!tty) { - dbg("%s - no tty available", __FUNCTION__); + dbg("%s - no tty available", __func__); return; } @@ -1634,7 +1634,7 @@ static void mos7840_unthrottle(struct usb_serial_port *port) int status; struct moschip_port *mos7840_port = mos7840_get_port_private(port); - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return; } @@ -1643,7 +1643,7 @@ static void mos7840_unthrottle(struct usb_serial_port *port) return; if (!mos7840_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } @@ -1651,7 +1651,7 @@ static void mos7840_unthrottle(struct usb_serial_port *port) tty = port->tty; if (!tty) { - dbg("%s - no tty available", __FUNCTION__); + dbg("%s - no tty available", __func__); return; } @@ -1688,7 +1688,7 @@ static int mos7840_tiocmget(struct usb_serial_port *port, struct file *file) int status = 0; mos7840_port = mos7840_get_port_private(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (mos7840_port == NULL) return -ENODEV; @@ -1703,7 +1703,7 @@ static int mos7840_tiocmget(struct usb_serial_port *port, struct file *file) | ((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) | ((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); - dbg("%s - 0x%04X", __FUNCTION__, result); + dbg("%s - 0x%04X", __func__, result); return result; } @@ -1715,7 +1715,7 @@ static int mos7840_tiocmset(struct usb_serial_port *port, struct file *file, unsigned int mcr; unsigned int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); mos7840_port = mos7840_get_port_private(port); @@ -1759,7 +1759,7 @@ static int mos7840_calc_baud_rate_divisor(int baudRate, int *divisor, __u16 * clk_sel_val) { - dbg("%s - %d", __FUNCTION__, baudRate); + dbg("%s - %d", __func__, baudRate); if (baudRate <= 115200) { *divisor = 115200 / baudRate; @@ -1842,12 +1842,12 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, return -1; port = (struct usb_serial_port *)mos7840_port->port; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return -1; } - if (mos7840_serial_paranoia_check(port->serial, __FUNCTION__)) { + if (mos7840_serial_paranoia_check(port->serial, __func__)) { dbg("%s", "Invalid Serial \n"); return -1; } @@ -1856,7 +1856,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, number = mos7840_port->port->number - mos7840_port->port->serial->minor; - dbg("%s - port = %d, baud = %d", __FUNCTION__, + dbg("%s - port = %d, baud = %d", __func__, mos7840_port->port->number, baudRate); //reset clk_uart_sel in spregOffset if (baudRate > 115200) { @@ -1916,7 +1916,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, /* Calculate the Divisor */ if (status) { - err("%s - bad baud rate", __FUNCTION__); + err("%s - bad baud rate", __func__); dbg("%s\n", "bad baud rate"); return status; } @@ -1970,22 +1970,22 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port, port = (struct usb_serial_port *)mos7840_port->port; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return; } - if (mos7840_serial_paranoia_check(port->serial, __FUNCTION__)) { + if (mos7840_serial_paranoia_check(port->serial, __func__)) { dbg("%s", "Invalid Serial \n"); return; } serial = port->serial; - dbg("%s - port %d", __FUNCTION__, mos7840_port->port->number); + dbg("%s - port %d", __func__, mos7840_port->port->number); if (!mos7840_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } @@ -2024,14 +2024,14 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port, if (cflag & PARENB) { if (cflag & PARODD) { lParity = LCR_PAR_ODD; - dbg("%s - parity = odd", __FUNCTION__); + dbg("%s - parity = odd", __func__); } else { lParity = LCR_PAR_EVEN; - dbg("%s - parity = even", __FUNCTION__); + dbg("%s - parity = even", __func__); } } else { - dbg("%s - parity = none", __FUNCTION__); + dbg("%s - parity = none", __func__); } if (cflag & CMSPAR) { @@ -2041,10 +2041,10 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port, /* Change the Stop bit */ if (cflag & CSTOPB) { lStop = LCR_STOP_2; - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); } else { lStop = LCR_STOP_1; - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); } /* Update the LCR with the correct value */ @@ -2101,7 +2101,7 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port, baud = 9600; } - dbg("%s - baud rate = %d", __FUNCTION__, baud); + dbg("%s - baud rate = %d", __func__, baud); status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); /* Enable Interrupts */ @@ -2141,14 +2141,14 @@ static void mos7840_set_termios(struct usb_serial_port *port, struct moschip_port *mos7840_port; struct tty_struct *tty; dbg("mos7840_set_termios: START\n"); - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return; } serial = port->serial; - if (mos7840_serial_paranoia_check(serial, __FUNCTION__)) { + if (mos7840_serial_paranoia_check(serial, __func__)) { dbg("%s", "Invalid Serial \n"); return; } @@ -2161,7 +2161,7 @@ static void mos7840_set_termios(struct usb_serial_port *port, tty = port->tty; if (!mos7840_port->open) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); return; } @@ -2169,11 +2169,11 @@ static void mos7840_set_termios(struct usb_serial_port *port, cflag = tty->termios->c_cflag; - dbg("%s - clfag %08x iflag %08x", __FUNCTION__, + dbg("%s - clfag %08x iflag %08x", __func__, tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); - dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, + dbg("%s - old clfag %08x old iflag %08x", __func__, old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* change the port settings to the new ones specified */ @@ -2214,7 +2214,7 @@ static int mos7840_get_lsr_info(struct moschip_port *mos7840_port, count = mos7840_chars_in_buffer(mos7840_port->port); if (count == 0) { - dbg("%s -- Empty", __FUNCTION__); + dbg("%s -- Empty", __func__); result = TIOCSER_TEMT; } @@ -2241,7 +2241,7 @@ static int mos7840_set_modem_info(struct moschip_port *mos7840_port, return -1; port = (struct usb_serial_port *)mos7840_port->port; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return -1; } @@ -2315,7 +2315,7 @@ static int mos7840_get_modem_info(struct moschip_port *mos7840_port, |((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */ |((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */ - dbg("%s -- %x", __FUNCTION__, result); + dbg("%s -- %x", __func__, result); if (copy_to_user(value, &result, sizeof(int))) return -EFAULT; @@ -2372,7 +2372,7 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file, struct serial_icounter_struct icount; int mosret = 0; - if (mos7840_port_paranoia_check(port, __FUNCTION__)) { + if (mos7840_port_paranoia_check(port, __func__)) { dbg("%s", "Invalid port \n"); return -1; } @@ -2384,39 +2384,39 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file, tty = mos7840_port->port->tty; - dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); switch (cmd) { /* return number of bytes available */ case TIOCSERGETLSR: - dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); + dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); return mos7840_get_lsr_info(mos7840_port, argp); return 0; case TIOCMBIS: case TIOCMBIC: case TIOCMSET: - dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, + dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __func__, port->number); mosret = mos7840_set_modem_info(mos7840_port, cmd, argp); return mosret; case TIOCMGET: - dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number); + dbg("%s (%d) TIOCMGET", __func__, port->number); return mos7840_get_modem_info(mos7840_port, argp); case TIOCGSERIAL: - dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number); + dbg("%s (%d) TIOCGSERIAL", __func__, port->number); return mos7840_get_serial_info(mos7840_port, argp); case TIOCSSERIAL: - dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number); + dbg("%s (%d) TIOCSSERIAL", __func__, port->number); break; case TIOCMIWAIT: - dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number); + dbg("%s (%d) TIOCMIWAIT", __func__, port->number); cprev = mos7840_port->icount; while (1) { //interruptible_sleep_on(&mos7840_port->delta_msr_wait); @@ -2459,7 +2459,7 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file, icount.brk = cnow.brk; icount.buf_overrun = cnow.buf_overrun; - dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, + dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, icount.rx, icount.tx); if (copy_to_user(argp, &icount, sizeof(icount))) return -EFAULT; @@ -2522,7 +2522,7 @@ static int mos7840_startup(struct usb_serial *serial) for (i = 0; i < serial->num_ports; ++i) { mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); if (mos7840_port == NULL) { - err("%s - Out of memory", __FUNCTION__); + err("%s - Out of memory", __func__); status = -ENOMEM; i--; /* don't follow NULL pointer cleaning up */ goto error; diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c index ddaccbcde84..7cea325d577 100644 --- a/drivers/usb/serial/navman.c +++ b/drivers/usb/serial/navman.c @@ -49,15 +49,15 @@ static void navman_read_int_callback(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); tty = port->tty; @@ -72,29 +72,29 @@ exit: if (result) dev_err(&urb->dev->dev, "%s - Error %d submitting interrupt urb\n", - __FUNCTION__, result); + __func__, result); } static int navman_open(struct usb_serial_port *port, struct file *filp) { int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (port->interrupt_in_urb) { - dbg("%s - adding interrupt input for treo", __FUNCTION__); + dbg("%s - adding interrupt input for treo", __func__); result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) dev_err(&port->dev, "%s - failed submitting interrupt urb, error %d\n", - __FUNCTION__, result); + __func__, result); } return result; } static void navman_close(struct usb_serial_port *port, struct file *filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); usb_kill_urb(port->interrupt_in_urb); } @@ -102,7 +102,7 @@ static void navman_close(struct usb_serial_port *port, struct file *filp) static int navman_write(struct usb_serial_port *port, const unsigned char *buf, int count) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * This device can't write any data, only read from the device diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 050511ff2b1..1b041c59aab 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -150,7 +150,7 @@ static int omninet_attach (struct usb_serial *serial) od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL ); if( !od ) { - err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data)); + err("%s- kmalloc(%Zd) failed.", __func__, sizeof(struct omninet_data)); return -ENOMEM; } usb_set_serial_port_data(port, od); @@ -163,7 +163,7 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp) struct usb_serial_port *wport; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); wport = serial->port[1]; wport->tty = port->tty; @@ -175,7 +175,7 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp) omninet_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) { - err("%s - failed submitting read urb, error %d", __FUNCTION__, result); + err("%s - failed submitting read urb, error %d", __func__, result); } return result; @@ -183,7 +183,7 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp) static void omninet_close (struct usb_serial_port *port, struct file * filp) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); usb_kill_urb(port->read_urb); } @@ -201,11 +201,11 @@ static void omninet_read_bulk_callback (struct urb *urb) int i; int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -233,7 +233,7 @@ static void omninet_read_bulk_callback (struct urb *urb) omninet_read_bulk_callback, port); result = usb_submit_urb(urb, GFP_ATOMIC); if (result) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + err("%s - failed resubmitting read urb, error %d", __func__, result); return; } @@ -248,17 +248,17 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return (0); } spin_lock_bh(&wport->lock); if (wport->write_urb_busy) { spin_unlock_bh(&wport->lock); - dbg("%s - already writing", __FUNCTION__); + dbg("%s - already writing", __func__); return 0; } wport->write_urb_busy = 1; @@ -268,7 +268,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, wport->write_urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, wport->write_urb->transfer_buffer); header->oh_seq = od->od_outseq++; header->oh_len = count; @@ -282,7 +282,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); if (result) { wport->write_urb_busy = 0; - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); } else result = count; @@ -300,7 +300,7 @@ static int omninet_write_room (struct usb_serial_port *port) if (wport->write_urb_busy) room = wport->bulk_out_size - OMNINET_HEADERLEN; - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return (room); } @@ -311,12 +311,12 @@ static void omninet_write_bulk_callback (struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *) urb->context; int status = urb->status; - dbg("%s - port %0x\n", __FUNCTION__, port->number); + dbg("%s - port %0x\n", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -328,7 +328,7 @@ static void omninet_shutdown (struct usb_serial *serial) { struct usb_serial_port *wport = serial->port[1]; struct usb_serial_port *port = serial->port[0]; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); usb_kill_urb(wport->write_urb); kfree(usb_get_serial_port_data(port)); diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f4914209871..920241897c9 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -408,24 +408,24 @@ module_exit(option_exit); static void option_rx_throttle(struct usb_serial_port *port) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void option_rx_unthrottle(struct usb_serial_port *port) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void option_break_ctl(struct usb_serial_port *port, int break_state) { /* Unfortunately, I don't know how to send a break */ - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void option_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Doesn't support option setting */ tty_termios_copy_hw(port->tty->termios, old_termios); option_send_setup(port); @@ -486,7 +486,7 @@ static int option_write(struct usb_serial_port *port, portdata = usb_get_serial_port_data(port); - dbg("%s: write (%d chars)", __FUNCTION__, count); + dbg("%s: write (%d chars)", __func__, count); i = 0; left = count; @@ -507,7 +507,7 @@ static int option_write(struct usb_serial_port *port, dbg("usb_write %p failed (err=%d)", this_urb, this_urb->status); - dbg("%s: endpoint %d buf %d", __FUNCTION__, + dbg("%s: endpoint %d buf %d", __func__, usb_pipeendpoint(this_urb->pipe), i); /* send the data */ @@ -529,7 +529,7 @@ static int option_write(struct usb_serial_port *port, } count -= left; - dbg("%s: wrote (did %d)", __FUNCTION__, count); + dbg("%s: wrote (did %d)", __func__, count); return count; } @@ -542,14 +542,14 @@ static void option_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg("%s: %p", __FUNCTION__, urb); + dbg("%s: %p", __func__, urb); endpoint = usb_pipeendpoint(urb->pipe); port = (struct usb_serial_port *) urb->context; if (status) { dbg("%s: nonzero status: %d on endpoint %02x.", - __FUNCTION__, status, endpoint); + __func__, status, endpoint); } else { tty = port->tty; if (urb->actual_length) { @@ -557,7 +557,7 @@ static void option_indat_callback(struct urb *urb) tty_insert_flip_string(tty, data, urb->actual_length); tty_flip_buffer_push(tty); } else { - dbg("%s: empty read urb received", __FUNCTION__); + dbg("%s: empty read urb received", __func__); } /* Resubmit urb so we continue receiving */ @@ -565,7 +565,7 @@ static void option_indat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err) printk(KERN_ERR "%s: resubmit read urb failed. " - "(%d)", __FUNCTION__, err); + "(%d)", __func__, err); } } return; @@ -577,7 +577,7 @@ static void option_outdat_callback(struct urb *urb) struct option_port_private *portdata; int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); port = (struct usb_serial_port *) urb->context; @@ -601,15 +601,15 @@ static void option_instat_callback(struct urb *urb) struct option_port_private *portdata = usb_get_serial_port_data(port); struct usb_serial *serial = port->serial; - dbg("%s", __FUNCTION__); - dbg("%s: urb %p port %p has data %p", __FUNCTION__,urb,port,portdata); + dbg("%s", __func__); + dbg("%s: urb %p port %p has data %p", __func__,urb,port,portdata); if (status == 0) { struct usb_ctrlrequest *req_pkt = (struct usb_ctrlrequest *)urb->transfer_buffer; if (!req_pkt) { - dbg("%s: NULL req_pkt\n", __FUNCTION__); + dbg("%s: NULL req_pkt\n", __func__); return; } if ((req_pkt->bRequestType == 0xA1) && @@ -619,7 +619,7 @@ static void option_instat_callback(struct urb *urb) urb->transfer_buffer + sizeof(struct usb_ctrlrequest)); - dbg("%s: signal x%x", __FUNCTION__, signals); + dbg("%s: signal x%x", __func__, signals); old_dcd_state = portdata->dcd_state; portdata->cts_state = 1; @@ -631,11 +631,11 @@ static void option_instat_callback(struct urb *urb) old_dcd_state && !portdata->dcd_state) tty_hangup(port->tty); } else { - dbg("%s: type %x req %x", __FUNCTION__, + dbg("%s: type %x req %x", __func__, req_pkt->bRequestType,req_pkt->bRequest); } } else - dbg("%s: error %d", __FUNCTION__, status); + dbg("%s: error %d", __func__, status); /* Resubmit urb so we continue receiving IRQ data */ if (status != -ESHUTDOWN) { @@ -643,7 +643,7 @@ static void option_instat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err) dbg("%s: resubmit intr urb failed. (%d)", - __FUNCTION__, err); + __func__, err); } } @@ -662,7 +662,7 @@ static int option_write_room(struct usb_serial_port *port) data_len += OUT_BUFLEN; } - dbg("%s: %d", __FUNCTION__, data_len); + dbg("%s: %d", __func__, data_len); return data_len; } @@ -680,7 +680,7 @@ static int option_chars_in_buffer(struct usb_serial_port *port) if (this_urb && test_bit(i, &portdata->out_busy)) data_len += this_urb->transfer_buffer_length; } - dbg("%s: %d", __FUNCTION__, data_len); + dbg("%s: %d", __func__, data_len); return data_len; } @@ -693,7 +693,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) portdata = usb_get_serial_port_data(port); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Set some sane defaults */ portdata->rts_state = 1; @@ -705,7 +705,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) if (! urb) continue; if (urb->dev != serial->dev) { - dbg("%s: dev %p != %p", __FUNCTION__, + dbg("%s: dev %p != %p", __func__, urb->dev, serial->dev); continue; } @@ -719,7 +719,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) err = usb_submit_urb(urb, GFP_KERNEL); if (err) { dbg("%s: submit urb %d failed (%d) %d", - __FUNCTION__, i, err, + __func__, i, err, urb->transfer_buffer_length); } } @@ -747,7 +747,7 @@ static void option_close(struct usb_serial_port *port, struct file *filp) struct usb_serial *serial = port->serial; struct option_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); portdata = usb_get_serial_port_data(port); portdata->rts_state = 0; @@ -780,7 +780,7 @@ static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint, urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ if (urb == NULL) { - dbg("%s: alloc for endpoint %d failed.", __FUNCTION__, endpoint); + dbg("%s: alloc for endpoint %d failed.", __func__, endpoint); return NULL; } @@ -799,7 +799,7 @@ static void option_setup_urbs(struct usb_serial *serial) struct usb_serial_port *port; struct option_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; @@ -832,7 +832,7 @@ static int option_send_setup(struct usb_serial_port *port) struct usb_serial *serial = port->serial; struct option_port_private *portdata; int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); portdata = usb_get_serial_port_data(port); @@ -858,7 +858,7 @@ static int option_startup(struct usb_serial *serial) struct option_port_private *portdata; u8 *buffer; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Now setup per port private data */ for (i = 0; i < serial->num_ports; i++) { @@ -866,7 +866,7 @@ static int option_startup(struct usb_serial *serial) portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); if (!portdata) { dbg("%s: kmalloc for option_port_private (%d) failed!.", - __FUNCTION__, i); + __func__, i); return (1); } @@ -891,7 +891,7 @@ static int option_startup(struct usb_serial *serial) err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (err) dbg("%s: submit irq_in urb failed %d", - __FUNCTION__, err); + __func__, err); } option_setup_urbs(serial); @@ -915,7 +915,7 @@ static void option_shutdown(struct usb_serial *serial) struct usb_serial_port *port; struct option_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Stop reading/writing urbs */ for (i = 0; i < serial->num_ports; ++i) { diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 20a680ed0cc..87f33e06301 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -235,10 +235,10 @@ static void setup_line(struct work_struct *work) unsigned long flags; int result; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); if ((new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL)) == NULL) { - dev_err(&port->dev, "%s(): out of memory!\n", __FUNCTION__); + dev_err(&port->dev, "%s(): out of memory!\n", __func__); /* we will try again */ schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2)); return; @@ -253,7 +253,7 @@ static void setup_line(struct work_struct *work) 100); if (result != OTI6858_CTRL_PKT_SIZE) { - dev_err(&port->dev, "%s(): error reading status\n", __FUNCTION__); + dev_err(&port->dev, "%s(): error reading status\n", __func__); kfree(new_setup); /* we will try again */ schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2)); @@ -286,12 +286,12 @@ static void setup_line(struct work_struct *work) priv->setup_done = 1; spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s(): submitting interrupt urb", __FUNCTION__); + dbg("%s(): submitting interrupt urb", __func__); port->interrupt_in_urb->dev = port->serial->dev; result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result != 0) { dev_err(&port->dev, "%s(): usb_submit_urb() failed" - " with error %d\n", __FUNCTION__, result); + " with error %d\n", __func__, result); } } @@ -303,7 +303,7 @@ void send_data(struct work_struct *work) unsigned long flags; unsigned char allow; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); if (priv->flags.write_urb_in_use) { @@ -331,12 +331,12 @@ void send_data(struct work_struct *work) if (count == 0) { priv->flags.write_urb_in_use = 0; - dbg("%s(): submitting interrupt urb", __FUNCTION__); + dbg("%s(): submitting interrupt urb", __func__); port->interrupt_in_urb->dev = port->serial->dev; result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result != 0) { dev_err(&port->dev, "%s(): usb_submit_urb() failed" - " with error %d\n", __FUNCTION__, result); + " with error %d\n", __func__, result); } return; } @@ -350,7 +350,7 @@ void send_data(struct work_struct *work) result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result != 0) { dev_err(&port->dev, "%s(): usb_submit_urb() failed" - " with error %d\n", __FUNCTION__, result); + " with error %d\n", __func__, result); priv->flags.write_urb_in_use = 0; } @@ -401,7 +401,7 @@ static int oti6858_write(struct usb_serial_port *port, struct oti6858_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s(port = %d, count = %d)", __FUNCTION__, port->number, count); + dbg("%s(port = %d, count = %d)", __func__, port->number, count); if (!count) return count; @@ -419,7 +419,7 @@ static int oti6858_write_room(struct usb_serial_port *port) int room = 0; unsigned long flags; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); room = oti6858_buf_space_avail(priv->buf); @@ -434,7 +434,7 @@ static int oti6858_chars_in_buffer(struct usb_serial_port *port) int chars = 0; unsigned long flags; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); chars = oti6858_buf_data_avail(priv->buf); @@ -453,10 +453,10 @@ static void oti6858_set_termios(struct usb_serial_port *port, u16 divisor; int br; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); if (!port->tty || !port->tty->termios) { - dbg("%s(): no tty structures", __FUNCTION__); + dbg("%s(): no tty structures", __func__); return; } @@ -572,7 +572,7 @@ static int oti6858_open(struct usb_serial_port *port, struct file *filp) unsigned long flags; int result; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); usb_clear_halt(serial->dev, port->write_urb->pipe); usb_clear_halt(serial->dev, port->read_urb->pipe); @@ -581,7 +581,7 @@ static int oti6858_open(struct usb_serial_port *port, struct file *filp) return 0; if ((buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL)) == NULL) { - dev_err(&port->dev, "%s(): out of memory!\n", __FUNCTION__); + dev_err(&port->dev, "%s(): out of memory!\n", __func__); return -ENOMEM; } @@ -610,12 +610,12 @@ static int oti6858_open(struct usb_serial_port *port, struct file *filp) spin_unlock_irqrestore(&priv->lock, flags); kfree(buf); - dbg("%s(): submitting interrupt urb", __FUNCTION__); + dbg("%s(): submitting interrupt urb", __func__); port->interrupt_in_urb->dev = serial->dev; result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result != 0) { dev_err(&port->dev, "%s(): usb_submit_urb() failed" - " with error %d\n", __FUNCTION__, result); + " with error %d\n", __func__, result); oti6858_close(port, NULL); return -EPROTO; } @@ -634,14 +634,14 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp) long timeout; wait_queue_t wait; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); /* wait for data to drain from the buffer */ spin_lock_irqsave(&priv->lock, flags); timeout = 30 * HZ; /* PL2303_CLOSING_WAIT */ init_waitqueue_entry(&wait, current); add_wait_queue(&port->tty->write_wait, &wait); - dbg("%s(): entering wait loop", __FUNCTION__); + dbg("%s(): entering wait loop", __func__); for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (oti6858_buf_data_avail(priv->buf) == 0 @@ -654,7 +654,7 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp) } set_current_state(TASK_RUNNING); remove_wait_queue(&port->tty->write_wait, &wait); - dbg("%s(): after wait loop", __FUNCTION__); + dbg("%s(): after wait loop", __func__); /* clear out any remaining data in the buffer */ oti6858_buf_clear(priv->buf); @@ -675,7 +675,7 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp) */ timeout = 2*HZ; schedule_timeout_interruptible(timeout); - dbg("%s(): after schedule_timeout_interruptible()", __FUNCTION__); + dbg("%s(): after schedule_timeout_interruptible()", __func__); /* cancel scheduled setup */ cancel_delayed_work(&priv->delayed_setup_work); @@ -683,7 +683,7 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp) flush_scheduled_work(); /* shutdown our urbs */ - dbg("%s(): shutting down urbs", __FUNCTION__); + dbg("%s(): shutting down urbs", __func__); usb_kill_urb(port->write_urb); usb_kill_urb(port->read_urb); usb_kill_urb(port->interrupt_in_urb); @@ -706,7 +706,7 @@ static int oti6858_tiocmset(struct usb_serial_port *port, struct file *file, u8 control; dbg("%s(port = %d, set = 0x%08x, clear = 0x%08x)", - __FUNCTION__, port->number, set, clear); + __func__, port->number, set, clear); if (!usb_get_intfdata(port->serial->interface)) return -ENODEV; @@ -738,7 +738,7 @@ static int oti6858_tiocmget(struct usb_serial_port *port, struct file *file) unsigned pin_state; unsigned result = 0; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); if (!usb_get_intfdata(port->serial->interface)) return -ENODEV; @@ -761,7 +761,7 @@ static int oti6858_tiocmget(struct usb_serial_port *port, struct file *file) if ((pin_state & PIN_DCD) != 0) result |= TIOCM_CD; - dbg("%s() = 0x%08x", __FUNCTION__, result); + dbg("%s() = 0x%08x", __func__, result); return result; } @@ -808,7 +808,7 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file, unsigned int x; dbg("%s(port = %d, cmd = 0x%04x, arg = 0x%08lx)", - __FUNCTION__, port->number, cmd, arg); + __func__, port->number, cmd, arg); switch (cmd) { case TIOCMBIS: @@ -822,11 +822,11 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file, return oti6858_tiocmset(port, NULL, 0, x); case TIOCMIWAIT: - dbg("%s(): TIOCMIWAIT", __FUNCTION__); + dbg("%s(): TIOCMIWAIT", __func__); return wait_modem_info(port, arg); default: - dbg("%s(): 0x%04x not supported", __FUNCTION__, cmd); + dbg("%s(): 0x%04x not supported", __func__, cmd); break; } @@ -837,10 +837,10 @@ static void oti6858_break_ctl(struct usb_serial_port *port, int break_state) { int state; - dbg("%s(port = %d)", __FUNCTION__, port->number); + dbg("%s(port = %d)", __func__, port->number); state = (break_state == 0) ? 0 : 1; - dbg("%s(): turning break %s", __FUNCTION__, state ? "on" : "off"); + dbg("%s(): turning break %s", __func__, state ? "on" : "off"); /* FIXME */ /* @@ -848,7 +848,7 @@ static void oti6858_break_ctl(struct usb_serial_port *port, int break_state) BREAK_REQUEST, BREAK_REQUEST_TYPE, state, 0, NULL, 0, 100); if (result != 0) - dbg("%s(): error sending break", __FUNCTION__); + dbg("%s(): error sending break", __func__); */ } @@ -857,7 +857,7 @@ static void oti6858_shutdown(struct usb_serial *serial) struct oti6858_private *priv; int i; - dbg("%s()", __FUNCTION__); + dbg("%s()", __func__); for (i = 0; i < serial->num_ports; ++i) { priv = usb_get_serial_port_data(serial->port[i]); @@ -877,7 +877,7 @@ static void oti6858_read_int_callback(struct urb *urb) int status = urb->status; dbg("%s(port = %d, status = %d)", - __FUNCTION__, port->number, status); + __func__, port->number, status); switch (status) { case 0: @@ -888,11 +888,11 @@ static void oti6858_read_int_callback(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s(): urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s(): nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); break; } @@ -909,7 +909,7 @@ static void oti6858_read_int_callback(struct urb *urb) priv->setup_done = 0; resubmit = 0; dbg("%s(): scheduling setup_line()", - __FUNCTION__); + __func__); schedule_delayed_work(&priv->delayed_setup_work, 0); } } @@ -924,7 +924,7 @@ static void oti6858_read_int_callback(struct urb *urb) priv->setup_done = 0; resubmit = 0; dbg("%s(): scheduling setup_line()", - __FUNCTION__); + __func__); schedule_delayed_work(&priv->delayed_setup_work, 0); } } @@ -953,7 +953,7 @@ static void oti6858_read_int_callback(struct urb *urb) if (result != 0) { priv->flags.read_urb_in_use = 0; dev_err(&port->dev, "%s(): usb_submit_urb() failed," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); } else { resubmit = 0; } @@ -972,13 +972,13 @@ static void oti6858_read_int_callback(struct urb *urb) if (resubmit) { int result; -// dbg("%s(): submitting interrupt urb", __FUNCTION__); +// dbg("%s(): submitting interrupt urb", __func__); urb->dev = port->serial->dev; result = usb_submit_urb(urb, GFP_ATOMIC); if (result != 0) { dev_err(&urb->dev->dev, "%s(): usb_submit_urb() failed with" - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); } } } @@ -994,7 +994,7 @@ static void oti6858_read_bulk_callback(struct urb *urb) int result; dbg("%s(port = %d, status = %d)", - __FUNCTION__, port->number, status); + __func__, port->number, status); spin_lock_irqsave(&priv->lock, flags); priv->flags.read_urb_in_use = 0; @@ -1002,20 +1002,20 @@ static void oti6858_read_bulk_callback(struct urb *urb) if (status != 0) { if (!port->open_count) { - dbg("%s(): port is closed, exiting", __FUNCTION__); + dbg("%s(): port is closed, exiting", __func__); return; } /* if (status == -EPROTO) { // PL2303 mysteriously fails with -EPROTO reschedule the read - dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); + dbg("%s - caught -EPROTO, resubmitting the urb", __func__); result = usb_submit_urb(urb, GFP_ATOMIC); if (result) - dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); return; } */ - dbg("%s(): unable to handle the error, exiting", __FUNCTION__); + dbg("%s(): unable to handle the error, exiting", __func__); return; } @@ -1031,7 +1031,7 @@ static void oti6858_read_bulk_callback(struct urb *urb) result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result != 0) { dev_err(&port->dev, "%s(): usb_submit_urb() failed," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); } } } @@ -1044,7 +1044,7 @@ static void oti6858_write_bulk_callback(struct urb *urb) int result; dbg("%s(port = %d, status = %d)", - __FUNCTION__, port->number, status); + __func__, port->number, status); switch (status) { case 0: @@ -1055,21 +1055,21 @@ static void oti6858_write_bulk_callback(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s(): urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); priv->flags.write_urb_in_use = 0; return; default: /* error in the urb, so we have to resubmit it */ dbg("%s(): nonzero write bulk status received: %d", - __FUNCTION__, status); - dbg("%s(): overflow in write", __FUNCTION__); + __func__, status); + dbg("%s(): overflow in write", __func__); port->write_urb->transfer_buffer_length = 1; port->write_urb->dev = port->serial->dev; result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s(): usb_submit_urb() failed," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); } else { return; } @@ -1079,11 +1079,11 @@ static void oti6858_write_bulk_callback(struct urb *urb) // schedule the interrupt urb if we are still open */ port->interrupt_in_urb->dev = port->serial->dev; - dbg("%s(): submitting interrupt urb", __FUNCTION__); + dbg("%s(): submitting interrupt urb", __func__); result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result != 0) { dev_err(&port->dev, "%s(): failed submitting int urb," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); } } diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 1fbb4dbdf23..2b4ab371c76 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -410,7 +410,7 @@ static int set_control_lines(struct usb_device *dev, u8 value) retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE, value, 0, NULL, 0, 100); - dbg("%s - value = %d, retval = %d", __FUNCTION__, value, retval); + dbg("%s - value = %d, retval = %d", __func__, value, retval); return retval; } @@ -420,7 +420,7 @@ static void pl2303_send(struct usb_serial_port *port) struct pl2303_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); @@ -441,7 +441,7 @@ static void pl2303_send(struct usb_serial_port *port) spin_unlock_irqrestore(&priv->lock, flags); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, + usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); port->write_urb->transfer_buffer_length = count; @@ -449,7 +449,7 @@ static void pl2303_send(struct usb_serial_port *port) result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s - failed submitting write urb," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); priv->write_urb_in_use = 0; // TODO: reschedule pl2303_send } @@ -463,7 +463,7 @@ static int pl2303_write(struct usb_serial_port *port, const unsigned char *buf, struct pl2303_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d, %d bytes", __FUNCTION__, port->number, count); + dbg("%s - port %d, %d bytes", __func__, port->number, count); if (!count) return count; @@ -483,13 +483,13 @@ static int pl2303_write_room(struct usb_serial_port *port) int room = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); room = pl2303_buf_space_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -499,13 +499,13 @@ static int pl2303_chars_in_buffer(struct usb_serial_port *port) int chars = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); chars = pl2303_buf_data_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return chars; } @@ -521,7 +521,7 @@ static void pl2303_set_termios(struct usb_serial_port *port, int i; u8 control; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); if (!priv->termios_initialized) { @@ -545,7 +545,7 @@ static void pl2303_set_termios(struct usb_serial_port *port, buf = kzalloc(7, GFP_KERNEL); if (!buf) { - dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); + dev_err(&port->dev, "%s - out of memory.\n", __func__); return; } @@ -563,11 +563,11 @@ static void pl2303_set_termios(struct usb_serial_port *port, default: case CS8: buf[6] = 8; break; } - dbg("%s - data bits = %d", __FUNCTION__, buf[6]); + dbg("%s - data bits = %d", __func__, buf[6]); } baud = tty_get_baud_rate(port->tty);; - dbg("%s - baud = %d", __FUNCTION__, baud); + dbg("%s - baud = %d", __func__, baud); if (baud) { buf[0] = baud & 0xff; buf[1] = (baud >> 8) & 0xff; @@ -580,10 +580,10 @@ static void pl2303_set_termios(struct usb_serial_port *port, /* For reference buf[4]=2 is 2 stop bits */ if (cflag & CSTOPB) { buf[4] = 2; - dbg("%s - stop bits = 2", __FUNCTION__); + dbg("%s - stop bits = 2", __func__); } else { buf[4] = 0; - dbg("%s - stop bits = 1", __FUNCTION__); + dbg("%s - stop bits = 1", __func__); } if (cflag & PARENB) { @@ -594,14 +594,14 @@ static void pl2303_set_termios(struct usb_serial_port *port, /* For reference buf[5]=4 is space parity */ if (cflag & PARODD) { buf[5] = 1; - dbg("%s - parity = odd", __FUNCTION__); + dbg("%s - parity = odd", __func__); } else { buf[5] = 2; - dbg("%s - parity = even", __FUNCTION__); + dbg("%s - parity = even", __func__); } } else { buf[5] = 0; - dbg("%s - parity = none", __FUNCTION__); + dbg("%s - parity = none", __func__); } i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), @@ -657,7 +657,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) long timeout; wait_queue_t wait; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* wait for data to drain from the buffer */ spin_lock_irqsave(&priv->lock, flags); @@ -695,7 +695,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) schedule_timeout_interruptible(timeout); /* shutdown our urbs */ - dbg("%s - shutting down urbs", __FUNCTION__); + dbg("%s - shutting down urbs", __func__); usb_kill_urb(port->write_urb); usb_kill_urb(port->read_urb); usb_kill_urb(port->interrupt_in_urb); @@ -719,7 +719,7 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp) struct pl2303_private *priv = usb_get_serial_port_data(port); int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (priv->type != HX) { usb_clear_halt(serial->dev, port->write_urb->pipe); @@ -737,22 +737,22 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp) //FIXME: need to assert RTS and DTR if CRTSCTS off - dbg("%s - submitting read urb", __FUNCTION__); + dbg("%s - submitting read urb", __func__); port->read_urb->dev = serial->dev; result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) { dev_err(&port->dev, "%s - failed submitting read urb," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); pl2303_close(port, NULL); return -EPROTO; } - dbg("%s - submitting interrupt urb", __FUNCTION__); + dbg("%s - submitting interrupt urb", __func__); port->interrupt_in_urb->dev = serial->dev; result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) { dev_err(&port->dev, "%s - failed submitting interrupt urb," - " error %d\n", __FUNCTION__, result); + " error %d\n", __func__, result); pl2303_close(port, NULL); return -EPROTO; } @@ -792,7 +792,7 @@ static int pl2303_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int status; unsigned int result; - dbg("%s (%d)", __FUNCTION__, port->number); + dbg("%s (%d)", __func__, port->number); if (!usb_get_intfdata(port->serial->interface)) return -ENODEV; @@ -809,7 +809,7 @@ static int pl2303_tiocmget(struct usb_serial_port *port, struct file *file) | ((status & UART_RING) ? TIOCM_RI : 0) | ((status & UART_DCD) ? TIOCM_CD : 0); - dbg("%s - result = %x", __FUNCTION__, result); + dbg("%s - result = %x", __func__, result); return result; } @@ -853,15 +853,15 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) static int pl2303_ioctl(struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg) { - dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd); + dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd); switch (cmd) { case TIOCMIWAIT: - dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number); + dbg("%s (%d) TIOCMIWAIT", __func__, port->number); return wait_modem_info(port, arg); default: - dbg("%s not supported = 0x%04x", __FUNCTION__, cmd); + dbg("%s not supported = 0x%04x", __func__, cmd); break; } @@ -874,19 +874,19 @@ static void pl2303_break_ctl(struct usb_serial_port *port, int break_state) u16 state; int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (break_state == 0) state = BREAK_OFF; else state = BREAK_ON; - dbg("%s - turning break %s", __FUNCTION__, state==BREAK_OFF ? "off" : "on"); + dbg("%s - turning break %s", __func__, state==BREAK_OFF ? "off" : "on"); result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), BREAK_REQUEST, BREAK_REQUEST_TYPE, state, 0, NULL, 0, 100); if (result) - dbg("%s - error sending break = %d", __FUNCTION__, result); + dbg("%s - error sending break = %d", __func__, result); } static void pl2303_shutdown(struct usb_serial *serial) @@ -894,7 +894,7 @@ static void pl2303_shutdown(struct usb_serial *serial) int i; struct pl2303_private *priv; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i = 0; i < serial->num_ports; ++i) { priv = usb_get_serial_port_data(serial->port[i]); @@ -949,7 +949,7 @@ static void pl2303_read_int_callback(struct urb *urb) int status = urb->status; int retval; - dbg("%s (%d)", __FUNCTION__, port->number); + dbg("%s (%d)", __func__, port->number); switch (status) { case 0: @@ -959,16 +959,16 @@ static void pl2303_read_int_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, urb->transfer_buffer); pl2303_update_line_status(port, data, actual_length); @@ -978,7 +978,7 @@ exit: if (retval) dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with result %d\n", - __FUNCTION__, retval); + __func__, retval); } static void pl2303_read_bulk_callback(struct urb *urb) @@ -994,32 +994,32 @@ static void pl2303_read_bulk_callback(struct urb *urb) u8 line_status; char tty_flag; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { - dbg("%s - urb status = %d", __FUNCTION__, status); + dbg("%s - urb status = %d", __func__, status); if (!port->open_count) { - dbg("%s - port is closed, exiting.", __FUNCTION__); + dbg("%s - port is closed, exiting.", __func__); return; } if (status == -EPROTO) { /* PL2303 mysteriously fails with -EPROTO reschedule * the read */ dbg("%s - caught -EPROTO, resubmitting the urb", - __FUNCTION__); + __func__); urb->dev = port->serial->dev; result = usb_submit_urb(urb, GFP_ATOMIC); if (result) dev_err(&urb->dev->dev, "%s - failed" " resubmitting read urb, error %d\n", - __FUNCTION__, result); + __func__, result); return; } - dbg("%s - unable to handle the error, exiting.", __FUNCTION__); + dbg("%s - unable to handle the error, exiting.", __func__); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* get tty_flag from status */ @@ -1039,7 +1039,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) tty_flag = TTY_PARITY; else if (line_status & UART_FRAME_ERROR) tty_flag = TTY_FRAME; - dbg("%s - tty_flag = %d", __FUNCTION__, tty_flag); + dbg("%s - tty_flag = %d", __func__, tty_flag); tty = port->tty; if (tty && urb->actual_length) { @@ -1058,7 +1058,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) result = usb_submit_urb(urb, GFP_ATOMIC); if (result) dev_err(&urb->dev->dev, "%s - failed resubmitting" - " read urb, error %d\n", __FUNCTION__, result); + " read urb, error %d\n", __func__, result); } return; @@ -1071,7 +1071,7 @@ static void pl2303_write_bulk_callback(struct urb *urb) int result; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); switch (status) { case 0: @@ -1081,21 +1081,21 @@ static void pl2303_write_bulk_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, + dbg("%s - urb shutting down with status: %d", __func__, status); priv->write_urb_in_use = 0; return; default: /* error in the urb, so we have to resubmit it */ - dbg("%s - Overflow in write", __FUNCTION__); - dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, + dbg("%s - Overflow in write", __func__); + dbg("%s - nonzero write bulk status received: %d", __func__, status); port->write_urb->transfer_buffer_length = 1; port->write_urb->dev = port->serial->dev; result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) dev_err(&urb->dev->dev, "%s - failed resubmitting write" - " urb, error %d\n", __FUNCTION__, result); + " urb, error %d\n", __func__, result); else return; } diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 353c54fa058..3fe98a52b91 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -202,11 +202,11 @@ static void safe_read_bulk_callback (struct urb *urb) int result; int status = urb->status; - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -232,18 +232,18 @@ static void safe_read_bulk_callback (struct urb *urb) if (actual_length <= (length - 2)) { - info ("%s - actual: %d", __FUNCTION__, actual_length); + info ("%s - actual: %d", __func__, actual_length); for (i = 0; i < actual_length; i++) { tty_insert_flip_char (port->tty, data[i], 0); } tty_flip_buffer_push (port->tty); } else { - err ("%s - inconsistent lengths %d:%d", __FUNCTION__, + err ("%s - inconsistent lengths %d:%d", __func__, actual_length, length); } } else { - err ("%s - bad CRC %x", __FUNCTION__, fcs); + err ("%s - bad CRC %x", __func__, fcs); } } else { for (i = 0; i < length; i++) { @@ -259,7 +259,7 @@ static void safe_read_bulk_callback (struct urb *urb) safe_read_bulk_callback, port); if ((result = usb_submit_urb (urb, GFP_ATOMIC))) { - err ("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + err ("%s - failed resubmitting read urb, error %d", __func__, result); } } @@ -274,7 +274,7 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i count); if (!port->write_urb) { - dbg ("%s - write urb NULL", __FUNCTION__); + dbg ("%s - write urb NULL", __func__); return (0); } @@ -282,17 +282,17 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i port->write_urb->transfer_buffer_length); if (!port->write_urb->transfer_buffer_length) { - dbg ("%s - write urb transfer_buffer_length zero", __FUNCTION__); + dbg ("%s - write urb transfer_buffer_length zero", __func__); return (0); } if (count == 0) { - dbg ("%s - write request of 0 bytes", __FUNCTION__); + dbg ("%s - write request of 0 bytes", __func__); return (0); } spin_lock_bh(&port->lock); if (port->write_urb_busy) { spin_unlock_bh(&port->lock); - dbg("%s - already writing", __FUNCTION__); + dbg("%s - already writing", __func__); return 0; } port->write_urb_busy = 1; @@ -332,7 +332,7 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i port->write_urb->transfer_buffer_length = count; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); #ifdef ECHO_TX { int i; @@ -349,10 +349,10 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i port->write_urb->dev = port->serial->dev; if ((result = usb_submit_urb (port->write_urb, GFP_KERNEL))) { port->write_urb_busy = 0; - err ("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err ("%s - failed submitting write urb, error %d", __func__, result); return 0; } - dbg ("%s urb: %p submitted", __FUNCTION__, port->write_urb); + dbg ("%s urb: %p submitted", __func__, port->write_urb); return (count); } @@ -361,7 +361,7 @@ static int safe_write_room (struct usb_serial_port *port) { int room = 0; // Default: no room - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); if (port->write_urb_busy) room = port->bulk_out_size - (safe ? 2 : 0); diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 07eabaf9f04..ed30adefff8 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -256,7 +256,7 @@ static int sierra_send_setup(struct usb_serial_port *port) struct sierra_port_private *portdata; __u16 interface = 0; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); portdata = usb_get_serial_port_data(port); @@ -286,24 +286,24 @@ static int sierra_send_setup(struct usb_serial_port *port) static void sierra_rx_throttle(struct usb_serial_port *port) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void sierra_rx_unthrottle(struct usb_serial_port *port) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void sierra_break_ctl(struct usb_serial_port *port, int break_state) { /* Unfortunately, I don't know how to send a break */ - dbg("%s", __FUNCTION__); + dbg("%s", __func__); } static void sierra_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); tty_termios_copy_hw(port->tty->termios, old_termios); sierra_send_setup(port); } @@ -357,14 +357,14 @@ static void sierra_outdat_callback(struct urb *urb) int status = urb->status; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree(urb->transfer_buffer); if (status) dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); spin_lock_irqsave(&portdata->lock, flags); --portdata->outstanding_urbs; @@ -386,12 +386,12 @@ static int sierra_write(struct usb_serial_port *port, portdata = usb_get_serial_port_data(port); - dbg("%s: write (%d chars)", __FUNCTION__, count); + dbg("%s: write (%d chars)", __func__, count); spin_lock_irqsave(&portdata->lock, flags); if (portdata->outstanding_urbs > N_OUT_URB) { spin_unlock_irqrestore(&portdata->lock, flags); - dbg("%s - write limit hit\n", __FUNCTION__); + dbg("%s - write limit hit\n", __func__); return 0; } portdata->outstanding_urbs++; @@ -413,7 +413,7 @@ static int sierra_write(struct usb_serial_port *port, memcpy(buffer, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); usb_fill_bulk_urb(urb, serial->dev, usb_sndbulkpipe(serial->dev, @@ -424,7 +424,7 @@ static int sierra_write(struct usb_serial_port *port, status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " - "with status = %d\n", __FUNCTION__, status); + "with status = %d\n", __func__, status); count = status; goto error; } @@ -454,14 +454,14 @@ static void sierra_indat_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int status = urb->status; - dbg("%s: %p", __FUNCTION__, urb); + dbg("%s: %p", __func__, urb); endpoint = usb_pipeendpoint(urb->pipe); port = (struct usb_serial_port *) urb->context; if (status) { dbg("%s: nonzero status: %d on endpoint %02x.", - __FUNCTION__, status, endpoint); + __func__, status, endpoint); } else { tty = port->tty; if (urb->actual_length) { @@ -469,7 +469,7 @@ static void sierra_indat_callback(struct urb *urb) tty_insert_flip_string(tty, data, urb->actual_length); tty_flip_buffer_push(tty); } else { - dbg("%s: empty read urb received", __FUNCTION__); + dbg("%s: empty read urb received", __func__); } /* Resubmit urb so we continue receiving */ @@ -491,15 +491,15 @@ static void sierra_instat_callback(struct urb *urb) struct sierra_port_private *portdata = usb_get_serial_port_data(port); struct usb_serial *serial = port->serial; - dbg("%s", __FUNCTION__); - dbg("%s: urb %p port %p has data %p", __FUNCTION__, urb, port, portdata); + dbg("%s", __func__); + dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); if (status == 0) { struct usb_ctrlrequest *req_pkt = (struct usb_ctrlrequest *)urb->transfer_buffer; if (!req_pkt) { - dbg("%s: NULL req_pkt\n", __FUNCTION__); + dbg("%s: NULL req_pkt\n", __func__); return; } if ((req_pkt->bRequestType == 0xA1) && @@ -509,7 +509,7 @@ static void sierra_instat_callback(struct urb *urb) urb->transfer_buffer + sizeof(struct usb_ctrlrequest)); - dbg("%s: signal x%x", __FUNCTION__, signals); + dbg("%s: signal x%x", __func__, signals); old_dcd_state = portdata->dcd_state; portdata->cts_state = 1; @@ -521,11 +521,11 @@ static void sierra_instat_callback(struct urb *urb) old_dcd_state && !portdata->dcd_state) tty_hangup(port->tty); } else { - dbg("%s: type %x req %x", __FUNCTION__, + dbg("%s: type %x req %x", __func__, req_pkt->bRequestType, req_pkt->bRequest); } } else - dbg("%s: error %d", __FUNCTION__, status); + dbg("%s: error %d", __func__, status); /* Resubmit urb so we continue receiving IRQ data */ if (status != -ESHUTDOWN) { @@ -533,7 +533,7 @@ static void sierra_instat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err) dbg("%s: resubmit intr urb failed. (%d)", - __FUNCTION__, err); + __func__, err); } } @@ -542,14 +542,14 @@ static int sierra_write_room(struct usb_serial_port *port) struct sierra_port_private *portdata = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* try to give a good number back based on if we have any free urbs at * this point in time */ spin_lock_irqsave(&portdata->lock, flags); if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) { spin_unlock_irqrestore(&portdata->lock, flags); - dbg("%s - write limit hit\n", __FUNCTION__); + dbg("%s - write limit hit\n", __func__); return 0; } spin_unlock_irqrestore(&portdata->lock, flags); @@ -559,7 +559,7 @@ static int sierra_write_room(struct usb_serial_port *port) static int sierra_chars_in_buffer(struct usb_serial_port *port) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * We can't really account for how much data we @@ -580,7 +580,7 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp) portdata = usb_get_serial_port_data(port); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Set some sane defaults */ portdata->rts_state = 1; @@ -592,7 +592,7 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp) if (!urb) continue; if (urb->dev != serial->dev) { - dbg("%s: dev %p != %p", __FUNCTION__, + dbg("%s: dev %p != %p", __func__, urb->dev, serial->dev); continue; } @@ -630,7 +630,7 @@ static void sierra_close(struct usb_serial_port *port, struct file *filp) struct usb_serial *serial = port->serial; struct sierra_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); portdata = usb_get_serial_port_data(port); portdata->rts_state = 0; @@ -660,7 +660,7 @@ static int sierra_startup(struct usb_serial *serial) int i; int j; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* Set Device mode to D0 */ sierra_set_power_state(serial->dev, 0x0000); @@ -675,7 +675,7 @@ static int sierra_startup(struct usb_serial *serial) portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); if (!portdata) { dbg("%s: kmalloc for sierra_port_private (%d) failed!.", - __FUNCTION__, i); + __func__, i); return -ENOMEM; } spin_lock_init(&portdata->lock); @@ -696,7 +696,7 @@ static int sierra_startup(struct usb_serial *serial) urb = usb_alloc_urb(0, GFP_KERNEL); if (urb == NULL) { dbg("%s: alloc for in port failed.", - __FUNCTION__); + __func__); continue; } /* Fill URB using supplied data. */ @@ -718,7 +718,7 @@ static void sierra_shutdown(struct usb_serial *serial) struct usb_serial_port *port; struct sierra_port_private *portdata; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index f3bbf777c81..e0b1564de90 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -408,14 +408,14 @@ static int ti_startup(struct usb_serial *serial) dbg("%s - product 0x%4X, num configurations %d, configuration value %d", - __FUNCTION__, le16_to_cpu(dev->descriptor.idProduct), + __func__, le16_to_cpu(dev->descriptor.idProduct), dev->descriptor.bNumConfigurations, dev->actconfig->desc.bConfigurationValue); /* create device structure */ tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); if (tdev == NULL) { - dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&dev->dev, "%s - out of memory\n", __func__); return -ENOMEM; } mutex_init(&tdev->td_open_close_lock); @@ -425,7 +425,7 @@ static int ti_startup(struct usb_serial *serial) /* determine device type */ if (usb_match_id(serial->interface, ti_id_table_3410)) tdev->td_is_3410 = 1; - dbg("%s - device type is %s", __FUNCTION__, tdev->td_is_3410 ? "3410" : "5052"); + dbg("%s - device type is %s", __func__, tdev->td_is_3410 ? "3410" : "5052"); /* if we have only 1 configuration, download firmware */ if (dev->descriptor.bNumConfigurations == 1) { @@ -459,7 +459,7 @@ static int ti_startup(struct usb_serial *serial) for (i = 0; i < serial->num_ports; ++i) { tport = kzalloc(sizeof(struct ti_port), GFP_KERNEL); if (tport == NULL) { - dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&dev->dev, "%s - out of memory\n", __func__); status = -ENOMEM; goto free_tports; } @@ -471,7 +471,7 @@ static int ti_startup(struct usb_serial *serial) init_waitqueue_head(&tport->tp_write_wait); tport->tp_write_buf = ti_buf_alloc(); if (tport->tp_write_buf == NULL) { - dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&dev->dev, "%s - out of memory\n", __func__); kfree(tport); status = -ENOMEM; goto free_tports; @@ -504,7 +504,7 @@ static void ti_shutdown(struct usb_serial *serial) struct ti_device *tdev = usb_get_serial_data(serial); struct ti_port *tport; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i=0; i < serial->num_ports; ++i) { tport = usb_get_serial_port_data(serial->port[i]); @@ -532,7 +532,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file) TI_PIPE_TIMEOUT_ENABLE | (TI_TRANSFER_TIMEOUT << 2)); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return -ENODEV; @@ -557,10 +557,10 @@ static int ti_open(struct usb_serial_port *port, struct file *file) /* start interrupt urb the first time a port is opened on this device */ if (tdev->td_open_port_count == 0) { - dbg("%s - start interrupt in urb", __FUNCTION__); + dbg("%s - start interrupt in urb", __func__); urb = tdev->td_serial->port[0]->interrupt_in_urb; if (!urb) { - dev_err(&port->dev, "%s - no interrupt urb\n", __FUNCTION__); + dev_err(&port->dev, "%s - no interrupt urb\n", __func__); status = -EINVAL; goto release_lock; } @@ -569,40 +569,40 @@ static int ti_open(struct usb_serial_port *port, struct file *file) urb->dev = dev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { - dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status); goto release_lock; } } ti_set_termios(port, port->tty->termios); - dbg("%s - sending TI_OPEN_PORT", __FUNCTION__); + dbg("%s - sending TI_OPEN_PORT", __func__); status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { - dev_err(&port->dev, "%s - cannot send open command, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); goto unlink_int_urb; } - dbg("%s - sending TI_START_PORT", __FUNCTION__); + dbg("%s - sending TI_START_PORT", __func__); status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { - dev_err(&port->dev, "%s - cannot send start command, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status); goto unlink_int_urb; } - dbg("%s - sending TI_PURGE_PORT", __FUNCTION__); + dbg("%s - sending TI_PURGE_PORT", __func__); status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); if (status) { - dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status); goto unlink_int_urb; } status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_OUTPUT, NULL, 0); if (status) { - dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status); goto unlink_int_urb; } @@ -613,27 +613,27 @@ static int ti_open(struct usb_serial_port *port, struct file *file) ti_set_termios(port, port->tty->termios); - dbg("%s - sending TI_OPEN_PORT (2)", __FUNCTION__); + dbg("%s - sending TI_OPEN_PORT (2)", __func__); status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { - dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status); goto unlink_int_urb; } - dbg("%s - sending TI_START_PORT (2)", __FUNCTION__); + dbg("%s - sending TI_START_PORT (2)", __func__); status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { - dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status); goto unlink_int_urb; } /* start read urb */ - dbg("%s - start read urb", __FUNCTION__); + dbg("%s - start read urb", __func__); urb = port->read_urb; if (!urb) { - dev_err(&port->dev, "%s - no read urb\n", __FUNCTION__); + dev_err(&port->dev, "%s - no read urb\n", __func__); status = -EINVAL; goto unlink_int_urb; } @@ -643,7 +643,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file) urb->dev = dev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { - dev_err(&port->dev, "%s - submit read urb failed, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - submit read urb failed, %d\n", __func__, status); goto unlink_int_urb; } @@ -657,7 +657,7 @@ unlink_int_urb: usb_kill_urb(port->serial->port[0]->interrupt_in_urb); release_lock: mutex_unlock(&tdev->td_open_close_lock); - dbg("%s - exit %d", __FUNCTION__, status); + dbg("%s - exit %d", __func__, status); return status; } @@ -670,7 +670,7 @@ static void ti_close(struct usb_serial_port *port, struct file *file) int status; int do_unlock; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); tdev = usb_get_serial_data(port->serial); tport = usb_get_serial_port_data(port); @@ -687,11 +687,11 @@ static void ti_close(struct usb_serial_port *port, struct file *file) port_number = port->number - port->serial->minor; - dbg("%s - sending TI_CLOSE_PORT", __FUNCTION__); + dbg("%s - sending TI_CLOSE_PORT", __func__); status = ti_command_out_sync(tdev, TI_CLOSE_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) - dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __func__, status); /* if mutex_lock is interrupted, continue anyway */ do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock); @@ -704,7 +704,7 @@ static void ti_close(struct usb_serial_port *port, struct file *file) if (do_unlock) mutex_unlock(&tdev->td_open_close_lock); - dbg("%s - exit", __FUNCTION__); + dbg("%s - exit", __func__); } @@ -714,10 +714,10 @@ static int ti_write(struct usb_serial_port *port, const unsigned char *data, struct ti_port *tport = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return 0; } @@ -740,7 +740,7 @@ static int ti_write_room(struct usb_serial_port *port) int room = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return -ENODEV; @@ -749,7 +749,7 @@ static int ti_write_room(struct usb_serial_port *port) room = ti_buf_space_avail(tport->tp_write_buf); spin_unlock_irqrestore(&tport->tp_lock, flags); - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return room; } @@ -760,7 +760,7 @@ static int ti_chars_in_buffer(struct usb_serial_port *port) int chars = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return -ENODEV; @@ -769,7 +769,7 @@ static int ti_chars_in_buffer(struct usb_serial_port *port) chars = ti_buf_data_avail(tport->tp_write_buf); spin_unlock_irqrestore(&tport->tp_lock, flags); - dbg("%s - returns %d", __FUNCTION__, chars); + dbg("%s - returns %d", __func__, chars); return chars; } @@ -779,14 +779,14 @@ static void ti_throttle(struct usb_serial_port *port) struct ti_port *tport = usb_get_serial_port_data(port); struct tty_struct *tty; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return; tty = port->tty; if (!tty) { - dbg("%s - no tty", __FUNCTION__); + dbg("%s - no tty", __func__); return; } @@ -802,21 +802,21 @@ static void ti_unthrottle(struct usb_serial_port *port) struct tty_struct *tty; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return; tty = port->tty; if (!tty) { - dbg("%s - no tty", __FUNCTION__); + dbg("%s - no tty", __func__); return; } if (I_IXOFF(tty) || C_CRTSCTS(tty)) { status = ti_restart_read(tport, tty); if (status) - dev_err(&port->dev, "%s - cannot restart read, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - cannot restart read, %d\n", __func__, status); } } @@ -828,24 +828,24 @@ static int ti_ioctl(struct usb_serial_port *port, struct file *file, struct async_icount cnow; struct async_icount cprev; - dbg("%s - port %d, cmd = 0x%04X", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd = 0x%04X", __func__, port->number, cmd); if (tport == NULL) return -ENODEV; switch (cmd) { case TIOCGSERIAL: - dbg("%s - (%d) TIOCGSERIAL", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); return ti_get_serial_info(tport, (struct serial_struct __user *)arg); break; case TIOCSSERIAL: - dbg("%s - (%d) TIOCSSERIAL", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCSSERIAL", __func__, port->number); return ti_set_serial_info(tport, (struct serial_struct __user *)arg); break; case TIOCMIWAIT: - dbg("%s - (%d) TIOCMIWAIT", __FUNCTION__, port->number); + dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); cprev = tport->tp_icount; while (1) { interruptible_sleep_on(&tport->tp_msr_wait); @@ -866,7 +866,7 @@ static int ti_ioctl(struct usb_serial_port *port, struct file *file, break; case TIOCGICOUNT: - dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); + dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount))) return -EFAULT; return 0; @@ -888,20 +888,20 @@ static void ti_set_termios(struct usb_serial_port *port, int port_number = port->number - port->serial->minor; unsigned int mcr; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); cflag = tty->termios->c_cflag; iflag = tty->termios->c_iflag; - dbg("%s - cflag %08x, iflag %08x", __FUNCTION__, cflag, iflag); - dbg("%s - old clfag %08x, old iflag %08x", __FUNCTION__, old_termios->c_cflag, old_termios->c_iflag); + dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag); + dbg("%s - old clfag %08x, old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); if (tport == NULL) return; config = kmalloc(sizeof(*config), GFP_KERNEL); if (!config) { - dev_err(&port->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&port->dev, "%s - out of memory\n", __func__); return; } @@ -985,7 +985,7 @@ static void ti_set_termios(struct usb_serial_port *port, tty_encode_baud_rate(tty, baud, baud); dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d", - __FUNCTION__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode); + __func__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode); cpu_to_be16s(&config->wBaudRate); cpu_to_be16s(&config->wFlags); @@ -994,7 +994,7 @@ static void ti_set_termios(struct usb_serial_port *port, (__u8)(TI_UART1_PORT + port_number), 0, (__u8 *)config, sizeof(*config)); if (status) - dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __FUNCTION__, port_number, status); + dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __func__, port_number, status); /* SET_CONFIG asserts RTS and DTR, reset them correctly */ mcr = tport->tp_shadow_mcr; @@ -1003,7 +1003,7 @@ static void ti_set_termios(struct usb_serial_port *port, mcr &= ~(TI_MCR_DTR | TI_MCR_RTS); status = ti_set_mcr(tport, mcr); if (status) - dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __FUNCTION__, port_number, status); + dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __func__, port_number, status); kfree(config); } @@ -1017,7 +1017,7 @@ static int ti_tiocmget(struct usb_serial_port *port, struct file *file) unsigned int mcr; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return -ENODEV; @@ -1035,7 +1035,7 @@ static int ti_tiocmget(struct usb_serial_port *port, struct file *file) | ((msr & TI_MSR_RI) ? TIOCM_RI : 0) | ((msr & TI_MSR_DSR) ? TIOCM_DSR : 0); - dbg("%s - 0x%04X", __FUNCTION__, result); + dbg("%s - 0x%04X", __func__, result); return result; } @@ -1048,7 +1048,7 @@ static int ti_tiocmset(struct usb_serial_port *port, struct file *file, unsigned int mcr; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (tport == NULL) return -ENODEV; @@ -1080,7 +1080,7 @@ static void ti_break(struct usb_serial_port *port, int break_state) struct ti_port *tport = usb_get_serial_port_data(port); int status; - dbg("%s - state = %d", __FUNCTION__, break_state); + dbg("%s - state = %d", __func__, break_state); if (tport == NULL) return; @@ -1092,7 +1092,7 @@ static void ti_break(struct usb_serial_port *port, int break_state) TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0); if (status) - dbg("%s - error setting break, %d", __FUNCTION__, status); + dbg("%s - error setting break, %d", __func__, status); } @@ -1111,7 +1111,7 @@ static void ti_interrupt_callback(struct urb *urb) int retval; __u8 msr; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); switch (status) { case 0: @@ -1119,33 +1119,33 @@ static void ti_interrupt_callback(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("%s - urb shutting down, %d", __FUNCTION__, status); + dbg("%s - urb shutting down, %d", __func__, status); tdev->td_urb_error = 1; return; default: dev_err(dev, "%s - nonzero urb status, %d\n", - __FUNCTION__, status); + __func__, status); tdev->td_urb_error = 1; goto exit; } if (length != 2) { - dbg("%s - bad packet size, %d", __FUNCTION__, length); + dbg("%s - bad packet size, %d", __func__, length); goto exit; } if (data[0] == TI_CODE_HARDWARE_ERROR) { - dev_err(dev, "%s - hardware error, %d\n", __FUNCTION__, data[1]); + dev_err(dev, "%s - hardware error, %d\n", __func__, data[1]); goto exit; } port_number = TI_GET_PORT_FROM_CODE(data[0]); function = TI_GET_FUNC_FROM_CODE(data[0]); - dbg("%s - port_number %d, function %d, data 0x%02X", __FUNCTION__, port_number, function, data[1]); + dbg("%s - port_number %d, function %d, data 0x%02X", __func__, port_number, function, data[1]); if (port_number >= serial->num_ports) { - dev_err(dev, "%s - bad port number, %d\n", __FUNCTION__, port_number); + dev_err(dev, "%s - bad port number, %d\n", __func__, port_number); goto exit; } @@ -1157,17 +1157,17 @@ static void ti_interrupt_callback(struct urb *urb) switch (function) { case TI_CODE_DATA_ERROR: - dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __FUNCTION__, port_number, data[1]); + dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __func__, port_number, data[1]); break; case TI_CODE_MODEM_STATUS: msr = data[1]; - dbg("%s - port %d, msr 0x%02X", __FUNCTION__, port_number, msr); + dbg("%s - port %d, msr 0x%02X", __func__, port_number, msr); ti_handle_new_msr(tport, msr); break; default: - dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __FUNCTION__, data[1]); + dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __func__, data[1]); break; } @@ -1175,7 +1175,7 @@ exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(dev, "%s - resubmit interrupt urb failed, %d\n", - __FUNCTION__, retval); + __func__, retval); } @@ -1187,7 +1187,7 @@ static void ti_bulk_in_callback(struct urb *urb) int status = urb->status; int retval = 0; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); switch (status) { case 0: @@ -1195,13 +1195,13 @@ static void ti_bulk_in_callback(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("%s - urb shutting down, %d", __FUNCTION__, status); + dbg("%s - urb shutting down, %d", __func__, status); tport->tp_tdev->td_urb_error = 1; wake_up_interruptible(&tport->tp_write_wait); return; default: dev_err(dev, "%s - nonzero urb status, %d\n", - __FUNCTION__, status ); + __func__, status ); tport->tp_tdev->td_urb_error = 1; wake_up_interruptible(&tport->tp_write_wait); } @@ -1210,16 +1210,16 @@ static void ti_bulk_in_callback(struct urb *urb) goto exit; if (status) { - dev_err(dev, "%s - stopping read!\n", __FUNCTION__); + dev_err(dev, "%s - stopping read!\n", __func__); return; } if (port->tty && urb->actual_length) { - usb_serial_debug_data(debug, dev, __FUNCTION__, + usb_serial_debug_data(debug, dev, __func__, urb->actual_length, urb->transfer_buffer); if (!tport->tp_is_open) - dbg("%s - port closed, dropping data", __FUNCTION__); + dbg("%s - port closed, dropping data", __func__); else ti_recv(&urb->dev->dev, port->tty, urb->transfer_buffer, urb->actual_length); @@ -1241,7 +1241,7 @@ exit: spin_unlock(&tport->tp_lock); if (retval) dev_err(dev, "%s - resubmit read urb failed, %d\n", - __FUNCTION__, retval); + __func__, retval); } @@ -1252,7 +1252,7 @@ static void ti_bulk_out_callback(struct urb *urb) struct device *dev = &urb->dev->dev; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); tport->tp_write_urb_in_use = 0; @@ -1262,13 +1262,13 @@ static void ti_bulk_out_callback(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("%s - urb shutting down, %d", __FUNCTION__, status); + dbg("%s - urb shutting down, %d", __func__, status); tport->tp_tdev->td_urb_error = 1; wake_up_interruptible(&tport->tp_write_wait); return; default: dev_err(dev, "%s - nonzero urb status, %d\n", - __FUNCTION__, status); + __func__, status); tport->tp_tdev->td_urb_error = 1; wake_up_interruptible(&tport->tp_write_wait); } @@ -1286,7 +1286,7 @@ static void ti_recv(struct device *dev, struct tty_struct *tty, do { cnt = tty_buffer_request_room(tty, length); if (cnt < length) { - dev_err(dev, "%s - dropping data, %d bytes lost\n", __FUNCTION__, length - cnt); + dev_err(dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); if(cnt == 0) break; } @@ -1307,7 +1307,7 @@ static void ti_send(struct ti_port *tport) unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&tport->tp_lock, flags); @@ -1329,7 +1329,7 @@ static void ti_send(struct ti_port *tport) spin_unlock_irqrestore(&tport->tp_lock, flags); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); usb_fill_bulk_urb(port->write_urb, port->serial->dev, usb_sndbulkpipe(port->serial->dev, @@ -1339,7 +1339,7 @@ static void ti_send(struct ti_port *tport) result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { - dev_err(&port->dev, "%s - submit write urb failed, %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - submit write urb failed, %d\n", __func__, result); tport->tp_write_urb_in_use = 0; /* TODO: reschedule ti_send */ } else { @@ -1381,23 +1381,23 @@ static int ti_get_lsr(struct ti_port *tport) int port_number = port->number - port->serial->minor; struct ti_port_status *data; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); size = sizeof(struct ti_port_status); data = kmalloc(size, GFP_KERNEL); if (!data) { - dev_err(&port->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&port->dev, "%s - out of memory\n", __func__); return -ENOMEM; } status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); if (status) { - dev_err(&port->dev, "%s - get port status command failed, %d\n", __FUNCTION__, status); + dev_err(&port->dev, "%s - get port status command failed, %d\n", __func__, status); goto free_data; } - dbg("%s - lsr 0x%02X", __FUNCTION__, data->bLSR); + dbg("%s - lsr 0x%02X", __func__, data->bLSR); tport->tp_lsr = data->bLSR; @@ -1458,7 +1458,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) struct tty_struct *tty; unsigned long flags; - dbg("%s - msr 0x%02X", __FUNCTION__, msr); + dbg("%s - msr 0x%02X", __func__, msr); if (msr & TI_MSR_DELTA_MASK) { spin_lock_irqsave(&tport->tp_lock, flags); @@ -1496,7 +1496,7 @@ static void ti_drain(struct ti_port *tport, unsigned long timeout, int flush) struct usb_serial_port *port = tport->tp_port; wait_queue_t wait; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irq(&tport->tp_lock); @@ -1628,12 +1628,12 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr, struct ti_write_data_bytes *data; struct device *dev = &tdev->td_serial->dev->dev; - dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __FUNCTION__, addr, mask, byte); + dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __func__, addr, mask, byte); size = sizeof(struct ti_write_data_bytes) + 2; data = kmalloc(size, GFP_KERNEL); if (!data) { - dev_err(dev, "%s - out of memory\n", __FUNCTION__); + dev_err(dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -1649,7 +1649,7 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr, (__u8 *)data, size); if (status < 0) - dev_err(dev, "%s - failed, %d\n", __FUNCTION__, status); + dev_err(dev, "%s - failed, %d\n", __func__, status); kfree(data); @@ -1676,7 +1676,7 @@ static int ti_download_firmware(struct ti_device *tdev, buffer_size = TI_FIRMWARE_BUF_SIZE + sizeof(struct ti_firmware_header); buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { - dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&dev->dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -1690,7 +1690,7 @@ static int ti_download_firmware(struct ti_device *tdev, header->wLength = cpu_to_le16((__u16)(buffer_size - sizeof(struct ti_firmware_header))); header->bCheckSum = cs; - dbg("%s - downloading firmware", __FUNCTION__); + dbg("%s - downloading firmware", __func__); for (pos = 0; pos < buffer_size; pos += done) { len = min(buffer_size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE); status = usb_bulk_msg(dev, pipe, buffer+pos, len, &done, 1000); @@ -1701,11 +1701,11 @@ static int ti_download_firmware(struct ti_device *tdev, kfree(buffer); if (status) { - dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __FUNCTION__, status); + dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __func__, status); return status; } - dbg("%s - download successful", __FUNCTION__); + dbg("%s - download successful", __func__); return 0; } diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 5b464811fa4..baf953d14d8 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -81,7 +81,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po unsigned int i, j; int good_spot; - dbg("%s %d", __FUNCTION__, num_ports); + dbg("%s %d", __func__, num_ports); *minor = 0; mutex_lock(&table_lock); @@ -101,7 +101,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po *minor = i; j = 0; - dbg("%s - minor base = %d", __FUNCTION__, *minor); + dbg("%s - minor base = %d", __func__, *minor); for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { serial_table[i] = serial; serial->port[j++]->number = i; @@ -117,7 +117,7 @@ static void return_serial(struct usb_serial *serial) { int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (serial == NULL) return; @@ -135,7 +135,7 @@ static void destroy_serial(struct kref *kref) serial = to_usb_serial(kref); - dbg("%s - %s", __FUNCTION__, serial->type->description); + dbg("%s - %s", __func__, serial->type->description); serial->type->shutdown(serial); @@ -187,7 +187,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp) unsigned int portNumber; int retval; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* get the serial object associated with this tty pointer */ serial = usb_serial_get_by_index(tty->index); @@ -259,7 +259,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp) if (!port) return; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); mutex_lock(&port->mutex); @@ -299,11 +299,11 @@ static int serial_write (struct tty_struct * tty, const unsigned char *buf, int if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED) goto exit; - dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); + dbg("%s - port %d, %d byte(s)", __func__, port->number, count); if (!port->open_count) { retval = -EINVAL; - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not opened", __func__); goto exit; } @@ -322,10 +322,10 @@ static int serial_write_room (struct tty_struct *tty) if (!port) goto exit; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); goto exit; } @@ -344,10 +344,10 @@ static int serial_chars_in_buffer (struct tty_struct *tty) if (!port) goto exit; - dbg("%s = port %d", __FUNCTION__, port->number); + dbg("%s = port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); goto exit; } @@ -365,10 +365,10 @@ static void serial_throttle (struct tty_struct * tty) if (!port) return; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg ("%s - port not open", __FUNCTION__); + dbg ("%s - port not open", __func__); return; } @@ -384,10 +384,10 @@ static void serial_unthrottle (struct tty_struct * tty) if (!port) return; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); return; } @@ -405,11 +405,11 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in if (!port) goto exit; - dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); /* Caution - port->open_count is BKL protected */ if (!port->open_count) { - dbg ("%s - port not open", __FUNCTION__); + dbg ("%s - port not open", __func__); goto exit; } @@ -430,10 +430,10 @@ static void serial_set_termios (struct tty_struct *tty, struct ktermios * old) if (!port) return; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); return; } @@ -454,10 +454,10 @@ static void serial_break (struct tty_struct *tty, int break_state) return; } - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); unlock_kernel(); return; } @@ -476,7 +476,7 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int off_t begin = 0; char tmp[40]; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); length += sprintf (page, "usbserinfo:1.0 driver:2.0\n"); for (i = 0; i < SERIAL_TTY_MINORS && length < PAGE_SIZE; ++i) { serial = usb_serial_get_by_index(i); @@ -522,10 +522,10 @@ static int serial_tiocmget (struct tty_struct *tty, struct file *file) if (!port) return -ENODEV; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); return -ENODEV; } @@ -543,10 +543,10 @@ static int serial_tiocmset (struct tty_struct *tty, struct file *file, if (!port) return -ENODEV; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->open_count) { - dbg("%s - port not open", __FUNCTION__); + dbg("%s - port not open", __func__); return -ENODEV; } @@ -572,7 +572,7 @@ static void usb_serial_port_work(struct work_struct *work) container_of(work, struct usb_serial_port, work); struct tty_struct *tty; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port) return; @@ -588,7 +588,7 @@ static void port_release(struct device *dev) { struct usb_serial_port *port = to_usb_serial_port(dev); - dbg ("%s - %s", __FUNCTION__, dev->bus_id); + dbg ("%s - %s", __func__, dev->bus_id); port_free(port); } @@ -634,7 +634,7 @@ static struct usb_serial * create_serial (struct usb_device *dev, serial = kzalloc(sizeof(*serial), GFP_KERNEL); if (!serial) { - dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&dev->dev, "%s - out of memory\n", __func__); return NULL; } serial->dev = usb_get_dev(dev); @@ -729,7 +729,7 @@ int usb_serial_probe(struct usb_interface *interface, serial = create_serial (dev, interface, type); if (!serial) { unlock_kernel(); - dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&interface->dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -874,7 +874,7 @@ int usb_serial_probe(struct usb_interface *interface, serial->num_port_pointers = max_endpoints; unlock_kernel(); - dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); + dbg("%s - setting up %d port structures for this device", __func__, max_endpoints); for (i = 0; i < max_endpoints; ++i) { port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); if (!port) @@ -1022,7 +1022,7 @@ int usb_serial_probe(struct usb_interface *interface, port->dev.release = &port_release; snprintf (&port->dev.bus_id[0], sizeof(port->dev.bus_id), "ttyUSB%d", port->number); - dbg ("%s - registering %s", __FUNCTION__, port->dev.bus_id); + dbg ("%s - registering %s", __func__, port->dev.bus_id); retval = device_register(&port->dev); if (retval) dev_err(&port->dev, "Error registering port device, " @@ -1081,7 +1081,7 @@ void usb_serial_disconnect(struct usb_interface *interface) struct usb_serial_port *port; usb_serial_console_disconnect(serial); - dbg ("%s", __FUNCTION__); + dbg ("%s", __func__); mutex_lock(&serial->disc_mutex); usb_set_intfdata (interface, NULL); @@ -1165,7 +1165,7 @@ static int __init usb_serial_init(void) result = bus_register(&usb_serial_bus_type); if (result) { - err("%s - registering bus driver failed", __FUNCTION__); + err("%s - registering bus driver failed", __func__); goto exit_bus; } @@ -1182,21 +1182,21 @@ static int __init usb_serial_init(void) tty_set_operations(usb_serial_tty_driver, &serial_ops); result = tty_register_driver(usb_serial_tty_driver); if (result) { - err("%s - tty_register_driver failed", __FUNCTION__); + err("%s - tty_register_driver failed", __func__); goto exit_reg_driver; } /* register the USB driver */ result = usb_register(&usb_serial_driver); if (result < 0) { - err("%s - usb_register failed", __FUNCTION__); + err("%s - usb_register failed", __func__); goto exit_tty; } /* register the generic driver, if we should */ result = usb_serial_generic_register(debug); if (result < 0) { - err("%s - registering generic driver failed", __FUNCTION__); + err("%s - registering generic driver failed", __func__); goto exit_generic; } @@ -1214,7 +1214,7 @@ exit_reg_driver: bus_unregister(&usb_serial_bus_type); exit_bus: - err ("%s - returning with error %d", __FUNCTION__, result); + err ("%s - returning with error %d", __func__, result); put_tty_driver(usb_serial_tty_driver); return result; } diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index f2d59b06c36..137df445e29 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -281,7 +281,7 @@ static int visor_open (struct usb_serial_port *port, struct file *filp) unsigned long flags; int result = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (!port->read_urb) { /* this is needed for some brain dead Sony devices */ @@ -313,16 +313,16 @@ static int visor_open (struct usb_serial_port *port, struct file *filp) result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) { dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", - __FUNCTION__, result); + __func__, result); goto exit; } if (port->interrupt_in_urb) { - dbg("%s - adding interrupt input for treo", __FUNCTION__); + dbg("%s - adding interrupt input for treo", __func__); result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) dev_err(&port->dev, "%s - failed submitting interrupt urb, error %d\n", - __FUNCTION__, result); + __func__, result); } exit: return result; @@ -334,7 +334,7 @@ static void visor_close (struct usb_serial_port *port, struct file * filp) struct visor_private *priv = usb_get_serial_port_data(port); unsigned char *transfer_buffer; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* shutdown our urbs */ usb_kill_urb(port->read_urb); @@ -370,12 +370,12 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf, unsigned long flags; int status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); if (priv->outstanding_urbs > URB_UPPER_LIMIT) { spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - write limit hit\n", __FUNCTION__); + dbg("%s - write limit hit\n", __func__); return 0; } priv->outstanding_urbs++; @@ -397,7 +397,7 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf, memcpy (buffer, buf, count); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, buffer); + usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); usb_fill_bulk_urb (urb, serial->dev, usb_sndbulkpipe (serial->dev, @@ -409,7 +409,7 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf, status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", - __FUNCTION__, status); + __func__, status); count = status; goto error; } else { @@ -440,7 +440,7 @@ static int visor_write_room (struct usb_serial_port *port) struct visor_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * We really can take anything the user throws at us @@ -451,7 +451,7 @@ static int visor_write_room (struct usb_serial_port *port) spin_lock_irqsave(&priv->lock, flags); if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) { spin_unlock_irqrestore(&priv->lock, flags); - dbg("%s - write limit hit\n", __FUNCTION__); + dbg("%s - write limit hit\n", __func__); return 0; } spin_unlock_irqrestore(&priv->lock, flags); @@ -462,7 +462,7 @@ static int visor_write_room (struct usb_serial_port *port) static int visor_chars_in_buffer (struct usb_serial_port *port) { - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); /* * We can't really account for how much data we @@ -484,11 +484,11 @@ static void visor_write_bulk_callback (struct urb *urb) /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree (urb->transfer_buffer); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); spin_lock_irqsave(&priv->lock, flags); --priv->outstanding_urbs; @@ -508,15 +508,15 @@ static void visor_read_bulk_callback (struct urb *urb) int result; int available_room; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); tty = port->tty; if (tty && urb->actual_length) { @@ -542,7 +542,7 @@ static void visor_read_bulk_callback (struct urb *urb) visor_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); } else { priv->actually_throttled = 1; } @@ -564,11 +564,11 @@ static void visor_read_int_callback (struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } @@ -579,14 +579,14 @@ static void visor_read_int_callback (struct urb *urb) * Rumor has it this endpoint is used to notify when data * is ready to be read from the bulk ones. */ - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, urb->transfer_buffer); exit: result = usb_submit_urb (urb, GFP_ATOMIC); if (result) dev_err(&urb->dev->dev, "%s - Error %d submitting interrupt urb\n", - __FUNCTION__, result); + __func__, result); } static void visor_throttle (struct usb_serial_port *port) @@ -594,7 +594,7 @@ static void visor_throttle (struct usb_serial_port *port) struct visor_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); priv->throttled = 1; spin_unlock_irqrestore(&priv->lock, flags); @@ -607,7 +607,7 @@ static void visor_unthrottle (struct usb_serial_port *port) unsigned long flags; int result; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&priv->lock, flags); priv->throttled = 0; priv->actually_throttled = 0; @@ -616,7 +616,7 @@ static void visor_unthrottle (struct usb_serial_port *port) port->read_urb->dev = port->serial->dev; result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); + dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result); } static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_id *id) @@ -629,11 +629,11 @@ static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_i int i; int num_ports = 0; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); transfer_buffer = kmalloc (sizeof (*connection_info), GFP_KERNEL); if (!transfer_buffer) { - dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __FUNCTION__, + dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__, sizeof(*connection_info)); return -ENOMEM; } @@ -646,7 +646,7 @@ static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_i sizeof(*connection_info), 300); if (retval < 0) { dev_err(dev, "%s - error %d getting connection information\n", - __FUNCTION__, retval); + __func__, retval); goto exit; } @@ -706,7 +706,7 @@ static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_i 0x02, 300); if (retval < 0) dev_err(dev, "%s - error %d getting bytes available request\n", - __FUNCTION__, retval); + __func__, retval); retval = 0; exit: @@ -722,11 +722,11 @@ static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_i unsigned char *transfer_buffer; int retval; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); transfer_buffer = kmalloc (sizeof (*connection_info), GFP_KERNEL); if (!transfer_buffer) { - dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __FUNCTION__, + dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__, sizeof(*connection_info)); return -ENOMEM; } @@ -738,9 +738,9 @@ static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_i sizeof (*connection_info), 300); if (retval < 0) dev_err(dev, "%s - error %d getting connection info\n", - __FUNCTION__, retval); + __func__, retval); else - usb_serial_debug_data(debug, &serial->dev->dev, __FUNCTION__, + usb_serial_debug_data(debug, &serial->dev->dev, __func__, retval, transfer_buffer); kfree (transfer_buffer); @@ -753,7 +753,7 @@ static int visor_probe (struct usb_serial *serial, const struct usb_device_id *i int retval = 0; int (*startup) (struct usb_serial *serial, const struct usb_device_id *id); - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (serial->dev->actconfig->desc.bConfigurationValue != 1) { err("active config #%d != 1 ??", @@ -807,7 +807,7 @@ static int clie_3_5_startup (struct usb_serial *serial) int result; u8 data; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* * Note that PEG-300 series devices expect the following two calls. @@ -818,11 +818,11 @@ static int clie_3_5_startup (struct usb_serial *serial) USB_REQ_GET_CONFIGURATION, USB_DIR_IN, 0, 0, &data, 1, 3000); if (result < 0) { - dev_err(dev, "%s: get config number failed: %d\n", __FUNCTION__, result); + dev_err(dev, "%s: get config number failed: %d\n", __func__, result); return result; } if (result != 1) { - dev_err(dev, "%s: get config number bad return length: %d\n", __FUNCTION__, result); + dev_err(dev, "%s: get config number bad return length: %d\n", __func__, result); return -EIO; } @@ -832,11 +832,11 @@ static int clie_3_5_startup (struct usb_serial *serial) USB_DIR_IN | USB_RECIP_INTERFACE, 0, 0, &data, 1, 3000); if (result < 0) { - dev_err(dev, "%s: get interface number failed: %d\n", __FUNCTION__, result); + dev_err(dev, "%s: get interface number failed: %d\n", __func__, result); return result; } if (result != 1) { - dev_err(dev, "%s: get interface number bad return length: %d\n", __FUNCTION__, result); + dev_err(dev, "%s: get interface number bad return length: %d\n", __func__, result); return -EIO; } @@ -854,7 +854,7 @@ static int treo_attach (struct usb_serial *serial) (serial->num_interrupt_in == 0)) goto generic_startup; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* * It appears that Treos and Kyoceras want to use the @@ -885,7 +885,7 @@ generic_startup: static int clie_5_attach (struct usb_serial *serial) { - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* TH55 registers 2 ports. Communication in from the UX50/TH55 uses bulk_in_endpointAddress from port 0 @@ -909,7 +909,7 @@ static void visor_shutdown (struct usb_serial *serial) struct visor_private *priv; int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); for (i = 0; i < serial->num_ports; i++) { priv = usb_get_serial_port_data(serial->port[i]); @@ -922,7 +922,7 @@ static void visor_shutdown (struct usb_serial *serial) static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) { - dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); return -ENOIOCTLCMD; } diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index c5af57be62f..fb02424de4a 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -282,7 +282,7 @@ static int whiteheat_firmware_download (struct usb_serial *serial, const struct int response; const struct whiteheat_hex_record *record; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); response = ezusb_set_reset (serial, 1); @@ -292,7 +292,7 @@ static int whiteheat_firmware_download (struct usb_serial *serial, const struct (unsigned char *)record->data, record->data_size, 0xa0); if (response < 0) { err("%s - ezusb_writememory failed for loader (%d %04X %p %d)", - __FUNCTION__, response, record->address, record->data, record->data_size); + __func__, response, record->address, record->data, record->data_size); break; } ++record; @@ -309,7 +309,7 @@ static int whiteheat_firmware_download (struct usb_serial *serial, const struct (unsigned char *)record->data, record->data_size, 0xa3); if (response < 0) { err("%s - ezusb_writememory failed for first firmware step (%d %04X %p %d)", - __FUNCTION__, response, record->address, record->data, record->data_size); + __func__, response, record->address, record->data, record->data_size); break; } ++record; @@ -323,7 +323,7 @@ static int whiteheat_firmware_download (struct usb_serial *serial, const struct (unsigned char *)record->data, record->data_size, 0xa0); if (response < 0) { err("%s - ezusb_writememory failed for second firmware step (%d %04X %p %d)", - __FUNCTION__, response, record->address, record->data, record->data_size); + __func__, response, record->address, record->data, record->data_size); break; } ++record; @@ -561,7 +561,7 @@ static void whiteheat_shutdown (struct usb_serial *serial) struct list_head *tmp2; int i; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* free up our private data for our command port */ command_port = serial->port[COMMAND_PORT]; @@ -598,7 +598,7 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp) int retval = 0; struct ktermios old_term; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); retval = start_command_port(port->serial); if (retval) @@ -631,14 +631,14 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp) /* Start reading from the device */ retval = start_port_read(port); if (retval) { - err("%s - failed submitting read urb, error %d", __FUNCTION__, retval); + err("%s - failed submitting read urb, error %d", __func__, retval); firm_close(port); stop_command_port(port->serial); goto exit; } exit: - dbg("%s - exit, retval = %d", __FUNCTION__, retval); + dbg("%s - exit, retval = %d", __func__, retval); return retval; } @@ -651,7 +651,7 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp) struct list_head *tmp; struct list_head *tmp2; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); mutex_lock(&port->serial->disc_mutex); /* filp is NULL when called from usb_serial_disconnect */ @@ -726,10 +726,10 @@ static int whiteheat_write(struct usb_serial_port *port, const unsigned char *bu unsigned long flags; struct list_head *tmp; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (count == 0) { - dbg("%s - write request of 0 bytes", __FUNCTION__); + dbg("%s - write request of 0 bytes", __func__); return (0); } @@ -748,13 +748,13 @@ static int whiteheat_write(struct usb_serial_port *port, const unsigned char *bu bytes = (count > port->bulk_out_size) ? port->bulk_out_size : count; memcpy (urb->transfer_buffer, buf + sent, bytes); - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, bytes, urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __func__, bytes, urb->transfer_buffer); urb->dev = serial->dev; urb->transfer_buffer_length = bytes; result = usb_submit_urb(urb, GFP_ATOMIC); if (result) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + err("%s - failed submitting write urb, error %d", __func__, result); sent = result; spin_lock_irqsave(&info->lock, flags); list_add(tmp, &info->tx_urbs_free); @@ -780,7 +780,7 @@ static int whiteheat_write_room(struct usb_serial_port *port) int room = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&info->lock, flags); list_for_each(tmp, &info->tx_urbs_free) @@ -788,7 +788,7 @@ static int whiteheat_write_room(struct usb_serial_port *port) spin_unlock_irqrestore(&info->lock, flags); room *= port->bulk_out_size; - dbg("%s - returns %d", __FUNCTION__, room); + dbg("%s - returns %d", __func__, room); return (room); } @@ -798,7 +798,7 @@ static int whiteheat_tiocmget (struct usb_serial_port *port, struct file *file) struct whiteheat_private *info = usb_get_serial_port_data(port); unsigned int modem_signals = 0; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); firm_get_dtr_rts(port); if (info->mcr & UART_MCR_DTR) @@ -815,7 +815,7 @@ static int whiteheat_tiocmset (struct usb_serial_port *port, struct file *file, { struct whiteheat_private *info = usb_get_serial_port_data(port); - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); if (set & TIOCM_RTS) info->mcr |= UART_MCR_RTS; @@ -838,7 +838,7 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un struct serial_struct serstruct; void __user *user_arg = (void __user *)arg; - dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); + dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); switch (cmd) { case TIOCGSERIAL: @@ -880,7 +880,7 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un static void whiteheat_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) { - dbg("%s -port %d", __FUNCTION__, port->number); + dbg("%s -port %d", __func__, port->number); firm_setup_port(port); } @@ -898,7 +898,7 @@ static int whiteheat_chars_in_buffer(struct usb_serial_port *port) int chars = 0; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&info->lock, flags); list_for_each(tmp, &info->tx_urbs_submitted) { @@ -907,7 +907,7 @@ static int whiteheat_chars_in_buffer(struct usb_serial_port *port) } spin_unlock_irqrestore(&info->lock, flags); - dbg ("%s - returns %d", __FUNCTION__, chars); + dbg ("%s - returns %d", __func__, chars); return chars; } @@ -917,7 +917,7 @@ static void whiteheat_throttle (struct usb_serial_port *port) struct whiteheat_private *info = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&info->lock, flags); info->flags |= THROTTLED; @@ -933,7 +933,7 @@ static void whiteheat_unthrottle (struct usb_serial_port *port) int actually_throttled; unsigned long flags; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock_irqsave(&info->lock, flags); actually_throttled = info->flags & ACTUALLY_THROTTLED; @@ -954,7 +954,7 @@ static void command_port_write_callback(struct urb *urb) { int status = urb->status; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); if (status) { dbg("nonzero urb status: %d", status); @@ -971,22 +971,22 @@ static void command_port_read_callback(struct urb *urb) unsigned char *data = urb->transfer_buffer; int result; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); command_info = usb_get_serial_port_data(command_port); if (!command_info) { - dbg ("%s - command_info is NULL, exiting.", __FUNCTION__); + dbg ("%s - command_info is NULL, exiting.", __func__); return; } if (status) { - dbg("%s - nonzero urb status: %d", __FUNCTION__, status); + dbg("%s - nonzero urb status: %d", __func__, status); if (status != -ENOENT) command_info->command_finished = WHITEHEAT_CMD_FAILURE; wake_up(&command_info->wait_command); return; } - usb_serial_debug_data(debug, &command_port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &command_port->dev, __func__, urb->actual_length, data); if (data[0] == WHITEHEAT_CMD_COMPLETE) { command_info->command_finished = WHITEHEAT_CMD_COMPLETE; @@ -996,20 +996,20 @@ static void command_port_read_callback(struct urb *urb) wake_up(&command_info->wait_command); } else if (data[0] == WHITEHEAT_EVENT) { /* These are unsolicited reports from the firmware, hence no waiting command to wakeup */ - dbg("%s - event received", __FUNCTION__); + dbg("%s - event received", __func__); } else if (data[0] == WHITEHEAT_GET_DTR_RTS) { memcpy(command_info->result_buffer, &data[1], urb->actual_length - 1); command_info->command_finished = WHITEHEAT_CMD_COMPLETE; wake_up(&command_info->wait_command); } else { - dbg("%s - bad reply from firmware", __FUNCTION__); + dbg("%s - bad reply from firmware", __func__); } /* Continue trying to always read */ command_port->read_urb->dev = command_port->serial->dev; result = usb_submit_urb(command_port->read_urb, GFP_ATOMIC); if (result) - dbg("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + dbg("%s - failed resubmitting read urb, error %d", __func__, result); } @@ -1021,13 +1021,13 @@ static void whiteheat_read_callback(struct urb *urb) struct whiteheat_private *info = usb_get_serial_port_data(port); int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock(&info->lock); wrap = urb_to_wrap(urb, &info->rx_urbs_submitted); if (!wrap) { spin_unlock(&info->lock); - err("%s - Not my urb!", __FUNCTION__); + err("%s - Not my urb!", __func__); return; } list_del(&wrap->list); @@ -1035,14 +1035,14 @@ static void whiteheat_read_callback(struct urb *urb) if (status) { dbg("%s - nonzero read bulk status received: %d", - __FUNCTION__, status); + __func__, status); spin_lock(&info->lock); list_add(&wrap->list, &info->rx_urbs_free); spin_unlock(&info->lock); return; } - usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); spin_lock(&info->lock); list_add_tail(&wrap->list, &info->rx_urb_q); @@ -1064,13 +1064,13 @@ static void whiteheat_write_callback(struct urb *urb) struct whiteheat_urb_wrap *wrap; int status = urb->status; - dbg("%s - port %d", __FUNCTION__, port->number); + dbg("%s - port %d", __func__, port->number); spin_lock(&info->lock); wrap = urb_to_wrap(urb, &info->tx_urbs_submitted); if (!wrap) { spin_unlock(&info->lock); - err("%s - Not my urb!", __FUNCTION__); + err("%s - Not my urb!", __func__); return; } list_move(&wrap->list, &info->tx_urbs_free); @@ -1078,7 +1078,7 @@ static void whiteheat_write_callback(struct urb *urb) if (status) { dbg("%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); return; } @@ -1098,7 +1098,7 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command, __u8 *d int retval = 0; int t; - dbg("%s - command %d", __FUNCTION__, command); + dbg("%s - command %d", __func__, command); command_port = port->serial->port[COMMAND_PORT]; command_info = usb_get_serial_port_data(command_port); @@ -1112,7 +1112,7 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command, __u8 *d command_port->write_urb->dev = port->serial->dev; retval = usb_submit_urb (command_port->write_urb, GFP_NOIO); if (retval) { - dbg("%s - submit urb failed", __FUNCTION__); + dbg("%s - submit urb failed", __func__); goto exit; } @@ -1123,19 +1123,19 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command, __u8 *d usb_kill_urb(command_port->write_urb); if (command_info->command_finished == false) { - dbg("%s - command timed out.", __FUNCTION__); + dbg("%s - command timed out.", __func__); retval = -ETIMEDOUT; goto exit; } if (command_info->command_finished == WHITEHEAT_CMD_FAILURE) { - dbg("%s - command failed.", __FUNCTION__); + dbg("%s - command failed.", __func__); retval = -EIO; goto exit; } if (command_info->command_finished == WHITEHEAT_CMD_COMPLETE) { - dbg("%s - command completed.", __FUNCTION__); + dbg("%s - command completed.", __func__); switch (command) { case WHITEHEAT_GET_DTR_RTS: info = usb_get_serial_port_data(port); @@ -1180,7 +1180,7 @@ static int firm_setup_port(struct usb_serial_port *port) { default: case CS8: port_settings.bits = 8; break; } - dbg("%s - data bits = %d", __FUNCTION__, port_settings.bits); + dbg("%s - data bits = %d", __func__, port_settings.bits); /* determine the parity */ if (cflag & PARENB) @@ -1196,21 +1196,21 @@ static int firm_setup_port(struct usb_serial_port *port) { port_settings.parity = WHITEHEAT_PAR_EVEN; else port_settings.parity = WHITEHEAT_PAR_NONE; - dbg("%s - parity = %c", __FUNCTION__, port_settings.parity); + dbg("%s - parity = %c", __func__, port_settings.parity); /* figure out the stop bits requested */ if (cflag & CSTOPB) port_settings.stop = 2; else port_settings.stop = 1; - dbg("%s - stop bits = %d", __FUNCTION__, port_settings.stop); + dbg("%s - stop bits = %d", __func__, port_settings.stop); /* figure out the flow control settings */ if (cflag & CRTSCTS) port_settings.hflow = (WHITEHEAT_HFLOW_CTS | WHITEHEAT_HFLOW_RTS); else port_settings.hflow = WHITEHEAT_HFLOW_NONE; - dbg("%s - hardware flow control = %s %s %s %s", __FUNCTION__, + dbg("%s - hardware flow control = %s %s %s %s", __func__, (port_settings.hflow & WHITEHEAT_HFLOW_CTS) ? "CTS" : "", (port_settings.hflow & WHITEHEAT_HFLOW_RTS) ? "RTS" : "", (port_settings.hflow & WHITEHEAT_HFLOW_DSR) ? "DSR" : "", @@ -1221,15 +1221,15 @@ static int firm_setup_port(struct usb_serial_port *port) { port_settings.sflow = WHITEHEAT_SFLOW_RXTX; else port_settings.sflow = WHITEHEAT_SFLOW_NONE; - dbg("%s - software flow control = %c", __FUNCTION__, port_settings.sflow); + dbg("%s - software flow control = %c", __func__, port_settings.sflow); port_settings.xon = START_CHAR(port->tty); port_settings.xoff = STOP_CHAR(port->tty); - dbg("%s - XON = %2x, XOFF = %2x", __FUNCTION__, port_settings.xon, port_settings.xoff); + dbg("%s - XON = %2x, XOFF = %2x", __func__, port_settings.xon, port_settings.xoff); /* get the baud rate wanted */ port_settings.baud = tty_get_baud_rate(port->tty); - dbg("%s - baud rate = %d", __FUNCTION__, port_settings.baud); + dbg("%s - baud rate = %d", __func__, port_settings.baud); /* fixme: should set validated settings */ tty_encode_baud_rate(port->tty, port_settings.baud, port_settings.baud); @@ -1312,7 +1312,7 @@ static int start_command_port(struct usb_serial *serial) command_port->read_urb->dev = serial->dev; retval = usb_submit_urb(command_port->read_urb, GFP_KERNEL); if (retval) { - err("%s - failed submitting read urb, error %d", __FUNCTION__, retval); + err("%s - failed submitting read urb, error %d", __func__, retval); goto exit; } } @@ -1448,7 +1448,7 @@ static void rx_data_softint(struct work_struct *work) urb->dev = port->serial->dev; result = usb_submit_urb(urb, GFP_ATOMIC); if (result) { - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + err("%s - failed resubmitting read urb, error %d", __func__, result); spin_lock_irqsave(&info->lock, flags); list_add(tmp, &info->rx_urbs_free); continue; diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 521f0297aef..3fcde9f0fa5 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -228,12 +228,12 @@ static int queuecommand(struct scsi_cmnd *srb, { struct us_data *us = host_to_us(srb->device->host); - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); /* check for state-transition errors */ if (us->srb != NULL) { printk(KERN_ERR USB_STORAGE "Error in %s: us->srb = %p\n", - __FUNCTION__, us->srb); + __func__, us->srb); return SCSI_MLQUEUE_HOST_BUSY; } @@ -262,7 +262,7 @@ static int command_abort(struct scsi_cmnd *srb) { struct us_data *us = host_to_us(srb->device->host); - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); /* us->srb together with the TIMED_OUT, RESETTING, and ABORTING * bits are protected by the host lock. */ @@ -299,7 +299,7 @@ static int device_reset(struct scsi_cmnd *srb) struct us_data *us = host_to_us(srb->device->host); int result; - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); /* lock the device pointers and do the reset */ mutex_lock(&(us->dev_mutex)); @@ -315,7 +315,7 @@ static int bus_reset(struct scsi_cmnd *srb) struct us_data *us = host_to_us(srb->device->host); int result; - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); result = usb_stor_port_reset(us); return result < 0 ? FAILED : SUCCESS; } diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 4628f03b13b..db55ec39bb8 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -198,7 +198,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe, int status; US_DEBUGP("%s: rq=%02x rqtype=%02x value=%04x index=%02x len=%u\n", - __FUNCTION__, request, requesttype, + __func__, request, requesttype, value, index, size); /* fill in the devrequest structure */ @@ -250,7 +250,7 @@ int usb_stor_clear_halt(struct us_data *us, unsigned int pipe) usb_settoggle(us->pusb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), 0); - US_DEBUGP("%s: result = %d\n", __FUNCTION__, result); + US_DEBUGP("%s: result = %d\n", __func__, result); return result; } @@ -332,7 +332,7 @@ int usb_stor_ctrl_transfer(struct us_data *us, unsigned int pipe, int result; US_DEBUGP("%s: rq=%02x rqtype=%02x value=%04x index=%02x len=%u\n", - __FUNCTION__, request, requesttype, + __func__, request, requesttype, value, index, size); /* fill in the devrequest structure */ @@ -366,7 +366,7 @@ static int usb_stor_intr_transfer(struct us_data *us, void *buf, unsigned int pipe = us->recv_intr_pipe; unsigned int maxp; - US_DEBUGP("%s: xfer %u bytes\n", __FUNCTION__, length); + US_DEBUGP("%s: xfer %u bytes\n", __func__, length); /* calculate the max packet size */ maxp = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe)); @@ -393,7 +393,7 @@ int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe, { int result; - US_DEBUGP("%s: xfer %u bytes\n", __FUNCTION__, length); + US_DEBUGP("%s: xfer %u bytes\n", __func__, length); /* fill and submit the URB */ usb_fill_bulk_urb(us->current_urb, us->pusb_dev, pipe, buf, length, @@ -424,7 +424,7 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, return USB_STOR_XFER_ERROR; /* initialize the scatter-gather request block */ - US_DEBUGP("%s: xfer %u bytes, %d entries\n", __FUNCTION__, + US_DEBUGP("%s: xfer %u bytes, %d entries\n", __func__, length, num_sg); result = usb_sg_init(&us->current_sg, us->pusb_dev, pipe, 0, sg, num_sg, length, GFP_NOIO); @@ -701,7 +701,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) /* Stop the current URB transfer */ void usb_stor_stop_transport(struct us_data *us) { - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); /* If the state machine is blocked waiting for an URB, * let's wake it up. The test_and_clear_bit() call @@ -1135,7 +1135,7 @@ static int usb_stor_reset_common(struct us_data *us, int usb_stor_CB_reset(struct us_data *us) { - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); memset(us->iobuf, 0xFF, CB_RESET_CMD_SIZE); us->iobuf[0] = SEND_DIAGNOSTIC; @@ -1150,7 +1150,7 @@ int usb_stor_CB_reset(struct us_data *us) */ int usb_stor_Bulk_reset(struct us_data *us) { - US_DEBUGP("%s called\n", __FUNCTION__); + US_DEBUGP("%s called\n", __func__); return usb_stor_reset_common(us, US_BULK_RESET_REQUEST, USB_TYPE_CLASS | USB_RECIP_INTERFACE, diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index f59593de3b8..a856effad3b 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -190,7 +190,7 @@ static int storage_suspend(struct usb_interface *iface, pm_message_t message) /* Wait until no command is running */ mutex_lock(&us->dev_mutex); - US_DEBUGP("%s\n", __FUNCTION__); + US_DEBUGP("%s\n", __func__); if (us->suspend_resume_hook) (us->suspend_resume_hook)(us, US_SUSPEND); @@ -207,7 +207,7 @@ static int storage_resume(struct usb_interface *iface) mutex_lock(&us->dev_mutex); - US_DEBUGP("%s\n", __FUNCTION__); + US_DEBUGP("%s\n", __func__); if (us->suspend_resume_hook) (us->suspend_resume_hook)(us, US_RESUME); @@ -219,7 +219,7 @@ static int storage_reset_resume(struct usb_interface *iface) { struct us_data *us = usb_get_intfdata(iface); - US_DEBUGP("%s\n", __FUNCTION__); + US_DEBUGP("%s\n", __func__); /* Report the reset to the SCSI core */ usb_stor_report_bus_reset(us); @@ -240,7 +240,7 @@ static int storage_pre_reset(struct usb_interface *iface) { struct us_data *us = usb_get_intfdata(iface); - US_DEBUGP("%s\n", __FUNCTION__); + US_DEBUGP("%s\n", __func__); /* Make sure no command runs during the reset */ mutex_lock(&us->dev_mutex); @@ -251,7 +251,7 @@ static int storage_post_reset(struct usb_interface *iface) { struct us_data *us = usb_get_intfdata(iface); - US_DEBUGP("%s\n", __FUNCTION__); + US_DEBUGP("%s\n", __func__); /* Report the reset to the SCSI core */ usb_stor_report_bus_reset(us); @@ -437,7 +437,7 @@ SkipForAbort: /* Associate our private data with the USB device */ static int associate_dev(struct us_data *us, struct usb_interface *intf) { - US_DEBUGP("-- %s\n", __FUNCTION__); + US_DEBUGP("-- %s\n", __func__); /* Fill in the device-related fields */ us->pusb_dev = interface_to_usbdev(intf); @@ -816,7 +816,7 @@ static int usb_stor_acquire_resources(struct us_data *us) /* Release all our dynamic resources */ static void usb_stor_release_resources(struct us_data *us) { - US_DEBUGP("-- %s\n", __FUNCTION__); + US_DEBUGP("-- %s\n", __func__); /* Tell the control thread to exit. The SCSI host must * already have been removed so it won't try to queue @@ -842,7 +842,7 @@ static void usb_stor_release_resources(struct us_data *us) /* Dissociate from the USB device */ static void dissociate_dev(struct us_data *us) { - US_DEBUGP("-- %s\n", __FUNCTION__); + US_DEBUGP("-- %s\n", __func__); kfree(us->sensebuf); diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index c815a40e167..73e6a66d95a 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -88,7 +88,7 @@ static int skel_open(struct inode *inode, struct file *file) interface = usb_find_interface(&skel_driver, subminor); if (!interface) { err ("%s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); retval = -ENODEV; goto exit; } @@ -220,7 +220,7 @@ static void skel_write_bulk_callback(struct urb *urb) urb->status == -ECONNRESET || urb->status == -ESHUTDOWN)) err("%s - nonzero write bulk status received: %d", - __FUNCTION__, urb->status); + __func__, urb->status); spin_lock(&dev->err_lock); dev->errors = urb->status; @@ -301,7 +301,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, size_t cou retval = usb_submit_urb(urb, GFP_KERNEL); mutex_unlock(&dev->io_mutex); if (retval) { - err("%s - failed submitting write urb, error %d", __FUNCTION__, retval); + err("%s - failed submitting write urb, error %d", __func__, retval); goto error_unanchor; } -- cgit v1.2.3 From a5b6f60c5a30c494017c7a2d11c4067f90d3d0df Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 8 Apr 2008 17:16:06 +0100 Subject: usb serial: more fixes and groundwork for tty changes - If a termios change fails due to lack of memory we should copy the old settings back over as the device has not changed - Note various locking problems - kl5kusb105 had various remaining tty flag handling problems - Make safe_serial use tty_insert_flip_string not open coded loops - set termios speed properly in usb_serial Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ark3116.c | 1 + drivers/usb/serial/cyberjack.c | 31 +++++++++++++++--------------- drivers/usb/serial/generic.c | 5 +++-- drivers/usb/serial/keyspan.c | 19 ++++++++++--------- drivers/usb/serial/keyspan_pda.c | 9 +++++++-- drivers/usb/serial/kl5kusb105.c | 41 ++++++++++++++++++++++++---------------- drivers/usb/serial/mos7720.c | 1 + drivers/usb/serial/navman.c | 10 +++++----- drivers/usb/serial/omninet.c | 3 ++- drivers/usb/serial/option.c | 3 +++ drivers/usb/serial/pl2303.c | 2 ++ drivers/usb/serial/safe_serial.c | 27 +++++++++++--------------- drivers/usb/serial/sierra.c | 2 ++ drivers/usb/serial/usb-serial.c | 2 ++ drivers/usb/serial/visor.c | 2 ++ drivers/usb/serial/whiteheat.c | 2 +- 16 files changed, 93 insertions(+), 67 deletions(-) diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 9d708b22e95..599ab2e548a 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -192,6 +192,7 @@ static void ark3116_set_termios(struct usb_serial_port *port, buf = kmalloc(1, GFP_KERNEL); if (!buf) { dbg("error kmalloc"); + *port->tty->termios = *old_termios; return; } diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 5348e97b52b..d077534ceae 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -151,7 +151,7 @@ static void cyberjack_shutdown (struct usb_serial *serial) dbg("%s", __func__); - for (i=0; i < serial->num_ports; ++i) { + for (i = 0; i < serial->num_ports; ++i) { usb_kill_urb(serial->port[i]->interrupt_in_urb); /* My special items, the standard routines free my urbs */ kfree(usb_get_serial_port_data(serial->port[i])); @@ -209,7 +209,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b if (count == 0) { dbg("%s - write request of 0 bytes", __func__); - return (0); + return 0; } spin_lock_bh(&port->lock); @@ -223,12 +223,12 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b spin_lock_irqsave(&priv->lock, flags); - if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) { + if( (count+priv->wrfilled) > sizeof(priv->wrbuf) ) { /* To much data for buffer. Reset buffer. */ - priv->wrfilled=0; - spin_unlock_irqrestore(&priv->lock, flags); + priv->wrfilled = 0; port->write_urb_busy = 0; - return (0); + spin_unlock_irqrestore(&priv->lock, flags); + return 0; } /* Copy data */ @@ -269,8 +269,8 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b if (result) { err("%s - failed submitting write urb, error %d", __func__, result); /* Throw away data. No better idea what to do with it. */ - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; spin_unlock_irqrestore(&priv->lock, flags); port->write_urb_busy = 0; return 0; @@ -282,8 +282,8 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b if( priv->wrsent>=priv->wrfilled ) { dbg("%s - buffer cleaned", __func__); memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; } } @@ -294,6 +294,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b static int cyberjack_write_room( struct usb_serial_port *port ) { + /* FIXME: .... */ return CYBERJACK_LOCAL_BUF_SIZE; } @@ -314,7 +315,7 @@ static void cyberjack_read_int_callback( struct urb *urb ) usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* React only to interrupts signaling a bulk_in transfer */ - if( (urb->actual_length==4) && (data[0]==0x01) ) { + if( (urb->actual_length == 4) && (data[0] == 0x01) ) { short old_rdtodo; /* This is a announcement of coming bulk_ins. */ @@ -450,8 +451,8 @@ static void cyberjack_write_bulk_callback (struct urb *urb) if (result) { err("%s - failed submitting write urb, error %d", __func__, result); /* Throw away data. No better idea what to do with it. */ - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; goto exit; } @@ -463,8 +464,8 @@ static void cyberjack_write_bulk_callback (struct urb *urb) if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) { dbg("%s - buffer cleaned", __func__); memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; } } diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 2078667db4a..65765ce7625 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -262,13 +262,14 @@ int usb_serial_generic_write_room (struct usb_serial_port *port) dbg("%s - port %d", __func__, port->number); + /* FIXME: Locking */ if (serial->num_bulk_out) { if (!(port->write_urb_busy)) room = port->bulk_out_size; } dbg("%s - returns %d", __func__, room); - return (room); + return room; } int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port) @@ -278,6 +279,7 @@ int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port) dbg("%s - port %d", __func__, port->number); + /* FIXME: Locking */ if (serial->num_bulk_out) { if (port->write_urb_busy) chars = port->write_urb->transfer_buffer_length; @@ -368,7 +370,6 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb) __func__, status); return; } - usb_serial_port_softint(port); } EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 857c5312555..0d122feb2b2 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -1187,6 +1187,7 @@ static int keyspan_write_room (struct usb_serial_port *port) p_priv = usb_get_serial_port_data(port); d_details = p_priv->device_details; + /* FIXME: locking */ if (d_details->msg_format == msg_usa90) data_len = 64; else @@ -1203,13 +1204,13 @@ static int keyspan_write_room (struct usb_serial_port *port) if (this_urb->status != -EINPROGRESS) return (data_len); } - return (0); + return 0; } static int keyspan_chars_in_buffer (struct usb_serial_port *port) { - return (0); + return 0; } @@ -1289,7 +1290,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) //mdelay(100); //keyspan_set_termios(port, NULL); - return (0); + return 0; } static inline void stop_urb(struct urb *urb) @@ -2006,7 +2007,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, } #endif - return (0); + return 0; } static int keyspan_usa28_send_setup(struct usb_serial *serial, @@ -2131,7 +2132,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, } #endif - return (0); + return 0; } static int keyspan_usa49_send_setup(struct usb_serial *serial, @@ -2317,7 +2318,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, } #endif - return (0); + return 0; } static int keyspan_usa90_send_setup(struct usb_serial *serial, @@ -2455,7 +2456,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); } - return (0); + return 0; } static int keyspan_usa67_send_setup(struct usb_serial *serial, @@ -2603,7 +2604,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, if (err != 0) dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); - return (0); + return 0; } static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) @@ -2696,7 +2697,7 @@ static int keyspan_startup (struct usb_serial *serial) err); } - return (0); + return 0; } static void keyspan_shutdown (struct usb_serial *serial) diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 6ce292ef1c4..b650fb4754b 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -636,14 +636,19 @@ static int keyspan_pda_write_room (struct usb_serial_port *port) static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port) { struct keyspan_pda_private *priv; + unsigned long flags; + int ret = 0; priv = usb_get_serial_port_data(port); /* when throttled, return at least WAKEUP_CHARS to tell select() (via n_tty.c:normal_poll() ) that we're not writeable. */ + + spin_lock_irqsave(&port->lock, flags); if (port->write_urb_busy || priv->tx_throttled) - return 256; - return 0; + ret = 256; + spin_unlock_irqrestore(&port->lock, flags); + return ret; } diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 160e19263e2..b3ac045ab40 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -702,12 +702,14 @@ static void klsi_105_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) { struct klsi_105_private *priv = usb_get_serial_port_data(port); - unsigned int iflag = port->tty->termios->c_iflag; + struct tty_struct *tty = port->tty; + unsigned int iflag = tty->termios->c_iflag; unsigned int old_iflag = old_termios->c_iflag; - unsigned int cflag = port->tty->termios->c_cflag; + unsigned int cflag = tty->termios->c_cflag; unsigned int old_cflag = old_termios->c_cflag; struct klsi_105_port_settings cfg; unsigned long flags; + speed_t baud; /* lock while we are modifying the settings */ spin_lock_irqsave (&priv->lock, flags); @@ -715,6 +717,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port, /* * Update baud rate */ + baud = tty_get_baud_rate(tty); + if( (cflag & CBAUD) != (old_cflag & CBAUD) ) { /* reassert DTR and (maybe) RTS on transition from B0 */ if( (old_cflag & CBAUD) == B0 ) { @@ -728,8 +732,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port, mct_u232_set_modem_ctrl(serial, priv->control_state); #endif } - - switch(tty_get_baud_rate(port->tty)) { + } + switch(baud) { case 0: /* handled below */ break; case 1200: @@ -757,25 +761,26 @@ static void klsi_105_set_termios (struct usb_serial_port *port, priv->cfg.baudrate = kl5kusb105a_sio_b115200; break; default: - err("KLSI USB->Serial converter:" + dbg("KLSI USB->Serial converter:" " unsupported baudrate request, using default" " of 9600"); priv->cfg.baudrate = kl5kusb105a_sio_b9600; + baud = 9600; break; - } - if ((cflag & CBAUD) == B0 ) { - dbg("%s: baud is B0", __func__); - /* Drop RTS and DTR */ - /* maybe this should be simulated by sending read - * disable and read enable messages? - */ - ; + } + if ((cflag & CBAUD) == B0 ) { + dbg("%s: baud is B0", __func__); + /* Drop RTS and DTR */ + /* maybe this should be simulated by sending read + * disable and read enable messages? + */ + ; #if 0 - priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); - mct_u232_set_modem_ctrl(serial, priv->control_state); + priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); + mct_u232_set_modem_ctrl(serial, priv->control_state); #endif - } } + tty_encode_baud_rate(tty, baud, baud); if ((cflag & CSIZE) != (old_cflag & CSIZE)) { /* set the number of data bits */ @@ -807,6 +812,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port, if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD)) || (cflag & CSTOPB) != (old_cflag & CSTOPB) ) { + /* Not currently supported */ + tty->termios->c_cflag &= ~(PARENB|PARODD|CSTOPB); #if 0 priv->last_lcr = 0; @@ -834,6 +841,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port, || (iflag & IXON) != (old_iflag & IXON) || (cflag & CRTSCTS) != (old_cflag & CRTSCTS) ) { + /* Not currently supported */ + tty->termios->c_cflag &= ~CRTSCTS; /* Drop DTR/RTS if no flow control otherwise assert */ #if 0 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS) ) diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 74b889bf19c..50f1fe26333 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -635,6 +635,7 @@ static int mos7720_write_room(struct usb_serial_port *port) return -ENODEV; } + /* FIXME: Locking */ for (i = 0; i < NUM_URBS; ++i) { if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) room += URB_TRANSFER_BUFFER_SIZE; diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c index 7cea325d577..43c8894353b 100644 --- a/drivers/usb/serial/navman.c +++ b/drivers/usb/serial/navman.c @@ -6,6 +6,10 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. + * + * TODO: + * Add termios method that uses copy_hw but also kills all echo + * flags as the navman is rx only so cannot echo. */ #include @@ -106,12 +110,8 @@ static int navman_write(struct usb_serial_port *port, /* * This device can't write any data, only read from the device - * so we just silently eat all data sent to us and say it was - * successfully sent. - * Evil, I know, but do you have a better idea? */ - - return count; + return -EOPNOTSUPP; } static struct usb_serial_driver navman_device = { diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 1b041c59aab..10090cb52d3 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -295,8 +295,9 @@ static int omninet_write_room (struct usb_serial_port *port) struct usb_serial *serial = port->serial; struct usb_serial_port *wport = serial->port[1]; - int room = 0; // Default: no room + int room = 0; /* Default: no room */ + /* FIXME: no consistent locking for write_urb_busy */ if (wport->write_urb_busy) room = wport->bulk_out_size - OMNINET_HEADERLEN; diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 920241897c9..a83892627d6 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -656,6 +656,7 @@ static int option_write_room(struct usb_serial_port *port) portdata = usb_get_serial_port_data(port); + for (i=0; i < N_OUT_URB; i++) { this_urb = portdata->out_urbs[i]; if (this_urb && !test_bit(i, &portdata->out_busy)) @@ -677,6 +678,8 @@ static int option_chars_in_buffer(struct usb_serial_port *port) for (i=0; i < N_OUT_URB; i++) { this_urb = portdata->out_urbs[i]; + /* FIXME: This locking is insufficient as this_urb may + go unused during the test */ if (this_urb && test_bit(i, &portdata->out_busy)) data_len += this_urb->transfer_buffer_length; } diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2b4ab371c76..c60930ec934 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -546,6 +546,8 @@ static void pl2303_set_termios(struct usb_serial_port *port, buf = kzalloc(7, GFP_KERNEL); if (!buf) { dev_err(&port->dev, "%s - out of memory.\n", __func__); + /* Report back no change occurred */ + *port->tty->termios = *old_termios; return; } diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 3fe98a52b91..e6acac49a9c 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -198,7 +198,6 @@ static void safe_read_bulk_callback (struct urb *urb) struct usb_serial_port *port = (struct usb_serial_port *) urb->context; unsigned char *data = urb->transfer_buffer; unsigned char length = urb->actual_length; - int i; int result; int status = urb->status; @@ -227,16 +226,10 @@ static void safe_read_bulk_callback (struct urb *urb) if (safe) { __u16 fcs; if (!(fcs = fcs_compute10 (data, length, CRC10_INITFCS))) { - int actual_length = data[length - 2] >> 2; - if (actual_length <= (length - 2)) { - info ("%s - actual: %d", __func__, actual_length); - - for (i = 0; i < actual_length; i++) { - tty_insert_flip_char (port->tty, data[i], 0); - } + tty_insert_flip_string(port->tty, data, actual_length); tty_flip_buffer_push (port->tty); } else { err ("%s - inconsistent lengths %d:%d", __func__, @@ -246,9 +239,7 @@ static void safe_read_bulk_callback (struct urb *urb) err ("%s - bad CRC %x", __func__, fcs); } } else { - for (i = 0; i < length; i++) { - tty_insert_flip_char (port->tty, data[i], 0); - } + tty_insert_flip_string(port->tty, data, length); tty_flip_buffer_push (port->tty); } @@ -260,6 +251,7 @@ static void safe_read_bulk_callback (struct urb *urb) if ((result = usb_submit_urb (urb, GFP_ATOMIC))) { err ("%s - failed resubmitting read urb, error %d", __func__, result); + /* FIXME: Need a mechanism to retry later if this happens */ } } @@ -275,7 +267,7 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i if (!port->write_urb) { dbg ("%s - write urb NULL", __func__); - return (0); + return 0; } dbg ("safe_write write_urb: %d transfer_buffer_length", @@ -283,11 +275,11 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i if (!port->write_urb->transfer_buffer_length) { dbg ("%s - write urb transfer_buffer_length zero", __func__); - return (0); + return 0; } if (count == 0) { dbg ("%s - write request of 0 bytes", __func__); - return (0); + return 0; } spin_lock_bh(&port->lock); if (port->write_urb_busy) { @@ -359,18 +351,21 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i static int safe_write_room (struct usb_serial_port *port) { - int room = 0; // Default: no room + int room = 0; /* Default: no room */ + unsigned long flags; dbg ("%s", __func__); + spin_lock_irqsave(&port->lock, flags); if (port->write_urb_busy) room = port->bulk_out_size - (safe ? 2 : 0); + spin_unlock_irqrestore(&port->lock, flags); if (room) { dbg ("safe_write_room returns %d", room); } - return (room); + return room; } static int safe_startup (struct usb_serial *serial) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ed30adefff8..23188873eb0 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -566,6 +566,8 @@ static int sierra_chars_in_buffer(struct usb_serial_port *port) * have sent out, but hasn't made it through to the * device as we can't see the backend here, so just * tell the tty layer that everything is flushed. + * + * FIXME: should walk the outstanding urbs info */ return 0; } diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index baf953d14d8..a9934a3f984 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -1179,6 +1179,8 @@ static int __init usb_serial_init(void) usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; usb_serial_tty_driver->init_termios = tty_std_termios; usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; + usb_serial_tty_driver->init_termios.c_ispeed = 9600; + usb_serial_tty_driver->init_termios.c_ospeed = 9600; tty_set_operations(usb_serial_tty_driver, &serial_ops); result = tty_register_driver(usb_serial_tty_driver); if (result) { diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 137df445e29..a100a52a376 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -469,6 +469,8 @@ static int visor_chars_in_buffer (struct usb_serial_port *port) * have sent out, but hasn't made it through to the * device, so just tell the tty layer that everything * is flushed. + * + * FIXME: Should walk outstanding_urbs */ return 0; } diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index fb02424de4a..6926a81a0cc 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -219,7 +219,7 @@ struct whiteheat_urb_wrap { struct whiteheat_private { spinlock_t lock; __u8 flags; - __u8 mcr; + __u8 mcr; /* FIXME: no locking on mcr */ struct list_head rx_urbs_free; struct list_head rx_urbs_submitted; struct list_head rx_urb_q; -- cgit v1.2.3 From cdc97792289179974af6dda781c855696358d307 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sun, 24 Feb 2008 18:41:47 +0800 Subject: USB: remove unnecessary type casting of urb->context urb->context code cleanup Signed-off-by: Ming Lei Signed-off-by: Greg Kroah-Hartman --- drivers/usb/atm/cxacru.c | 2 +- drivers/usb/class/cdc-acm.c | 2 +- drivers/usb/misc/auerswald.c | 12 ++++++------ drivers/usb/misc/ftdi-elan.c | 2 +- drivers/usb/misc/iowarrior.c | 4 ++-- drivers/usb/misc/legousbtower.c | 4 ++-- drivers/usb/misc/usblcd.c | 2 +- drivers/usb/misc/usbtest.c | 4 ++-- drivers/usb/serial/belkin_sa.c | 2 +- drivers/usb/serial/cyberjack.c | 6 +++--- drivers/usb/serial/cypress_m8.c | 4 ++-- drivers/usb/serial/digi_acceleport.c | 8 ++++---- drivers/usb/serial/empeg.c | 2 +- drivers/usb/serial/ftdi_sio.c | 4 ++-- drivers/usb/serial/garmin_gps.c | 6 +++--- drivers/usb/serial/generic.c | 4 ++-- drivers/usb/serial/io_edgeport.c | 8 ++++---- drivers/usb/serial/io_ti.c | 6 +++--- drivers/usb/serial/ipaq.c | 4 ++-- drivers/usb/serial/ir-usb.c | 4 ++-- drivers/usb/serial/iuu_phoenix.c | 16 ++++++++-------- drivers/usb/serial/keyspan.c | 28 ++++++++++++++-------------- drivers/usb/serial/keyspan_pda.c | 4 ++-- drivers/usb/serial/kl5kusb105.c | 4 ++-- drivers/usb/serial/mct_u232.c | 2 +- drivers/usb/serial/mos7840.c | 8 ++++---- drivers/usb/serial/omninet.c | 4 ++-- drivers/usb/serial/option.c | 6 +++--- drivers/usb/serial/oti6858.c | 6 +++--- drivers/usb/serial/pl2303.c | 6 +++--- drivers/usb/serial/safe_serial.c | 2 +- drivers/usb/serial/sierra.c | 4 ++-- drivers/usb/serial/ti_usb_3410_5052.c | 6 +++--- drivers/usb/serial/visor.c | 6 +++--- drivers/usb/serial/whiteheat.c | 6 +++--- drivers/usb/storage/transport.c | 2 +- drivers/usb/usb-skeleton.c | 2 +- 37 files changed, 101 insertions(+), 101 deletions(-) diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index a51eeedc18d..d470c72b737 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -444,7 +444,7 @@ CXACRU_ALL_FILES(INIT); /* the following three functions are stolen from drivers/usb/core/message.c */ static void cxacru_blocking_completion(struct urb *urb) { - complete((struct completion *)urb->context); + complete(urb->context); } static void cxacru_timeout_kill(unsigned long data) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 33cdf8fa2f2..7b572e75e73 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -443,7 +443,7 @@ urbs: static void acm_write_bulk(struct urb *urb) { struct acm *acm; - struct acm_wb *wb = (struct acm_wb *)urb->context; + struct acm_wb *wb = urb->context; dbg("Entering acm_write_bulk with status %d", urb->status); diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 309c743a09d..09393869742 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -284,7 +284,7 @@ static void auerchain_complete (struct urb * urb) int result; /* get pointer to element and to chain */ - pauerchainelement_t acep = (pauerchainelement_t) urb->context; + pauerchainelement_t acep = urb->context; pauerchain_t acp = acep->chain; /* restore original entries in urb */ @@ -594,7 +594,7 @@ ac_fail:/* free the elements */ /* completion handler for synchronous chained URBs */ static void auerchain_blocking_completion (struct urb *urb) { - pauerchain_chs_t pchs = (pauerchain_chs_t)urb->context; + pauerchain_chs_t pchs = urb->context; pchs->done = 1; wmb(); wake_up (&pchs->wqh); @@ -847,7 +847,7 @@ static int auerswald_status_retry (int status) /* Completion of asynchronous write block */ static void auerchar_ctrlwrite_complete (struct urb * urb) { - pauerbuf_t bp = (pauerbuf_t) urb->context; + pauerbuf_t bp = urb->context; pauerswald_t cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); dbg ("auerchar_ctrlwrite_complete called"); @@ -860,7 +860,7 @@ static void auerchar_ctrlwrite_complete (struct urb * urb) /* Completion handler for dummy retry packet */ static void auerswald_ctrlread_wretcomplete (struct urb * urb) { - pauerbuf_t bp = (pauerbuf_t) urb->context; + pauerbuf_t bp = urb->context; pauerswald_t cp; int ret; int status = urb->status; @@ -904,7 +904,7 @@ static void auerswald_ctrlread_complete (struct urb * urb) unsigned int serviceid; pauerswald_t cp; pauerscon_t scp; - pauerbuf_t bp = (pauerbuf_t) urb->context; + pauerbuf_t bp = urb->context; int status = urb->status; int ret; @@ -981,7 +981,7 @@ static void auerswald_int_complete (struct urb * urb) int ret; int status = urb->status; pauerbuf_t bp = NULL; - pauerswald_t cp = (pauerswald_t) urb->context; + pauerswald_t cp = urb->context; dbg ("%s called", __func__); diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 148b7fe639b..ec88b3bfee4 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -746,7 +746,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer, static void ftdi_elan_write_bulk_callback(struct urb *urb) { - struct usb_ftdi *ftdi = (struct usb_ftdi *)urb->context; + struct usb_ftdi *ftdi = urb->context; int status = urb->status; if (status && !(status == -ENOENT || status == -ECONNRESET || diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 0a2549bc054..1cb54a28347 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -154,7 +154,7 @@ MODULE_DEVICE_TABLE(usb, iowarrior_ids); */ static void iowarrior_callback(struct urb *urb) { - struct iowarrior *dev = (struct iowarrior *)urb->context; + struct iowarrior *dev = urb->context; int intr_idx; int read_idx; int aux_idx; @@ -230,7 +230,7 @@ static void iowarrior_write_callback(struct urb *urb) struct iowarrior *dev; int status = urb->status; - dev = (struct iowarrior *)urb->context; + dev = urb->context; /* sync/async unlink faults aren't errors */ if (status && !(status == -ENOENT || diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index fae5b1730ba..9370326a594 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -753,7 +753,7 @@ exit: */ static void tower_interrupt_in_callback (struct urb *urb) { - struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; + struct lego_usb_tower *dev = urb->context; int status = urb->status; int retval; @@ -810,7 +810,7 @@ exit: */ static void tower_interrupt_out_callback (struct urb *urb) { - struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; + struct lego_usb_tower *dev = urb->context; int status = urb->status; dbg(4, "%s: enter, status %d", __func__, status); diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index ada7bf898fe..7f7021ee418 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c @@ -185,7 +185,7 @@ static void lcd_write_bulk_callback(struct urb *urb) struct usb_lcd *dev; int status = urb->status; - dev = (struct usb_lcd *)urb->context; + dev = urb->context; /* sync/async unlink faults aren't errors */ if (status && diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 678fac86c46..a51983854ca 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -201,7 +201,7 @@ found: static void simple_callback (struct urb *urb) { - complete ((struct completion *) urb->context); + complete(urb->context); } static struct urb *simple_alloc_urb ( @@ -1046,7 +1046,7 @@ static void unlink1_callback (struct urb *urb) status = usb_submit_urb (urb, GFP_ATOMIC); if (status) { urb->status = status; - complete ((struct completion *) urb->context); + complete(urb->context); } } diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 5a2877c2212..0a322fc53d6 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -248,7 +248,7 @@ static void belkin_sa_close (struct usb_serial_port *port, struct file *filp) static void belkin_sa_read_int_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct belkin_sa_private *priv; unsigned char *data = urb->transfer_buffer; int retval; diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index d077534ceae..c164e2cf275 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -300,7 +300,7 @@ static int cyberjack_write_room( struct usb_serial_port *port ) static void cyberjack_read_int_callback( struct urb *urb ) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct cyberjack_private *priv = usb_get_serial_port_data(port); unsigned char *data = urb->transfer_buffer; int status = urb->status; @@ -357,7 +357,7 @@ resubmit: static void cyberjack_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct cyberjack_private *priv = usb_get_serial_port_data(port); struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; @@ -409,7 +409,7 @@ static void cyberjack_read_bulk_callback (struct urb *urb) static void cyberjack_write_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct cyberjack_private *priv = usb_get_serial_port_data(port); int status = urb->status; diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 01dfc0afc65..32121794808 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -1209,7 +1209,7 @@ static void cypress_unthrottle (struct usb_serial_port *port) static void cypress_read_int_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct cypress_private *priv = usb_get_serial_port_data(port); struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; @@ -1361,7 +1361,7 @@ continue_read: static void cypress_write_int_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct cypress_private *priv = usb_get_serial_port_data(port); int result; int status = urb->status; diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index c7cbc02f1a7..d17d1645714 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1227,7 +1227,7 @@ static int digi_write(struct usb_serial_port *port, const unsigned char *buf, in static void digi_write_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct usb_serial *serial; struct digi_port *priv; struct digi_serial *serial_priv; @@ -1605,7 +1605,7 @@ static void digi_shutdown(struct usb_serial *serial) static void digi_read_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct digi_port *priv; struct digi_serial *serial_priv; int ret; @@ -1664,7 +1664,7 @@ static void digi_read_bulk_callback(struct urb *urb) static int digi_read_inb_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct tty_struct *tty = port->tty; struct digi_port *priv = usb_get_serial_port_data(port); int opcode = ((unsigned char *)urb->transfer_buffer)[0]; @@ -1754,7 +1754,7 @@ static int digi_read_inb_callback(struct urb *urb) static int digi_read_oob_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct usb_serial *serial = port->serial; struct digi_port *priv = usb_get_serial_port_data(port); int opcode, line, status, val; diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 5f731d4912f..c5ec309a3cb 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c @@ -340,7 +340,7 @@ static void empeg_write_bulk_callback (struct urb *urb) static void empeg_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; int result; diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8b531b377dc..23f51a41093 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1377,7 +1377,7 @@ error_no_buffer: static void ftdi_write_bulk_callback (struct urb *urb) { unsigned long flags; - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct ftdi_private *priv; int data_offset; /* will be 1 for the SIO and 0 otherwise */ unsigned long countback; @@ -1460,7 +1460,7 @@ static int ftdi_chars_in_buffer (struct usb_serial_port *port) static void ftdi_read_bulk_callback (struct urb *urb) { /* ftdi_read_bulk_callback */ - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct tty_struct *tty; struct ftdi_private *priv; unsigned long countread; diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 513d771adc4..8ce5a56a48e 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -1046,7 +1046,7 @@ static void garmin_close (struct usb_serial_port *port, struct file * filp) static void garmin_write_bulk_callback (struct urb *urb) { unsigned long flags; - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int status = urb->status; if (port) { @@ -1286,7 +1286,7 @@ static void garmin_read_process(struct garmin_data * garmin_data_p, static void garmin_read_bulk_callback (struct urb *urb) { unsigned long flags; - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct usb_serial *serial = port->serial; struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); unsigned char *data = urb->transfer_buffer; @@ -1344,7 +1344,7 @@ static void garmin_read_int_callback (struct urb *urb) { unsigned long flags; int retval; - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct usb_serial *serial = port->serial; struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); unsigned char *data = urb->transfer_buffer; diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 65765ce7625..537f12a027c 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -331,7 +331,7 @@ static void flush_and_resubmit_read_urb (struct usb_serial_port *port) void usb_serial_generic_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; unsigned char *data = urb->transfer_buffer; int status = urb->status; unsigned long flags; @@ -359,7 +359,7 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); void usb_serial_generic_write_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 2b676732e9f..ce2e487f324 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -589,7 +589,7 @@ static int get_epic_descriptor(struct edgeport_serial *ep) *****************************************************************************/ static void edge_interrupt_callback (struct urb *urb) { - struct edgeport_serial *edge_serial = (struct edgeport_serial *)urb->context; + struct edgeport_serial *edge_serial = urb->context; struct edgeport_port *edge_port; struct usb_serial_port *port; unsigned char *data = urb->transfer_buffer; @@ -689,7 +689,7 @@ exit: *****************************************************************************/ static void edge_bulk_in_callback (struct urb *urb) { - struct edgeport_serial *edge_serial = (struct edgeport_serial *)urb->context; + struct edgeport_serial *edge_serial = urb->context; unsigned char *data = urb->transfer_buffer; int retval; __u16 raw_data_length; @@ -749,7 +749,7 @@ static void edge_bulk_in_callback (struct urb *urb) *****************************************************************************/ static void edge_bulk_out_data_callback (struct urb *urb) { - struct edgeport_port *edge_port = (struct edgeport_port *)urb->context; + struct edgeport_port *edge_port = urb->context; struct tty_struct *tty; int status = urb->status; @@ -782,7 +782,7 @@ static void edge_bulk_out_data_callback (struct urb *urb) *****************************************************************************/ static void edge_bulk_out_cmd_callback (struct urb *urb) { - struct edgeport_port *edge_port = (struct edgeport_port *)urb->context; + struct edgeport_port *edge_port = urb->context; struct tty_struct *tty; int status = urb->status; diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 0d412ede839..05e4fa73073 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -1710,7 +1710,7 @@ static void handle_new_lsr (struct edgeport_port *edge_port, int lsr_data, __u8 static void edge_interrupt_callback (struct urb *urb) { - struct edgeport_serial *edge_serial = (struct edgeport_serial *)urb->context; + struct edgeport_serial *edge_serial = urb->context; struct usb_serial_port *port; struct edgeport_port *edge_port; unsigned char *data = urb->transfer_buffer; @@ -1803,7 +1803,7 @@ exit: static void edge_bulk_in_callback (struct urb *urb) { - struct edgeport_port *edge_port = (struct edgeport_port *)urb->context; + struct edgeport_port *edge_port = urb->context; unsigned char *data = urb->transfer_buffer; struct tty_struct *tty; int retval = 0; @@ -1897,7 +1897,7 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c static void edge_bulk_out_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct edgeport_port *edge_port = usb_get_serial_port_data(port); int status = urb->status; diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index c90436ea806..ea924dc4849 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -729,7 +729,7 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp) static void ipaq_read_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; int result; @@ -869,7 +869,7 @@ static void ipaq_write_gather(struct usb_serial_port *port) static void ipaq_write_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct ipaq_private *priv = usb_get_serial_port_data(port); unsigned long flags; int result; diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 496009cff3a..004d57385a7 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -393,7 +393,7 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int static void ir_write_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); @@ -417,7 +417,7 @@ static void ir_write_bulk_callback (struct urb *urb) static void ir_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; int result; diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index b486a54c6f4..8a217648b25 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -186,7 +186,7 @@ static int iuu_tiocmget(struct usb_serial_port *port, struct file *file) static void iuu_rxcmd(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int result; dbg("%s - enter", __func__); @@ -240,7 +240,7 @@ static int iuu_reset(struct usb_serial_port *port, u8 wt) */ static void iuu_update_status_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct iuu_private *priv = usb_get_serial_port_data(port); u8 *st; dbg("%s - enter", __func__); @@ -270,7 +270,7 @@ static void iuu_update_status_callback(struct urb *urb) static void iuu_status_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int result; dbg("%s - enter", __func__); @@ -392,7 +392,7 @@ static void iuu_rgbf_fill_buffer(u8 *buf, u8 r1, u8 r2, u8 g1, u8 g2, u8 b1, static void iuu_led_activity_on(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int result; char *buf_ptr = port->write_urb->transfer_buffer; *buf_ptr++ = IUU_SET_LED; @@ -413,7 +413,7 @@ static void iuu_led_activity_on(struct urb *urb) static void iuu_led_activity_off(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int result; char *buf_ptr = port->write_urb->transfer_buffer; if (xmas == 1) { @@ -616,7 +616,7 @@ static int iuu_uart_flush(struct usb_serial_port *port) static void read_buf_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; unsigned char *data = urb->transfer_buffer; struct tty_struct *tty; dbg("%s - urb->status = %d", __func__, urb->status); @@ -692,7 +692,7 @@ static int iuu_read_buf(struct usb_serial_port *port, int len) static void iuu_uart_read_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct iuu_private *priv = usb_get_serial_port_data(port); unsigned int flags; int status; @@ -781,7 +781,7 @@ static int iuu_uart_write(struct usb_serial_port *port, const u8 *buf, static void read_rxcmd_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int result; dbg("%s - enter", __func__); diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 0d122feb2b2..3df8a66c5c3 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -445,7 +445,7 @@ static void usa26_indat_callback(struct urb *urb) return; } - port = (struct usb_serial_port *) urb->context; + port = urb->context; tty = port->tty; if (tty && urb->actual_length) { /* 0x80 bit is error flag */ @@ -490,7 +490,7 @@ static void usa2x_outdat_callback(struct urb *urb) struct usb_serial_port *port; struct keyspan_port_private *p_priv; - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); dbg ("%s - urb %d", __func__, urb == p_priv->out_urbs[1]); @@ -509,7 +509,7 @@ static void usa26_outcont_callback(struct urb *urb) struct usb_serial_port *port; struct keyspan_port_private *p_priv; - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { @@ -528,7 +528,7 @@ static void usa26_instat_callback(struct urb *urb) int old_dcd_state, err; int status = urb->status; - serial = (struct usb_serial *) urb->context; + serial = urb->context; if (status) { dbg("%s - nonzero status: %x", __func__, status); @@ -599,7 +599,7 @@ static void usa28_indat_callback(struct urb *urb) dbg ("%s", __func__); - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); data = urb->transfer_buffer; @@ -613,7 +613,7 @@ static void usa28_indat_callback(struct urb *urb) return; } - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); data = urb->transfer_buffer; @@ -647,7 +647,7 @@ static void usa28_outcont_callback(struct urb *urb) struct usb_serial_port *port; struct keyspan_port_private *p_priv; - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { @@ -667,7 +667,7 @@ static void usa28_instat_callback(struct urb *urb) int old_dcd_state; int status = urb->status; - serial = (struct usb_serial *) urb->context; + serial = urb->context; if (status) { dbg("%s - nonzero status: %x", __func__, status); @@ -733,7 +733,7 @@ static void usa49_glocont_callback(struct urb *urb) dbg ("%s", __func__); - serial = (struct usb_serial *) urb->context; + serial = urb->context; for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; p_priv = usb_get_serial_port_data(port); @@ -761,7 +761,7 @@ static void usa49_instat_callback(struct urb *urb) dbg ("%s", __func__); - serial = (struct usb_serial *) urb->context; + serial = urb->context; if (status) { dbg("%s - nonzero status: %x", __func__, status); @@ -836,7 +836,7 @@ static void usa49_indat_callback(struct urb *urb) return; } - port = (struct usb_serial_port *) urb->context; + port = urb->context; tty = port->tty; if (tty && urb->actual_length) { /* 0x80 bit is error flag */ @@ -973,7 +973,7 @@ static void usa90_indat_callback(struct urb *urb) return; } - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); tty = port->tty; @@ -1037,7 +1037,7 @@ static void usa90_instat_callback(struct urb *urb) int old_dcd_state, err; int status = urb->status; - serial = (struct usb_serial *) urb->context; + serial = urb->context; if (status) { dbg("%s - nonzero status: %x", __func__, status); @@ -1084,7 +1084,7 @@ static void usa90_outcont_callback(struct urb *urb) struct usb_serial_port *port; struct keyspan_port_private *p_priv; - port = (struct usb_serial_port *) urb->context; + port = urb->context; p_priv = usb_get_serial_port_data(port); if (p_priv->resend_cont) { diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index b650fb4754b..ff54203944c 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -214,7 +214,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) static void keyspan_pda_rx_interrupt (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct tty_struct *tty = port->tty; unsigned char *data = urb->transfer_buffer; int i; @@ -608,7 +608,7 @@ exit: static void keyspan_pda_write_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct keyspan_pda_private *priv; port->write_urb_busy = 0; diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index b3ac045ab40..b395ac75988 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -567,7 +567,7 @@ exit: static void klsi_105_write_bulk_callback ( struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); @@ -628,7 +628,7 @@ static int klsi_105_write_room (struct usb_serial_port *port) static void klsi_105_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct klsi_105_private *priv = usb_get_serial_port_data(port); struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index e25c0c2791e..5fc2cef30e3 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -514,7 +514,7 @@ static void mct_u232_close (struct usb_serial_port *port, struct file *filp) static void mct_u232_read_int_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct mct_u232_private *priv = usb_get_serial_port_data(port); struct usb_serial *serial = port->serial; struct tty_struct *tty; diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 7823222570b..6bcb82d3911 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -449,7 +449,7 @@ static void mos7840_control_callback(struct urb *urb) int result = 0; int status = urb->status; - mos7840_port = (struct moschip_port *)urb->context; + mos7840_port = urb->context; switch (status) { case 0: @@ -554,7 +554,7 @@ static void mos7840_interrupt_callback(struct urb *urb) length = urb->actual_length; data = urb->transfer_buffer; - serial = (struct usb_serial *)urb->context; + serial = urb->context; /* Moschip get 5 bytes * Byte 1 IIR Port 1 (port.number is 0) @@ -685,7 +685,7 @@ static void mos7840_bulk_in_callback(struct urb *urb) return; } - mos7840_port = (struct moschip_port *)urb->context; + mos7840_port = urb->context; if (!mos7840_port) { dbg("%s", "NULL mos7840_port pointer \n"); return; @@ -752,7 +752,7 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) int status = urb->status; int i; - mos7840_port = (struct moschip_port *)urb->context; + mos7840_port = urb->context; spin_lock(&mos7840_port->pool_lock); for (i = 0; i < NUM_URBS; i++) { if (urb == mos7840_port->write_urb_pool[i]) { diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 10090cb52d3..7b7422f4947 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -194,7 +194,7 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp) static void omninet_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; unsigned char *data = urb->transfer_buffer; struct omninet_header *header = (struct omninet_header *) &data[0]; int status = urb->status; @@ -309,7 +309,7 @@ static int omninet_write_room (struct usb_serial_port *port) static void omninet_write_bulk_callback (struct urb *urb) { /* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */ - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %0x\n", __func__, port->number); diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index a83892627d6..e4be2d442b1 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -545,7 +545,7 @@ static void option_indat_callback(struct urb *urb) dbg("%s: %p", __func__, urb); endpoint = usb_pipeendpoint(urb->pipe); - port = (struct usb_serial_port *) urb->context; + port = urb->context; if (status) { dbg("%s: nonzero status: %d on endpoint %02x.", @@ -579,7 +579,7 @@ static void option_outdat_callback(struct urb *urb) dbg("%s", __func__); - port = (struct usb_serial_port *) urb->context; + port = urb->context; usb_serial_port_softint(port); @@ -597,7 +597,7 @@ static void option_instat_callback(struct urb *urb) { int err; int status = urb->status; - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct option_port_private *portdata = usb_get_serial_port_data(port); struct usb_serial *serial = port->serial; diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 87f33e06301..d92bb6501c8 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -871,7 +871,7 @@ static void oti6858_shutdown(struct usb_serial *serial) static void oti6858_read_int_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct oti6858_private *priv = usb_get_serial_port_data(port); int transient = 0, can_recv = 0, resubmit = 1; int status = urb->status; @@ -985,7 +985,7 @@ static void oti6858_read_int_callback(struct urb *urb) static void oti6858_read_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct oti6858_private *priv = usb_get_serial_port_data(port); struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; @@ -1038,7 +1038,7 @@ static void oti6858_read_bulk_callback(struct urb *urb) static void oti6858_write_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct oti6858_private *priv = usb_get_serial_port_data(port); int status = urb->status; int result; diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index c60930ec934..c605fb68f80 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -945,7 +945,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, static void pl2303_read_int_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; unsigned char *data = urb->transfer_buffer; unsigned int actual_length = urb->actual_length; int status = urb->status; @@ -985,7 +985,7 @@ exit: static void pl2303_read_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct pl2303_private *priv = usb_get_serial_port_data(port); struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; @@ -1068,7 +1068,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) static void pl2303_write_bulk_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct pl2303_private *priv = usb_get_serial_port_data(port); int result; int status = urb->status; diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index e6acac49a9c..94bddf06ea4 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -195,7 +195,7 @@ static __u16 __inline__ fcs_compute10 (unsigned char *sp, int len, __u16 fcs) static void safe_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; unsigned char *data = urb->transfer_buffer; unsigned char length = urb->actual_length; int result; diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 23188873eb0..29074c1ba22 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -457,7 +457,7 @@ static void sierra_indat_callback(struct urb *urb) dbg("%s: %p", __func__, urb); endpoint = usb_pipeendpoint(urb->pipe); - port = (struct usb_serial_port *) urb->context; + port = urb->context; if (status) { dbg("%s: nonzero status: %d on endpoint %02x.", @@ -487,7 +487,7 @@ static void sierra_instat_callback(struct urb *urb) { int err; int status = urb->status; - struct usb_serial_port *port = (struct usb_serial_port *) urb->context; + struct usb_serial_port *port = urb->context; struct sierra_port_private *portdata = usb_get_serial_port_data(port); struct usb_serial *serial = port->serial; diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index e0b1564de90..a1c8aef0141 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -1098,7 +1098,7 @@ static void ti_break(struct usb_serial_port *port, int break_state) static void ti_interrupt_callback(struct urb *urb) { - struct ti_device *tdev = (struct ti_device *)urb->context; + struct ti_device *tdev = urb->context; struct usb_serial_port *port; struct usb_serial *serial = tdev->td_serial; struct ti_port *tport; @@ -1181,7 +1181,7 @@ exit: static void ti_bulk_in_callback(struct urb *urb) { - struct ti_port *tport = (struct ti_port *)urb->context; + struct ti_port *tport = urb->context; struct usb_serial_port *port = tport->tp_port; struct device *dev = &urb->dev->dev; int status = urb->status; @@ -1247,7 +1247,7 @@ exit: static void ti_bulk_out_callback(struct urb *urb) { - struct ti_port *tport = (struct ti_port *)urb->context; + struct ti_port *tport = urb->context; struct usb_serial_port *port = tport->tp_port; struct device *dev = &urb->dev->dev; int status = urb->status; diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index a100a52a376..5fc20122145 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -478,7 +478,7 @@ static int visor_chars_in_buffer (struct usb_serial_port *port) static void visor_write_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct visor_private *priv = usb_get_serial_port_data(port); int status = urb->status; unsigned long flags; @@ -502,7 +502,7 @@ static void visor_write_bulk_callback (struct urb *urb) static void visor_read_bulk_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct visor_private *priv = usb_get_serial_port_data(port); unsigned char *data = urb->transfer_buffer; int status = urb->status; @@ -553,7 +553,7 @@ static void visor_read_bulk_callback (struct urb *urb) static void visor_read_int_callback (struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; int status = urb->status; int result; diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 6926a81a0cc..e96bf8663ff 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -965,7 +965,7 @@ static void command_port_write_callback(struct urb *urb) static void command_port_read_callback(struct urb *urb) { - struct usb_serial_port *command_port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *command_port = urb->context; struct whiteheat_command_private *command_info; int status = urb->status; unsigned char *data = urb->transfer_buffer; @@ -1015,7 +1015,7 @@ static void command_port_read_callback(struct urb *urb) static void whiteheat_read_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct whiteheat_urb_wrap *wrap; unsigned char *data = urb->transfer_buffer; struct whiteheat_private *info = usb_get_serial_port_data(port); @@ -1059,7 +1059,7 @@ static void whiteheat_read_callback(struct urb *urb) static void whiteheat_write_callback(struct urb *urb) { - struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct usb_serial_port *port = urb->context; struct whiteheat_private *info = usb_get_serial_port_data(port); struct whiteheat_urb_wrap *wrap; int status = urb->status; diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index db55ec39bb8..6610d2dd1e7 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -110,7 +110,7 @@ */ static void usb_stor_blocking_completion(struct urb *urb) { - struct completion *urb_done_ptr = (struct completion *)urb->context; + struct completion *urb_done_ptr = urb->context; complete(urb_done_ptr); } diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 73e6a66d95a..be76084c8d7 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -212,7 +212,7 @@ static void skel_write_bulk_callback(struct urb *urb) { struct usb_skel *dev; - dev = (struct usb_skel *)urb->context; + dev = urb->context; /* sync/async unlink faults aren't errors */ if (urb->status) { -- cgit v1.2.3 From 3b52f128aeacc4b9e5992012c39ffc9508513bcd Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: wusb: add authenticathed bit to usb_dev This bit indicates the system that the WUSB device has been crypto authenticated and thus can operate as normal. Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/usb.h b/include/linux/usb.h index 4a91181629d..c5af7633c44 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -372,6 +372,7 @@ struct usb_tt; * used or not. By default, wired USB devices are authorized. * WUSB devices are not, until we authorize them from user space. * FIXME -- complete doc + * @authenticated: Crypto authentication passed * @wusb: device is Wireless USB * @string_langid: language ID for strings * @product: iProduct string, if present (static) @@ -438,6 +439,7 @@ struct usb_device { unsigned persist_enabled:1; unsigned have_langid:1; unsigned authorized:1; + unsigned authenticated:1; unsigned wusb:1; int string_langid; -- cgit v1.2.3 From b1d8dfb0e548543b1645362e80e1fff522645299 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: wusb: add link wusb-usb device We need to tie the WUSB and USB devices; the USB stack doesn't need to know the details about the WUSB device, but needs to have a link to it. This is needed so that the notify call back for Remove Device can tie both and undo the device setup (sysfs files). We connect the devices together at the Add Device notifier callback (the wusb_dev references the usb_dev and stores it, the usb_dev references the wusb_dev and stores it); then we do create the WUSB sysfs files at the usb_dev sysfs directory. At Remove Device, we undo that (thus we need the usb_dev reference). Cross reference to functions in the WUSB substack: wusb_dev_{add,rm}_ncb(). Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/usb.h b/include/linux/usb.h index c5af7633c44..c08689ea9b4 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -23,6 +23,7 @@ struct usb_device; struct usb_driver; +struct wusb_dev; /*-------------------------------------------------------------------------*/ @@ -480,6 +481,7 @@ struct usb_device { unsigned autoresume_disabled:1; unsigned skip_sys_resume:1; #endif + struct wusb_dev *wusb_dev; }; #define to_usb_device(d) container_of(d, struct usb_device, dev) -- cgit v1.2.3 From 8af548dc8e36f845943ffcba07fafaa56c844221 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: wusb: teach choose_address() about wireless devices Modify choose_address() so it knows about our special scheme of addressing WUSB devices (1:1 w/ port number). Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 06c3acb161e..baae2aa0dbf 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1195,21 +1195,42 @@ void usb_set_device_state(struct usb_device *udev, spin_unlock_irqrestore(&device_state_lock, flags); } +/* + * WUSB devices are simple: they have no hubs behind, so the mapping + * device <-> virtual port number becomes 1:1. Why? to simplify the + * life of the device connection logic in + * drivers/usb/wusbcore/devconnect.c. When we do the initial secret + * handshake we need to assign a temporary address in the unauthorized + * space. For simplicity we use the first virtual port number found to + * be free [drivers/usb/wusbcore/devconnect.c:wusbhc_devconnect_ack()] + * and that becomes it's address [X < 128] or its unauthorized address + * [X | 0x80]. + * + * We add 1 as an offset to the one-based USB-stack port number + * (zero-based wusb virtual port index) for two reasons: (a) dev addr + * 0 is reserved by USB for default address; (b) Linux's USB stack + * uses always #1 for the root hub of the controller. So USB stack's + * port #1, which is wusb virtual-port #0 has address #2. + */ static void choose_address(struct usb_device *udev) { int devnum; struct usb_bus *bus = udev->bus; /* If khubd ever becomes multithreaded, this will need a lock */ - - /* Try to allocate the next devnum beginning at bus->devnum_next. */ - devnum = find_next_zero_bit(bus->devmap.devicemap, 128, - bus->devnum_next); - if (devnum >= 128) - devnum = find_next_zero_bit(bus->devmap.devicemap, 128, 1); - - bus->devnum_next = ( devnum >= 127 ? 1 : devnum + 1); - + if (udev->wusb) { + devnum = udev->portnum + 1; + BUG_ON(test_bit(devnum, bus->devmap.devicemap)); + } else { + /* Try to allocate the next devnum beginning at + * bus->devnum_next. */ + devnum = find_next_zero_bit(bus->devmap.devicemap, 128, + bus->devnum_next); + if (devnum >= 128) + devnum = find_next_zero_bit(bus->devmap.devicemap, + 128, 1); + bus->devnum_next = ( devnum >= 127 ? 1 : devnum + 1); + } if (devnum < 128) { set_bit(devnum, bus->devmap.devicemap); udev->devnum = devnum; @@ -2611,6 +2632,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, udev->speed = USB_SPEED_UNKNOWN; udev->bus_mA = hub->mA_per_port; udev->level = hdev->level + 1; + udev->wusb = hub_is_wusb(hub); /* set the address */ choose_address(udev); -- cgit v1.2.3 From 6c529cdca914ba2a08a4bba54f11dedc2d3a7c17 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: wusb: devices dont use a set address A WUSB device gets his address during the connection phase; later on, during the authenthication phase (driven from user space) we assign the final address. So we need to skip in hub_port_init() the actual setting of the address for WUSB devices. Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index baae2aa0dbf..1815034ccb7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2419,26 +2419,33 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, #undef GET_DESCRIPTOR_BUFSIZE } - for (j = 0; j < SET_ADDRESS_TRIES; ++j) { - retval = hub_set_address(udev, devnum); - if (retval >= 0) + /* + * If device is WUSB, we already assigned an + * unauthorized address in the Connect Ack sequence; + * authorization will assign the final address. + */ + if (udev->wusb == 0) { + for (j = 0; j < SET_ADDRESS_TRIES; ++j) { + retval = hub_set_address(udev, devnum); + if (retval >= 0) + break; + msleep(200); + } + if (retval < 0) { + dev_err(&udev->dev, + "device not accepting address %d, error %d\n", + devnum, retval); + goto fail; + } + + /* cope with hardware quirkiness: + * - let SET_ADDRESS settle, some device hardware wants it + * - read ep0 maxpacket even for high and low speed, + */ + msleep(10); + if (USE_NEW_SCHEME(retry_counter)) break; - msleep(200); - } - if (retval < 0) { - dev_err(&udev->dev, - "device not accepting address %d, error %d\n", - devnum, retval); - goto fail; - } - - /* cope with hardware quirkiness: - * - let SET_ADDRESS settle, some device hardware wants it - * - read ep0 maxpacket even for high and low speed, - */ - msleep(10); - if (USE_NEW_SCHEME(retry_counter)) - break; + } retval = usb_get_device_descriptor(udev, 8); if (retval < 8) { @@ -2455,7 +2462,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, if (retval) goto fail; - i = udev->descriptor.bMaxPacketSize0 == 0xff? + i = udev->descriptor.bMaxPacketSize0 == 0xff? /* wusb device? */ 512 : udev->descriptor.bMaxPacketSize0; if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { if (udev->speed != USB_SPEED_FULL || -- cgit v1.2.3 From fc721f5194dc98c8108fb155a4fbae1cd746cf41 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: wusb: make ep0_reinit available for modules We need to be able to call ep0_reinit() [renamed to usb_ep0_reinit()] from the WUSB security code. The reason is that when we authenticate the device, it's address changes (from having bit 7 set to having it cleared). Thus, we need to signal the USB stack to reinitialize EP0, so the status with the previous address kept at the HCD layer is cleared and properly reinitialized. Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 11 ++++++----- drivers/usb/core/hub.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1815034ccb7..830c851384b 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2211,12 +2211,13 @@ static int hub_port_debounce(struct usb_hub *hub, int port1) return portstatus; } -static void ep0_reinit(struct usb_device *udev) +void usb_ep0_reinit(struct usb_device *udev) { usb_disable_endpoint(udev, 0 + USB_DIR_IN); usb_disable_endpoint(udev, 0 + USB_DIR_OUT); usb_enable_endpoint(udev, &udev->ep0); } +EXPORT_SYMBOL_GPL(usb_ep0_reinit); #define usb_sndaddr0pipe() (PIPE_CONTROL << 30) #define usb_rcvaddr0pipe() ((PIPE_CONTROL << 30) | USB_DIR_IN) @@ -2237,7 +2238,7 @@ static int hub_set_address(struct usb_device *udev, int devnum) if (retval == 0) { udev->devnum = devnum; /* Device now using proper address */ usb_set_device_state(udev, USB_STATE_ADDRESS); - ep0_reinit(udev); + usb_ep0_reinit(udev); } return retval; } @@ -2473,7 +2474,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, } dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); - ep0_reinit(udev); + usb_ep0_reinit(udev); } retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE); @@ -2729,7 +2730,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, loop_disable: hub_port_disable(hub, port1, 1); loop: - ep0_reinit(udev); + usb_ep0_reinit(udev); release_address(udev); usb_put_dev(udev); if ((status == -ENOTCONN) || (status == -ENOTSUPP)) @@ -3164,7 +3165,7 @@ int usb_reset_device(struct usb_device *udev) /* ep0 maxpacket size may change; let the HCD know about it. * Other endpoints will be handled by re-enumeration. */ - ep0_reinit(udev); + usb_ep0_reinit(udev); ret = hub_port_init(parent_hub, udev, port1, i); if (ret >= 0 || ret == -ENOTCONN || ret == -ENODEV) break; diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index d672cd81a3e..2a116ce53c9 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -195,5 +195,6 @@ struct usb_tt_clear { }; extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe); +extern void usb_ep0_reinit(struct usb_device *); #endif /* __LINUX_HUB_H */ -- cgit v1.2.3 From 4953d141dc5db748475001cfbfdcc42e66cf900e Mon Sep 17 00:00:00 2001 From: David Vrabel Date: Tue, 8 Apr 2008 13:24:46 -0700 Subject: usb: don't update devnum for wusb devices For WUSB devices, usb_dev.devnum is a device index and not the real device address (which is managed by wusbcore). Therefore, only set devnum once (in choose_address()) and never change it. Signed-off-by: David Vrabel Cc: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 830c851384b..eb57fcc701d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1245,6 +1245,13 @@ static void release_address(struct usb_device *udev) } } +static void update_address(struct usb_device *udev, int devnum) +{ + /* The address for a WUSB device is managed by wusbcore. */ + if (!udev->wusb) + udev->devnum = devnum; +} + #ifdef CONFIG_USB_SUSPEND static void usb_stop_pm(struct usb_device *udev) @@ -1733,7 +1740,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1, case 0: /* TRSTRCY = 10 ms; plus some extra */ msleep(10 + 40); - udev->devnum = 0; /* Device now at address 0 */ + update_address(udev, 0); /* FALL THROUGH */ case -ENOTCONN: case -ENODEV: @@ -2236,7 +2243,8 @@ static int hub_set_address(struct usb_device *udev, int devnum) USB_REQ_SET_ADDRESS, 0, devnum, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (retval == 0) { - udev->devnum = devnum; /* Device now using proper address */ + /* Device now using proper address. */ + update_address(udev, devnum); usb_set_device_state(udev, USB_STATE_ADDRESS); usb_ep0_reinit(udev); } @@ -2491,7 +2499,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, fail: if (retval) { hub_port_disable(hub, port1, 0); - udev->devnum = devnum; /* for disconnect processing */ + update_address(udev, devnum); /* for disconnect processing */ } mutex_unlock(&usb_address0_mutex); return retval; -- cgit v1.2.3