Commit 50c17dc6 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleed-2.6

into kroah.com:/home/greg/linux/BK/usb-2.6
parents bd24a6bd cf84bde9
...@@ -2563,6 +2563,7 @@ Your cooperation is appreciated. ...@@ -2563,6 +2563,7 @@ Your cooperation is appreciated.
128 = /dev/usb/brlvgr0 First Braille Voyager device 128 = /dev/usb/brlvgr0 First Braille Voyager device
... ...
131 = /dev/usb/brlvgr3 Fourth Braille Voyager device 131 = /dev/usb/brlvgr3 Fourth Braille Voyager device
132 = /dev/usb/idmouse ID Mouse (fingerprint scanner) device
144 = /dev/usb/lcd USB LCD device 144 = /dev/usb/lcd USB LCD device
160 = /dev/usb/legousbtower0 1st USB Legotower device 160 = /dev/usb/legousbtower0 1st USB Legotower device
... ...
......
...@@ -83,7 +83,18 @@ one or more packets could finish before an error stops further endpoint I/O. ...@@ -83,7 +83,18 @@ one or more packets could finish before an error stops further endpoint I/O.
prescribed bus turn-around time prescribed bus turn-around time
c) unknown USB error c) unknown USB error
-EILSEQ (*, **) CRC mismatch -EILSEQ (*, **) a) CRC mismatch
b) no response packet received within the
prescribed bus turn-around time
c) unknown USB error
In cases b) and c) either -EPROTO or -EILSEQ
may be returned. Note that often the controller
hardware does not distinguish among cases a),
b), and c), so a driver cannot tell whether
there was a protocol error, a failure to respond
(often caused by device disconnect), or some
other fault.
-EPIPE (**) Endpoint stalled. For non-control endpoints, -EPIPE (**) Endpoint stalled. For non-control endpoints,
reset this status with usb_clear_halt(). reset this status with usb_clear_halt().
...@@ -104,8 +115,6 @@ one or more packets could finish before an error stops further endpoint I/O. ...@@ -104,8 +115,6 @@ one or more packets could finish before an error stops further endpoint I/O.
specified buffer, and URB_SHORT_NOT_OK was set in specified buffer, and URB_SHORT_NOT_OK was set in
urb->transfer_flags. urb->transfer_flags.
-ETIMEDOUT (**) transfer timed out, NAK
-ENODEV Device was removed. Often preceded by a burst of -ENODEV Device was removed. Often preceded by a burst of
other errors, since the hub driver does't detect other errors, since the hub driver does't detect
device removal events immediately. device removal events immediately.
...@@ -143,4 +152,4 @@ usb_register(): ...@@ -143,4 +152,4 @@ usb_register():
usb_get_*/usb_set_*(): usb_get_*/usb_set_*():
usb_control_msg(): usb_control_msg():
usb_bulk_msg(): usb_bulk_msg():
All USB errors (submit/status) can occur -ETIMEDOUT timeout expired before the transfer completed
...@@ -26,7 +26,7 @@ Index ...@@ -26,7 +26,7 @@ Index
1. Copyright 1. Copyright
============ ============
Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it>
2. Disclaimer 2. Disclaimer
...@@ -165,6 +165,17 @@ Description: Specify V4L2 minor mode number: ...@@ -165,6 +165,17 @@ Description: Specify V4L2 minor mode number:
other camera. other camera.
Default: -1 Default: -1
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Name: force_munmap;
Type: bool array (min = 0, max = 64)
Syntax: <0|1[,...]>
Description: Force the application to unmap previously mapped buffer memory
before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not
all the applications support this feature. This parameter is
specific for each detected camera.
0 = do not force memory unmapping"
1 = force memory unmapping (save memory)"
Default: 0
-------------------------------------------------------------------------------
Name: debug Name: debug
Type: int Type: int
Syntax: <n> Syntax: <n>
...@@ -362,11 +373,11 @@ rules: ...@@ -362,11 +373,11 @@ rules:
file descriptor. Once it is selected, the application must close and reopen the file descriptor. Once it is selected, the application must close and reopen the
device to switch to the other I/O method; device to switch to the other I/O method;
- previously mapped buffer memory must always be unmapped before calling any - although it is not mandatory, previously mapped buffer memory should always
of the "VIDIOC_S_CROP", "VIDIOC_TRY_FMT" and "VIDIOC_S_FMT" ioctl's. The same be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's.
number of buffers as before will be allocated again to match the size of the The same number of buffers as before will be allocated again to match the size
new video frames, so you have to map the buffers again before any I/O attempts of the new video frames, so you have to map the buffers again before any I/O
on them. attempts on them.
Consistently with the hardware limits, this driver also supports image Consistently with the hardware limits, this driver also supports image
downscaling with arbitrary scaling factors from 1, 2 and 4 in both directions. downscaling with arbitrary scaling factors from 1, 2 and 4 in both directions.
......
...@@ -108,7 +108,8 @@ struct ub_dev; ...@@ -108,7 +108,8 @@ struct ub_dev;
*/ */
#define UB_URB_TIMEOUT (HZ*2) #define UB_URB_TIMEOUT (HZ*2)
#define UB_DATA_TIMEOUT (HZ*5) /* ZIP does spin-ups in the data phase */ #define UB_DATA_TIMEOUT (HZ*5) /* ZIP does spin-ups in the data phase */
#define UB_CTRL_TIMEOUT (HZ/2) /* 500ms ought to be enough to clear a stall */ #define UB_STAT_TIMEOUT (HZ*5) /* Same spinups and eject for a dataless cmd. */
#define UB_CTRL_TIMEOUT (HZ/2) /* 500ms ought to be enough to clear a stall */
/* /*
* An instance of a SCSI command in transit. * An instance of a SCSI command in transit.
...@@ -307,6 +308,7 @@ static void ub_scsi_action(unsigned long _dev); ...@@ -307,6 +308,7 @@ static void ub_scsi_action(unsigned long _dev);
static void ub_scsi_dispatch(struct ub_dev *sc); static void ub_scsi_dispatch(struct ub_dev *sc);
static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd); static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc); static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc);
static void __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd); static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd); static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd,
...@@ -894,7 +896,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -894,7 +896,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
if (urb->status == -EPIPE) { if (urb->status == -EPIPE) {
/* /*
* STALL while clearning STALL. * STALL while clearning STALL.
* A STALL is illegal on a control pipe! * The control pipe clears itself - nothing to do.
* XXX Might try to reset the device here and retry. * XXX Might try to reset the device here and retry.
*/ */
printk(KERN_NOTICE "%s: " printk(KERN_NOTICE "%s: "
...@@ -917,7 +919,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -917,7 +919,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
if (urb->status == -EPIPE) { if (urb->status == -EPIPE) {
/* /*
* STALL while clearning STALL. * STALL while clearning STALL.
* A STALL is illegal on a control pipe! * The control pipe clears itself - nothing to do.
* XXX Might try to reset the device here and retry. * XXX Might try to reset the device here and retry.
*/ */
printk(KERN_NOTICE "%s: " printk(KERN_NOTICE "%s: "
...@@ -941,7 +943,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -941,7 +943,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe); rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe);
if (rc != 0) { if (rc != 0) {
printk(KERN_NOTICE "%s: " printk(KERN_NOTICE "%s: "
"unable to submit clear for device %u (%d)\n", "unable to submit clear for device %u"
" (code %d)\n",
sc->name, sc->dev->devnum, rc); sc->name, sc->dev->devnum, rc);
/* /*
* This is typically ENOMEM or some other such shit. * This is typically ENOMEM or some other such shit.
...@@ -1001,7 +1004,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -1001,7 +1004,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe); rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe);
if (rc != 0) { if (rc != 0) {
printk(KERN_NOTICE "%s: " printk(KERN_NOTICE "%s: "
"unable to submit clear for device %u (%d)\n", "unable to submit clear for device %u"
" (code %d)\n",
sc->name, sc->dev->devnum, rc); sc->name, sc->dev->devnum, rc);
/* /*
* This is typically ENOMEM or some other such shit. * This is typically ENOMEM or some other such shit.
...@@ -1033,7 +1037,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -1033,7 +1037,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe); rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe);
if (rc != 0) { if (rc != 0) {
printk(KERN_NOTICE "%s: " printk(KERN_NOTICE "%s: "
"unable to submit clear for device %u (%d)\n", "unable to submit clear for device %u"
" (code %d)\n",
sc->name, sc->dev->devnum, rc); sc->name, sc->dev->devnum, rc);
/* /*
* This is typically ENOMEM or some other such shit. * This is typically ENOMEM or some other such shit.
...@@ -1061,33 +1066,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -1061,33 +1066,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
sc->name, sc->dev->devnum); sc->name, sc->dev->devnum);
goto Bad_End; goto Bad_End;
} }
__ub_state_stat(sc, cmd);
/*
* ub_state_stat only not dropping the count...
*/
UB_INIT_COMPLETION(sc->work_done);
sc->last_pipe = sc->recv_bulk_pipe;
usb_fill_bulk_urb(&sc->work_urb, sc->dev,
sc->recv_bulk_pipe, &sc->work_bcs,
US_BULK_CS_WRAP_LEN, ub_urb_complete, sc);
sc->work_urb.transfer_flags = URB_ASYNC_UNLINK;
sc->work_urb.actual_length = 0;
sc->work_urb.error_count = 0;
sc->work_urb.status = 0;
rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC);
if (rc != 0) {
/* XXX Clear stalls */
printk("%s: CSW #%d submit failed (%d)\n",
sc->name, cmd->tag, rc); /* P3 */
ub_complete(&sc->work_done);
ub_state_done(sc, cmd, rc);
return;
}
sc->work_timer.expires = jiffies + UB_URB_TIMEOUT;
add_timer(&sc->work_timer);
return; return;
} }
...@@ -1108,17 +1087,31 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -1108,17 +1087,31 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
goto Bad_End; goto Bad_End;
} }
#if 0
if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN) && if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN) &&
bcs->Signature != cpu_to_le32(US_BULK_CS_OLYMPUS_SIGN)) { bcs->Signature != cpu_to_le32(US_BULK_CS_OLYMPUS_SIGN)) {
/* XXX Rate-limit, even for P3 tagged */
/* P3 */ printk("ub: signature 0x%x\n", bcs->Signature);
/* Windows ignores signatures, so do we. */ /* Windows ignores signatures, so do we. */
} }
#endif
if (bcs->Tag != cmd->tag) { if (bcs->Tag != cmd->tag) {
/* P3 */ printk("%s: tag orig 0x%x reply 0x%x\n", /*
sc->name, cmd->tag, bcs->Tag); * This usually happens when we disagree with the
goto Bad_End; * device's microcode about something. For instance,
* a few of them throw this after timeouts. They buffer
* commands and reply at commands we timed out before.
* Without flushing these replies we loop forever.
*/
if (++cmd->stat_count >= 4) {
printk(KERN_NOTICE "%s: "
"tag mismatch orig 0x%x reply 0x%x "
"on device %u\n",
sc->name, cmd->tag, bcs->Tag,
sc->dev->devnum);
goto Bad_End;
}
__ub_state_stat(sc, cmd);
return;
} }
switch (bcs->Status) { switch (bcs->Status) {
...@@ -1174,9 +1167,9 @@ static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc) ...@@ -1174,9 +1167,9 @@ static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc)
/* /*
* Factorization helper for the command state machine: * Factorization helper for the command state machine:
* Submit a CSW read and go to STAT state. * Submit a CSW read.
*/ */
static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) static void __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
{ {
int rc; int rc;
...@@ -1192,14 +1185,23 @@ static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) ...@@ -1192,14 +1185,23 @@ static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) {
/* XXX Clear stalls */ /* XXX Clear stalls */
printk("ub: CSW #%d submit failed (%d)\n", cmd->tag, rc); /* P3 */ printk("%s: CSW #%d submit failed (%d)\n", sc->name, cmd->tag, rc); /* P3 */
ub_complete(&sc->work_done); ub_complete(&sc->work_done);
ub_state_done(sc, cmd, rc); ub_state_done(sc, cmd, rc);
return; return;
} }
sc->work_timer.expires = jiffies + UB_URB_TIMEOUT; sc->work_timer.expires = jiffies + UB_STAT_TIMEOUT;
add_timer(&sc->work_timer); add_timer(&sc->work_timer);
}
/*
* Factorization helper for the command state machine:
* Submit a CSW read and go to STAT state.
*/
static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
{
__ub_state_stat(sc, cmd);
cmd->stat_count = 0; cmd->stat_count = 0;
cmd->state = UB_CMDST_STAT; cmd->state = UB_CMDST_STAT;
......
...@@ -59,6 +59,7 @@ obj-$(CONFIG_USB_AUERSWALD) += misc/ ...@@ -59,6 +59,7 @@ obj-$(CONFIG_USB_AUERSWALD) += misc/
obj-$(CONFIG_USB_CYTHERM) += misc/ obj-$(CONFIG_USB_CYTHERM) += misc/
obj-$(CONFIG_USB_EMI26) += misc/ obj-$(CONFIG_USB_EMI26) += misc/
obj-$(CONFIG_USB_EMI62) += misc/ obj-$(CONFIG_USB_EMI62) += misc/
obj-$(CONFIG_USB_IDMOUSE) += misc/
obj-$(CONFIG_USB_LCD) += misc/ obj-$(CONFIG_USB_LCD) += misc/
obj-$(CONFIG_USB_LED) += misc/ obj-$(CONFIG_USB_LED) += misc/
obj-$(CONFIG_USB_LEGOTOWER) += misc/ obj-$(CONFIG_USB_LEGOTOWER) += misc/
......
...@@ -544,24 +544,24 @@ static int acm_probe (struct usb_interface *intf, ...@@ -544,24 +544,24 @@ static int acm_probe (struct usb_interface *intf,
/* normal probing*/ /* normal probing*/
if (!buffer) { if (!buffer) {
err("Wierd descriptor references"); err("Wierd descriptor references\n");
return -EINVAL; return -EINVAL;
} }
if (!buflen) { if (!buflen) {
if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) {
dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint"); dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint\n");
buflen = intf->cur_altsetting->endpoint->extralen; buflen = intf->cur_altsetting->endpoint->extralen;
buffer = intf->cur_altsetting->endpoint->extra; buffer = intf->cur_altsetting->endpoint->extra;
} else { } else {
err("Zero length descriptor references"); err("Zero length descriptor references\n");
return -EINVAL; return -EINVAL;
} }
} }
while (buflen > 0) { while (buflen > 0) {
if (buffer [1] != USB_DT_CS_INTERFACE) { if (buffer [1] != USB_DT_CS_INTERFACE) {
err("skipping garbage"); err("skipping garbage\n");
goto next_desc; goto next_desc;
} }
...@@ -614,14 +614,10 @@ static int acm_probe (struct usb_interface *intf, ...@@ -614,14 +614,10 @@ static int acm_probe (struct usb_interface *intf,
} }
} }
if (data_interface_num != call_interface_num) if (data_interface_num != call_interface_num)
dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported."); dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.\n");
skip_normal_probe: skip_normal_probe:
if (usb_interface_claimed(data_interface)) { /* valid in this context */
dev_dbg(&intf->dev,"The data interface isn't available\n");
return -EBUSY;
}
/*workaround for switched interfaces */ /*workaround for switched interfaces */
if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) {
...@@ -636,6 +632,13 @@ static int acm_probe (struct usb_interface *intf, ...@@ -636,6 +632,13 @@ static int acm_probe (struct usb_interface *intf,
return -EINVAL; return -EINVAL;
} }
} }
if (usb_interface_claimed(data_interface)) { /* valid in this context */
dev_dbg(&intf->dev,"The data interface isn't available\n");
return -EBUSY;
}
if (data_interface->cur_altsetting->desc.bNumEndpoints < 2) if (data_interface->cur_altsetting->desc.bNumEndpoints < 2)
return -EINVAL; return -EINVAL;
......
...@@ -1096,7 +1096,7 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol) ...@@ -1096,7 +1096,7 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
usblp->writebuf, 0, usblp->writebuf, 0,
usblp_bulk_write, usblp); usblp_bulk_write, usblp);
usblp->bidir = (usblp->protocol[protocol].epread != 0); usblp->bidir = (usblp->protocol[protocol].epread != NULL);
if (usblp->bidir) if (usblp->bidir)
usb_fill_bulk_urb(usblp->readurb, usblp->dev, usb_fill_bulk_urb(usblp->readurb, usblp->dev,
usb_rcvbulkpipe(usblp->dev, usb_rcvbulkpipe(usblp->dev,
......
...@@ -1127,7 +1127,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) ...@@ -1127,7 +1127,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
if (copy_from_user(&ctrl, arg, sizeof (ctrl))) if (copy_from_user(&ctrl, arg, sizeof (ctrl)))
return -EFAULT; return -EFAULT;
if ((size = _IOC_SIZE (ctrl.ioctl_code)) > 0) { if ((size = _IOC_SIZE (ctrl.ioctl_code)) > 0) {
if ((buf = kmalloc (size, GFP_KERNEL)) == 0) if ((buf = kmalloc (size, GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) { if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) {
if (copy_from_user (buf, ctrl.data, size)) { if (copy_from_user (buf, ctrl.data, size)) {
...@@ -1187,7 +1187,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) ...@@ -1187,7 +1187,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
down_read(&usb_bus_type.subsys.rwsem); down_read(&usb_bus_type.subsys.rwsem);
if (intf->dev.driver) if (intf->dev.driver)
driver = to_usb_driver(intf->dev.driver); driver = to_usb_driver(intf->dev.driver);
if (driver == 0 || driver->ioctl == 0) { if (driver == NULL || driver->ioctl == NULL) {
retval = -ENOTTY; retval = -ENOTTY;
} else { } else {
retval = driver->ioctl (intf, ctrl.ioctl_code, buf); retval = driver->ioctl (intf, ctrl.ioctl_code, buf);
...@@ -1203,7 +1203,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) ...@@ -1203,7 +1203,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
&& size > 0 && size > 0
&& copy_to_user (ctrl.data, buf, size) != 0) && copy_to_user (ctrl.data, buf, size) != 0)
retval = -EFAULT; retval = -EFAULT;
if (buf != 0) if (buf != NULL)
kfree (buf); kfree (buf);
return retval; return retval;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define MAX_USB_MINORS 256 #define MAX_USB_MINORS 256
static struct file_operations *usb_minors[MAX_USB_MINORS]; static struct file_operations *usb_minors[MAX_USB_MINORS];
static spinlock_t minor_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(minor_lock);
static int usb_open(struct inode * inode, struct file * file) static int usb_open(struct inode * inode, struct file * file)
{ {
......
...@@ -86,7 +86,6 @@ ...@@ -86,7 +86,6 @@
/* host controllers we manage */ /* host controllers we manage */
LIST_HEAD (usb_bus_list); LIST_HEAD (usb_bus_list);
EXPORT_SYMBOL_GPL (usb_bus_list);
/* used when allocating bus numbers */ /* used when allocating bus numbers */
#define USB_MAXBUS 64 #define USB_MAXBUS 64
...@@ -97,10 +96,9 @@ static struct usb_busmap busmap; ...@@ -97,10 +96,9 @@ static struct usb_busmap busmap;
/* used when updating list of hcds */ /* used when updating list of hcds */
DECLARE_MUTEX (usb_bus_list_lock); /* exported only for usbfs */ DECLARE_MUTEX (usb_bus_list_lock); /* exported only for usbfs */
EXPORT_SYMBOL_GPL (usb_bus_list_lock);
/* used when updating hcd data */ /* used when updating hcd data */
static spinlock_t hcd_data_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(hcd_data_lock);
/* wait queue for synchronous unlinks */ /* wait queue for synchronous unlinks */
DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue); DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue);
...@@ -526,7 +524,7 @@ static void rh_report_status (unsigned long ptr) ...@@ -526,7 +524,7 @@ static void rh_report_status (unsigned long ptr)
/* do nothing if the urb's been unlinked */ /* do nothing if the urb's been unlinked */
if (!urb->dev if (!urb->dev
|| urb->status != -EINPROGRESS || urb->status != -EINPROGRESS
|| (hcd = urb->dev->bus->hcpriv) == 0) { || (hcd = urb->dev->bus->hcpriv) == NULL) {
spin_unlock (&urb->lock); spin_unlock (&urb->lock);
local_irq_restore (flags); local_irq_restore (flags);
return; return;
...@@ -1542,7 +1540,6 @@ void usb_hc_died (struct usb_hcd *hcd) ...@@ -1542,7 +1540,6 @@ void usb_hc_died (struct usb_hcd *hcd)
usb_set_device_state(hcd->self.root_hub, USB_STATE_NOTATTACHED); usb_set_device_state(hcd->self.root_hub, USB_STATE_NOTATTACHED);
mod_timer(&hcd->rh_timer, jiffies); mod_timer(&hcd->rh_timer, jiffies);
} }
EXPORT_SYMBOL (usb_hc_died);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
/* Protect struct usb_device->state and ->children members /* Protect struct usb_device->state and ->children members
* Note: Both are also protected by ->serialize, except that ->state can * Note: Both are also protected by ->serialize, except that ->state can
* change to USB_STATE_NOTATTACHED even when the semaphore isn't held. */ * change to USB_STATE_NOTATTACHED even when the semaphore isn't held. */
static spinlock_t device_state_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(device_state_lock);
/* khubd's worklist and its lock */ /* khubd's worklist and its lock */
static spinlock_t hub_event_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(hub_event_lock);
static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */ static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */
/* Wakes up khubd */ /* Wakes up khubd */
...@@ -404,7 +404,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) ...@@ -404,7 +404,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe)
* since each TT has "at least two" buffers that can need it (and * since each TT has "at least two" buffers that can need it (and
* there can be many TTs per hub). even if they're uncommon. * there can be many TTs per hub). even if they're uncommon.
*/ */
if ((clear = kmalloc (sizeof *clear, SLAB_ATOMIC)) == 0) { if ((clear = kmalloc (sizeof *clear, SLAB_ATOMIC)) == NULL) {
dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
/* FIXME recover somehow ... RESET_TT? */ /* FIXME recover somehow ... RESET_TT? */
return; return;
...@@ -1617,7 +1617,6 @@ int __usb_suspend_device (struct usb_device *udev, int port1, u32 state) ...@@ -1617,7 +1617,6 @@ int __usb_suspend_device (struct usb_device *udev, int port1, u32 state)
udev->dev.power.power_state = state; udev->dev.power.power_state = state;
return status; return status;
} }
EXPORT_SYMBOL(__usb_suspend_device);
/** /**
* usb_suspend_device - suspend a usb device * usb_suspend_device - suspend a usb device
...@@ -2299,7 +2298,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1) ...@@ -2299,7 +2298,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
int status; int status;
qual = kmalloc (sizeof *qual, SLAB_KERNEL); qual = kmalloc (sizeof *qual, SLAB_KERNEL);
if (qual == 0) if (qual == NULL)
return; return;
status = usb_get_descriptor (udev, USB_DT_DEVICE_QUALIFIER, 0, status = usb_get_descriptor (udev, USB_DT_DEVICE_QUALIFIER, 0,
...@@ -2830,7 +2829,7 @@ static int config_descriptors_changed(struct usb_device *udev) ...@@ -2830,7 +2829,7 @@ static int config_descriptors_changed(struct usb_device *udev)
len = le16_to_cpu(udev->config[index].desc.wTotalLength); len = le16_to_cpu(udev->config[index].desc.wTotalLength);
} }
buf = kmalloc (len, SLAB_KERNEL); buf = kmalloc (len, SLAB_KERNEL);
if (buf == 0) { if (buf == NULL) {
dev_err(&udev->dev, "no mem to re-read configs after reset\n"); dev_err(&udev->dev, "no mem to re-read configs after reset\n");
/* assume the worst */ /* assume the worst */
return 1; return 1;
......
...@@ -209,7 +209,7 @@ static void sg_clean (struct usb_sg_request *io) ...@@ -209,7 +209,7 @@ static void sg_clean (struct usb_sg_request *io)
kfree (io->urbs); kfree (io->urbs);
io->urbs = NULL; io->urbs = NULL;
} }
if (io->dev->dev.dma_mask != 0) if (io->dev->dev.dma_mask != NULL)
usb_buffer_unmap_sg (io->dev, io->pipe, io->sg, io->nents); usb_buffer_unmap_sg (io->dev, io->pipe, io->sg, io->nents);
io->dev = NULL; io->dev = NULL;
} }
...@@ -334,7 +334,7 @@ int usb_sg_init ( ...@@ -334,7 +334,7 @@ int usb_sg_init (
/* not all host controllers use DMA (like the mainstream pci ones); /* not all host controllers use DMA (like the mainstream pci ones);
* they can use PIO (sl811) or be software over another transport. * they can use PIO (sl811) or be software over another transport.
*/ */
dma = (dev->dev.dma_mask != 0); dma = (dev->dev.dma_mask != NULL);
if (dma) if (dma)
io->entries = usb_buffer_map_sg (dev, pipe, sg, nents); io->entries = usb_buffer_map_sg (dev, pipe, sg, nents);
else else
......
...@@ -63,8 +63,7 @@ const char *usbcore_name = "usbcore"; ...@@ -63,8 +63,7 @@ const char *usbcore_name = "usbcore";
int nousb; /* Disable USB when built into kernel image */ int nousb; /* Disable USB when built into kernel image */
/* Not honored on modular build */ /* Not honored on modular build */
DECLARE_RWSEM(usb_all_devices_rwsem); static DECLARE_RWSEM(usb_all_devices_rwsem);
EXPORT_SYMBOL(usb_all_devices_rwsem);
static int generic_probe (struct device *dev) static int generic_probe (struct device *dev)
......
...@@ -796,7 +796,7 @@ static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs) ...@@ -796,7 +796,7 @@ static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs)
* such lossage has been observed on both VT6202 and VT8235. * such lossage has been observed on both VT6202 and VT8235.
*/ */
if (HCD_IS_RUNNING (ehci_to_hcd(ehci)->state) && if (HCD_IS_RUNNING (ehci_to_hcd(ehci)->state) &&
(ehci->async->qh_next.ptr != 0 || (ehci->async->qh_next.ptr != NULL ||
ehci->periodic_sched != 0)) ehci->periodic_sched != 0))
timer_action (ehci, TIMER_IO_WATCHDOG); timer_action (ehci, TIMER_IO_WATCHDOG);
} }
......
...@@ -51,7 +51,7 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags) ...@@ -51,7 +51,7 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags)
dma_addr_t dma; dma_addr_t dma;
qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma); qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma);
if (qtd != 0) { if (qtd != NULL) {
ehci_qtd_init (qtd, dma); ehci_qtd_init (qtd, dma);
} }
return qtd; return qtd;
...@@ -98,7 +98,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags) ...@@ -98,7 +98,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
/* dummy td enables safe urb queuing */ /* dummy td enables safe urb queuing */
qh->dummy = ehci_qtd_alloc (ehci, flags); qh->dummy = ehci_qtd_alloc (ehci, flags);
if (qh->dummy == 0) { if (qh->dummy == NULL) {
ehci_dbg (ehci, "no dummy td\n"); ehci_dbg (ehci, "no dummy td\n");
dma_pool_free (ehci->qh_pool, qh, qh->qh_dma); dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
qh = NULL; qh = NULL;
...@@ -215,7 +215,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, int flags) ...@@ -215,7 +215,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, int flags)
dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller, dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller,
ehci->periodic_size * sizeof(__le32), ehci->periodic_size * sizeof(__le32),
&ehci->periodic_dma, 0); &ehci->periodic_dma, 0);
if (ehci->periodic == 0) { if (ehci->periodic == NULL) {
goto fail; goto fail;
} }
for (i = 0; i < ehci->periodic_size; i++) for (i = 0; i < ehci->periodic_size; i++)
...@@ -223,7 +223,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, int flags) ...@@ -223,7 +223,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, int flags)
/* software shadow of hardware table */ /* software shadow of hardware table */
ehci->pshadow = kmalloc (ehci->periodic_size * sizeof (void *), flags); ehci->pshadow = kmalloc (ehci->periodic_size * sizeof (void *), flags);
if (ehci->pshadow == 0) { if (ehci->pshadow == NULL) {
goto fail; goto fail;
} }
memset (ehci->pshadow, 0, ehci->periodic_size * sizeof (void *)); memset (ehci->pshadow, 0, ehci->periodic_size * sizeof (void *));
......
...@@ -218,7 +218,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs) ...@@ -218,7 +218,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
__releases(ehci->lock) __releases(ehci->lock)
__acquires(ehci->lock) __acquires(ehci->lock)
{ {
if (likely (urb->hcpriv != 0)) { if (likely (urb->hcpriv != NULL)) {
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
/* S-mask in a QH means it's an interrupt urb */ /* S-mask in a QH means it's an interrupt urb */
...@@ -404,7 +404,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs) ...@@ -404,7 +404,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
} }
/* last urb's completion might still need calling */ /* last urb's completion might still need calling */
if (likely (last != 0)) { if (likely (last != NULL)) {
ehci_urb_done (ehci, last->urb, regs); ehci_urb_done (ehci, last->urb, regs);
count++; count++;
ehci_qtd_free (ehci, last); ehci_qtd_free (ehci, last);
...@@ -846,7 +846,7 @@ static struct ehci_qh *qh_append_tds ( ...@@ -846,7 +846,7 @@ static struct ehci_qh *qh_append_tds (
/* just one way to queue requests: swap with the dummy qtd. /* just one way to queue requests: swap with the dummy qtd.
* only hc or qh_refresh() ever modify the overlay. * only hc or qh_refresh() ever modify the overlay.
*/ */
if (likely (qtd != 0)) { if (likely (qtd != NULL)) {
struct ehci_qtd *dummy; struct ehci_qtd *dummy;
dma_addr_t dma; dma_addr_t dma;
__le32 token; __le32 token;
...@@ -921,12 +921,12 @@ submit_async ( ...@@ -921,12 +921,12 @@ submit_async (
/* Control/bulk operations through TTs don't need scheduling, /* Control/bulk operations through TTs don't need scheduling,
* the HC and TT handle it when the TT has a buffer ready. * the HC and TT handle it when the TT has a buffer ready.
*/ */
if (likely (qh != 0)) { if (likely (qh != NULL)) {
if (likely (qh->qh_state == QH_STATE_IDLE)) if (likely (qh->qh_state == QH_STATE_IDLE))
qh_link_async (ehci, qh_get (qh)); qh_link_async (ehci, qh_get (qh));
} }
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
if (unlikely (qh == 0)) { if (unlikely (qh == NULL)) {
qtd_list_free (ehci, urb, qtd_list); qtd_list_free (ehci, urb, qtd_list);
return -ENOMEM; return -ENOMEM;
} }
...@@ -967,7 +967,7 @@ static void end_unlink_async (struct ehci_hcd *ehci, struct pt_regs *regs) ...@@ -967,7 +967,7 @@ static void end_unlink_async (struct ehci_hcd *ehci, struct pt_regs *regs)
* active but idle for a while once it empties. * active but idle for a while once it empties.
*/ */
if (HCD_IS_RUNNING (ehci_to_hcd(ehci)->state) if (HCD_IS_RUNNING (ehci_to_hcd(ehci)->state)
&& ehci->async->qh_next.qh == 0) && ehci->async->qh_next.qh == NULL)
timer_action (ehci, TIMER_ASYNC_OFF); timer_action (ehci, TIMER_ASYNC_OFF);
} }
...@@ -1048,7 +1048,7 @@ scan_async (struct ehci_hcd *ehci, struct pt_regs *regs) ...@@ -1048,7 +1048,7 @@ scan_async (struct ehci_hcd *ehci, struct pt_regs *regs)
timer_action_done (ehci, TIMER_ASYNC_SHRINK); timer_action_done (ehci, TIMER_ASYNC_SHRINK);
rescan: rescan:
qh = ehci->async->qh_next.qh; qh = ehci->async->qh_next.qh;
if (likely (qh != 0)) { if (likely (qh != NULL)) {
do { do {
/* clean any finished work for this qh */ /* clean any finished work for this qh */
if (!list_empty (&qh->qtd_list) if (!list_empty (&qh->qtd_list)
......
...@@ -604,7 +604,7 @@ static int intr_submit ( ...@@ -604,7 +604,7 @@ static int intr_submit (
/* get qh and force any scheduling errors */ /* get qh and force any scheduling errors */
INIT_LIST_HEAD (&empty); INIT_LIST_HEAD (&empty);
qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv); qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv);
if (qh == 0) { if (qh == NULL) {
status = -ENOMEM; status = -ENOMEM;
goto done; goto done;
} }
...@@ -615,7 +615,7 @@ static int intr_submit ( ...@@ -615,7 +615,7 @@ static int intr_submit (
/* then queue the urb's tds to the qh */ /* then queue the urb's tds to the qh */
qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv);
BUG_ON (qh == 0); BUG_ON (qh == NULL);
/* ... update usbfs periodic stats */ /* ... update usbfs periodic stats */
ehci_to_hcd(ehci)->self.bandwidth_int_reqs++; ehci_to_hcd(ehci)->self.bandwidth_int_reqs++;
...@@ -638,7 +638,7 @@ iso_stream_alloc (int mem_flags) ...@@ -638,7 +638,7 @@ iso_stream_alloc (int mem_flags)
struct ehci_iso_stream *stream; struct ehci_iso_stream *stream;
stream = kmalloc(sizeof *stream, mem_flags); stream = kmalloc(sizeof *stream, mem_flags);
if (likely (stream != 0)) { if (likely (stream != NULL)) {
memset (stream, 0, sizeof(*stream)); memset (stream, 0, sizeof(*stream));
INIT_LIST_HEAD(&stream->td_list); INIT_LIST_HEAD(&stream->td_list);
INIT_LIST_HEAD(&stream->free_list); INIT_LIST_HEAD(&stream->free_list);
...@@ -791,7 +791,7 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream) ...@@ -791,7 +791,7 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
static inline struct ehci_iso_stream * static inline struct ehci_iso_stream *
iso_stream_get (struct ehci_iso_stream *stream) iso_stream_get (struct ehci_iso_stream *stream)
{ {
if (likely (stream != 0)) if (likely (stream != NULL))
stream->refcount++; stream->refcount++;
return stream; return stream;
} }
...@@ -813,9 +813,9 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb) ...@@ -813,9 +813,9 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb)
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
stream = ep->hcpriv; stream = ep->hcpriv;
if (unlikely (stream == 0)) { if (unlikely (stream == NULL)) {
stream = iso_stream_alloc(GFP_ATOMIC); stream = iso_stream_alloc(GFP_ATOMIC);
if (likely (stream != 0)) { if (likely (stream != NULL)) {
/* dev->ep owns the initial refcount */ /* dev->ep owns the initial refcount */
ep->hcpriv = stream; ep->hcpriv = stream;
stream->ep = ep; stream->ep = ep;
...@@ -850,7 +850,7 @@ iso_sched_alloc (unsigned packets, int mem_flags) ...@@ -850,7 +850,7 @@ iso_sched_alloc (unsigned packets, int mem_flags)
size += packets * sizeof (struct ehci_iso_packet); size += packets * sizeof (struct ehci_iso_packet);
iso_sched = kmalloc (size, mem_flags); iso_sched = kmalloc (size, mem_flags);
if (likely (iso_sched != 0)) { if (likely (iso_sched != NULL)) {
memset(iso_sched, 0, size); memset(iso_sched, 0, size);
INIT_LIST_HEAD (&iso_sched->td_list); INIT_LIST_HEAD (&iso_sched->td_list);
} }
...@@ -927,7 +927,7 @@ itd_urb_transaction ( ...@@ -927,7 +927,7 @@ itd_urb_transaction (
unsigned long flags; unsigned long flags;
sched = iso_sched_alloc (urb->number_of_packets, mem_flags); sched = iso_sched_alloc (urb->number_of_packets, mem_flags);
if (unlikely (sched == 0)) if (unlikely (sched == NULL))
return -ENOMEM; return -ENOMEM;
itd_sched_init (sched, stream, urb); itd_sched_init (sched, stream, urb);
...@@ -961,7 +961,7 @@ itd_urb_transaction ( ...@@ -961,7 +961,7 @@ itd_urb_transaction (
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
} }
if (unlikely (0 == itd)) { if (unlikely (NULL == itd)) {
iso_sched_free (stream, sched); iso_sched_free (stream, sched);
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
return -ENOMEM; return -ENOMEM;
...@@ -1416,7 +1416,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) ...@@ -1416,7 +1416,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
/* Get iso_stream head */ /* Get iso_stream head */
stream = iso_stream_find (ehci, urb); stream = iso_stream_find (ehci, urb);
if (unlikely (stream == 0)) { if (unlikely (stream == NULL)) {
ehci_dbg (ehci, "can't get iso stream\n"); ehci_dbg (ehci, "can't get iso stream\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1530,7 +1530,7 @@ sitd_urb_transaction ( ...@@ -1530,7 +1530,7 @@ sitd_urb_transaction (
unsigned long flags; unsigned long flags;
iso_sched = iso_sched_alloc (urb->number_of_packets, mem_flags); iso_sched = iso_sched_alloc (urb->number_of_packets, mem_flags);
if (iso_sched == 0) if (iso_sched == NULL)
return -ENOMEM; return -ENOMEM;
sitd_sched_init (iso_sched, stream, urb); sitd_sched_init (iso_sched, stream, urb);
...@@ -1784,7 +1784,7 @@ static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) ...@@ -1784,7 +1784,7 @@ static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
/* Get iso_stream head */ /* Get iso_stream head */
stream = iso_stream_find (ehci, urb); stream = iso_stream_find (ehci, urb);
if (stream == 0) { if (stream == NULL) {
ehci_dbg (ehci, "can't get iso stream\n"); ehci_dbg (ehci, "can't get iso stream\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1889,7 +1889,7 @@ scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs) ...@@ -1889,7 +1889,7 @@ scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs)
type = Q_NEXT_TYPE (*hw_p); type = Q_NEXT_TYPE (*hw_p);
modified = 0; modified = 0;
while (q.ptr != 0) { while (q.ptr != NULL) {
unsigned uf; unsigned uf;
union ehci_shadow temp; union ehci_shadow temp;
int live; int live;
......
...@@ -1042,7 +1042,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) ...@@ -1042,7 +1042,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
usb_put_dev(ep->udev); usb_put_dev(ep->udev);
kfree(ep); kfree(ep);
hep->hcpriv = 0; hep->hcpriv = NULL;
} }
static int static int
......
...@@ -95,24 +95,25 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) ...@@ -95,24 +95,25 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
struct list_head *head, *tmp; struct list_head *head, *tmp;
struct uhci_td *td; struct uhci_td *td;
int i = 0, checked = 0, prevactive = 0; int i = 0, checked = 0, prevactive = 0;
__le32 element = qh_element(qh);
/* Try to make sure there's enough memory */ /* Try to make sure there's enough memory */
if (len < 80 * 6) if (len < 80 * 6)
return 0; return 0;
out += sprintf(out, "%*s[%p] link (%08x) element (%08x)\n", space, "", out += sprintf(out, "%*s[%p] link (%08x) element (%08x)\n", space, "",
qh, le32_to_cpu(qh->link), le32_to_cpu(qh->element)); qh, le32_to_cpu(qh->link), le32_to_cpu(element));
if (qh->element & UHCI_PTR_QH) if (element & UHCI_PTR_QH)
out += sprintf(out, "%*s Element points to QH (bug?)\n", space, ""); out += sprintf(out, "%*s Element points to QH (bug?)\n", space, "");
if (qh->element & UHCI_PTR_DEPTH) if (element & UHCI_PTR_DEPTH)
out += sprintf(out, "%*s Depth traverse\n", space, ""); out += sprintf(out, "%*s Depth traverse\n", space, "");
if (qh->element & cpu_to_le32(8)) if (element & cpu_to_le32(8))
out += sprintf(out, "%*s Bit 3 set (bug?)\n", space, ""); out += sprintf(out, "%*s Bit 3 set (bug?)\n", space, "");
if (!(qh->element & ~(UHCI_PTR_QH | UHCI_PTR_DEPTH))) if (!(element & ~(UHCI_PTR_QH | UHCI_PTR_DEPTH)))
out += sprintf(out, "%*s Element is NULL (bug?)\n", space, ""); out += sprintf(out, "%*s Element is NULL (bug?)\n", space, "");
if (!qh->urbp) { if (!qh->urbp) {
...@@ -127,7 +128,7 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) ...@@ -127,7 +128,7 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
td = list_entry(tmp, struct uhci_td, list); td = list_entry(tmp, struct uhci_td, list);
if (cpu_to_le32(td->dma_handle) != (qh->element & ~UHCI_PTR_BITS)) if (cpu_to_le32(td->dma_handle) != (element & ~UHCI_PTR_BITS))
out += sprintf(out, "%*s Element != First TD\n", space, ""); out += sprintf(out, "%*s Element != First TD\n", space, "");
while (tmp != head) { while (tmp != head) {
...@@ -447,7 +448,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) ...@@ -447,7 +448,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
if (qh->link != UHCI_PTR_TERM) if (qh->link != UHCI_PTR_TERM)
out += sprintf(out, " bandwidth reclamation on!\n"); out += sprintf(out, " bandwidth reclamation on!\n");
if (qh->element != cpu_to_le32(uhci->term_td->dma_handle)) if (qh_element(qh) != cpu_to_le32(uhci->term_td->dma_handle))
out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); out += sprintf(out, " skel_term_qh element is not set to term_td!\n");
continue; continue;
......
...@@ -236,7 +236,7 @@ static void uhci_insert_tds_in_qh(struct uhci_qh *qh, struct urb *urb, __le32 br ...@@ -236,7 +236,7 @@ static void uhci_insert_tds_in_qh(struct uhci_qh *qh, struct urb *urb, __le32 br
{ {
struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
struct uhci_td *td; struct uhci_td *td;
u32 *plink; __le32 *plink;
/* Ordering isn't important here yet since the QH hasn't been */ /* Ordering isn't important here yet since the QH hasn't been */
/* inserted into the schedule yet */ /* inserted into the schedule yet */
...@@ -637,8 +637,9 @@ static void uhci_dec_fsbr(struct uhci_hcd *uhci, struct urb *urb) ...@@ -637,8 +637,9 @@ static void uhci_dec_fsbr(struct uhci_hcd *uhci, struct urb *urb)
/* /*
* Map status to standard result codes * Map status to standard result codes
* *
* <status> is (td->status & 0xF60000) [a.k.a. uhci_status_bits(td->status)] * <status> is (td_status(td) & 0xF60000), a.k.a.
* Note: status does not include the TD_CTRL_NAK bit. * uhci_status_bits(td_status(td)).
* Note: <status> does not include the TD_CTRL_NAK bit.
* <dir_out> is True for output TDs and False for input TDs. * <dir_out> is True for output TDs and False for input TDs.
*/ */
static int uhci_map_status(int status, int dir_out) static int uhci_map_status(int status, int dir_out)
...@@ -843,21 +844,24 @@ static int uhci_result_control(struct uhci_hcd *uhci, struct urb *urb) ...@@ -843,21 +844,24 @@ static int uhci_result_control(struct uhci_hcd *uhci, struct urb *urb)
/* The rest of the TD's (but the last) are data */ /* The rest of the TD's (but the last) are data */
tmp = tmp->next; tmp = tmp->next;
while (tmp != head && tmp->next != head) { while (tmp != head && tmp->next != head) {
td = list_entry(tmp, struct uhci_td, list); unsigned int ctrlstat;
td = list_entry(tmp, struct uhci_td, list);
tmp = tmp->next; tmp = tmp->next;
status = uhci_status_bits(td_status(td)); ctrlstat = td_status(td);
status = uhci_status_bits(ctrlstat);
if (status & TD_CTRL_ACTIVE) if (status & TD_CTRL_ACTIVE)
return -EINPROGRESS; return -EINPROGRESS;
urb->actual_length += uhci_actual_length(td_status(td)); urb->actual_length += uhci_actual_length(ctrlstat);
if (status) if (status)
goto td_error; goto td_error;
/* Check to see if we received a short packet */ /* Check to see if we received a short packet */
if (uhci_actual_length(td_status(td)) < uhci_expected_length(td_token(td))) { if (uhci_actual_length(ctrlstat) <
uhci_expected_length(td_token(td))) {
if (urb->transfer_flags & URB_SHORT_NOT_OK) { if (urb->transfer_flags & URB_SHORT_NOT_OK) {
ret = -EREMOTEIO; ret = -EREMOTEIO;
goto err; goto err;
...@@ -1031,16 +1035,19 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) ...@@ -1031,16 +1035,19 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
urb->actual_length = 0; urb->actual_length = 0;
list_for_each_entry(td, &urbp->td_list, list) { list_for_each_entry(td, &urbp->td_list, list) {
status = uhci_status_bits(td_status(td)); unsigned int ctrlstat = td_status(td);
status = uhci_status_bits(ctrlstat);
if (status & TD_CTRL_ACTIVE) if (status & TD_CTRL_ACTIVE)
return -EINPROGRESS; return -EINPROGRESS;
urb->actual_length += uhci_actual_length(td_status(td)); urb->actual_length += uhci_actual_length(ctrlstat);
if (status) if (status)
goto td_error; goto td_error;
if (uhci_actual_length(td_status(td)) < uhci_expected_length(td_token(td))) { if (uhci_actual_length(ctrlstat) <
uhci_expected_length(td_token(td))) {
if (urb->transfer_flags & URB_SHORT_NOT_OK) { if (urb->transfer_flags & URB_SHORT_NOT_OK) {
ret = -EREMOTEIO; ret = -EREMOTEIO;
goto err; goto err;
...@@ -1209,15 +1216,16 @@ static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb) ...@@ -1209,15 +1216,16 @@ static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)
i = 0; i = 0;
list_for_each_entry(td, &urbp->td_list, list) { list_for_each_entry(td, &urbp->td_list, list) {
int actlength; int actlength;
unsigned int ctrlstat = td_status(td);
if (td_status(td) & TD_CTRL_ACTIVE) if (ctrlstat & TD_CTRL_ACTIVE)
return -EINPROGRESS; return -EINPROGRESS;
actlength = uhci_actual_length(td_status(td)); actlength = uhci_actual_length(ctrlstat);
urb->iso_frame_desc[i].actual_length = actlength; urb->iso_frame_desc[i].actual_length = actlength;
urb->actual_length += actlength; urb->actual_length += actlength;
status = uhci_map_status(uhci_status_bits(td_status(td)), status = uhci_map_status(uhci_status_bits(ctrlstat),
usb_pipeout(urb->pipe)); usb_pipeout(urb->pipe));
urb->iso_frame_desc[i].status = status; urb->iso_frame_desc[i].status = status;
if (status) { if (status) {
...@@ -1423,19 +1431,21 @@ static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb) ...@@ -1423,19 +1431,21 @@ static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb)
*/ */
head = &urbp->td_list; head = &urbp->td_list;
list_for_each_entry(td, head, list) { list_for_each_entry(td, head, list) {
if (!(td_status(td) & TD_CTRL_ACTIVE) && unsigned int ctrlstat = td_status(td);
(uhci_actual_length(td_status(td)) <
if (!(ctrlstat & TD_CTRL_ACTIVE) &&
(uhci_actual_length(ctrlstat) <
uhci_expected_length(td_token(td)) || uhci_expected_length(td_token(td)) ||
td->list.next == head)) td->list.next == head))
usb_settoggle(urb->dev, uhci_endpoint(td_token(td)), usb_settoggle(urb->dev, uhci_endpoint(td_token(td)),
uhci_packetout(td_token(td)), uhci_packetout(td_token(td)),
uhci_toggle(td_token(td)) ^ 1); uhci_toggle(td_token(td)) ^ 1);
else if ((td_status(td) & TD_CTRL_ACTIVE) && !prevactive) else if ((ctrlstat & TD_CTRL_ACTIVE) && !prevactive)
usb_settoggle(urb->dev, uhci_endpoint(td_token(td)), usb_settoggle(urb->dev, uhci_endpoint(td_token(td)),
uhci_packetout(td_token(td)), uhci_packetout(td_token(td)),
uhci_toggle(td_token(td))); uhci_toggle(td_token(td)));
prevactive = td_status(td) & TD_CTRL_ACTIVE; prevactive = ctrlstat & TD_CTRL_ACTIVE;
} }
uhci_delete_queued_urb(uhci, urb); uhci_delete_queued_urb(uhci, urb);
......
...@@ -118,10 +118,20 @@ struct uhci_qh { ...@@ -118,10 +118,20 @@ struct uhci_qh {
struct list_head remove_list; /* P: uhci->remove_list_lock */ struct list_head remove_list; /* P: uhci->remove_list_lock */
} __attribute__((aligned(16))); } __attribute__((aligned(16)));
/*
* We need a special accessor for the element pointer because it is
* subject to asynchronous updates by the controller
*/
static __le32 inline qh_element(struct uhci_qh *qh) {
__le32 element = qh->element;
barrier();
return element;
}
/* /*
* for TD <status>: * for TD <status>:
*/ */
#define td_status(td) le32_to_cpu((td)->status)
#define TD_CTRL_SPD (1 << 29) /* Short Packet Detect */ #define TD_CTRL_SPD (1 << 29) /* Short Packet Detect */
#define TD_CTRL_C_ERR_MASK (3 << 27) /* Error Counter bits */ #define TD_CTRL_C_ERR_MASK (3 << 27) /* Error Counter bits */
#define TD_CTRL_C_ERR_SHIFT 27 #define TD_CTRL_C_ERR_SHIFT 27
...@@ -203,6 +213,18 @@ struct uhci_td { ...@@ -203,6 +213,18 @@ struct uhci_td {
struct list_head fl_list; /* P: uhci->frame_list_lock */ struct list_head fl_list; /* P: uhci->frame_list_lock */
} __attribute__((aligned(16))); } __attribute__((aligned(16)));
/*
* We need a special accessor for the control/status word because it is
* subject to asynchronous updates by the controller
*/
static u32 inline td_status(struct uhci_td *td) {
__le32 status = td->status;
barrier();
return le32_to_cpu(status);
}
/* /*
* The UHCI driver places Interrupt, Control and Bulk into QH's both * The UHCI driver places Interrupt, Control and Bulk into QH's both
* to group together TD's for one transfer, and also to faciliate queuing * to group together TD's for one transfer, and also to faciliate queuing
......
...@@ -456,7 +456,7 @@ static int mdc800_usb_probe (struct usb_interface *intf, ...@@ -456,7 +456,7 @@ static int mdc800_usb_probe (struct usb_interface *intf,
dbg ("(mdc800_usb_probe) called."); dbg ("(mdc800_usb_probe) called.");
if (mdc800->dev != 0) if (mdc800->dev != NULL)
{ {
warn ("only one Mustek MDC800 is supported."); warn ("only one Mustek MDC800 is supported.");
return -ENODEV; return -ENODEV;
...@@ -1045,7 +1045,7 @@ static int __init usb_mdc800_init (void) ...@@ -1045,7 +1045,7 @@ static int __init usb_mdc800_init (void)
cleanup_on_fail: cleanup_on_fail:
if (mdc800 != 0) if (mdc800 != NULL)
{ {
err ("can't alloc memory!"); err ("can't alloc memory!");
......
...@@ -676,7 +676,7 @@ static struct hid_device *hid_parse_report(__u8 *start, unsigned size) ...@@ -676,7 +676,7 @@ static struct hid_device *hid_parse_report(__u8 *start, unsigned size)
parser->device = device; parser->device = device;
end = start + size; end = start + size;
while ((start = fetch_item(start, end, &item)) != 0) { while ((start = fetch_item(start, end, &item)) != NULL) {
if (item.format != HID_ITEM_FORMAT_SHORT) { if (item.format != HID_ITEM_FORMAT_SHORT) {
dbg("unexpected long global item"); dbg("unexpected long global item");
......
/*************************************************************************** /***************************************************************************
* V4L2 driver for SN9C10x PC Camera Controllers * * V4L2 driver for SN9C10x PC Camera Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#define SN9C102_DEBUG_LEVEL 2 #define SN9C102_DEBUG_LEVEL 2
#define SN9C102_MAX_DEVICES 64 #define SN9C102_MAX_DEVICES 64
#define SN9C102_PRESERVE_IMGSCALE 0 #define SN9C102_PRESERVE_IMGSCALE 0
#define SN9C102_FORCE_MUNMAP 0
#define SN9C102_MAX_FRAMES 32 #define SN9C102_MAX_FRAMES 32
#define SN9C102_URBS 2 #define SN9C102_URBS 2
#define SN9C102_ISO_PACKETS 7 #define SN9C102_ISO_PACKETS 7
...@@ -55,8 +56,8 @@ ...@@ -55,8 +56,8 @@
#define SN9C102_MODULE_AUTHOR "(C) 2004 Luca Risolia" #define SN9C102_MODULE_AUTHOR "(C) 2004 Luca Risolia"
#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
#define SN9C102_MODULE_LICENSE "GPL" #define SN9C102_MODULE_LICENSE "GPL"
#define SN9C102_MODULE_VERSION "1:1.20" #define SN9C102_MODULE_VERSION "1:1.22"
#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 20) #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 22)
enum sn9c102_bridge { enum sn9c102_bridge {
BRIDGE_SN9C101 = 0x01, BRIDGE_SN9C101 = 0x01,
...@@ -109,6 +110,10 @@ struct sn9c102_sysfs_attr { ...@@ -109,6 +110,10 @@ struct sn9c102_sysfs_attr {
sn9c102_sof_header_t frame_header; sn9c102_sof_header_t frame_header;
}; };
struct sn9c102_module_param {
u8 force_munmap;
};
static DECLARE_MUTEX(sn9c102_sysfs_lock); static DECLARE_MUTEX(sn9c102_sysfs_lock);
static DECLARE_RWSEM(sn9c102_disconnect); static DECLARE_RWSEM(sn9c102_disconnect);
...@@ -138,6 +143,8 @@ struct sn9c102_device { ...@@ -138,6 +143,8 @@ struct sn9c102_device {
sn9c102_sof_header_t sof_header; sn9c102_sof_header_t sof_header;
u16 reg[32]; u16 reg[32];
struct sn9c102_module_param module_param;
enum sn9c102_dev_state state; enum sn9c102_dev_state state;
u8 users; u8 users;
......
/*************************************************************************** /***************************************************************************
* V4L2 driver for SN9C10x PC Camera Controllers * * V4L2 driver for SN9C10x PC Camera Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/page-flags.h> #include <linux/page-flags.h>
#include <linux/byteorder/generic.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -65,6 +66,20 @@ MODULE_PARM_DESC(video_nr, ...@@ -65,6 +66,20 @@ MODULE_PARM_DESC(video_nr,
"\none and for every other camera." "\none and for every other camera."
"\n"); "\n");
static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] =
SN9C102_FORCE_MUNMAP};
module_param_array(force_munmap, bool, NULL, 0444);
MODULE_PARM_DESC(force_munmap,
"\n<0|1[,...]> Force the application to unmap previously "
"\nmapped buffer memory before calling any VIDIOC_S_CROP or "
"\nVIDIOC_S_FMT ioctl's. Not all the applications support "
"\nthis feature. This parameter is specific for each "
"\ndetected camera."
"\n 0 = do not force memory unmapping"
"\n 1 = force memory unmapping (save memory)"
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
"\n");
#ifdef SN9C102_DEBUG #ifdef SN9C102_DEBUG
static unsigned short debug = SN9C102_DEBUG_LEVEL; static unsigned short debug = SN9C102_DEBUG_LEVEL;
module_param(debug, ushort, 0644); module_param(debug, ushort, 0644);
...@@ -141,10 +156,16 @@ static void rvfree(void* mem, size_t size) ...@@ -141,10 +156,16 @@ static void rvfree(void* mem, size_t size)
} }
static u32 sn9c102_request_buffers(struct sn9c102_device* cam, u32 count) static u32
sn9c102_request_buffers(struct sn9c102_device* cam, u32 count,
enum sn9c102_io_method io)
{ {
struct v4l2_pix_format* p = &(cam->sensor->pix_format); struct v4l2_pix_format* p = &(cam->sensor->pix_format);
const size_t imagesize = (p->width * p->height * p->priv)/8; struct v4l2_rect* r = &(cam->sensor->cropcap.bounds);
const size_t imagesize = cam->module_param.force_munmap ||
io == IO_READ ?
(p->width * p->height * p->priv)/8 :
(r->width * r->height * p->priv)/8;
void* buff = NULL; void* buff = NULL;
u32 i; u32 i;
...@@ -911,11 +932,6 @@ sn9c102_store_val(struct class_device* cd, const char* buf, size_t len) ...@@ -911,11 +932,6 @@ sn9c102_store_val(struct class_device* cd, const char* buf, size_t len)
return -ENODEV; return -ENODEV;
} }
if (!(cam->sensor->sysfs_ops & SN9C102_I2C_WRITE)) {
up(&sn9c102_sysfs_lock);
return -ENOSYS;
}
value = sn9c102_strtou8(buf, len, &count); value = sn9c102_strtou8(buf, len, &count);
if (!count) { if (!count) {
up(&sn9c102_sysfs_lock); up(&sn9c102_sysfs_lock);
...@@ -1047,6 +1063,11 @@ sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len) ...@@ -1047,6 +1063,11 @@ sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len)
return -ENODEV; return -ENODEV;
} }
if (!(cam->sensor->sysfs_ops & SN9C102_I2C_WRITE)) {
up(&sn9c102_sysfs_lock);
return -ENOSYS;
}
value = sn9c102_strtou8(buf, len, &count); value = sn9c102_strtou8(buf, len, &count);
if (!count) { if (!count) {
up(&sn9c102_sysfs_lock); up(&sn9c102_sysfs_lock);
...@@ -1514,7 +1535,7 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) ...@@ -1514,7 +1535,7 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos)
} }
if (cam->io == IO_NONE) { if (cam->io == IO_NONE) {
if (!sn9c102_request_buffers(cam, cam->nreadbuffers)) { if (!sn9c102_request_buffers(cam,cam->nreadbuffers, IO_READ)) {
DBG(1, "read() failed, not enough memory") DBG(1, "read() failed, not enough memory")
up(&cam->fileop_sem); up(&cam->fileop_sem);
return -ENOMEM; return -ENOMEM;
...@@ -1594,7 +1615,7 @@ static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) ...@@ -1594,7 +1615,7 @@ static unsigned int sn9c102_poll(struct file *filp, poll_table *wait)
} }
if (cam->io == IO_NONE) { if (cam->io == IO_NONE) {
if (!sn9c102_request_buffers(cam, 2)) { if (!sn9c102_request_buffers(cam, 2, IO_READ)) {
DBG(1, "poll() failed, not enough memory") DBG(1, "poll() failed, not enough memory")
goto error; goto error;
} }
...@@ -1811,6 +1832,7 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -1811,6 +1832,7 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
return err; return err;
} }
case VIDIOC_S_CTRL_OLD:
case VIDIOC_S_CTRL: case VIDIOC_S_CTRL:
{ {
struct sn9c102_sensor* s = cam->sensor; struct sn9c102_sensor* s = cam->sensor;
...@@ -1895,12 +1917,13 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -1895,12 +1917,13 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
for (i = 0; i < cam->nbuffers; i++) if (cam->module_param.force_munmap)
if (cam->frame[i].vma_use_count) { for (i = 0; i < cam->nbuffers; i++)
DBG(3, "VIDIOC_S_CROP failed. " if (cam->frame[i].vma_use_count) {
"Unmap the buffers first.") DBG(3, "VIDIOC_S_CROP failed. "
return -EINVAL; "Unmap the buffers first.")
} return -EINVAL;
}
/* Preserve R,G or B origin */ /* Preserve R,G or B origin */
rect->left = (s->_rect.left & 1L) ? rect->left = (s->_rect.left & 1L) ?
...@@ -1947,7 +1970,8 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -1947,7 +1970,8 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
return -EFAULT; return -EFAULT;
} }
sn9c102_release_buffers(cam); if (cam->module_param.force_munmap)
sn9c102_release_buffers(cam);
err = sn9c102_set_crop(cam, rect); err = sn9c102_set_crop(cam, rect);
if (s->set_crop) if (s->set_crop)
...@@ -1966,7 +1990,9 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -1966,7 +1990,9 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
s->pix_format.height = rect->height/scale; s->pix_format.height = rect->height/scale;
memcpy(&(s->_rect), rect, sizeof(*rect)); memcpy(&(s->_rect), rect, sizeof(*rect));
if (nbuffers != sn9c102_request_buffers(cam, nbuffers)) { if (cam->module_param.force_munmap &&
nbuffers != sn9c102_request_buffers(cam, nbuffers,
cam->io)) {
cam->state |= DEV_MISCONFIGURED; cam->state |= DEV_MISCONFIGURED;
DBG(1, "VIDIOC_S_CROP failed because of not enough " DBG(1, "VIDIOC_S_CROP failed because of not enough "
"memory. To use the camera, close and open " "memory. To use the camera, close and open "
...@@ -2103,12 +2129,13 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -2103,12 +2129,13 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
return 0; return 0;
} }
for (i = 0; i < cam->nbuffers; i++) if (cam->module_param.force_munmap)
if (cam->frame[i].vma_use_count) { for (i = 0; i < cam->nbuffers; i++)
DBG(3, "VIDIOC_S_FMT failed. " if (cam->frame[i].vma_use_count) {
"Unmap the buffers first.") DBG(3, "VIDIOC_S_FMT failed. "
return -EINVAL; "Unmap the buffers first.")
} return -EINVAL;
}
if (cam->stream == STREAM_ON) if (cam->stream == STREAM_ON)
if ((err = sn9c102_stream_interrupt(cam))) if ((err = sn9c102_stream_interrupt(cam)))
...@@ -2119,7 +2146,8 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -2119,7 +2146,8 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
return -EFAULT; return -EFAULT;
} }
sn9c102_release_buffers(cam); if (cam->module_param.force_munmap)
sn9c102_release_buffers(cam);
err += sn9c102_set_pix_format(cam, pix); err += sn9c102_set_pix_format(cam, pix);
err += sn9c102_set_crop(cam, &rect); err += sn9c102_set_crop(cam, &rect);
...@@ -2140,7 +2168,9 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -2140,7 +2168,9 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
memcpy(pfmt, pix, sizeof(*pix)); memcpy(pfmt, pix, sizeof(*pix));
memcpy(&(s->_rect), &rect, sizeof(rect)); memcpy(&(s->_rect), &rect, sizeof(rect));
if (nbuffers != sn9c102_request_buffers(cam, nbuffers)) { if (cam->module_param.force_munmap &&
nbuffers != sn9c102_request_buffers(cam, nbuffers,
cam->io)) {
cam->state |= DEV_MISCONFIGURED; cam->state |= DEV_MISCONFIGURED;
DBG(1, "VIDIOC_S_FMT failed because of not enough " DBG(1, "VIDIOC_S_FMT failed because of not enough "
"memory. To use the camera, close and open " "memory. To use the camera, close and open "
...@@ -2228,7 +2258,8 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -2228,7 +2258,8 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
sn9c102_release_buffers(cam); sn9c102_release_buffers(cam);
if (rb.count) if (rb.count)
rb.count = sn9c102_request_buffers(cam, rb.count); rb.count = sn9c102_request_buffers(cam, rb.count,
IO_MMAP);
if (copy_to_user(arg, &rb, sizeof(rb))) { if (copy_to_user(arg, &rb, sizeof(rb))) {
sn9c102_release_buffers(cam); sn9c102_release_buffers(cam);
...@@ -2402,6 +2433,7 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp, ...@@ -2402,6 +2433,7 @@ static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
return 0; return 0;
} }
case VIDIOC_S_PARM_OLD:
case VIDIOC_S_PARM: case VIDIOC_S_PARM:
{ {
struct v4l2_streamparm sp; struct v4l2_streamparm sp;
...@@ -2496,8 +2528,10 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) ...@@ -2496,8 +2528,10 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
n = sizeof(sn9c102_id_table)/sizeof(sn9c102_id_table[0]); n = sizeof(sn9c102_id_table)/sizeof(sn9c102_id_table[0]);
for (i = 0; i < n-1; i++) for (i = 0; i < n-1; i++)
if (le16_to_cpu(udev->descriptor.idVendor) == sn9c102_id_table[i].idVendor && if (le16_to_cpu(udev->descriptor.idVendor) ==
le16_to_cpu(udev->descriptor.idProduct) == sn9c102_id_table[i].idProduct) sn9c102_id_table[i].idVendor &&
le16_to_cpu(udev->descriptor.idProduct) ==
sn9c102_id_table[i].idProduct)
break; break;
if (i == n-1) if (i == n-1)
return -ENODEV; return -ENODEV;
...@@ -2596,6 +2630,10 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) ...@@ -2596,6 +2630,10 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor) DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor)
cam->module_param.force_munmap = force_munmap[dev_nr];
dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0;
sn9c102_create_sysfs(cam); sn9c102_create_sysfs(cam);
DBG(2, "Optional device control through 'sysfs' interface ready") DBG(2, "Optional device control through 'sysfs' interface ready")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Plug-in for HV7131D image sensor connected to the SN9C10x PC Camera * * Plug-in for HV7131D image sensor connected to the SN9C10x PC Camera *
* Controllers * * Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Plug-in for MI-0343 image sensor connected to the SN9C10x PC Camera * * Plug-in for MI-0343 image sensor connected to the SN9C10x PC Camera *
* Controllers * * Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Plug-in for PAS106B image sensor connected to the SN9C10x PC Camera * * Plug-in for PAS106B image sensor connected to the SN9C10x PC Camera *
* Controllers * * Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
......
/*************************************************************************** /***************************************************************************
* API for image sensors connected to the SN9C10x PC Camera Controllers * * API for image sensors connected to the SN9C10x PC Camera Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Plug-in for TAS5110C1B image sensor connected to the SN9C10x PC Camera * * Plug-in for TAS5110C1B image sensor connected to the SN9C10x PC Camera *
* Controllers * * Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Plug-in for TAS5130D1B image sensor connected to the SN9C10x PC Camera * * Plug-in for TAS5130D1B image sensor connected to the SN9C10x PC Camera *
* Controllers * * Controllers *
* * * *
* Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it> * * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
......
...@@ -123,6 +123,20 @@ config USB_PHIDGETSERVO ...@@ -123,6 +123,20 @@ config USB_PHIDGETSERVO
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called phidgetservo. module will be called phidgetservo.
config USB_IDMOUSE
tristate "Siemens ID USB Mouse Fingerprint sensor support"
depends on USB
help
Say Y here if you want to use the fingerprint sensor on
the Siemens ID Mouse. There is also a Siemens ID Mouse
_Professional_, which has not been tested with this driver,
but uses the same sensor and may therefore work.
This driver creates an entry "/dev/idmouseX" or "/dev/usb/idmouseX",
which can be used by, e.g.,"cat /dev/idmouse0 > fingerprint.pnm".
See also <http://www.fs.tum.de/~echtler/idmouse/>.
config USB_TEST config USB_TEST
tristate "USB testing driver (DEVELOPMENT)" tristate "USB testing driver (DEVELOPMENT)"
depends on USB && USB_DEVICEFS && EXPERIMENTAL depends on USB && USB_DEVICEFS && EXPERIMENTAL
......
...@@ -7,6 +7,7 @@ obj-$(CONFIG_USB_AUERSWALD) += auerswald.o ...@@ -7,6 +7,7 @@ obj-$(CONFIG_USB_AUERSWALD) += auerswald.o
obj-$(CONFIG_USB_CYTHERM) += cytherm.o obj-$(CONFIG_USB_CYTHERM) += cytherm.o
obj-$(CONFIG_USB_EMI26) += emi26.o obj-$(CONFIG_USB_EMI26) += emi26.o
obj-$(CONFIG_USB_EMI62) += emi62.o obj-$(CONFIG_USB_EMI62) += emi62.o
obj-$(CONFIG_USB_IDMOUSE) += idmouse.o
obj-$(CONFIG_USB_LCD) += usblcd.o obj-$(CONFIG_USB_LCD) += usblcd.o
obj-$(CONFIG_USB_LED) += usbled.o obj-$(CONFIG_USB_LED) += usbled.o
obj-$(CONFIG_USB_LEGOTOWER) += legousbtower.o obj-$(CONFIG_USB_LEGOTOWER) += legousbtower.o
......
This diff is collapsed.
...@@ -1204,7 +1204,7 @@ static int halt_simple (struct usbtest_dev *dev) ...@@ -1204,7 +1204,7 @@ static int halt_simple (struct usbtest_dev *dev)
struct urb *urb; struct urb *urb;
urb = simple_alloc_urb (testdev_to_usbdev (dev), 0, 512); urb = simple_alloc_urb (testdev_to_usbdev (dev), 0, 512);
if (urb == 0) if (urb == NULL)
return -ENOMEM; return -ENOMEM;
if (dev->in_pipe) { if (dev->in_pipe) {
...@@ -1862,7 +1862,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id) ...@@ -1862,7 +1862,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
dev->intf = intf; dev->intf = intf;
/* cacheline-aligned scratch for i/o */ /* cacheline-aligned scratch for i/o */
if ((dev->buf = kmalloc (TBUF_SIZE, SLAB_KERNEL)) == 0) { if ((dev->buf = kmalloc (TBUF_SIZE, SLAB_KERNEL)) == NULL) {
kfree (dev); kfree (dev);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
* is out of the interrupt routine. * is out of the interrupt routine.
*/ */
#undef DEBUG
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v0.5.12 (2003/06/06)" #define DRIVER_VERSION "v0.5.12 (2005/01/13)"
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>" #define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver" #define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
...@@ -712,11 +714,11 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs) ...@@ -712,11 +714,11 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs)
{ {
pegasus_t *pegasus = urb->context; pegasus_t *pegasus = urb->context;
struct net_device *net; struct net_device *net;
__u8 *d;
int status; int status;
if (!pegasus) if (!pegasus)
return; return;
net = pegasus->net;
switch (urb->status) { switch (urb->status) {
case 0: case 0:
...@@ -726,36 +728,50 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs) ...@@ -726,36 +728,50 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs)
case -ESHUTDOWN: case -ESHUTDOWN:
return; return;
default: default:
info("intr status %d", urb->status); /* some Pegasus-I products report LOTS of data
* toggle errors... avoid log spamming
*/
pr_debug("%s: intr status %d\n", net->name, urb->status);
} }
d = urb->transfer_buffer; if (urb->actual_length >= 6) {
net = pegasus->net; u8 * d = urb->transfer_buffer;
if (d[0] & 0xfc) {
pegasus->stats.tx_errors++; /* byte 0 == tx_status1, reg 2B */
if (d[0] & TX_UNDERRUN) if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL
pegasus->stats.tx_fifo_errors++; |LATE_COL|JABBER_TIMEOUT)) {
if (d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT)) pegasus->stats.tx_errors++;
pegasus->stats.tx_aborted_errors++; if (d[0] & TX_UNDERRUN)
if (d[0] & LATE_COL) pegasus->stats.tx_fifo_errors++;
pegasus->stats.tx_window_errors++; if (d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT))
if (d[5] & LINK_STATUS) { pegasus->stats.tx_aborted_errors++;
netif_carrier_on(net); if (d[0] & LATE_COL)
} else { pegasus->stats.tx_window_errors++;
pegasus->stats.tx_carrier_errors++;
netif_carrier_off(net);
} }
/* d[5].LINK_STATUS lies on some adapters.
* d[0].NO_CARRIER kicks in only with failed TX.
* ... so monitoring with MII may be safest.
*/
if (d[0] & NO_CARRIER)
netif_carrier_off(net);
else
netif_carrier_on(net);
/* bytes 3-4 == rx_lostpkt, reg 2E/2F */
pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
} }
status = usb_submit_urb(urb, SLAB_ATOMIC); status = usb_submit_urb(urb, SLAB_ATOMIC);
if (status) if (status)
err("%s: can't resubmit interrupt urb, %d", net->name, status); printk(KERN_ERR "%s: can't resubmit interrupt urb, %d\n",
net->name, status);
} }
static void pegasus_tx_timeout(struct net_device *net) static void pegasus_tx_timeout(struct net_device *net)
{ {
pegasus_t *pegasus = netdev_priv(net); pegasus_t *pegasus = netdev_priv(net);
warn("%s: Tx timed out.", net->name); printk(KERN_WARNING "%s: tx timeout\n", net->name);
pegasus->tx_urb->transfer_flags |= URB_ASYNC_UNLINK; pegasus->tx_urb->transfer_flags |= URB_ASYNC_UNLINK;
usb_unlink_urb(pegasus->tx_urb); usb_unlink_urb(pegasus->tx_urb);
pegasus->stats.tx_errors++; pegasus->stats.tx_errors++;
...@@ -948,14 +964,57 @@ void pegasus_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) ...@@ -948,14 +964,57 @@ void pegasus_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
usb_make_path(pegasus->usb, info->bus_info, sizeof (info->bus_info)); usb_make_path(pegasus->usb, info->bus_info, sizeof (info->bus_info));
} }
#ifdef CONFIG_MII /* also handles three patterns of some kind in hardware */
static int pegasus_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) #define WOL_SUPPORTED (WAKE_MAGIC|WAKE_PHY)
static void
pegasus_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
pegasus_t *pegasus = netdev_priv(dev);
wol->supported = WAKE_MAGIC | WAKE_PHY;
wol->wolopts = pegasus->wolopts;
}
static int
pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
pegasus_t *pegasus = netdev_priv(dev);
u8 reg78 = 0x04;
if (wol->wolopts & ~WOL_SUPPORTED)
return -EINVAL;
if (wol->wolopts & WAKE_MAGIC)
reg78 |= 0x80;
if (wol->wolopts & WAKE_PHY)
reg78 |= 0x40;
if (wol->wolopts)
pegasus->eth_regs[0] |= 0x10;
else
pegasus->eth_regs[0] &= ~0x10;
pegasus->wolopts = wol->wolopts;
return set_register(pegasus, WakeupControl, reg78);
}
static inline void
pegasus_reset_wol(struct net_device *dev)
{
struct ethtool_wolinfo wol;
memset(&wol, 0, sizeof wol);
(void) pegasus_set_wol(dev, &wol);
}
static int
pegasus_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
pegasus_t *pegasus = netdev_priv(dev); pegasus_t *pegasus = netdev_priv(dev);
mii_ethtool_gset(&pegasus->mii, ecmd); mii_ethtool_gset(&pegasus->mii, ecmd);
return 0; return 0;
} }
static int pegasus_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) static int
pegasus_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
pegasus_t *pegasus = netdev_priv(dev); pegasus_t *pegasus = netdev_priv(dev);
return mii_ethtool_sset(&pegasus->mii, ecmd); return mii_ethtool_sset(&pegasus->mii, ecmd);
...@@ -975,19 +1034,14 @@ static u32 pegasus_get_link(struct net_device *dev) ...@@ -975,19 +1034,14 @@ static u32 pegasus_get_link(struct net_device *dev)
static u32 pegasus_get_msglevel(struct net_device *dev) static u32 pegasus_get_msglevel(struct net_device *dev)
{ {
/* pegasus_t *pegasus = netdev_priv(dev);
* pegasus_t *pegasus = netdev_priv(dev); return pegasus->msg_level;
* return pegasus->msg_enable; FIXME
*/
return 0;
} }
static void pegasus_set_msglevel(struct net_device *dev, u32 v) static void pegasus_set_msglevel(struct net_device *dev, u32 v)
{ {
/* pegasus_t *pegasus = netdev_priv(dev);
* pegasus_t *pegasus = netdev_priv(dev); pegasus->msg_level = v;
* pegasus->msg_enable = edata.data; FIXME
*/
} }
static struct ethtool_ops ops = { static struct ethtool_ops ops = {
...@@ -998,58 +1052,10 @@ static struct ethtool_ops ops = { ...@@ -998,58 +1052,10 @@ static struct ethtool_ops ops = {
.get_link = pegasus_get_link, .get_link = pegasus_get_link,
.get_msglevel = pegasus_get_msglevel, .get_msglevel = pegasus_get_msglevel,
.set_msglevel = pegasus_set_msglevel, .set_msglevel = pegasus_set_msglevel,
.get_wol = pegasus_get_wol,
.set_wol = pegasus_set_wol,
}; };
#else
static int pegasus_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
pegasus_t *pegasus = netdev_priv(dev);
short lpa, bmcr;
u8 port;
ecmd->supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half |
SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg |
SUPPORTED_TP | SUPPORTED_MII);
get_registers(pegasus, Reg7b, 1, &port);
if (port == 0)
ecmd->port = PORT_MII;
else
ecmd->port = PORT_TP;
ecmd->transceiver = XCVR_INTERNAL;
ecmd->phy_address = pegasus->phy;
read_mii_word(pegasus, pegasus->phy, MII_BMCR, &bmcr);
read_mii_word(pegasus, pegasus->phy, MII_LPA, &lpa);
if (bmcr & BMCR_ANENABLE) {
ecmd->autoneg = AUTONEG_ENABLE;
ecmd->speed = lpa & (LPA_100HALF | LPA_100FULL) ?
SPEED_100 : SPEED_10;
if (ecmd->speed == SPEED_100)
ecmd->duplex = lpa & LPA_100FULL ?
DUPLEX_FULL : DUPLEX_HALF;
else
ecmd->duplex = lpa & LPA_10FULL ?
DUPLEX_FULL : DUPLEX_HALF;
} else {
ecmd->autoneg = AUTONEG_DISABLE;
ecmd->speed = bmcr & BMCR_SPEED100 ?
SPEED_100 : SPEED_10;
ecmd->duplex = bmcr & BMCR_FULLDPLX ?
DUPLEX_FULL : DUPLEX_HALF;
}
return 0;
}
static struct ethtool_ops ops = {
.get_drvinfo = pegasus_get_drvinfo,
.get_settings = pegasus_get_settings,
.get_link = ethtool_op_get_link,
};
#endif
static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
{ {
__u16 *data = (__u16 *) & rq->ifr_ifru; __u16 *data = (__u16 *) & rq->ifr_ifru;
...@@ -1081,12 +1087,12 @@ static void pegasus_set_multicast(struct net_device *net) ...@@ -1081,12 +1087,12 @@ static void pegasus_set_multicast(struct net_device *net)
if (net->flags & IFF_PROMISC) { if (net->flags & IFF_PROMISC) {
pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
info("%s: Promiscuous mode enabled", net->name); pr_info("%s: Promiscuous mode enabled.\n", net->name);
} else if ((net->mc_count > multicast_filter_limit) || } else if ((net->mc_count > multicast_filter_limit) ||
(net->flags & IFF_ALLMULTI)) { (net->flags & IFF_ALLMULTI)) {
pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
info("%s set allmulti", net->name); pr_info("%s: set allmulti\n", net->name);
} else { } else {
pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST; pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST;
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
...@@ -1180,7 +1186,6 @@ static int pegasus_probe(struct usb_interface *intf, ...@@ -1180,7 +1186,6 @@ static int pegasus_probe(struct usb_interface *intf,
net->hard_start_xmit = pegasus_start_xmit; net->hard_start_xmit = pegasus_start_xmit;
net->set_multicast_list = pegasus_set_multicast; net->set_multicast_list = pegasus_set_multicast;
net->get_stats = pegasus_netdev_stats; net->get_stats = pegasus_netdev_stats;
net->mtu = PEGASUS_MTU;
SET_ETHTOOL_OPS(net, &ops); SET_ETHTOOL_OPS(net, &ops);
pegasus->mii.dev = net; pegasus->mii.dev = net;
pegasus->mii.mdio_read = mdio_read; pegasus->mii.mdio_read = mdio_read;
...@@ -1192,27 +1197,28 @@ static int pegasus_probe(struct usb_interface *intf, ...@@ -1192,27 +1197,28 @@ static int pegasus_probe(struct usb_interface *intf,
pegasus->features = usb_dev_id[dev_index].private; pegasus->features = usb_dev_id[dev_index].private;
get_interrupt_interval(pegasus); get_interrupt_interval(pegasus);
if (reset_mac(pegasus)) { if (reset_mac(pegasus)) {
err("can't reset MAC"); dev_err(&intf->dev, "can't reset MAC\n");
res = -EIO; res = -EIO;
goto out2; goto out2;
} }
set_ethernet_addr(pegasus); set_ethernet_addr(pegasus);
fill_skb_pool(pegasus); fill_skb_pool(pegasus);
if (pegasus->features & PEGASUS_II) { if (pegasus->features & PEGASUS_II) {
info("setup Pegasus II specific registers"); dev_info(&intf->dev, "setup Pegasus II specific registers\n");
setup_pegasus_II(pegasus); setup_pegasus_II(pegasus);
} }
pegasus->phy = mii_phy_probe(pegasus); pegasus->phy = mii_phy_probe(pegasus);
if (pegasus->phy == 0xff) { if (pegasus->phy == 0xff) {
warn("can't locate MII phy, using default"); dev_warn(&intf->dev, "can't locate MII phy, using default\n");
pegasus->phy = 1; pegasus->phy = 1;
} }
usb_set_intfdata(intf, pegasus); usb_set_intfdata(intf, pegasus);
SET_NETDEV_DEV(net, &intf->dev); SET_NETDEV_DEV(net, &intf->dev);
pegasus_reset_wol(net);
res = register_netdev(net); res = register_netdev(net);
if (res) if (res)
goto out3; goto out3;
printk("%s: %s\n", net->name, usb_dev_id[dev_index].name); pr_info("%s: %s\n", net->name, usb_dev_id[dev_index].name);
return 0; return 0;
out3: out3:
...@@ -1247,16 +1253,34 @@ static void pegasus_disconnect(struct usb_interface *intf) ...@@ -1247,16 +1253,34 @@ static void pegasus_disconnect(struct usb_interface *intf)
free_netdev(pegasus->net); free_netdev(pegasus->net);
} }
static int pegasus_suspend (struct usb_interface *intf, u32 state)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
netif_device_detach (pegasus->net);
return 0;
}
static int pegasus_resume (struct usb_interface *intf)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
netif_device_attach (pegasus->net);
return 0;
}
static struct usb_driver pegasus_driver = { static struct usb_driver pegasus_driver = {
.name = driver_name, .name = driver_name,
.probe = pegasus_probe, .probe = pegasus_probe,
.disconnect = pegasus_disconnect, .disconnect = pegasus_disconnect,
.id_table = pegasus_ids, .id_table = pegasus_ids,
.suspend = pegasus_suspend,
.resume = pegasus_resume,
}; };
static int __init pegasus_init(void) static int __init pegasus_init(void)
{ {
info(DRIVER_VERSION ":" DRIVER_DESC); pr_info("%s: %s, " DRIVER_DESC "\n", driver_name, DRIVER_VERSION);
return usb_register(&pegasus_driver); return usb_register(&pegasus_driver);
} }
......
...@@ -76,6 +76,7 @@ enum pegasus_registers { ...@@ -76,6 +76,7 @@ enum pegasus_registers {
EthTxStat0 = 0x2b, EthTxStat0 = 0x2b,
EthTxStat1 = 0x2c, EthTxStat1 = 0x2c,
EthRxStat = 0x2d, EthRxStat = 0x2d,
WakeupControl = 0x78,
Reg7b = 0x7b, Reg7b = 0x7b,
Gpio0 = 0x7e, Gpio0 = 0x7e,
Gpio1 = 0x7f, Gpio1 = 0x7f,
...@@ -90,6 +91,8 @@ typedef struct pegasus { ...@@ -90,6 +91,8 @@ typedef struct pegasus {
struct mii_if_info mii; struct mii_if_info mii;
unsigned flags; unsigned flags;
unsigned features; unsigned features;
u32 msg_level;
u32 wolopts;
int dev_index; int dev_index;
int intr_interval; int intr_interval;
struct tasklet_struct rx_tl; struct tasklet_struct rx_tl;
......
...@@ -745,7 +745,7 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -745,7 +745,7 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
dev->out = usb_sndbulkpipe(dev->udev, 2); dev->out = usb_sndbulkpipe(dev->udev, 2);
// allocate irq urb // allocate irq urb
if ((data->int_urb = usb_alloc_urb (0, GFP_KERNEL)) == 0) { if ((data->int_urb = usb_alloc_urb (0, GFP_KERNEL)) == NULL) {
dbg ("%s: cannot allocate interrupt URB", dbg ("%s: cannot allocate interrupt URB",
dev->net->name); dev->net->name);
return -ENOMEM; return -ENOMEM;
...@@ -2265,14 +2265,34 @@ static const struct driver_info zaurus_sl5x00_info = { ...@@ -2265,14 +2265,34 @@ static const struct driver_info zaurus_sl5x00_info = {
.unbind = cdc_unbind, .unbind = cdc_unbind,
.tx_fixup = zaurus_tx_fixup, .tx_fixup = zaurus_tx_fixup,
}; };
#define ZAURUS_STRONGARM_INFO ((unsigned long)&zaurus_sl5x00_info)
static const struct driver_info zaurus_pxa_info = { static const struct driver_info zaurus_pxa_info = {
.description = "Sharp Zaurus, PXA-2xx based", .description = "Sharp Zaurus, PXA-2xx based",
.flags = FLAG_FRAMING_Z, .flags = FLAG_FRAMING_Z,
.check_connect = always_connected, .check_connect = always_connected,
.bind = generic_cdc_bind,
.unbind = cdc_unbind,
.tx_fixup = zaurus_tx_fixup, .tx_fixup = zaurus_tx_fixup,
};
#define ZAURUS_PXA_INFO ((unsigned long)&zaurus_pxa_info)
.in = 1, .out = 2, static const struct driver_info olympus_mxl_info = {
.description = "Olympus R1000",
.flags = FLAG_FRAMING_Z,
.check_connect = always_connected,
.bind = generic_cdc_bind,
.unbind = cdc_unbind,
.tx_fixup = zaurus_tx_fixup,
}; };
#define OLYMPUS_MXL_INFO ((unsigned long)&olympus_mxl_info)
#else
/* blacklist all those devices */
#define ZAURUS_STRONGARM_INFO 0
#define ZAURUS_PXA_INFO 0
#define OLYMPUS_MXL_INFO 0
#endif #endif
...@@ -2384,7 +2404,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags) ...@@ -2384,7 +2404,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags)
#endif #endif
size = (sizeof (struct ethhdr) + dev->net->mtu); size = (sizeof (struct ethhdr) + dev->net->mtu);
if ((skb = alloc_skb (size, flags)) == 0) { if ((skb = alloc_skb (size, flags)) == NULL) {
devdbg (dev, "no rx skb"); devdbg (dev, "no rx skb");
defer_kevent (dev, EVENT_RX_MEMORY); defer_kevent (dev, EVENT_RX_MEMORY);
usb_free_urb (urb); usb_free_urb (urb);
...@@ -2741,7 +2761,7 @@ kevent (void *data) ...@@ -2741,7 +2761,7 @@ kevent (void *data)
if (test_bit (EVENT_TX_HALT, &dev->flags)) { if (test_bit (EVENT_TX_HALT, &dev->flags)) {
unlink_urbs (dev, &dev->txq); unlink_urbs (dev, &dev->txq);
status = usb_clear_halt (dev->udev, dev->out); status = usb_clear_halt (dev->udev, dev->out);
if (status < 0) if (status < 0 && status != -EPIPE)
deverr (dev, "can't clear tx halt, status %d", deverr (dev, "can't clear tx halt, status %d",
status); status);
else { else {
...@@ -2752,7 +2772,7 @@ kevent (void *data) ...@@ -2752,7 +2772,7 @@ kevent (void *data)
if (test_bit (EVENT_RX_HALT, &dev->flags)) { if (test_bit (EVENT_RX_HALT, &dev->flags)) {
unlink_urbs (dev, &dev->rxq); unlink_urbs (dev, &dev->rxq);
status = usb_clear_halt (dev->udev, dev->in); status = usb_clear_halt (dev->udev, dev->in);
if (status < 0) if (status < 0 && status != -EPIPE)
deverr (dev, "can't clear rx halt, status %d", deverr (dev, "can't clear rx halt, status %d",
status); status);
else { else {
...@@ -2769,7 +2789,7 @@ kevent (void *data) ...@@ -2769,7 +2789,7 @@ kevent (void *data)
urb = usb_alloc_urb (0, GFP_KERNEL); urb = usb_alloc_urb (0, GFP_KERNEL);
else else
clear_bit (EVENT_RX_MEMORY, &dev->flags); clear_bit (EVENT_RX_MEMORY, &dev->flags);
if (urb != 0) { if (urb != NULL) {
clear_bit (EVENT_RX_MEMORY, &dev->flags); clear_bit (EVENT_RX_MEMORY, &dev->flags);
rx_submit (dev, urb, GFP_KERNEL); rx_submit (dev, urb, GFP_KERNEL);
tasklet_schedule (&dev->bh); tasklet_schedule (&dev->bh);
...@@ -2996,7 +3016,8 @@ static void usbnet_bh (unsigned long param) ...@@ -2996,7 +3016,8 @@ static void usbnet_bh (unsigned long param)
// don't refill the queue all at once // don't refill the queue all at once
for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) { for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) {
if ((urb = usb_alloc_urb (0, GFP_ATOMIC)) != 0) urb = usb_alloc_urb (0, GFP_ATOMIC);
if (urb != NULL)
rx_submit (dev, urb, GFP_ATOMIC); rx_submit (dev, urb, GFP_ATOMIC);
} }
if (temp != dev->rxq.qlen) if (temp != dev->rxq.qlen)
...@@ -3354,12 +3375,15 @@ static const struct usb_device_id products [] = { ...@@ -3354,12 +3375,15 @@ static const struct usb_device_id products [] = {
}, },
#endif #endif
#ifdef CONFIG_USB_ZAURUS #if defined(CONFIG_USB_ZAURUS) || defined(CONFIG_USB_CDCETHER)
/* /*
* SA-1100 based Sharp Zaurus ("collie"), or compatible. * SA-1100 based Sharp Zaurus ("collie"), or compatible.
* Same idea as above, but different framing. * Same idea as above, but different framing.
* *
* PXA-2xx based models are also lying-about-cdc. * PXA-2xx based models are also lying-about-cdc.
*
* NOTE: These entries do double-duty, serving as blacklist entries
* whenever Zaurus support isn't enabled, but CDC Ethernet is.
*/ */
{ {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
...@@ -3370,82 +3394,79 @@ static const struct usb_device_id products [] = { ...@@ -3370,82 +3394,79 @@ static const struct usb_device_id products [] = {
.bInterfaceClass = USB_CLASS_COMM, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 6 /* Ethernet model */, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = (unsigned long) &zaurus_sl5x00_info, .driver_info = ZAURUS_STRONGARM_INFO,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x04DD,
.idProduct = 0x8005, /* A-300 */ .idProduct = 0x8005, /* A-300 */
.bInterfaceClass = 0x02, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 0x0a, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0x00, .bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_pxa_info, .driver_info = ZAURUS_PXA_INFO,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x04DD,
.idProduct = 0x8006, /* B-500/SL-5600 */ .idProduct = 0x8006, /* B-500/SL-5600 */
.bInterfaceClass = 0x02, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 0x0a, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0x00, .bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_pxa_info, .driver_info = ZAURUS_PXA_INFO,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x04DD,
.idProduct = 0x8007, /* C-700 */ .idProduct = 0x8007, /* C-700 */
.bInterfaceClass = 0x02, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 0x0a, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0x00, .bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_pxa_info, .driver_info = ZAURUS_PXA_INFO,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x04DD,
.idProduct = 0x9031, /* C-750 C-760 */ .idProduct = 0x9031, /* C-750 C-760 */
.bInterfaceClass = 0x02, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 0x0a, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0x00, .bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_pxa_info, .driver_info = ZAURUS_PXA_INFO,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x04DD,
.idProduct = 0x9032, /* SL-6000 */ .idProduct = 0x9032, /* SL-6000 */
.bInterfaceClass = 0x02, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 0x0a, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0x00, .bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_pxa_info, .driver_info = ZAURUS_PXA_INFO,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x04DD,
.idProduct = 0x9050, /* C-860 */ .idProduct = 0x9050, /* C-860 */
.bInterfaceClass = 0x02, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 0x0a, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0x00, .bInterfaceProtocol = 0x00,
.driver_info = (unsigned long) &zaurus_pxa_info, .driver_info = ZAURUS_PXA_INFO,
}, },
#endif
#ifdef CONFIG_USB_CDCETHER /* Olympus has some models with a Zaurus-compatible option.
* R-1000 uses a FreeScale i.MXL cpu (ARMv4T)
#ifndef CONFIG_USB_ZAURUS */
/* if we couldn't whitelist Zaurus, we must blacklist it */
{ {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD, .idVendor = 0x07B4,
.idProduct = 0x8004, .idProduct = 0x0F02, /* R-1000 */
/* match the master interface */
.bInterfaceClass = USB_CLASS_COMM, .bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 6 /* Ethernet model */, .bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0x00,
.driver_info = 0, /* BLACKLIST */ .driver_info = OLYMPUS_MXL_INFO,
}, },
// FIXME blacklist the other Zaurus models too, sigh
#endif #endif
#ifdef CONFIG_USB_CDCETHER
{ {
/* CDC Ether uses two interfaces, not necessarily consecutive. /* CDC Ether uses two interfaces, not necessarily consecutive.
* We match the main interface, ignoring the optional device * We match the main interface, ignoring the optional device
......
This diff is collapsed.
...@@ -372,6 +372,7 @@ static struct usb_device_id id_table_8U232AM [] = { ...@@ -372,6 +372,7 @@ static struct usb_device_id id_table_8U232AM [] = {
{ USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) },
{ USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) },
{ USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) },
{ USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0, 0x3ff) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
...@@ -486,6 +487,7 @@ static struct usb_device_id id_table_FT232BM [] = { ...@@ -486,6 +487,7 @@ static struct usb_device_id id_table_FT232BM [] = {
{ USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) },
{ USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) },
{ USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) },
{ USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0x400, 0xffff) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
...@@ -608,6 +610,7 @@ static struct usb_device_id id_table_combined [] = { ...@@ -608,6 +610,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
{ USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
{ USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
{ USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -240,6 +240,12 @@ ...@@ -240,6 +240,12 @@
#define FTDI_RM_VID 0x0403 /* Vendor Id */ #define FTDI_RM_VID 0x0403 /* Vendor Id */
#define FTDI_RMCANVIEW_PID 0xfd60 /* Product Id */ #define FTDI_RMCANVIEW_PID 0xfd60 /* Product Id */
/*
* EVER Eco Pro UPS (http://www.ever.com.pl/)
*/
#define EVER_ECO_PRO_CDS 0xe520 /* RS-232 converter */
/* Commands */ /* Commands */
#define FTDI_SIO_RESET 0 /* Reset the port */ #define FTDI_SIO_RESET 0 /* Reset the port */
#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
......
...@@ -316,7 +316,7 @@ static int pkt_add(struct garmin_data * garmin_data_p, ...@@ -316,7 +316,7 @@ static int pkt_add(struct garmin_data * garmin_data_p,
garmin_data_p->flags |= FLAGS_QUEUING; garmin_data_p->flags |= FLAGS_QUEUING;
pkt = kmalloc(sizeof(struct garmin_packet)+data_length, pkt = kmalloc(sizeof(struct garmin_packet)+data_length,
GFP_ATOMIC); GFP_ATOMIC);
if (pkt == 0) { if (pkt == NULL) {
dev_err(&garmin_data_p->port->dev, "out of memory\n"); dev_err(&garmin_data_p->port->dev, "out of memory\n");
return 0; return 0;
} }
...@@ -739,7 +739,7 @@ static void gsp_next_packet(struct garmin_data * garmin_data_p) ...@@ -739,7 +739,7 @@ static void gsp_next_packet(struct garmin_data * garmin_data_p)
{ {
struct garmin_packet *pkt = NULL; struct garmin_packet *pkt = NULL;
while ((pkt = pkt_pop(garmin_data_p)) != 0) { while ((pkt = pkt_pop(garmin_data_p)) != NULL) {
dbg("%s - next pkt: %d", __FUNCTION__, pkt->seq); dbg("%s - next pkt: %d", __FUNCTION__, pkt->seq);
if (gsp_send(garmin_data_p, pkt->data, pkt->size) > 0) { if (gsp_send(garmin_data_p, pkt->data, pkt->size) > 0) {
kfree(pkt); kfree(pkt);
...@@ -877,7 +877,7 @@ static int garmin_clear(struct garmin_data * garmin_data_p) ...@@ -877,7 +877,7 @@ static int garmin_clear(struct garmin_data * garmin_data_p)
struct usb_serial_port *port = garmin_data_p->port; struct usb_serial_port *port = garmin_data_p->port;
if (port != 0 && garmin_data_p->flags & FLAGS_APP_RESP_SEEN) { if (port != NULL && garmin_data_p->flags & FLAGS_APP_RESP_SEEN) {
/* send a terminate command */ /* send a terminate command */
status = garmin_write_bulk(port, GARMIN_STOP_TRANSFER_REQ, status = garmin_write_bulk(port, GARMIN_STOP_TRANSFER_REQ,
sizeof(GARMIN_STOP_TRANSFER_REQ)); sizeof(GARMIN_STOP_TRANSFER_REQ));
...@@ -1366,7 +1366,7 @@ static int garmin_flush_queue(struct garmin_data * garmin_data_p) ...@@ -1366,7 +1366,7 @@ static int garmin_flush_queue(struct garmin_data * garmin_data_p)
if ((garmin_data_p->flags & FLAGS_THROTTLED) == 0) { if ((garmin_data_p->flags & FLAGS_THROTTLED) == 0) {
pkt = pkt_pop(garmin_data_p); pkt = pkt_pop(garmin_data_p);
if (pkt != 0) { if (pkt != NULL) {
send_to_tty(garmin_data_p->port, pkt->data, pkt->size); send_to_tty(garmin_data_p->port, pkt->data, pkt->size);
kfree(pkt); kfree(pkt);
......
...@@ -374,7 +374,7 @@ static int keyspan_write(struct usb_serial_port *port, ...@@ -374,7 +374,7 @@ static int keyspan_write(struct usb_serial_port *port,
flip = p_priv->out_flip; flip = p_priv->out_flip;
/* Check we have a valid urb/endpoint before we use it... */ /* Check we have a valid urb/endpoint before we use it... */
if ((this_urb = p_priv->out_urbs[flip]) == 0) { if ((this_urb = p_priv->out_urbs[flip]) == NULL) {
/* no bulk out, so return 0 bytes written */ /* no bulk out, so return 0 bytes written */
dbg("%s - no output urb :(", __FUNCTION__); dbg("%s - no output urb :(", __FUNCTION__);
return count; return count;
...@@ -1020,11 +1020,11 @@ static int keyspan_write_room (struct usb_serial_port *port) ...@@ -1020,11 +1020,11 @@ static int keyspan_write_room (struct usb_serial_port *port)
flip = p_priv->out_flip; flip = p_priv->out_flip;
/* Check both endpoints to see if any are available. */ /* Check both endpoints to see if any are available. */
if ((this_urb = p_priv->out_urbs[flip]) != 0) { if ((this_urb = p_priv->out_urbs[flip]) != NULL) {
if (this_urb->status != -EINPROGRESS) if (this_urb->status != -EINPROGRESS)
return (data_len); return (data_len);
flip = (flip + 1) & d_details->outdat_endp_flip; flip = (flip + 1) & d_details->outdat_endp_flip;
if ((this_urb = p_priv->out_urbs[flip]) != 0) if ((this_urb = p_priv->out_urbs[flip]) != NULL)
if (this_urb->status != -EINPROGRESS) if (this_urb->status != -EINPROGRESS)
return (data_len); return (data_len);
} }
......
...@@ -865,6 +865,14 @@ UNUSUAL_DEV( 0x0ed1, 0x6660, 0x0100, 0x0300, ...@@ -865,6 +865,14 @@ UNUSUAL_DEV( 0x0ed1, 0x6660, 0x0100, 0x0300,
US_SC_DEVICE, US_PR_DEVICE, NULL, US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_INQUIRY ), US_FL_FIX_INQUIRY ),
/* Submitted by Daniel Drake <dsd@gentoo.org>
* Reported by dayul on the Gentoo Forums */
UNUSUAL_DEV( 0x0ea0, 0x2168, 0x0110, 0x0110,
"Ours Technology",
"Flash Disk",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),
/* Reported by Rastislav Stanik <rs_kernel@yahoo.com> */ /* Reported by Rastislav Stanik <rs_kernel@yahoo.com> */
UNUSUAL_DEV( 0x0ea0, 0x6828, 0x0110, 0x0110, UNUSUAL_DEV( 0x0ea0, 0x6828, 0x0110, 0x0110,
"USB", "USB",
......
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