Commit 19e374c1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/linux/linux/BK/bleeding-2.5

into kroah.com:/home/linux/linux/BK/gregkh-2.5
parents 060c05b9 9932a78d
Copyright (C) 1999, 2000 David E. Nelson
April 26, 2000
CHANGES
- Amended for Linux-2.3.99-pre6-3
- Updated for multiple scanner support
INTRODUCTION
This document will hopefully provide enough info on how to get SANE
working with a Hewlett Packard USB capable scanner using the USB
interface. The majority of HP Scanners support the Scanner Control
Language (SCL) which is both published by HP and supported by SANE.
The only HP Scanners that I'm aware of that do not support SCL are the
4200C ,3300C, and the PhotoSmart S20. All other HP scanners with USB
interfaces should work (4100C, 5200C, 6200C, and 6300C) as do models
that are derived from the models above. ie the 6350C which is a 6300C
with a transparency adaptor included with the scanner at time of
purchase. Of course as HP releases new scanners this information may
change.
REQUIREMENTS
In order to get this running you'll need USB support in your kernel in
addition to USB Scanner support. Please refer to scanner.txt for
issues pertaining to Linux USB and USB Scanner support.
An installed version of SANE which is available from
http://www.mostang.com/sane/. Testing has been performed using
version SANE-1.0.1. For instructions on building and installing SANE,
refer to the various README files within the SANE distribution.
The latest SANE HP backend is available from http://www.kirchgessner.net.
At the time of this writing, version 0.83 was available.
OK, I'VE INSTALLED SANE. SO WHAT DO I DO NOW?
NOTE: $INSTALL_DIR is the location where SANE is installed. It may be
/usr/local, /usr, /opt or somewhere else. If you don't know, ask your
system administrator.
1) Make sure that you have the libsane-hp.* libraries under the
$INSTALL_DIR/lib/sane/ directory. If you don't, then the HP backend
was either not compiled or installed properly.
2) Under the directory $INSTALL_DIR/etc/sane.d/ edit the following
files: dll.conf, hp.conf.
dll.conf: Make sure that the 'hp' entry is present and uncommented.
hp.conf: This should contain two lines:
/dev/usbscanner
option connect-device
NOTE: If you are using multiple scanners, make sure to have the correct
device, ie /dev/usbscanner0. See scanner.txt for more info.
3) You should now be able to use SANE (xscanimage or scanimage).
Don't forget to read any relevant man pages regarding the usage of
SANE. If you have other entries uncommented in 'dll.conf', you may
have to specify the device to (x)scanimage. Again, `man` is your
friend. The xscanimage (1) man page has info on how to get 'The Gimp'
to work with xscanimage. Note that Gimp support must be compiled into
SANE for it to work. If you are dealing with a RedHat system, this
means that you'll also need to install the gimp-devel rpm package
prior to compiling SANE.
NOTE: The issues regarding core dumping by (x)scanimage have (or seem
to be thus far) been resolved with version 0.2+ of the USB scanner
driver which should be available in linux-2.3.23. If you notice
otherwise, please contact me.
David /\/elson
dnelson@jump.net
http://www.jump.net/~dnelson
This diff is collapsed.
......@@ -610,7 +610,8 @@ static ssize_t usblp_write(struct file *file, const char *buffer, size_t count,
{
DECLARE_WAITQUEUE(wait, current);
struct usblp *usblp = file->private_data;
int timeout, err = 0, writecount = 0;
int timeout, err = 0;
size_t writecount = 0;
while (writecount < count) {
if (!usblp->wcomplete) {
......
......@@ -147,7 +147,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
goto clean_2;
}
dev_info (*hcd->controller, "%s\n", hcd->product_desc);
dev_info (hcd->controller, "%s\n", hcd->product_desc);
#ifndef __sparc__
sprintf (buf, "%d", dev->irq);
......@@ -156,7 +156,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
#endif
if (request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, hcd->description, hcd)
!= 0) {
dev_err (*hcd->controller,
dev_err (hcd->controller,
"request interrupt %s failed\n", bufp);
retval = -EBUSY;
goto clean_3;
......@@ -165,7 +165,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
hcd->regs = base;
hcd->region = region;
dev_info (*hcd->controller, "irq %s, %s %p\n", bufp,
dev_info (hcd->controller, "irq %s, %s %p\n", bufp,
(driver->flags & HCD_MEMORY) ? "pci mem" : "io base",
base);
......@@ -207,7 +207,7 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
hcd = pci_get_drvdata(dev);
if (!hcd)
return;
dev_info (*hcd->controller, "remove, state %x\n", hcd->state);
dev_info (hcd->controller, "remove, state %x\n", hcd->state);
if (in_interrupt ()) BUG ();
......@@ -234,7 +234,7 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
usb_deregister_bus (&hcd->self);
if (atomic_read (&hcd->self.refcnt) != 1) {
dev_warn (*hcd->controller,
dev_warn (hcd->controller,
"dangling refs (%d) to bus %d!\n",
atomic_read (&hcd->self.refcnt) - 1,
hcd->self.busnum);
......@@ -285,7 +285,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
int retval;
hcd = pci_get_drvdata(dev);
dev_info (*hcd->controller, "suspend to state %d\n", state);
dev_info (hcd->controller, "suspend to state %d\n", state);
pci_save_state (dev, hcd->pci_state);
......@@ -314,12 +314,12 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
int retval;
hcd = pci_get_drvdata(dev);
dev_info (*hcd->controller, "resume\n");
dev_info (hcd->controller, "resume\n");
/* guard against multiple resumes (APM bug?) */
atomic_inc (&hcd->resume_count);
if (atomic_read (&hcd->resume_count) != 1) {
dev_err (*hcd->controller, "concurrent PCI resumes\n");
dev_err (hcd->controller, "concurrent PCI resumes\n");
retval = 0;
goto done;
}
......
......@@ -347,7 +347,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
/* FALLTHROUGH */
case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
case DeviceOutRequest | USB_REQ_SET_FEATURE:
dev_dbg (*hcd->controller, "no device features yet yet\n");
dev_dbg (hcd->controller, "no device features yet yet\n");
break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
ubuf [0] = 1;
......@@ -390,7 +390,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
break;
case DeviceOutRequest | USB_REQ_SET_ADDRESS:
// wValue == urb->dev->devaddr
dev_dbg (*hcd->controller, "root hub device address %d\n",
dev_dbg (hcd->controller, "root hub device address %d\n",
wValue);
break;
......@@ -405,7 +405,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
/* FALLTHROUGH */
case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
case EndpointOutRequest | USB_REQ_SET_FEATURE:
dev_dbg (*hcd->controller, "no endpoint features yet\n");
dev_dbg (hcd->controller, "no endpoint features yet\n");
break;
/* CLASS REQUESTS (and errors) */
......@@ -419,12 +419,12 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
error:
/* "protocol stall" on error */
urb->status = -EPIPE;
dev_dbg (*hcd->controller, "unsupported hub control message (maxchild %d)\n",
dev_dbg (hcd->controller, "unsupported hub control message (maxchild %d)\n",
urb->dev->maxchild);
}
if (urb->status) {
urb->actual_length = 0;
dev_dbg (*hcd->controller, "CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d\n",
dev_dbg (hcd->controller, "CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d\n",
typeReq, wValue, wIndex, wLength, urb->status);
}
if (bufp) {
......@@ -457,7 +457,7 @@ static int rh_status_urb (struct usb_hcd *hcd, struct urb *urb)
if (timer_pending (&hcd->rh_timer)
|| urb->status != -EINPROGRESS
|| urb->transfer_buffer_length < len) {
dev_dbg (*hcd->controller, "not queuing status urb, stat %d\n", urb->status);
dev_dbg (hcd->controller, "not queuing status urb, stat %d\n", urb->status);
return -EINVAL;
}
......@@ -668,7 +668,7 @@ void usb_register_bus(struct usb_bus *bus)
usbfs_add_bus (bus);
dev_info (*bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum);
dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum);
}
EXPORT_SYMBOL (usb_register_bus);
......@@ -682,7 +682,7 @@ EXPORT_SYMBOL (usb_register_bus);
*/
void usb_deregister_bus (struct usb_bus *bus)
{
dev_info (*bus->controller, "USB bus %d deregistered\n", bus->busnum);
dev_info (bus->controller, "USB bus %d deregistered\n", bus->busnum);
/*
* NOTE: make sure that all the devices are removed by the
......@@ -718,7 +718,7 @@ int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev
sprintf (&usb_dev->dev.bus_id[0], "usb%d", usb_dev->bus->busnum);
retval = usb_new_device (usb_dev, parent_dev);
if (retval)
dev_err (*parent_dev, "can't register root hub for %s, %d\n",
dev_err (parent_dev, "can't register root hub for %s, %d\n",
usb_dev->dev.bus_id, retval);
return retval;
}
......@@ -825,7 +825,7 @@ int usb_check_bandwidth (struct usb_device *dev, struct urb *urb)
#else
"would have ";
#endif
dev_dbg (dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n",
dev_dbg (&dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n",
mode, old_alloc, bustime, new_alloc);
#endif
#ifdef CONFIG_USB_BANDWIDTH
......@@ -864,7 +864,7 @@ void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime,
urb->bandwidth = bustime;
#ifdef USB_BANDWIDTH_MESSAGES
dev_dbg (dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n",
dev_dbg (&dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n",
bustime,
isoc ? "ISOC" : "INTR",
dev->bus->bandwidth_allocated,
......@@ -893,7 +893,7 @@ void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, int isoc)
dev->bus->bandwidth_int_reqs--;
#ifdef USB_BANDWIDTH_MESSAGES
dev_dbg (dev->dev, "bandwidth alloc reduced by %d (%s) to %d for %d requesters\n",
dev_dbg (&dev->dev, "bandwidth alloc reduced by %d (%s) to %d for %d requesters\n",
urb->bandwidth,
isoc ? "ISOC" : "INTR",
dev->bus->bandwidth_allocated,
......@@ -1154,7 +1154,7 @@ static int hcd_unlink_urb (struct urb *urb)
*/
if (!(urb->transfer_flags & URB_ASYNC_UNLINK)) {
if (in_interrupt ()) {
dev_dbg (*hcd->controller, "non-async unlink in_interrupt");
dev_dbg (hcd->controller, "non-async unlink in_interrupt");
retval = -EWOULDBLOCK;
goto done;
}
......@@ -1180,7 +1180,7 @@ static int hcd_unlink_urb (struct urb *urb)
/* hcds shouldn't really fail these calls, but... */
if (retval) {
dev_dbg (*sys, "dequeue %p --> %d\n", urb, retval);
dev_dbg (sys, "dequeue %p --> %d\n", urb, retval);
if (!(urb->transfer_flags & URB_ASYNC_UNLINK)) {
spin_lock_irqsave (&urb->lock, flags);
urb->complete = splice.complete;
......@@ -1203,7 +1203,7 @@ static int hcd_unlink_urb (struct urb *urb)
spin_unlock_irqrestore (&urb->lock, flags);
bye:
if (retval && sys)
dev_dbg (*sys, "hcd_unlink_urb %p fail %d\n", urb, retval);
dev_dbg (sys, "hcd_unlink_urb %p fail %d\n", urb, retval);
return retval;
}
......@@ -1234,7 +1234,7 @@ static int hcd_free_dev (struct usb_device *udev)
/* device driver problem with refcounts? */
if (!list_empty (&dev->urb_list)) {
dev_dbg (*hcd->controller, "free busy dev, %s devnum %d (bug!)\n",
dev_dbg (hcd->controller, "free busy dev, %s devnum %d (bug!)\n",
hcd->self.bus_name, udev->devnum);
return -EINVAL;
}
......@@ -1367,7 +1367,7 @@ void usb_hc_died (struct usb_hcd *hcd)
dev = list_entry (devlist, struct hcd_dev, dev_list);
list_for_each (urblist, &dev->urb_list) {
urb = list_entry (urblist, struct urb, urb_list);
dev_dbg (*hcd->controller, "shutdown %s urb %p pipe %x, current status %d\n",
dev_dbg (hcd->controller, "shutdown %s urb %p pipe %x, current status %d\n",
hcd->self.bus_name, urb, urb->pipe, urb->status);
if (urb->status == -EINPROGRESS)
urb->status = -ESHUTDOWN;
......
......@@ -263,7 +263,7 @@ static void usb_hub_power_on(struct usb_hub *hub)
int i;
/* Enable power to the ports */
dev_dbg(*hubdev(interface_to_usbdev(hub->intf)),
dev_dbg(hubdev(interface_to_usbdev(hub->intf)),
"enabling power on all ports\n");
dev = interface_to_usbdev(hub->intf);
for (i = 0; i < hub->descriptor->bNbrPorts; i++)
......@@ -307,7 +307,7 @@ static int usb_hub_configure(struct usb_hub *hub,
hub_dev = hubdev(dev);
dev->maxchild = hub->descriptor->bNbrPorts;
dev_info (*hub_dev, "%d port%s detected\n", dev->maxchild,
dev_info (hub_dev, "%d port%s detected\n", dev->maxchild,
(dev->maxchild == 1) ? "" : "s");
le16_to_cpus(&hub->descriptor->wHubCharacteristics);
......@@ -321,33 +321,33 @@ static int usb_hub_configure(struct usb_hub *hub,
[((i + 1) / 8)] & (1 << ((i + 1) % 8))
? 'F' : 'R';
portstr[dev->maxchild] = 0;
dev_dbg(*hub_dev, "compound device; port removable status: %s\n", portstr);
dev_dbg(hub_dev, "compound device; port removable status: %s\n", portstr);
} else
dev_dbg(*hub_dev, "standalone hub\n");
dev_dbg(hub_dev, "standalone hub\n");
switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) {
case 0x00:
dev_dbg(*hub_dev, "ganged power switching\n");
dev_dbg(hub_dev, "ganged power switching\n");
break;
case 0x01:
dev_dbg(*hub_dev, "individual port power switching\n");
dev_dbg(hub_dev, "individual port power switching\n");
break;
case 0x02:
case 0x03:
dev_dbg(*hub_dev, "unknown reserved power switching mode\n");
dev_dbg(hub_dev, "unknown reserved power switching mode\n");
break;
}
switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) {
case 0x00:
dev_dbg(*hub_dev, "global over-current protection\n");
dev_dbg(hub_dev, "global over-current protection\n");
break;
case 0x08:
dev_dbg(*hub_dev, "individual port over-current protection\n");
dev_dbg(hub_dev, "individual port over-current protection\n");
break;
case 0x10:
case 0x18:
dev_dbg(*hub_dev, "no over-current protection\n");
dev_dbg(hub_dev, "no over-current protection\n");
break;
}
......@@ -358,16 +358,16 @@ static int usb_hub_configure(struct usb_hub *hub,
case 0:
break;
case 1:
dev_dbg(*hub_dev, "Single TT\n");
dev_dbg(hub_dev, "Single TT\n");
hub->tt.hub = dev;
break;
case 2:
dev_dbg(*hub_dev, "TT per port\n");
dev_dbg(hub_dev, "TT per port\n");
hub->tt.hub = dev;
hub->tt.multi = 1;
break;
default:
dev_dbg(*hub_dev, "Unrecognized hub protocol %d\n",
dev_dbg(hub_dev, "Unrecognized hub protocol %d\n",
dev->descriptor.bDeviceProtocol);
break;
}
......@@ -375,26 +375,26 @@ static int usb_hub_configure(struct usb_hub *hub,
switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) {
case 0x00:
if (dev->descriptor.bDeviceProtocol != 0)
dev_dbg(*hub_dev, "TT requires at most 8 FS bit times\n");
dev_dbg(hub_dev, "TT requires at most 8 FS bit times\n");
break;
case 0x20:
dev_dbg(*hub_dev, "TT requires at most 16 FS bit times\n");
dev_dbg(hub_dev, "TT requires at most 16 FS bit times\n");
break;
case 0x40:
dev_dbg(*hub_dev, "TT requires at most 24 FS bit times\n");
dev_dbg(hub_dev, "TT requires at most 24 FS bit times\n");
break;
case 0x60:
dev_dbg(*hub_dev, "TT requires at most 32 FS bit times\n");
dev_dbg(hub_dev, "TT requires at most 32 FS bit times\n");
break;
}
dev_dbg(*hub_dev, "Port indicators are %s supported\n",
dev_dbg(hub_dev, "Port indicators are %s supported\n",
(hub->descriptor->wHubCharacteristics & HUB_CHAR_PORTIND)
? "" : "not");
dev_dbg(*hub_dev, "power on to power good time: %dms\n",
dev_dbg(hub_dev, "power on to power good time: %dms\n",
hub->descriptor->bPwrOn2PwrGood * 2);
dev_dbg(*hub_dev, "hub controller current requirement: %dmA\n",
dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
hub->descriptor->bHubContrCurrent);
ret = usb_get_hub_status(dev, &hubstatus);
......@@ -405,11 +405,11 @@ static int usb_hub_configure(struct usb_hub *hub,
le16_to_cpus(&hubstatus.wHubStatus);
dev_dbg(*hub_dev, "local power source is %s\n",
dev_dbg(hub_dev, "local power source is %s\n",
(hubstatus.wHubStatus & HUB_STATUS_LOCAL_POWER)
? "lost (inactive)" : "good");
dev_dbg(*hub_dev, "%sover-current condition exists\n",
dev_dbg(hub_dev, "%sover-current condition exists\n",
(hubstatus.wHubStatus & HUB_STATUS_OVERCURRENT) ? "" : "no ");
/* Start the interrupt endpoint */
......@@ -442,7 +442,7 @@ static int usb_hub_configure(struct usb_hub *hub,
return 0;
fail:
dev_err (hub->intf->dev, "config failed, %s (err %d)\n",
dev_err (&hub->intf->dev, "config failed, %s (err %d)\n",
message, ret);
/* hub_disconnect() frees urb and descriptor */
return ret;
......@@ -505,7 +505,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
if ((desc->desc.bInterfaceSubClass != 0) &&
(desc->desc.bInterfaceSubClass != 1)) {
descriptor_error:
dev_err (intf->dev, "bad descriptor, ignoring hub\n");
dev_err (&intf->dev, "bad descriptor, ignoring hub\n");
return -EIO;
}
......@@ -529,7 +529,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
}
/* We found a hub */
dev_info (*hubdev (dev), "USB hub found\n");
dev_info (hubdev (dev), "USB hub found\n");
hub = kmalloc(sizeof(*hub), GFP_KERNEL);
if (!hub) {
......@@ -714,7 +714,7 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port,
if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
delay = HUB_LONG_RESET_TIME;
dev_dbg (*hubdev (hub),
dev_dbg (hubdev (hub),
"port %d not reset yet, waiting %dms\n",
port + 1, delay);
}
......@@ -740,13 +740,13 @@ static int usb_hub_port_reset(struct usb_device *hub, int port,
return status;
}
dev_dbg (*hubdev (hub),
dev_dbg (hubdev (hub),
"port %d not enabled, trying reset again...\n",
port + 1);
delay = HUB_LONG_RESET_TIME;
}
dev_err (*hubdev (hub),
dev_err (hubdev (hub),
"Cannot enable port %i. Maybe the USB cable is bad?\n",
port + 1);
......@@ -814,7 +814,7 @@ static int usb_hub_port_debounce(struct usb_device *hub, int port)
}
/* XXX Replace this with dbg() when 2.6 is about to ship. */
dev_info (*hubdev (hub),
dev_info (hubdev (hub),
"debounce: port %d: delay %dms stable %d status 0x%x\n",
port + 1, delay_time, stable_count, portstatus);
......@@ -829,7 +829,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
unsigned int delay = HUB_SHORT_RESET_TIME;
int i;
dev_dbg (hubstate->intf->dev,
dev_dbg (&hubstate->intf->dev,
"port %d, status %x, change %x, %s\n",
port + 1, portstatus, portchange, portspeed (portstatus));
......@@ -849,7 +849,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
}
if (usb_hub_port_debounce(hub, port)) {
dev_err (hubstate->intf->dev,
dev_err (&hubstate->intf->dev,
"connect-debounce failed, port %d disabled\n",
port+1);
usb_hub_port_disable(hub, port);
......@@ -870,7 +870,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
/* Allocate a new device struct */
dev = usb_alloc_dev(hub, hub->bus);
if (!dev) {
dev_err (hubstate->intf->dev,
dev_err (&hubstate->intf->dev,
"couldn't allocate usb_device\n");
break;
}
......@@ -914,10 +914,10 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
len = snprintf (dev->devpath, sizeof dev->devpath,
"%d", port + 1);
if (len == sizeof dev->devpath)
dev_err (hubstate->intf->dev,
dev_err (&hubstate->intf->dev,
"devpath size! usb/%03d/%03d path %s\n",
dev->bus->busnum, dev->devnum, dev->devpath);
dev_info (hubstate->intf->dev,
dev_info (&hubstate->intf->dev,
"new USB device on port %d, assigned address %d\n",
port + 1, dev->devnum);
......@@ -1006,7 +1006,7 @@ static void usb_hub_events(void)
if (portchange & USB_PORT_STAT_C_CONNECTION) {
usb_hub_port_connect_change(hub, i, portstatus, portchange);
} else if (portchange & USB_PORT_STAT_C_ENABLE) {
dev_dbg (*hubdev (dev),
dev_dbg (hubdev (dev),
"port %d enable change, status %x\n",
i + 1, portstatus);
usb_clear_port_feature(dev,
......
......@@ -177,7 +177,7 @@ void usb_show_string(struct usb_device *dev, char *id, int index)
if (!(buf = kmalloc(256, GFP_KERNEL)))
return;
if (usb_string(dev, index, buf, 256) > 0)
dev_printk(KERN_INFO, dev->dev, "%s: %s\n", id, buf);
dev_printk(KERN_INFO, &dev->dev, "%s: %s\n", id, buf);
kfree(buf);
}
......
......@@ -84,19 +84,19 @@ int usb_device_probe(struct device *dev)
const struct usb_device_id *id;
int error = -ENODEV;
dev_dbg(*dev, "%s\n", __FUNCTION__);
dev_dbg(dev, "%s\n", __FUNCTION__);
if (!driver->probe)
return error;
if (!try_module_get(driver->owner)) {
dev_err (*dev, "Can't get a module reference for %s\n", driver->name);
dev_err (dev, "Can't get a module reference for %s\n", driver->name);
return error;
}
id = usb_match_id (intf, driver->id_table);
if (id) {
dev_dbg (*dev, "%s - got id\n", __FUNCTION__);
dev_dbg (dev, "%s - got id\n", __FUNCTION__);
down (&driver->serialize);
error = driver->probe (intf, id);
up (&driver->serialize);
......@@ -118,7 +118,7 @@ int usb_device_remove(struct device *dev)
driver = to_usb_driver(dev->driver);
if (!driver) {
dev_err(*dev, "%s does not have a valid driver to work with!",
dev_err(dev, "%s does not have a valid driver to work with!",
__FUNCTION__);
return -ENODEV;
}
......@@ -126,7 +126,7 @@ int usb_device_remove(struct device *dev)
if (!try_module_get(driver->owner)) {
// FIXME this happens even when we just rmmod
// drivers that aren't in active use...
dev_err(*dev, "Dieing driver still bound to device.\n");
dev_err(dev, "Dieing driver still bound to device.\n");
return -EIO;
}
......@@ -827,7 +827,7 @@ void usb_disconnect(struct usb_device **pdev)
*pdev = NULL;
dev_info (dev->dev, "USB disconnect, address %d\n", dev->devnum);
dev_info (&dev->dev, "USB disconnect, address %d\n", dev->devnum);
/* Free up all the children before we remove this device */
for (i = 0; i < USB_MAXCHILDREN; i++) {
......@@ -836,7 +836,7 @@ void usb_disconnect(struct usb_device **pdev)
usb_disconnect(child);
}
dev_dbg (dev->dev, "unregistering interfaces\n");
dev_dbg (&dev->dev, "unregistering interfaces\n");
if (dev->actconfig) {
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
struct usb_interface *interface = &dev->actconfig->interface[i];
......@@ -846,7 +846,7 @@ void usb_disconnect(struct usb_device **pdev)
}
}
dev_dbg (dev->dev, "unregistering device\n");
dev_dbg (&dev->dev, "unregistering device\n");
/* Free the device number and remove the /proc/bus/usb entry */
if (dev->devnum > 0) {
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
......@@ -931,7 +931,7 @@ static void set_device_description (struct usb_device *dev)
if (prod && usb_string (dev, prod, prod_str, 256) > 0) {
#ifdef DEBUG
dev_printk (KERN_INFO, dev->dev, "Product: %s\n", prod_str);
dev_printk (KERN_INFO, &dev->dev, "Product: %s\n", prod_str);
#endif
} else {
prod_str = 0;
......@@ -939,7 +939,7 @@ static void set_device_description (struct usb_device *dev)
if (mfgr && usb_string (dev, mfgr, mfgr_str, 256) > 0) {
#ifdef DEBUG
dev_printk (KERN_INFO, dev->dev, "Manufacturer: %s\n", mfgr_str);
dev_printk (KERN_INFO, &dev->dev, "Manufacturer: %s\n", mfgr_str);
#endif
} else {
mfgr_str = 0;
......@@ -1042,7 +1042,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
wait_ms(200);
}
if (err < 0) {
dev_err(dev->dev, "USB device not accepting new address=%d (error=%d)\n",
dev_err(&dev->dev, "USB device not accepting new address=%d (error=%d)\n",
dev->devnum, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
......@@ -1060,9 +1060,9 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
if (err < 8) {
if (err < 0)
dev_err(dev->dev, "USB device not responding, giving up (error=%d)\n", err);
dev_err(&dev->dev, "USB device not responding, giving up (error=%d)\n", err);
else
dev_err(dev->dev, "USB device descriptor short read (expected %i, got %i)\n", 8, err);
dev_err(&dev->dev, "USB device descriptor short read (expected %i, got %i)\n", 8, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
return 1;
......@@ -1077,9 +1077,9 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
err = usb_get_device_descriptor(dev);
if (err < (signed)sizeof(dev->descriptor)) {
if (err < 0)
dev_err(dev->dev, "unable to get device descriptor (error=%d)\n", err);
dev_err(&dev->dev, "unable to get device descriptor (error=%d)\n", err);
else
dev_err(dev->dev, "USB device descriptor short read (expected %Zi, got %i)\n",
dev_err(&dev->dev, "USB device descriptor short read (expected %Zi, got %i)\n",
sizeof(dev->descriptor), err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
......@@ -1089,7 +1089,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
err = usb_get_configuration(dev);
if (err < 0) {
dev_err(dev->dev, "unable to get device %d configuration (error=%d)\n",
dev_err(&dev->dev, "unable to get device %d configuration (error=%d)\n",
dev->devnum, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
......@@ -1099,7 +1099,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
/* we set the default configuration here */
err = usb_set_configuration(dev, dev->config[0].desc.bConfigurationValue);
if (err) {
dev_err(dev->dev, "failed to set device %d default configuration (error=%d)\n",
dev_err(&dev->dev, "failed to set device %d default configuration (error=%d)\n",
dev->devnum, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
......@@ -1108,7 +1108,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
/* USB device state == configured ... tell the world! */
dev_dbg(dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
dev_dbg(&dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber);
set_device_description (dev);
......@@ -1151,7 +1151,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
dev->bus->bus_name, dev->devpath,
desc->bInterfaceNumber);
}
dev_dbg (dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id);
dev_dbg (&dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id);
device_add (&interface->dev);
usb_create_driverfs_intf_files (interface);
}
......
......@@ -21,13 +21,13 @@
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,50)
#define ehci_dbg(ehci, fmt, args...) \
dev_dbg (*(ehci)->hcd.controller, fmt, ## args )
dev_dbg ((ehci)->hcd.controller, fmt, ## args )
#define ehci_err(ehci, fmt, args...) \
dev_err (*(ehci)->hcd.controller, fmt, ## args )
dev_err ((ehci)->hcd.controller, fmt, ## args )
#define ehci_info(ehci, fmt, args...) \
dev_info (*(ehci)->hcd.controller, fmt, ## args )
dev_info ((ehci)->hcd.controller, fmt, ## args )
#define ehci_warn(ehci, fmt, args...) \
dev_warn (*(ehci)->hcd.controller, fmt, ## args )
dev_warn ((ehci)->hcd.controller, fmt, ## args )
#else
......
......@@ -637,9 +637,13 @@ static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs)
static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
{
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
u32 status = readl (&ehci->regs->status);
u32 status;
int bh;
spin_lock (&ehci->lock);
status = readl (&ehci->regs->status);
/* e.g. cardbus physical eject */
if (status == ~(u32) 0) {
ehci_dbg (ehci, "device removed\n");
......@@ -648,9 +652,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
status &= INTR_MASK;
if (!status) /* irq sharing? */
return;
spin_lock (&ehci->lock);
goto done;
/* clear (just) interrupts */
writel (status, &ehci->regs->status);
......@@ -693,6 +695,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
if (bh)
ehci_work (ehci, regs);
done:
spin_unlock (&ehci->lock);
}
......
......@@ -222,7 +222,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
static unsigned
qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
{
struct ehci_qtd *last = 0;
struct ehci_qtd *last = 0, *end = qh->dummy;
struct list_head *entry, *tmp;
int stopped = 0;
unsigned count = 0;
......@@ -253,6 +253,10 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
last = 0;
}
/* ignore urbs submitted during completions we reported */
if (qtd == end)
break;
/* hardware copies qtd out of qh overlay */
rmb ();
token = le32_to_cpu (qtd->hw_token);
......@@ -967,25 +971,28 @@ static void
scan_async (struct ehci_hcd *ehci, struct pt_regs *regs)
{
struct ehci_qh *qh;
unsigned count;
if (!++(ehci->stamp))
ehci->stamp++;
rescan:
qh = ehci->async->qh_next.qh;
count = 0;
if (likely (qh != 0)) {
do {
/* clean any finished work for this qh */
if (!list_empty (&qh->qtd_list)) {
if (!list_empty (&qh->qtd_list)
&& qh->stamp != ehci->stamp) {
int temp;
/* unlinks could happen here; completion
* reporting drops the lock.
* reporting drops the lock. rescan using
* the latest schedule, but don't rescan
* qhs we already finished (no looping).
*/
qh = qh_get (qh);
qh->stamp = ehci->stamp;
temp = qh_completions (ehci, qh, regs);
qh_put (ehci, qh);
if (temp != 0) {
count += temp;
goto rescan;
}
}
......
......@@ -81,6 +81,7 @@ struct ehci_hcd { /* one per controller */
struct pci_pool *sitd_pool; /* sitd per split iso urb */
struct timer_list watchdog;
unsigned stamp;
#ifdef EHCI_STATS
struct ehci_stats stats;
......@@ -306,6 +307,7 @@ struct ehci_qh {
struct ehci_qtd *dummy;
atomic_t refcount;
unsigned stamp;
u8 qh_state;
#define QH_STATE_LINKED 1 /* HC sees this */
......
......@@ -75,7 +75,7 @@ urb_print (struct urb * urb, char * str, int small)
static void ohci_dump_intr_mask (struct device *dev, char *label, __u32 mask)
{
dev_dbg (*dev, "%s: 0x%08x%s%s%s%s%s%s%s%s%s\n",
dev_dbg (dev, "%s: 0x%08x%s%s%s%s%s%s%s%s%s\n",
label,
mask,
(mask & OHCI_INTR_MIE) ? " MIE" : "",
......@@ -93,7 +93,7 @@ static void ohci_dump_intr_mask (struct device *dev, char *label, __u32 mask)
static void maybe_print_eds (struct device *dev, char *label, __u32 value)
{
if (value)
dev_dbg (*dev, "%s %08x\n", label, value);
dev_dbg (dev, "%s %08x\n", label, value);
}
static char *hcfs2string (int state)
......@@ -115,12 +115,12 @@ static void ohci_dump_status (struct ohci_hcd *controller)
__u32 temp;
temp = readl (&regs->revision) & 0xff;
dev_dbg (*dev, "OHCI %d.%d, %s legacy support registers\n",
dev_dbg (dev, "OHCI %d.%d, %s legacy support registers\n",
0x03 & (temp >> 4), (temp & 0x0f),
(temp & 0x10) ? "with" : "NO");
temp = readl (&regs->control);
dev_dbg (*dev, "control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", temp,
dev_dbg (dev, "control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", temp,
(temp & OHCI_CTRL_RWE) ? " RWE" : "",
(temp & OHCI_CTRL_RWC) ? " RWC" : "",
(temp & OHCI_CTRL_IR) ? " IR" : "",
......@@ -133,7 +133,7 @@ static void ohci_dump_status (struct ohci_hcd *controller)
);
temp = readl (&regs->cmdstatus);
dev_dbg (*dev, "cmdstatus: 0x%08x SOC=%d%s%s%s%s\n", temp,
dev_dbg (dev, "cmdstatus: 0x%08x SOC=%d%s%s%s%s\n", temp,
(temp & OHCI_SOC) >> 16,
(temp & OHCI_OCR) ? " OCR" : "",
(temp & OHCI_BLF) ? " BLF" : "",
......@@ -167,7 +167,7 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
ndp = (temp & RH_A_NDP);
if (verbose) {
dev_dbg (*controller->hcd.controller,
dev_dbg (controller->hcd.controller,
"roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d\n", temp,
((temp & RH_A_POTPGT) >> 24) & 0xff,
(temp & RH_A_NOCP) ? " NOCP" : "",
......@@ -178,14 +178,14 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
ndp
);
temp = roothub_b (controller);
dev_dbg (*controller->hcd.controller,
dev_dbg (controller->hcd.controller,
"roothub.b: %08x PPCM=%04x DR=%04x\n",
temp,
(temp & RH_B_PPCM) >> 16,
(temp & RH_B_DR)
);
temp = roothub_status (controller);
dev_dbg (*controller->hcd.controller,
dev_dbg (controller->hcd.controller,
"roothub.status: %08x%s%s%s%s%s%s\n",
temp,
(temp & RH_HS_CRWE) ? " CRWE" : "",
......@@ -205,13 +205,13 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
static void ohci_dump (struct ohci_hcd *controller, int verbose)
{
dev_dbg (*controller->hcd.controller,
dev_dbg (controller->hcd.controller,
"OHCI controller state\n");
// dumps some of the state we know about
ohci_dump_status (controller);
if (controller->hcca)
dev_dbg (*controller->hcd.controller,
dev_dbg (controller->hcd.controller,
"hcca frame #%04x\n", controller->hcca->frame_no);
ohci_dump_roothub (controller, 1);
}
......@@ -318,6 +318,8 @@ ohci_dump_ed (struct ohci_hcd *ohci, char *label, struct ed *ed, int verbose)
}
}
#define DRIVERFS_DEBUG_FILES /* only on 2.5 versions */
#else
static inline void ohci_dump (struct ohci_hcd *controller, int verbose) {}
......@@ -325,6 +327,8 @@ static inline void ohci_dump (struct ohci_hcd *controller, int verbose) {}
/*-------------------------------------------------------------------------*/
#ifdef DRIVERFS_DEBUG_FILES
static ssize_t
show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
{
......@@ -355,7 +359,7 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
scratch,
(info & ED_SKIP) ? " s" : "",
(ed->hwHeadP & ED_H) ? " H" : "",
(ed->hwHeadP & ED_C) ? "data1" : "data0");
(ed->hwHeadP & ED_C) ? data1 : data0);
size -= temp;
buf += temp;
......@@ -513,7 +517,7 @@ static inline void create_debug_files (struct ohci_hcd *bus)
device_create_file (bus->hcd.controller, &dev_attr_async);
device_create_file (bus->hcd.controller, &dev_attr_periodic);
// registers
dev_dbg (*bus->hcd.controller, "created debug files\n");
dev_dbg (bus->hcd.controller, "created debug files\n");
}
static inline void remove_debug_files (struct ohci_hcd *bus)
......@@ -522,5 +526,12 @@ static inline void remove_debug_files (struct ohci_hcd *bus)
device_remove_file (bus->hcd.controller, &dev_attr_periodic);
}
#else /* empty stubs for creating those files */
static inline void create_debug_files (struct ohci_hcd *bus) { }
static inline void remove_debug_files (struct ohci_hcd *bus) { }
#endif /* DRIVERFS_DEBUG_FILES */
/*-------------------------------------------------------------------------*/
......@@ -383,7 +383,7 @@ static int hc_reset (struct ohci_hcd *ohci)
/* SMM owns the HC? not for long! */
if (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
dev_dbg (*ohci->hcd.controller, "USB HC TakeOver from BIOS/SMM\n");
dev_dbg (ohci->hcd.controller, "USB HC TakeOver from BIOS/SMM\n");
/* this timeout is arbitrary. we make it long, so systems
* depending on usb keyboards may be usable even if the
......@@ -396,7 +396,7 @@ static int hc_reset (struct ohci_hcd *ohci)
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
wait_ms (10);
if (--temp == 0) {
dev_err (*ohci->hcd.controller, "USB HC TakeOver failed!\n");
dev_err (ohci->hcd.controller, "USB HC TakeOver failed!\n");
return -1;
}
}
......@@ -405,7 +405,7 @@ static int hc_reset (struct ohci_hcd *ohci)
/* Disable HC interrupts */
writel (OHCI_INTR_MIE, &ohci->regs->intrdisable);
dev_dbg (*ohci->hcd.controller, "USB HC reset_hc %s: ctrl = 0x%x ;\n",
dev_dbg (ohci->hcd.controller, "USB HC reset_hc %s: ctrl = 0x%x ;\n",
ohci->hcd.self.bus_name,
readl (&ohci->regs->control));
......@@ -422,7 +422,7 @@ static int hc_reset (struct ohci_hcd *ohci)
temp = 30; /* ... allow extra time */
while ((readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
if (--temp == 0) {
dev_err (*ohci->hcd.controller, "USB HC reset timed out!");
dev_err (ohci->hcd.controller, "USB HC reset timed out!");
return -1;
}
udelay (1);
......@@ -594,7 +594,7 @@ static void ohci_stop (struct usb_hcd *hcd)
{
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
dev_dbg (*hcd->controller, "stop %s controller%s\n",
dev_dbg (hcd->controller, "stop %s controller%s\n",
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
ohci->disabled ? " (disabled)" : ""
);
......
......@@ -41,7 +41,7 @@ static u32 roothub_portstatus (struct ohci_hcd *hc, int i)
/*-------------------------------------------------------------------------*/
#define dbg_port(hc,label,num,value) \
dev_dbg (*hc->hcd.controller, \
dev_dbg (hc->hcd.controller, \
"%s roothub.portstatus [%d] " \
"= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
label, num, temp, \
......
......@@ -122,7 +122,7 @@ td_free (struct ohci_hcd *hc, struct td *td)
if (*prev)
*prev = td->td_hash;
else
dev_dbg (*hc->hcd.controller, "bad hash for td %p\n", td);
dev_dbg (hc->hcd.controller, "bad hash for td %p\n", td);
pci_pool_free (hc->td_cache, td, td->td_dma);
}
......
......@@ -206,7 +206,7 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
default:
branch = balance (ohci, ed->interval, ed->load);
if (branch < 0) {
dev_dbg (*ohci->hcd.controller,
dev_dbg (ohci->hcd.controller,
"ERR %d, interval %d msecs, load %d\n",
branch, ed->interval, ed->load);
// FIXME if there are TDs queued, fail them!
......@@ -786,7 +786,7 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
}
/* help for troubleshooting: */
dev_dbg (urb->dev->dev,
dev_dbg (&urb->dev->dev,
"urb %p usb-%s-%s ep-%d-%s cc %d --> status %d\n",
urb,
urb->dev->bus->bus_name, urb->dev->devpath,
......
......@@ -24,8 +24,8 @@ config USB_SCANNER
depends on USB
help
Say Y here if you want to connect a USB scanner to your computer's
USB port. Please read <file:Documentation/usb/scanner.txt> and
<file:Documentation/usb/scanner-hp-sane.txt> for more information.
USB port. Please read <file:Documentation/usb/scanner.txt> for more
information.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
......
......@@ -673,7 +673,7 @@ static int mdc800_device_release (struct inode* inode, struct file *file)
*/
static ssize_t mdc800_device_read (struct file *file, char *buf, size_t len, loff_t *pos)
{
int left=len, sts=len; /* single transfer size */
size_t left=len, sts=len; /* single transfer size */
char* ptr=buf;
DECLARE_WAITQUEUE(wait, current);
......@@ -767,7 +767,7 @@ static ssize_t mdc800_device_read (struct file *file, char *buf, size_t len, lof
*/
static ssize_t mdc800_device_write (struct file *file, const char *buf, size_t len, loff_t *pos)
{
int i=0;
size_t i=0;
DECLARE_WAITQUEUE(wait, current);
down (&mdc800->io_lock);
......
/* -*- linux-c -*- */
/*
* Driver for USB Scanners (linux-2.5.52)
* Driver for USB Scanners (linux-2.5.54)
*
* Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson
*
......@@ -328,13 +328,20 @@
* - Accept devices with more than one interface. Only use interfaces that
* look like belonging to scanners.
* - Fix compilation error when debugging is enabled.
* - Add locking to ioctl_scanner(). Thanks to Oliver Neukum
* <oliver@neukum.name>.
*
* 0.4.10 01/07/2003
* - Added vendor/product ids for Visioneer scanners.
* - Print information about user-supplied ids only once at startup instead
* of everytime any USB device is plugged in.
* - Removed PV8630 ioctls. Use the standard ioctls instead.
*
* TODO
* - Remove the 2/3 endpoint limitation
* - Performance
* - Select/poll methods
* - More testing
* - Proper registry/assignment for LM9830 ioctl's
* - More general usage ioctl's
*
*
......@@ -713,74 +720,22 @@ ioctl_scanner(struct inode *inode, struct file *file,
{
struct usb_device *dev;
struct scn_usb_data *scn = file->private_data;
int retval = -ENOTTY;
int scn_minor;
scn_minor = USB_SCN_MINOR(inode);
down(&(scn->sem));
dev = scn->scn_dev;
switch (cmd)
{
case SCANNER_IOCTL_VENDOR :
return (put_user(dev->descriptor.idVendor, (unsigned int *) arg));
retval = (put_user(dev->descriptor.idVendor, (unsigned int *) arg));
break;
case SCANNER_IOCTL_PRODUCT :
return (put_user(dev->descriptor.idProduct, (unsigned int *) arg));
#ifdef PV8630
case PV8630_IOCTL_INREQUEST :
{
int result;
struct {
__u8 data;
__u8 request;
__u16 value;
__u16 index;
} args;
if (copy_from_user(&args, (void *)arg, sizeof(args)))
return -EFAULT;
result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
args.request, USB_TYPE_VENDOR|
USB_RECIP_DEVICE|USB_DIR_IN,
args.value, args.index, &args.data,
1, HZ*5);
dbg("ioctl_scanner(%d): inreq: args.data:%x args.value:%x args.index:%x args.request:%x\n", scn_minor, args.data, args.value, args.index, args.request);
if (copy_to_user((void *)arg, &args, sizeof(args)))
return -EFAULT;
dbg("ioctl_scanner(%d): inreq: result:%d\n", scn_minor, result);
return result;
}
case PV8630_IOCTL_OUTREQUEST :
{
int result;
struct {
__u8 request;
__u16 value;
__u16 index;
} args;
if (copy_from_user(&args, (void *)arg, sizeof(args)))
return -EFAULT;
dbg("ioctl_scanner(%d): outreq: args.value:%x args.index:%x args.request:%x\n", scn_minor, args.value, args.index, args.request);
result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
args.request, USB_TYPE_VENDOR|
USB_RECIP_DEVICE|USB_DIR_OUT,
args.value, args.index, NULL,
0, HZ*5);
dbg("ioctl_scanner(%d): outreq: result:%d\n", scn_minor, result);
return result;
}
#endif /* PV8630 */
retval = (put_user(dev->descriptor.idProduct, (unsigned int *) arg));
break;
case SCANNER_IOCTL_CTRLMSG:
{
struct ctrlmsg_ioctl {
......@@ -789,19 +744,26 @@ ioctl_scanner(struct inode *inode, struct file *file,
} cmsg;
int pipe, nb, ret;
unsigned char buf[64];
retval = 0;
if (copy_from_user(&cmsg, (void *)arg, sizeof(cmsg)))
return -EFAULT;
if (copy_from_user(&cmsg, (void *)arg, sizeof(cmsg))) {
retval = -EFAULT;
break;
}
nb = cmsg.req.wLength;
if (nb > sizeof(buf))
return -EINVAL;
if (nb > sizeof(buf)) {
retval = -EINVAL;
break;
}
if ((cmsg.req.bRequestType & 0x80) == 0) {
pipe = usb_sndctrlpipe(dev, 0);
if (nb > 0 && copy_from_user(buf, cmsg.data, nb))
return -EFAULT;
if (nb > 0 && copy_from_user(buf, cmsg.data, nb)) {
retval = -EFAULT;
break;
}
} else {
pipe = usb_rcvctrlpipe(dev, 0);
}
......@@ -814,18 +776,20 @@ ioctl_scanner(struct inode *inode, struct file *file,
if (ret < 0) {
err("ioctl_scanner(%d): control_msg returned %d\n", scn_minor, ret);
return -EIO;
retval = -EIO;
break;
}
if (nb > 0 && (cmsg.req.bRequestType & 0x80) && copy_to_user(cmsg.data, buf, nb))
return -EFAULT;
retval = -EFAULT;
return 0;
break;
}
default:
return -ENOTTY;
break;
}
return 0;
up(&(scn->sem));
return retval;
}
static struct
......@@ -856,10 +820,6 @@ probe_scanner(struct usb_interface *intf,
char have_bulk_in, have_bulk_out, have_intr;
char name[10];
if (vendor != -1 && product != -1) {
info("probe_scanner: User specified USB scanner -- Vendor:Product - %x:%x", vendor, product);
}
dbg("probe_scanner: USB dev address:%p", dev);
/*
......@@ -1171,6 +1131,8 @@ usb_scanner_init (void)
return -1;
info(DRIVER_VERSION ":" DRIVER_DESC);
if (vendor != -1 && product != -1)
info("probe_scanner: User specified USB scanner -- Vendor:Product - %x:%x", vendor, product);
return 0;
}
......
/*
* Driver for USB Scanners (linux-2.5.52)
* Driver for USB Scanners (linux-2.5.54)
*
* Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson
*
......@@ -38,13 +38,7 @@
// #define DEBUG
/* Enable this to support the older ioctl interfaces scanners that
* a PV8630 Scanner-On-Chip. The prefered method is the
* SCANNER_IOCTL_CTRLMSG ioctl.
*/
// #define PV8630
#define DRIVER_VERSION "0.4.9"
#define DRIVER_VERSION "0.4.10"
#define DRIVER_DESC "USB Scanner Driver"
#include <linux/usb.h>
......@@ -122,6 +116,7 @@ static struct usb_device_id scanner_device_ids [] = {
{ USB_DEVICE(0x0458, 0x2016) }, /* ColorPage-HR6X */
/* Hewlett Packard */
{ USB_DEVICE(0x03f0, 0x0505) }, /* ScanJet 2100C */
{ USB_DEVICE(0x03f0, 0x0605) }, /* 2200C */
{ USB_DEVICE(0x03f0, 0x0901) }, /* 2300C */
{ USB_DEVICE(0x03f0, 0x0205) }, /* 3300C */
{ USB_DEVICE(0x03f0, 0x0405) }, /* 3400C */
......@@ -134,7 +129,6 @@ static struct usb_device_id scanner_device_ids [] = {
// { USB_DEVICE(0x03f0, 0x0701) }, /* 5300C - NOT SUPPORTED - see http://www.neatech.nl/oss/HP5300C/ */
{ USB_DEVICE(0x03f0, 0x0201) }, /* 6200C */
{ USB_DEVICE(0x03f0, 0x0601) }, /* 6300C */
{ USB_DEVICE(0x03f0, 0x605) }, /* 2200C */
/* iVina */
{ USB_DEVICE(0x0638, 0x0268) }, /* 1200U */
/* Lexmark */
......@@ -242,6 +236,8 @@ static struct usb_device_id scanner_device_ids [] = {
{ USB_DEVICE(0x04a7, 0x0311) }, /* 6200 EPP/USB */
{ USB_DEVICE(0x04a7, 0x0321) }, /* OneTouch 8100 EPP/USB */
{ USB_DEVICE(0x04a7, 0x0331) }, /* OneTouch 8600 EPP/USB */
{ USB_DEVICE(0x0461, 0x0345) }, /* 6200 (actually Primax?) */
{ USB_DEVICE(0x0461, 0x0371) }, /* Onetouch 8920 USB (actually Primax?) */
{ } /* Terminating entry */
};
......@@ -268,13 +264,6 @@ MODULE_DEVICE_TABLE (usb, scanner_device_ids);
#define RD_EXPIRE 12 /* Number of attempts to wait X seconds */
/* FIXME: These are NOT registered ioctls()'s */
#ifdef PV8630
#define PV8630_IOCTL_INREQUEST 69
#define PV8630_IOCTL_OUTREQUEST 70
#endif /* PV8630 */
/* read vendor and product IDs from the scanner */
#define SCANNER_IOCTL_VENDOR _IOR('U', 0x20, int)
#define SCANNER_IOCTL_PRODUCT _IOR('U', 0x21, int)
......
......@@ -48,9 +48,7 @@
/* Called when a transfer is completed */
static void hid_pid_ctrl_out(struct urb *u, struct pt_regs *regs)
{
#ifdef DEBUG
printk("hid_pid_ctrl_out - Transfer Completed\n");
#endif
dev_dbg(&u->dev->dev, "hid_pid_ctrl_out - Transfer Completed\n");
}
static void hid_pid_exit(struct hid_device* hid)
......@@ -64,32 +62,29 @@ static void hid_pid_exit(struct hid_device* hid)
}
static int pid_upload_periodic(struct hid_ff_pid *pid, struct ff_effect *effect, int is_update) {
printk("Requested periodic force upload\n");
dev_info(&pid->hid->dev->dev, "requested periodic force upload\n");
return 0;
}
static int pid_upload_constant(struct hid_ff_pid *pid, struct ff_effect *effect, int is_update) {
printk("Requested constant force upload\n");
dev_info(&pid->hid->dev->dev, "requested constant force upload\n");
return 0;
}
static int pid_upload_condition(struct hid_ff_pid *pid, struct ff_effect *effect, int is_update) {
printk("Requested Condition force upload\n");
dev_info(&pid->hid->dev->dev, "requested Condition force upload\n");
return 0;
}
static int pid_upload_ramp(struct hid_ff_pid *pid, struct ff_effect *effect, int is_update) {
printk("Request ramp force upload\n");
dev_info(&pid->hid->dev->dev, "request ramp force upload\n");
return 0;
}
static int hid_pid_event(struct hid_device *hid, struct input_dev *input,
unsigned int type, unsigned int code, int value)
{
#ifdef DEBUG
printk ("PID event received: type=%d,code=%d,value=%d.\n",type,code,value);
#endif
dev_dbg(&hid->dev->dev, "PID event received: type=%d,code=%d,value=%d.\n", type, code, value);
if (type != EV_FF)
return -1;
......@@ -127,20 +122,20 @@ static int hid_pid_erase(struct input_dev *dev, int id)
/* Find report */
ret = hid_find_report_by_usage(hid, wanted_report, &report, HID_OUTPUT_REPORT);
if(!ret) {
printk("Couldn't find report\n");
dev_err(&hid->dev->dev, "couldn't find report\n");
return ret;
}
/* Find field */
field = (struct hid_field *) kmalloc(sizeof(struct hid_field), GFP_KERNEL);
if(!field) {
printk("Couldn't allocate field\n");
dev_err(&hid->dev->dev, "couldn't allocate field\n");
return -ENOMEM;
}
ret = hid_set_field(field, ret, pid->effects[id].device_id);
if(!ret) {
printk("Couldn't set field\n");
dev_err(&hid->dev->dev, "couldn't set field\n");
return ret;
}
......@@ -169,7 +164,7 @@ static int hid_pid_flush(struct input_dev *dev, struct file *file)
if ( current->pid == pid->effects[i].owner
&& test_bit(FF_PID_FLAGS_USED, &pid->effects[i].flags))
if (hid_pid_erase(dev, i))
warn("erase effect %d failed", i);
dev_warn(&hid->dev->dev, "erase effect %d failed", i);
return 0;
}
......@@ -183,14 +178,10 @@ static int hid_pid_upload_effect(struct input_dev *dev,
int is_update;
int flags=0;
#ifdef DEBUG
printk("Upload effect called: effect_type=%x\n",effect->type);
#endif
dev_dbg(&pid_private->hid->dev->dev, "upload effect called: effect_type=%x\n",effect->type);
/* Check this effect type is supported by this device */
if (!test_bit(effect->type, dev->ffbit)) {
#ifdef DEBUG
printk("Invalid kind of effect requested.\n");
#endif
dev_dbg(&pid_private->hid->dev->dev, "invalid kind of effect requested.\n");
return -EINVAL;
}
......@@ -209,16 +200,12 @@ static int hid_pid_upload_effect(struct input_dev *dev,
if ( id == FF_EFFECTS_MAX) {
// TEMP - We need to get ff_effects_max correctly first: || id >= dev->ff_effects_max) {
#ifdef DEBUG
printk("Not enough device memory\n");
#endif
dev_dbg(&pid_private->hid->dev->dev, "Not enough device memory\n");
return -ENOMEM;
}
effect->id = id;
#ifdef DEBUG
printk("Effect ID is %d\n.",id);
#endif
dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d\n.",id);
pid_private->effects[id].owner = current->pid;
pid_private->effects[id].flags = (1<<FF_PID_FLAGS_USED);
spin_unlock_irqrestore(&pid_private->lock,flags);
......@@ -265,9 +252,7 @@ static int hid_pid_upload_effect(struct input_dev *dev,
break;
default:
#ifdef DEBUG
printk("Invalid type of effect requested - %x.\n", effect->type);
#endif
dev_dbg(&pid_private->hid->dev->dev, "invalid type of effect requested - %x.\n", effect->type);
return -EINVAL;
}
/* If a packet was sent, forbid new updates until we are notified
......
......@@ -1946,9 +1946,6 @@ static int auerswald_probe (struct usb_interface *intf,
if (intf->altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;
/* prevent module unloading while sleeping */
MOD_INC_USE_COUNT;
/* allocate memory for our device and intialize it */
cp = kmalloc (sizeof(auerswald_t), GFP_KERNEL);
if (cp == NULL) {
......@@ -2066,7 +2063,6 @@ static int auerswald_probe (struct usb_interface *intf,
/* Error exit: clean up the memory */
pfail: auerswald_delete (cp);
MOD_DEC_USE_COUNT;
return -EIO;
}
......@@ -2138,9 +2134,6 @@ static void auerswald_disconnect (struct usb_interface *intf)
if (scp) scp->disconnect( scp);
}
}
/* The device releases this module */
MOD_DEC_USE_COUNT;
}
/* Descriptor for the devices which are served by this driver.
......
......@@ -467,8 +467,6 @@ brlvger_open(struct inode *inode, struct file *file)
n = devnum - BRLVGER_MINOR;
MOD_INC_USE_COUNT;
do {
down(&disconnect_sem);
priv = display_table[n];
......@@ -478,7 +476,6 @@ brlvger_open(struct inode *inode, struct file *file)
if (file->f_flags & O_NONBLOCK) {
dbg3("Failing non-blocking open: "
"device %d not connected", n);
MOD_DEC_USE_COUNT;
return -EAGAIN;
}
/* Blocking open. One global wait queue will
......@@ -490,7 +487,6 @@ brlvger_open(struct inode *inode, struct file *file)
!= NULL);
if(ret) {
dbg2("Interrupted wait for device %d", n);
MOD_DEC_USE_COUNT;
return ret;
}
}
......@@ -504,7 +500,7 @@ brlvger_open(struct inode *inode, struct file *file)
/* Only one process can open each device, no sharing. */
ret = -EBUSY;
if(priv->opened)
goto error;
goto out;
dbg("Opening display %d", priv->subminor);
......@@ -512,7 +508,7 @@ brlvger_open(struct inode *inode, struct file *file)
priv->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if(!priv->intr_urb) {
err("Unable to allocate URB");
goto error;
goto out;
}
usb_fill_int_urb( priv->intr_urb, priv->dev,
usb_rcvintpipe(priv->dev,
......@@ -521,19 +517,19 @@ brlvger_open(struct inode *inode, struct file *file)
intr_callback, priv, priv->in_interrupt->bInterval);
if((ret = usb_submit_urb(priv->intr_urb, GFP_KERNEL)) <0){
err("Error %d while submitting URB", ret);
goto error;
goto out;
}
/* Set voltage */
if(brlvger_set_display_voltage(priv, raw_voltage) <0) {
err("Unable to set voltage");
goto error;
goto out;
}
/* Turn display on */
if((ret = brlvger_set_display_on_off(priv, 1)) <0) {
err("Error %d while turning display on", ret);
goto error;
goto out;
}
/* Mark as opened, so disconnect cannot free priv. */
......@@ -544,8 +540,6 @@ brlvger_open(struct inode *inode, struct file *file)
ret = 0;
goto out;
error:
MOD_DEC_USE_COUNT;
out:
up(&priv->open_sem);
return ret;
......@@ -577,8 +571,6 @@ brlvger_release(struct inode *inode, struct file *file)
up(&priv->open_sem);
}
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -589,7 +581,8 @@ brlvger_write(struct file *file, const char *buffer,
struct brlvger_priv *priv = file->private_data;
char buf[MAX_BRLVGER_CELLS];
int ret;
int rs, off;
size_t rs;
loff_t off;
__u16 written;
if(!priv->dev)
......
......@@ -94,8 +94,6 @@ static int open_rio(struct inode *inode, struct file *file)
init_waitqueue_head(&rio->wait_q);
MOD_INC_USE_COUNT;
unlock_kernel();
info("Rio opened.");
......@@ -109,8 +107,6 @@ static int close_rio(struct inode *inode, struct file *file)
rio->isopen = 0;
MOD_DEC_USE_COUNT;
info("Rio closed.");
return 0;
}
......@@ -443,6 +439,7 @@ read_rio(struct file *file, char *buffer, size_t count, loff_t * ppos)
static struct
file_operations usb_rio_fops = {
.owner = THIS_MODULE,
.read = read_rio,
.write = write_rio,
.ioctl = ioctl_rio,
......
......@@ -546,7 +546,300 @@ static int ch9_postconfig (struct usbtest_dev *dev)
/*-------------------------------------------------------------------------*/
// control queueing !!
/* use ch9 requests to test whether:
* (a) queues work for control, keeping N subtests queued and
* active (auto-resubmit) for M loops through the queue.
* (b) protocol stalls (control-only) will autorecover.
* it's quite not like bulk/intr; no halt clearing.
* (c) short control reads are reported and handled.
*/
struct ctrl_ctx {
spinlock_t lock;
struct usbtest_dev *dev;
struct completion complete;
unsigned count;
unsigned pending;
int status;
struct urb **urb;
struct usbtest_param *param;
};
static void ctrl_complete (struct urb *urb, struct pt_regs *regs)
{
struct ctrl_ctx *ctx = urb->context;
struct usb_ctrlrequest *reqp;
int status = urb->status;
reqp = (struct usb_ctrlrequest *)urb->setup_packet;
spin_lock (&ctx->lock);
ctx->count--;
ctx->pending--;
/* FIXME verify that the completions are in the right sequence.
* we could store the test number with the setup packet, that
* buffer has extra space.
*/
switch (status) {
case 0: /* success */
case -EREMOTEIO: /* short read */
if (reqp->bRequestType == (USB_DIR_IN|USB_RECIP_DEVICE)
&& reqp->bRequest == USB_REQ_GET_DESCRIPTOR
&& ((le16_to_cpu (reqp->wValue) >> 8)
== USB_DT_DEVICE)) {
if (reqp->wLength > USB_DT_DEVICE_SIZE
&& status == -EREMOTEIO)
status = 0;
else if (reqp->wLength == USB_DT_DEVICE_SIZE
&& status != 0)
status = -EIO;
if (status)
goto error;
}
break;
case -ECONNRESET: /* async unlink */
break;
case -EPIPE: /* (protocol) stall */
if (reqp->bRequestType == (USB_DIR_IN|USB_RECIP_INTERFACE)
&& reqp->bRequest == USB_REQ_GET_INTERFACE)
status = 0;
else if (reqp->bRequestType == (USB_DIR_IN|USB_RECIP_DEVICE)
&& reqp->bRequest == USB_REQ_GET_DESCRIPTOR) {
switch (le16_to_cpu (reqp->wValue) >> 8) {
case USB_DT_DEVICE_QUALIFIER:
case USB_DT_OTHER_SPEED_CONFIG:
case USB_DT_INTERFACE:
case USB_DT_ENDPOINT:
status = 0;
}
} else if (reqp->bRequestType == USB_RECIP_ENDPOINT
&& reqp->bRequest == USB_REQ_CLEAR_FEATURE)
status = 0;
/* some stalls we plan on; others would be errors */
if (status == 0)
break;
/* else FALLTHROUGH */
error:
default: /* this fault's an error */
if (ctx->status == 0) {
int i;
ctx->status = status;
info ("control queue %02x.%02x, err %d, %d left",
reqp->bRequestType, reqp->bRequest,
status, ctx->count);
/* FIXME use this "unlink everything" exit route
* in all cases, not just for fault cleanup.
* it'll be another test mode, but one that makes
* testing be more consistent.
*/
/* unlink whatever's still pending */
for (i = 0; i < ctx->param->sglen; i++) {
struct urb *u = ctx->urb [i];
if (u == urb || !u->dev)
continue;
status = usb_unlink_urb (u);
switch (status) {
case -EINPROGRESS:
case -EBUSY:
continue;
default:
dbg ("urb unlink --> %d", status);
}
}
status = ctx->status;
}
}
/* resubmit if we need to, else mark this as done */
if ((status == 0) && (ctx->pending < ctx->count)) {
if ((status = usb_submit_urb (urb, SLAB_ATOMIC)) != 0) {
dbg ("can't resubmit ctrl %02x.%02x, err %d",
reqp->bRequestType, reqp->bRequest, status);
urb->dev = 0;
} else
ctx->pending++;
} else
urb->dev = 0;
/* signal completion when nothing's queued */
if (ctx->pending == 0)
complete (&ctx->complete);
spin_unlock (&ctx->lock);
}
static int
test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
{
struct usb_device *udev = testdev_to_usbdev (dev);
struct urb **urb;
struct ctrl_ctx context;
int i;
spin_lock_init (&context.lock);
context.dev = dev;
init_completion (&context.complete);
context.count = param->sglen * param->iterations;
context.pending = 0;
context.status = -ENOMEM;
context.param = param;
/* allocate and init the urbs we'll queue.
* as with bulk/intr sglists, sglen is the queue depth; it also
* controls which subtests run (more tests than sglen) or rerun.
*/
urb = kmalloc (param->sglen * sizeof (struct urb *), SLAB_KERNEL);
if (!urb)
goto cleanup;
memset (urb, 0, param->sglen * sizeof (struct urb *));
for (i = 0; i < param->sglen; i++) {
int pipe = usb_rcvctrlpipe (udev, 0);
unsigned len;
struct urb *u;
struct usb_ctrlrequest req, *reqp;
/* requests here are mostly expected to succeed on any
* device, but some are chosen to trigger protocol stalls
* or short reads.
*/
memset (&req, 0, sizeof req);
req.bRequest = USB_REQ_GET_DESCRIPTOR;
req.bRequestType = USB_DIR_IN|USB_RECIP_DEVICE;
switch (i % 12 /* number of subtest cases here */) {
case 0: // get device descriptor
req.wValue = cpu_to_le16 (USB_DT_DEVICE << 8);
len = sizeof (struct usb_device_descriptor);
break;
case 1: // get first config descriptor (only)
req.wValue = cpu_to_le16 ((USB_DT_CONFIG << 8) | 0);
len = sizeof (struct usb_config_descriptor);
break;
case 2: // get altsetting (OFTEN STALLS)
req.bRequest = USB_REQ_GET_INTERFACE;
req.bRequestType = USB_DIR_IN|USB_RECIP_INTERFACE;
// index = 0 means first interface
len = 1;
break;
case 3: // get interface status
req.bRequest = USB_REQ_GET_STATUS;
req.bRequestType = USB_DIR_IN|USB_RECIP_INTERFACE;
// interface 0
len = 2;
break;
case 4: // get device status
req.bRequest = USB_REQ_GET_STATUS;
req.bRequestType = USB_DIR_IN|USB_RECIP_DEVICE;
len = 2;
break;
case 5: // get device qualifier (MAY STALL)
req.wValue = cpu_to_le16 (USB_DT_DEVICE_QUALIFIER << 8);
len = sizeof (struct usb_qualifier_descriptor);
break;
case 6: // get first config descriptor, plus interface
req.wValue = cpu_to_le16 ((USB_DT_CONFIG << 8) | 0);
len = sizeof (struct usb_config_descriptor);
len += sizeof (struct usb_interface_descriptor);
break;
case 7: // get interface descriptor (ALWAYS STALLS)
req.wValue = cpu_to_le16 (USB_DT_INTERFACE << 8);
// interface == 0
len = sizeof (struct usb_interface_descriptor);
break;
// NOTE: two consecutive stalls in the queue here.
// that tests fault recovery a bit more aggressively.
case 8: // clear endpoint halt (USUALLY STALLS)
req.bRequest = USB_REQ_CLEAR_FEATURE;
req.bRequestType = USB_RECIP_ENDPOINT;
// wValue 0 == ep halt
// wIndex 0 == ep0 (shouldn't halt!)
len = 0;
pipe = usb_sndctrlpipe (udev, 0);
break;
case 9: // get endpoint status
req.bRequest = USB_REQ_GET_STATUS;
req.bRequestType = USB_DIR_IN|USB_RECIP_ENDPOINT;
// endpoint 0
len = 2;
break;
case 10: // trigger short read (EREMOTEIO)
req.wValue = cpu_to_le16 ((USB_DT_CONFIG << 8) | 0);
len = 1024;
break;
// NOTE: two consecutive _different_ faults in the queue.
case 11: // get endpoint descriptor (ALWAYS STALLS)
req.wValue = cpu_to_le16 (USB_DT_ENDPOINT << 8);
// endpoint == 0
len = sizeof (struct usb_interface_descriptor);
break;
// NOTE: sometimes even a third fault in the queue!
case 12: // get string 0 descriptor (MAY STALL)
req.wValue = cpu_to_le16 (USB_DT_STRING << 8);
// string == 0, for language IDs
len = sizeof (struct usb_interface_descriptor);
break;
default:
err ("bogus number of ctrl queue testcases!");
context.status = -EINVAL;
goto cleanup;
}
req.wLength = cpu_to_le16 (len);
urb [i] = u = simple_alloc_urb (udev, pipe, len);
if (!u)
goto cleanup;
reqp = usb_buffer_alloc (udev, sizeof req, SLAB_KERNEL,
&u->setup_dma);
if (!reqp)
goto cleanup;
*reqp = req;
u->setup_packet = (char *) reqp;
u->context = &context;
u->complete = ctrl_complete;
u->transfer_flags |= URB_ASYNC_UNLINK;
}
/* queue the urbs */
context.urb = urb;
spin_lock_irq (&context.lock);
for (i = 0; i < param->sglen; i++) {
context.status = usb_submit_urb (urb [i], SLAB_ATOMIC);
if (context.status != 0) {
dbg ("can't submit urb[%d], status %d",
i, context.status);
context.count = context.pending;
break;
}
context.pending++;
}
spin_unlock_irq (&context.lock);
/* FIXME set timer and time out; provide a disconnect hook */
/* wait for the last one to complete */
wait_for_completion (&context.complete);
cleanup:
for (i = 0; i < param->sglen; i++) {
if (!urb [i])
continue;
urb [i]->dev = udev;
if (urb [i]->setup_packet)
usb_buffer_free (udev, sizeof (struct usb_ctrlrequest),
urb [i]->setup_packet,
urb [i]->setup_dma);
simple_free_urb (urb [i]);
}
kfree (urb);
return context.status;
}
/*-------------------------------------------------------------------------*/
......@@ -830,7 +1123,16 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
dbg ("ch9 subset failed, iterations left %d", i);
break;
// case 10: queued control
/* queued control messaging */
case 10:
if (param->sglen == 0)
break;
retval = 0;
dbg ("%s TEST 10: queue %d control calls, %d times",
dev->id, param->sglen,
param->iterations);
retval = test_ctrl_queue (dev, param);
break;
/* simple non-queued unlinks (ring with one urb) */
case 11:
......
......@@ -703,7 +703,7 @@ static void kaweth_usb_transmit_complete(struct urb *urb, struct pt_regs *regs)
kaweth_dbg("%s: TX status %d.", kaweth->net->name, urb->status);
netif_wake_queue(kaweth->net);
dev_kfree_skb(skb);
dev_kfree_skb_irq(skb);
}
/****************************************************************
......@@ -721,7 +721,7 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
if (kaweth->removed) {
/* our device is undergoing disconnection - we bail out */
spin_unlock(&kaweth->device_lock);
dev_kfree_skb(skb);
dev_kfree_skb_irq(skb);
return 0;
}
......@@ -733,7 +733,7 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
/* no such luck - we make our own */
struct sk_buff *copied_skb;
copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC);
dev_kfree_skb_any(skb);
dev_kfree_skb_irq(skb);
skb = copied_skb;
if (!copied_skb) {
kaweth->stats.tx_errors++;
......@@ -763,7 +763,7 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
kaweth->stats.tx_errors++;
netif_start_queue(net);
dev_kfree_skb(skb);
dev_kfree_skb_irq(skb);
}
else
{
......
......@@ -45,7 +45,7 @@
/*
* Version Information
*/
#define DRIVER_VERSION "v0.5.8 (2002/12/13)"
#define DRIVER_VERSION "v0.5.9 (2002/12/31)"
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
......@@ -866,6 +866,9 @@ static int pegasus_open(struct net_device *net)
return -ENOMEM;
down(&pegasus->sem);
set_registers(pegasus, EthID, 6, net->dev_addr);
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU + 8,
......
......@@ -239,8 +239,8 @@ PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
LINKSYS_GPIO_RESET )
PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
LINKSYS_GPIO_RESET | HAS_HOME_PNA )
PEGASUS_DEV( "Linksys USB Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
LINKSYS_GPIO_RESET )
PEGASUS_DEV( "Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
LINKSYS_GPIO_RESET | PEGASUS_II)
PEGASUS_DEV( "Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
LINKSYS_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
......
......@@ -21,7 +21,7 @@
#include <asm/uaccess.h>
/* Version Information */
#define DRIVER_VERSION "v0.5.6 (2002/09/19)"
#define DRIVER_VERSION "v0.5.7 (2002/12/31)"
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
#define DRIVER_DESC "rtl8150 based usb-ethernet driver"
......@@ -640,6 +640,9 @@ static int rtl8150_open(struct net_device *netdev)
return -ENOMEM;
down(&dev->sem);
set_registers(dev, IDR, 6, netdev->dev_addr);
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL)))
......
......@@ -1363,6 +1363,16 @@ static const struct driver_info zaurus_sla300_info = {
.in = 1, .out = 2,
.epsize = 64,
};
static const struct driver_info zaurus_slb500_info = {
/* Japanese B500 ~= US SL-5600 */
.description = "Sharp Zaurus SL-B500",
.flags = FLAG_FRAMING_Z,
.check_connect = always_connected,
.tx_fixup = zaurus_tx_fixup,
.in = 1, .out = 2,
.epsize = 64,
};
// SL-5600 and C-700 are PXA based; should resemble A300
......@@ -2331,8 +2341,7 @@ static const struct usb_device_id products [] = {
.bInterfaceSubClass = 0x00,
.bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_sl5x00_info,
},
{
}, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD,
......@@ -2341,6 +2350,15 @@ static const struct usb_device_id products [] = {
.bInterfaceSubClass = 0x0a,
.bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_sla300_info,
}, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD,
.idProduct = 0x8006,
.bInterfaceClass = 0x02,
.bInterfaceSubClass = 0x0a,
.bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_slb500_info,
},
#endif
......
......@@ -66,7 +66,7 @@ static int usb_serial_device_probe (struct device *dev)
driver = port->serial->type;
if (driver->port_probe) {
if (!try_module_get(driver->owner)) {
dev_err(*dev, "module get failed, exiting\n");
dev_err(dev, "module get failed, exiting\n");
retval = -EIO;
goto exit;
}
......@@ -79,7 +79,8 @@ static int usb_serial_device_probe (struct device *dev)
minor = port->number;
tty_register_device (&usb_serial_tty_driver, minor);
dev_info(*dev, "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
dev_info(&port->serial->dev->dev,
"%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
driver->name, minor, minor);
exit:
......@@ -101,7 +102,7 @@ static int usb_serial_device_remove (struct device *dev)
driver = port->serial->type;
if (driver->port_remove) {
if (!try_module_get(driver->owner)) {
dev_err(*dev, "module get failed, exiting\n");
dev_err(dev, "module get failed, exiting\n");
retval = -EIO;
goto exit;
}
......@@ -111,7 +112,7 @@ static int usb_serial_device_remove (struct device *dev)
exit:
minor = port->number;
tty_unregister_device (&usb_serial_tty_driver, minor);
dev_info(*dev, "%s converter now disconnected from ttyUSB%d\n",
dev_info(dev, "%s converter now disconnected from ttyUSB%d\n",
driver->name, minor);
return retval;
......
......@@ -181,7 +181,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", __FUNCTION__, result);
return result;
}
......@@ -205,7 +205,7 @@ static void empeg_close (struct usb_serial_port *port, struct file * filp)
usb_unlink_urb (port->read_urb);
}
/* Uncomment the following line if you want to see some statistics in your syslog */
/* dev_info (port->dev, "Bytes In = %d Bytes Out = %d\n", bytes_in, bytes_out); */
/* dev_info (&port->dev, "Bytes In = %d Bytes Out = %d\n", bytes_in, bytes_out); */
}
......@@ -248,7 +248,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
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", __FUNCTION__);
goto exit;
}
}
......@@ -278,7 +278,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
/* 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", __FUNCTION__, status);
bytes_sent = status;
break;
}
......@@ -426,7 +426,7 @@ static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
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", __FUNCTION__, result);
return;
......@@ -451,7 +451,7 @@ static void empeg_unthrottle (struct usb_serial_port *port)
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", __FUNCTION__, result);
return;
}
......
......@@ -41,7 +41,7 @@ int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *da
transfer_buffer = kmalloc (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", __FUNCTION__, length);
return -ENOMEM;
}
memcpy (transfer_buffer, data, length);
......@@ -56,7 +56,7 @@ int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit)
dbg("%s - %d", __FUNCTION__, 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", __FUNCTION__, reset_bit);
}
return response;
}
......
......@@ -106,7 +106,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", __FUNCTION__, result);
}
return result;
......@@ -176,7 +176,7 @@ int usb_serial_generic_write (struct usb_serial_port *port, int from_user, const
/* 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", __FUNCTION__, result);
else
result = count;
......@@ -266,7 +266,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg
usb_serial_generic_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", __FUNCTION__, result);
}
void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
......
......@@ -572,7 +572,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
record = (struct edge_firmware_image_record *)firmware;
response = rom_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]);
if (response < 0) {
dev_err(edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len);
dev_err(&edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len);
break;
}
firmware += sizeof (struct edge_firmware_image_record) + record->Len;
......@@ -840,7 +840,7 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
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", __FUNCTION__, result);
}
}
......@@ -889,7 +889,7 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs)
edge_serial->read_urb->dev = edge_serial->serial->dev;
status = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
if (status) {
dev_err(urb->dev->dev, "%s - usb_submit_urb(read bulk) failed, status = %d\n", __FUNCTION__, status);
dev_err(&urb->dev->dev, "%s - usb_submit_urb(read bulk) failed, status = %d\n", __FUNCTION__, status);
}
}
}
......@@ -1057,7 +1057,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", __FUNCTION__, response);
}
}
......@@ -1081,7 +1081,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", __FUNCTION__);
edge_port->openPending = FALSE;
return -ENODEV;
}
......@@ -1450,7 +1450,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_serial->serial->dev->dev, "%s - no more kernel memory...\n", __FUNCTION__);
dev_err(&edge_serial->serial->dev->dev, "%s - no more kernel memory...\n", __FUNCTION__);
edge_port->write_in_progress = FALSE;
return;
}
......@@ -2143,7 +2143,7 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2
}
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", __FUNCTION__, edge_serial->rxPort);
return;
}
......@@ -2330,7 +2330,7 @@ static int sram_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u
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", __FUNCTION__, 64);
return -ENOMEM;
}
......@@ -2375,7 +2375,7 @@ static int rom_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u1
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", __FUNCTION__, 64);
return -ENOMEM;
}
......@@ -2420,7 +2420,7 @@ static int rom_read (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u16
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", __FUNCTION__, 64);
return -ENOMEM;
}
......@@ -2463,7 +2463,7 @@ static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u
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", __FUNCTION__, 10);
return -ENOMEM;
}
......@@ -2554,14 +2554,14 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
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", __FUNCTION__);
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", __FUNCTION__, 0x100);
return -ENOMEM;
}
currCmd = cmdBuffer;
......@@ -2838,7 +2838,7 @@ static void get_manufacturing_desc (struct edgeport_serial *edge_serial)
(__u8 *)(&edge_serial->manuf_descriptor));
if (response < 1) {
dev_err(edge_serial->serial->dev->dev, "error in getting manufacturer descriptor\n");
dev_err(&edge_serial->serial->dev->dev, "error in getting manufacturer descriptor\n");
} else {
char string[30];
dbg("**Manufacturer Descriptor");
......@@ -2877,7 +2877,7 @@ static void get_boot_desc (struct edgeport_serial *edge_serial)
(__u8 *)(&edge_serial->boot_descriptor));
if (response < 1) {
dev_err(edge_serial->serial->dev->dev, "error in getting boot descriptor\n");
dev_err(&edge_serial->serial->dev->dev, "error in getting boot descriptor\n");
} else {
dbg("**Boot Descriptor:");
dbg(" BootCodeLength: %d", edge_serial->boot_descriptor.BootCodeLength);
......@@ -2938,7 +2938,7 @@ static void load_application_firmware (struct edgeport_serial *edge_serial)
record = (struct edge_firmware_image_record *)firmware;
response = sram_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]);
if (response < 0) {
dev_err(edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len);
dev_err(&edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len);
break;
}
firmware += sizeof (struct edge_firmware_image_record) + record->Len;
......@@ -2974,7 +2974,7 @@ static int edge_startup (struct usb_serial *serial)
/* create our private serial structure */
edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL);
if (edge_serial == NULL) {
dev_err(serial->dev->dev, "%s - Out of memory", __FUNCTION__);
dev_err(&serial->dev->dev, "%s - Out of memory", __FUNCTION__);
return -ENOMEM;
}
memset (edge_serial, 0, sizeof(struct edgeport_serial));
......@@ -2988,7 +2988,7 @@ static int edge_startup (struct usb_serial *serial)
get_string(dev, dev->descriptor.iProduct, &edge_serial->name[i]);
dev_info(serial->dev->dev, "%s detected\n", edge_serial->name);
dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name);
/* get the manufacturing descriptor for this device */
get_manufacturing_desc (edge_serial);
......@@ -3030,7 +3030,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", __FUNCTION__);
dev_err(&serial->dev->dev, "%s - Out of memory", __FUNCTION__);
usb_set_serial_data(serial, NULL);
kfree(edge_serial);
return -ENOMEM;
......
This diff is collapsed.
......@@ -243,7 +243,7 @@ static int ir_startup (struct usb_serial *serial)
irda_desc = irda_usb_find_class_desc (serial->dev, 0);
if (irda_desc == NULL) {
dev_err (serial->dev->dev, "IRDA class descriptor not found, device not bound\n");
dev_err (&serial->dev->dev, "IRDA class descriptor not found, device not bound\n");
return -ENODEV;
}
......@@ -291,7 +291,7 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
/* 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", __FUNCTION__);
return -ENOMEM;
}
kfree (port->read_urb->transfer_buffer);
......@@ -300,7 +300,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", __FUNCTION__);
return -ENOMEM;
}
kfree (port->write_urb->transfer_buffer);
......@@ -320,7 +320,7 @@ 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", __FUNCTION__, result);
return result;
}
......@@ -353,7 +353,7 @@ static int ir_write (struct usb_serial_port *port, int from_user, const unsigned
dbg("%s - port = %d, count = %d", __FUNCTION__, port->number, count);
if (!port->tty) {
dev_err (port->dev, "%s - no tty???\n", __FUNCTION__);
dev_err (&port->dev, "%s - no tty???\n", __FUNCTION__);
return 0;
}
......@@ -399,7 +399,7 @@ static int ir_write (struct usb_serial_port *port, int from_user, const unsigned
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", __FUNCTION__, result);
else
result = transfer_size;
......@@ -504,7 +504,7 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
dev_err(port->dev, "%s - failed resubmitting read urb, error %d\n",
dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n",
__FUNCTION__, result);
break ;
......@@ -599,7 +599,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct termios *old_te
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", __FUNCTION__, result);
}
return;
}
......
......@@ -1035,7 +1035,7 @@ static int keyspan_fake_startup (struct usb_serial *serial)
}
if (record == NULL) {
dev_err(serial->dev->dev, "Required keyspan firmware image (%s) unavailable.\n", fw_name);
dev_err(&serial->dev->dev, "Required keyspan firmware image (%s) unavailable.\n", fw_name);
return(1);
}
......@@ -1049,7 +1049,7 @@ static int keyspan_fake_startup (struct usb_serial *serial)
(unsigned char *)record->data,
record->data_size, 0xa0);
if (response < 0) {
dev_err(serial->dev->dev, "ezusb_writememory failed for Keyspan"
dev_err(&serial->dev->dev, "ezusb_writememory failed for Keyspan"
"firmware (%d %04X %p %d)\n",
response,
record->address, record->data, record->data_size);
......@@ -1847,7 +1847,7 @@ static int keyspan_startup (struct usb_serial *serial)
if (d_details->product_id == serial->dev->descriptor.idProduct)
break;
if (d_details == NULL) {
dev_err(serial->dev->dev, "%s - unknown product id %x\n", __FUNCTION__, serial->dev->descriptor.idProduct);
dev_err(&serial->dev->dev, "%s - unknown product id %x\n", __FUNCTION__, serial->dev->descriptor.idProduct);
return 1;
}
......
......@@ -204,7 +204,7 @@ static int pl2303_write (struct usb_serial_port *port, int from_user, const uns
port->write_urb->dev = port->serial->dev;
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", __FUNCTION__, result);
else
result = count;
......@@ -246,7 +246,7 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol
buf = kmalloc (7, GFP_KERNEL);
if (!buf) {
dev_err(port->dev, "%s - out of memory.\n", __FUNCTION__);
dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__);
return;
}
memset (buf, 0x00, 0x07);
......@@ -294,7 +294,7 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol
case B230400: baud = 230400; break;
case B460800: baud = 460800; break;
default:
dev_err(port->dev, "pl2303 driver does not support the baudrate requested (fix it)\n");
dev_err(&port->dev, "pl2303 driver does not support the baudrate requested (fix it)\n");
break;
}
dbg("%s - baud = %d", __FUNCTION__, baud);
......@@ -411,7 +411,7 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
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);
dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result);
pl2303_close (port, NULL);
return -EPROTO;
}
......@@ -420,7 +420,7 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
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);
dev_err(&port->dev, "%s - failed submitting interrupt urb, error %d\n", __FUNCTION__, result);
pl2303_close (port, NULL);
return -EPROTO;
}
......@@ -621,7 +621,7 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
exit:
status = usb_submit_urb (urb, GFP_ATOMIC);
if (status)
dev_err(urb->dev->dev, "%s - usb_submit_urb failed with result %d\n",
dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with result %d\n",
__FUNCTION__, status);
}
......@@ -658,7 +658,7 @@ static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
urb->dev = 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);
dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
return;
}
dbg("%s - unable to handle the error, exiting.", __FUNCTION__);
......@@ -683,7 +683,7 @@ static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
urb->dev = 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);
dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
}
return;
......@@ -712,7 +712,7 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
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);
dev_err(&urb->dev->dev, "%s - failed resubmitting write urb, error %d\n", __FUNCTION__, result);
return;
}
......
......@@ -841,7 +841,7 @@ static struct usb_serial * create_serial (struct usb_device *dev,
serial = kmalloc (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", __FUNCTION__);
return NULL;
}
memset (serial, 0, sizeof(*serial));
......@@ -899,18 +899,18 @@ int usb_serial_probe(struct usb_interface *interface,
serial = create_serial (dev, interface, type);
if (!serial) {
dev_err(interface->dev, "%s - out of memory\n", __FUNCTION__);
dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__);
return -ENODEV;
}
/* if this device type has a probe function, call it */
if (type->probe) {
if (!try_module_get(type->owner)) {
dev_err(interface->dev, "module get failed, exiting\n");
dev_err(&interface->dev, "module get failed, exiting\n");
kfree (serial);
return -EIO;
}
retval = type->probe (serial);
retval = type->probe (serial, id);
module_put(type->owner);
if (retval < 0) {
......@@ -980,7 +980,7 @@ int usb_serial_probe(struct usb_interface *interface,
* properly during a later invocation of usb_serial_probe
*/
if (num_bulk_in == 0 || num_bulk_out == 0) {
dev_info(interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n");
dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n");
kfree (serial);
return -ENODEV;
}
......@@ -989,13 +989,13 @@ int usb_serial_probe(struct usb_interface *interface,
#endif
/* found all that we need */
dev_info(interface->dev, "%s converter detected\n", type->name);
dev_info(&interface->dev, "%s converter detected\n", type->name);
#ifdef CONFIG_USB_SERIAL_GENERIC
if (type == &usb_serial_generic_device) {
num_ports = num_bulk_out;
if (num_ports == 0) {
dev_err(interface->dev, "Generic device with no bulk out, not allowed.\n");
dev_err(&interface->dev, "Generic device with no bulk out, not allowed.\n");
kfree (serial);
return -EIO;
}
......@@ -1005,7 +1005,7 @@ int usb_serial_probe(struct usb_interface *interface,
/* if this device type has a calc_num_ports function, call it */
if (type->calc_num_ports) {
if (!try_module_get(type->owner)) {
dev_err(interface->dev, "module get failed, exiting\n");
dev_err(&interface->dev, "module get failed, exiting\n");
kfree (serial);
return -EIO;
}
......@@ -1017,7 +1017,7 @@ int usb_serial_probe(struct usb_interface *interface,
}
if (get_free_serial (serial, num_ports, &minor) == NULL) {
dev_err(interface->dev, "No more free serial devices\n");
dev_err(&interface->dev, "No more free serial devices\n");
kfree (serial);
return -ENOMEM;
}
......@@ -1034,14 +1034,14 @@ int usb_serial_probe(struct usb_interface *interface,
port = &serial->port[i];
port->read_urb = usb_alloc_urb (0, GFP_KERNEL);
if (!port->read_urb) {
dev_err(interface->dev, "No free urbs available\n");
dev_err(&interface->dev, "No free urbs available\n");
goto probe_error;
}
buffer_size = endpoint->wMaxPacketSize;
port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!port->bulk_in_buffer) {
dev_err(interface->dev, "Couldn't allocate bulk_in_buffer\n");
dev_err(&interface->dev, "Couldn't allocate bulk_in_buffer\n");
goto probe_error;
}
usb_fill_bulk_urb (port->read_urb, dev,
......@@ -1059,7 +1059,7 @@ int usb_serial_probe(struct usb_interface *interface,
port = &serial->port[i];
port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!port->write_urb) {
dev_err(interface->dev, "No free urbs available\n");
dev_err(&interface->dev, "No free urbs available\n");
goto probe_error;
}
buffer_size = endpoint->wMaxPacketSize;
......@@ -1067,7 +1067,7 @@ int usb_serial_probe(struct usb_interface *interface,
port->bulk_out_endpointAddress = endpoint->bEndpointAddress;
port->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!port->bulk_out_buffer) {
dev_err(interface->dev, "Couldn't allocate bulk_out_buffer\n");
dev_err(&interface->dev, "Couldn't allocate bulk_out_buffer\n");
goto probe_error;
}
usb_fill_bulk_urb (port->write_urb, dev,
......@@ -1085,14 +1085,14 @@ int usb_serial_probe(struct usb_interface *interface,
port = &serial->port[i];
port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!port->interrupt_in_urb) {
dev_err(interface->dev, "No free urbs available\n");
dev_err(&interface->dev, "No free urbs available\n");
goto probe_error;
}
buffer_size = endpoint->wMaxPacketSize;
port->interrupt_in_endpointAddress = endpoint->bEndpointAddress;
port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!port->interrupt_in_buffer) {
dev_err(interface->dev, "Couldn't allocate interrupt_in_buffer\n");
dev_err(&interface->dev, "Couldn't allocate interrupt_in_buffer\n");
goto probe_error;
}
usb_fill_int_urb (port->interrupt_in_urb, dev,
......@@ -1121,7 +1121,7 @@ int usb_serial_probe(struct usb_interface *interface,
/* if this device type has an attach function, call it */
if (type->attach) {
if (!try_module_get(type->owner)) {
dev_err(interface->dev, "module get failed, exiting\n");
dev_err(&interface->dev, "module get failed, exiting\n");
goto probe_error;
}
retval = type->attach (serial);
......@@ -1253,7 +1253,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
/* free up any memory that we allocated */
kfree (serial);
}
dev_info(*dev, "device disconnected\n");
dev_info(dev, "device disconnected\n");
}
......
......@@ -231,7 +231,7 @@ struct usb_serial_device_type {
struct list_head driver_list;
struct device_driver driver;
int (*probe) (struct usb_serial *serial);
int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
int (*attach) (struct usb_serial *serial);
int (*calc_num_ports) (struct usb_serial *serial);
......
......@@ -168,7 +168,7 @@ static int visor_write_room (struct usb_serial_port *port);
static int visor_chars_in_buffer (struct usb_serial_port *port);
static void visor_throttle (struct usb_serial_port *port);
static void visor_unthrottle (struct usb_serial_port *port);
static int visor_probe (struct usb_serial *serial);
static int visor_probe (struct usb_serial *serial, const struct usb_device_id *id);
static int visor_calc_num_ports(struct usb_serial *serial);
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);
......@@ -303,7 +303,7 @@ static int visor_open (struct usb_serial_port *port, struct file *filp)
if (!port->read_urb) {
/* this is needed for some brain dead Sony devices */
dev_err(port->dev, "Device lied about number of ports, please use a lower one.\n");
dev_err(&port->dev, "Device lied about number of ports, please use a lower one.\n");
return -ENODEV;
}
......@@ -327,7 +327,7 @@ static int visor_open (struct usb_serial_port *port, struct file *filp)
visor_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result) {
dev_err(port->dev, "%s - failed submitting read urb, error %d\n",
dev_err(&port->dev, "%s - failed submitting read urb, error %d\n",
__FUNCTION__, result);
goto exit;
}
......@@ -336,7 +336,7 @@ static int visor_open (struct usb_serial_port *port, struct file *filp)
dbg("%s - adding interrupt input for treo", __FUNCTION__);
result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
if (result)
dev_err(port->dev, "%s - failed submitting interrupt urb, error %d\n",
dev_err(&port->dev, "%s - failed submitting interrupt urb, error %d\n",
__FUNCTION__, result);
}
exit:
......@@ -363,7 +363,7 @@ static void visor_close (struct usb_serial_port *port, struct file * filp)
* device is still here */
transfer_buffer = kmalloc (0x12, GFP_KERNEL);
if (!transfer_buffer) {
dev_err(port->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 0x12);
dev_err(&port->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 0x12);
} else {
/* send a shutdown message to the device */
usb_control_msg (serial->dev,
......@@ -380,7 +380,7 @@ static void visor_close (struct usb_serial_port *port, struct file * filp)
usb_unlink_urb (port->interrupt_in_urb);
}
/* Uncomment the following line if you want to see some statistics in your syslog */
/* dev_info (port->dev, "Bytes In = %d Bytes Out = %d\n", bytes_in, bytes_out); */
/* dev_info (&port->dev, "Bytes In = %d Bytes Out = %d\n", bytes_in, bytes_out); */
}
......@@ -395,13 +395,13 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig
buffer = kmalloc (count, GFP_ATOMIC);
if (!buffer) {
dev_err(port->dev, "out of memory\n");
dev_err(&port->dev, "out of memory\n");
return -ENOMEM;
}
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) {
dev_err(port->dev, "no more free urbs\n");
dev_err(&port->dev, "no more free urbs\n");
kfree (buffer);
return -ENOMEM;
}
......@@ -427,7 +427,7 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig
/* 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",
dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n",
__FUNCTION__, status);
count = status;
} else {
......@@ -539,7 +539,7 @@ static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
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", __FUNCTION__, result);
return;
}
......@@ -577,7 +577,7 @@ static void visor_read_int_callback (struct urb *urb, struct pt_regs *regs)
exit:
result = usb_submit_urb (urb, GFP_ATOMIC);
if (result)
dev_err(urb->dev->dev, "%s - Error %d submitting interrupt urb\n",
dev_err(&urb->dev->dev, "%s - Error %d submitting interrupt urb\n",
__FUNCTION__, result);
}
......@@ -597,10 +597,10 @@ 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", __FUNCTION__, result);
}
static int visor_probe (struct usb_serial *serial)
static int visor_probe (struct usb_serial *serial, const struct usb_device_id *id)
{
struct device *dev = &serial->dev->dev;
int response;
......@@ -609,7 +609,7 @@ static int visor_probe (struct usb_serial *serial)
unsigned char *transfer_buffer = kmalloc (256, GFP_KERNEL);
if (!transfer_buffer) {
dev_err(*dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 256);
dev_err(dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 256);
return -ENOMEM;
}
......@@ -622,14 +622,14 @@ static int visor_probe (struct usb_serial *serial)
response = usb_control_msg (serial->dev, usb_rcvctrlpipe(serial->dev, 0), VISOR_GET_CONNECTION_INFORMATION,
0xc2, 0x0000, 0x0000, transfer_buffer, 0x12, 300);
if (response < 0) {
dev_err(*dev, "%s - error getting connection information\n", __FUNCTION__);
dev_err(dev, "%s - error getting connection information\n", __FUNCTION__);
} else {
struct visor_connection_info *connection_info = (struct visor_connection_info *)transfer_buffer;
char *string;
le16_to_cpus(&connection_info->num_ports);
num_ports = connection_info->num_ports;
dev_info(*dev, "%s: Number of ports: %d\n", serial->type->name, connection_info->num_ports);
dev_info(dev, "%s: Number of ports: %d\n", serial->type->name, connection_info->num_ports);
for (i = 0; i < num_ports; ++i) {
switch (connection_info->connections[i].port_function_id) {
case VISOR_FUNCTION_GENERIC:
......@@ -651,7 +651,7 @@ static int visor_probe (struct usb_serial *serial)
string = "unknown";
break;
}
dev_info(*dev, "%s: port %d, is for %s use\n", serial->type->name,
dev_info(dev, "%s: port %d, is for %s use\n", serial->type->name,
connection_info->connections[i].port, string);
/* save off our num_ports info so that we can use it in the calc_num_ports call */
usb_set_serial_data(serial, (void *)(long)num_ports);
......@@ -667,7 +667,7 @@ static int visor_probe (struct usb_serial *serial)
0xc2, 0x0000, 0x0000, transfer_buffer,
0x14, 300);
if (response < 0) {
dev_err(*dev, "%s - error getting first unknown palm command\n", __FUNCTION__);
dev_err(dev, "%s - error getting first unknown palm command\n", __FUNCTION__);
} else {
usb_serial_debug_data (__FILE__, __FUNCTION__, 0x14, transfer_buffer);
}
......@@ -676,7 +676,7 @@ static int visor_probe (struct usb_serial *serial)
0xc2, 0x0000, 0x0000, transfer_buffer,
0x14, 300);
if (response < 0) {
dev_err(*dev, "%s - error getting second unknown palm command\n", __FUNCTION__);
dev_err(dev, "%s - error getting second unknown palm command\n", __FUNCTION__);
} else {
usb_serial_debug_data (__FILE__, __FUNCTION__, 0x14, transfer_buffer);
}
......@@ -686,7 +686,7 @@ static int visor_probe (struct usb_serial *serial)
response = usb_control_msg (serial->dev, usb_rcvctrlpipe(serial->dev, 0), VISOR_REQUEST_BYTES_AVAILABLE,
0xc2, 0x0000, 0x0005, transfer_buffer, 0x02, 300);
if (response < 0) {
dev_err(*dev, "%s - error getting bytes available request\n", __FUNCTION__);
dev_err(dev, "%s - error getting bytes available request\n", __FUNCTION__);
}
kfree (transfer_buffer);
......@@ -722,11 +722,11 @@ static int clie_3_5_startup (struct usb_serial *serial)
USB_REQ_GET_CONFIGURATION, USB_DIR_IN,
0, 0, &data, 1, HZ * 3);
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", __FUNCTION__, 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", __FUNCTION__, result);
return -EIO;
}
......@@ -736,11 +736,11 @@ static int clie_3_5_startup (struct usb_serial *serial)
USB_DIR_IN | USB_RECIP_INTERFACE,
0, 0, &data, 1, HZ * 3);
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", __FUNCTION__, 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", __FUNCTION__, result);
return -EIO;
}
......
......@@ -134,7 +134,7 @@ static struct usb_driver whiteheat_driver = {
};
/* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */
static int whiteheat_firmware_download (struct usb_serial *serial);
static int whiteheat_firmware_download (struct usb_serial *serial, const struct usb_device_id *id);
static int whiteheat_firmware_attach (struct usb_serial *serial);
/* function prototypes for the Connect Tech WhiteHEAT serial converter */
......@@ -269,7 +269,7 @@ static int firm_report_tx_done(struct usb_serial_port *port);
- device renumerated itself and comes up as new device id with all
firmware download completed.
*/
static int whiteheat_firmware_download (struct usb_serial *serial)
static int whiteheat_firmware_download (struct usb_serial *serial, const struct usb_device_id *id)
{
int response;
const struct whiteheat_hex_record *record;
......
......@@ -285,7 +285,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
* and such will hang. */
US_DEBUGP("Device indicates that it has %d bytes available\n",
le16_to_cpu (fst->Count));
US_DEBUGP("SCSI requested %d\n", usb_stor_transfer_length(srb));
US_DEBUGP("SCSI requested %d\n", srb->request_bufflen);
/* Find the length we desire to read. */
switch (srb->cmnd[0]) {
......@@ -296,7 +296,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
length = fst->Count;
break;
default:
length = usb_stor_transfer_length (srb);
length = srb->request_bufflen;
}
/* verify that this amount is legal */
......
......@@ -55,307 +55,6 @@
#include <linux/errno.h>
#include <linux/slab.h>
/***********************************************************************
* Helper routines
***********************************************************************/
/* Calculate the length of the data transfer (not the command) for any
* given SCSI command
*/
unsigned int usb_stor_transfer_length(Scsi_Cmnd *srb)
{
int i;
int doDefault = 0;
unsigned int len = 0;
unsigned int total = 0;
struct scatterlist *sg;
/* This table tells us:
X = command not supported
L = return length in cmnd[4] (8 bits).
M = return length in cmnd[8] (8 bits).
G = return length in cmnd[3] and cmnd[4] (16 bits)
H = return length in cmnd[7] and cmnd[8] (16 bits)
I = return length in cmnd[8] and cmnd[9] (16 bits)
C = return length in cmnd[2] to cmnd[5] (32 bits)
D = return length in cmnd[6] to cmnd[9] (32 bits)
B = return length in blocksize so we use buff_len
R = return length in cmnd[2] to cmnd[4] (24 bits)
S = return length in cmnd[3] to cmnd[5] (24 bits)
T = return length in cmnd[6] to cmnd[8] (24 bits)
U = return length in cmnd[7] to cmnd[9] (24 bits)
0-9 = fixed return length
V = 20 bytes
W = 24 bytes
Z = return length is mode dependant or not in command, use buff_len
*/
static char *lengths =
/* 0123456789ABCDEF 0123456789ABCDEF */
"00XLZ6XZBXBBXXXB" "00LBBLG0R0L0GG0X" /* 00-1F */
"XXXXT8XXB4B0BBBB" "ZZZ0B00HCSSZTBHH" /* 20-3F */
"M0HHB0X000H0HH0X" "XHH0HHXX0TH0H0XX" /* 40-5F */
"XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 60-7F */
"XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 80-9F */
"X0XXX00XB0BXBXBB" "ZZZ0XUIDU000XHBX" /* A0-BF */
"XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* C0-DF */
"XDXXXXXXXXXXXXXX" "XXW00HXXXXXXXXXX"; /* E0-FF */
/* Commands checked in table:
CHANGE_DEFINITION 40
COMPARE 39
COPY 18
COPY_AND_VERIFY 3a
ERASE 19
ERASE_10 2c
ERASE_12 ac
EXCHANGE_MEDIUM a6
FORMAT_UNIT 04
GET_DATA_BUFFER_STATUS 34
GET_MESSAGE_10 28
GET_MESSAGE_12 a8
GET_WINDOW 25 !!! Has more data than READ_CAPACITY, need to fix table
INITIALIZE_ELEMENT_STATUS 07 !!! REASSIGN_BLOCKS luckily uses buff_len
INQUIRY 12
LOAD_UNLOAD 1b
LOCATE 2b
LOCK_UNLOCK_CACHE 36
LOG_SELECT 4c
LOG_SENSE 4d
MEDIUM_SCAN 38 !!! This was M
MODE_SELECT6 15
MODE_SELECT_10 55
MODE_SENSE_6 1a
MODE_SENSE_10 5a
MOVE_MEDIUM a5
OBJECT_POSITION 31 !!! Same as SEARCH_DATA_EQUAL
PAUSE_RESUME 4b
PLAY_AUDIO_10 45
PLAY_AUDIO_12 a5
PLAY_AUDIO_MSF 47
PLAY_AUDIO_TRACK_INDEX 48
PLAY_AUDIO_TRACK_RELATIVE_10 49
PLAY_AUDIO_TRACK_RELATIVE_12 a9
POSITION_TO_ELEMENT 2b
PRE-FETCH 34
PREVENT_ALLOW_MEDIUM_REMOVAL 1e
PRINT 0a !!! Same as WRITE_6 but is always in bytes
READ_6 08
READ_10 28
READ_12 a8
READ_BLOCK_LIMITS 05
READ_BUFFER 3c
READ_CAPACITY 25
READ_CDROM_CAPACITY 25
READ_DEFECT_DATA 37
READ_DEFECT_DATA_12 b7
READ_ELEMENT_STATUS b8 !!! Think this is in bytes
READ_GENERATION 29 !!! Could also be M?
READ_HEADER 44 !!! This was L
READ_LONG 3e
READ_POSITION 34 !!! This should be V but conflicts with PRE-FETCH
READ_REVERSE 0f
READ_SUB-CHANNEL 42 !!! Is this in bytes?
READ_TOC 43 !!! Is this in bytes?
READ_UPDATED_BLOCK 2d
REASSIGN_BLOCKS 07
RECEIVE 08 !!! Same as READ_6 probably in bytes though
RECEIVE_DIAGNOSTIC_RESULTS 1c
RECOVER_BUFFERED_DATA 14 !!! For PRINTERs this is bytes
RELEASE_UNIT 17
REQUEST_SENSE 03
REQUEST_VOLUME_ELEMENT_ADDRESS b5 !!! Think this is in bytes
RESERVE_UNIT 16
REWIND 01
REZERO_UNIT 01
SCAN 1b !!! Conflicts with various commands, should be L
SEARCH_DATA_EQUAL 31
SEARCH_DATA_EQUAL_12 b1
SEARCH_DATA_LOW 30
SEARCH_DATA_LOW_12 b0
SEARCH_DATA_HIGH 32
SEARCH_DATA_HIGH_12 b2
SEEK_6 0b !!! Conflicts with SLEW_AND_PRINT
SEEK_10 2b
SEND 0a !!! Same as WRITE_6, probably in bytes though
SEND 2a !!! Similar to WRITE_10 but for scanners
SEND_DIAGNOSTIC 1d
SEND_MESSAGE_6 0a !!! Same as WRITE_6 - is in bytes
SEND_MESSAGE_10 2a !!! Same as WRITE_10 - is in bytes
SEND_MESSAGE_12 aa !!! Same as WRITE_12 - is in bytes
SEND_OPC 54
SEND_VOLUME_TAG b6 !!! Think this is in bytes
SET_LIMITS 33
SET_LIMITS_12 b3
SET_WINDOW 24
SLEW_AND_PRINT 0b !!! Conflicts with SEEK_6
SPACE 11
START_STOP_UNIT 1b
STOP_PRINT 1b
SYNCHRONIZE_BUFFER 10
SYNCHRONIZE_CACHE 35
TEST_UNIT_READY 00
UPDATE_BLOCK 3d
VERIFY 13
VERIFY 2f
VERIFY_12 af
WRITE_6 0a
WRITE_10 2a
WRITE_12 aa
WRITE_AND_VERIFY 2e
WRITE_AND_VERIFY_12 ae
WRITE_BUFFER 3b
WRITE_FILEMARKS 10
WRITE_LONG 3f
WRITE_SAME 41
*/
if (srb->sc_data_direction == SCSI_DATA_WRITE) {
doDefault = 1;
}
else
switch (lengths[srb->cmnd[0]]) {
case 'L':
len = srb->cmnd[4];
break;
case 'M':
len = srb->cmnd[8];
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
len = lengths[srb->cmnd[0]]-'0';
break;
case 'G':
len = (((unsigned int)srb->cmnd[3])<<8) |
srb->cmnd[4];
break;
case 'H':
len = (((unsigned int)srb->cmnd[7])<<8) |
srb->cmnd[8];
break;
case 'I':
len = (((unsigned int)srb->cmnd[8])<<8) |
srb->cmnd[9];
break;
case 'R':
len = (((unsigned int)srb->cmnd[2])<<16) |
(((unsigned int)srb->cmnd[3])<<8) |
srb->cmnd[4];
break;
case 'S':
len = (((unsigned int)srb->cmnd[3])<<16) |
(((unsigned int)srb->cmnd[4])<<8) |
srb->cmnd[5];
break;
case 'T':
len = (((unsigned int)srb->cmnd[6])<<16) |
(((unsigned int)srb->cmnd[7])<<8) |
srb->cmnd[8];
break;
case 'U':
len = (((unsigned int)srb->cmnd[7])<<16) |
(((unsigned int)srb->cmnd[8])<<8) |
srb->cmnd[9];
break;
case 'C':
len = (((unsigned int)srb->cmnd[2])<<24) |
(((unsigned int)srb->cmnd[3])<<16) |
(((unsigned int)srb->cmnd[4])<<8) |
srb->cmnd[5];
break;
case 'D':
len = (((unsigned int)srb->cmnd[6])<<24) |
(((unsigned int)srb->cmnd[7])<<16) |
(((unsigned int)srb->cmnd[8])<<8) |
srb->cmnd[9];
break;
case 'V':
len = 20;
break;
case 'W':
len = 24;
break;
case 'B':
/* Use buffer size due to different block sizes */
doDefault = 1;
break;
case 'X':
US_DEBUGP("Error: UNSUPPORTED COMMAND %02X\n",
srb->cmnd[0]);
doDefault = 1;
break;
case 'Z':
/* Use buffer size due to mode dependence */
doDefault = 1;
break;
default:
US_DEBUGP("Error: COMMAND %02X out of range or table inconsistent (%c).\n",
srb->cmnd[0], lengths[srb->cmnd[0]] );
doDefault = 1;
}
if ( doDefault == 1 ) {
/* Are we going to scatter gather? */
if (srb->use_sg) {
/* Add up the sizes of all the sg segments */
sg = (struct scatterlist *) srb->request_buffer;
for (i = 0; i < srb->use_sg; i++)
total += sg[i].length;
len = total;
/* Double-check to see if the advertised buffer
* length less than the actual buffer length --
* in other words, we should tend towards the
* conservative side for data transfers.
*/
if (len > srb->request_bufflen)
len = srb->request_bufflen;
}
else
/* Just return the length of the buffer */
len = srb->request_bufflen;
}
/* According to the linux-scsi people, any command sent which
* violates this invariant is a bug. In the hopes of removing
* all the complex logic above, let's find them and eliminate them.
*/
if (len != srb->request_bufflen) {
printk(KERN_ERR "USB len=%d, request_bufflen=%d\n", len, srb->request_bufflen);
dump_stack();
}
return len;
}
/***********************************************************************
* Data transfer routines
***********************************************************************/
......@@ -1031,7 +730,7 @@ void usb_stor_abort_transport(struct us_data *us)
int usb_stor_CBI_transport(Scsi_Cmnd *srb, struct us_data *us)
{
unsigned int transfer_length = usb_stor_transfer_length(srb);
unsigned int transfer_length = srb->request_bufflen;
int result;
/* COMMAND STAGE */
......@@ -1115,7 +814,7 @@ int usb_stor_CBI_transport(Scsi_Cmnd *srb, struct us_data *us)
*/
int usb_stor_CB_transport(Scsi_Cmnd *srb, struct us_data *us)
{
unsigned int transfer_length = usb_stor_transfer_length(srb);
unsigned int transfer_length = srb->request_bufflen;
int result;
/* COMMAND STAGE */
......@@ -1186,7 +885,7 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
{
struct bulk_cb_wrap bcb;
struct bulk_cs_wrap bcs;
unsigned int transfer_length = usb_stor_transfer_length(srb);
unsigned int transfer_length = srb->request_bufflen;
int result;
/* set up the command wrapper */
......
......@@ -154,7 +154,6 @@ extern int usb_stor_Bulk_transport(Scsi_Cmnd*, struct us_data*);
extern int usb_stor_Bulk_max_lun(struct us_data*);
extern int usb_stor_Bulk_reset(struct us_data*);
extern unsigned int usb_stor_transfer_length(Scsi_Cmnd*);
extern void usb_stor_invoke_transport(Scsi_Cmnd*, struct us_data*);
extern void usb_stor_abort_transport(struct us_data*);
......
......@@ -400,21 +400,21 @@ extern int firmware_register(struct subsystem *);
extern void firmware_unregister(struct subsystem *);
/* debugging and troubleshooting/diagnostic helpers. */
#define dev_printk(sev, dev, format, arg...) \
printk(sev "%s %s: " format , (dev).driver->name , (dev).bus_id , ## arg)
#define dev_printk(level, dev, format, arg...) \
printk(level "%s %s: " format , (dev)->driver->name , (dev)->bus_id , ## arg)
#ifdef DEBUG
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG , (dev) , format , ## arg)
dev_printk(KERN_DEBUG , dev , format , ## arg)
#else
#define dev_dbg(dev, format, arg...) do {} while (0)
#endif
#define dev_err(dev, format, arg...) \
dev_printk(KERN_ERR , (dev) , format , ## arg)
dev_printk(KERN_ERR , dev , format , ## arg)
#define dev_info(dev, format, arg...) \
dev_printk(KERN_INFO , (dev) , format , ## arg)
dev_printk(KERN_INFO , dev , format , ## arg)
#define dev_warn(dev, format, arg...) \
dev_printk(KERN_WARNING , (dev) , format , ## arg)
dev_printk(KERN_WARNING , dev , format , ## arg)
#endif /* _DEVICE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment