Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (39 commits)
  USB: at91-ohci, handle extra at91sam9261 ahb clock
  USB: another id for cp2101 driver
  USB: ueagle-atm.c needs sched.h
  USB: at91_udc, shrink runtime footprint
  usbnet: add missing Kconfig for KC2190 cables
  usbnet: init fault (oops) cleanup, whitespace fixes
  usbnet: recognize SiteCom CN-124
  usb: Remove Airprime device from option.c
  USB: change __init to __devinit for isp116x_probe
  USB: ps3: don't call ps3_system_bus_driver_register on other platforms
  USB: hid-core.c: Removes GTCO CalComp Interwrite IPanel PIDs from blacklist
  USB: kernel-doc fixes
  USB: quirky device for cdc-acm
  USB: cdc-acm: fix incorrect throtteling, make set_control optional
  USB: unconfigure devices which have config 0
  USB: make usb_iso_packet_descriptor.status signed
  USB: fix g_serial small error
  USB: use __u32 rather than u32 in userspace ioctls in usbdevice_fs.h
  USB Storage: US_FL_IGNORE_RESIDUE needed for Aiptek MP3 Player
  USB: Fix misspelled "USBNET_MII" kernel config option.
  ...
  • Loading branch information
Linus Torvalds committed Feb 19, 2007
2 parents 255f038 + ed077bb commit 460223d
Show file tree
Hide file tree
Showing 44 changed files with 532 additions and 170 deletions.
11 changes: 10 additions & 1 deletion drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,18 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,

/* Some devices return the total number of sectors, not the
* highest sector number. Make the necessary adjustment. */
if (sdp->fix_capacity)
if (sdp->fix_capacity) {
--sdkp->capacity;

/* Some devices have version which report the correct sizes
* and others which do not. We guess size according to a heuristic
* and err on the side of lowering the capacity. */
} else {
if (sdp->guess_capacity)
if (sdkp->capacity & 0x01) /* odd sizes are odd */
--sdkp->capacity;
}

got_data:
if (sector_size == 0) {
sector_size = 512;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ obj-$(CONFIG_USB_SERIAL) += serial/
obj-$(CONFIG_USB_ADUTUX) += misc/
obj-$(CONFIG_USB_APPLEDISPLAY) += misc/
obj-$(CONFIG_USB_AUERSWALD) += misc/
obj-$(CONFIG_USB_BERRY_CHARGE) += misc/
obj-$(CONFIG_USB_CYPRESS_CY7C63)+= misc/
obj-$(CONFIG_USB_CYTHERM) += misc/
obj-$(CONFIG_USB_EMI26) += misc/
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/atm/ueagle-atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <linux/usb.h>
#include <linux/firmware.h>
#include <linux/ctype.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/version.h>
#include <linux/mutex.h>
Expand Down
33 changes: 22 additions & 11 deletions drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,16 @@ static void acm_rx_tasklet(unsigned long _acm)
struct tty_struct *tty = acm->tty;
struct acm_ru *rcv;
unsigned long flags;
int i = 0;
unsigned char throttled;
dbg("Entering acm_rx_tasklet");

if (!ACM_READY(acm) || acm->throttle)
if (!ACM_READY(acm))
return;

spin_lock(&acm->throttle_lock);
throttled = acm->throttle;
spin_unlock(&acm->throttle_lock);
if (throttled)
return;

next_buffer:
Expand All @@ -346,22 +352,20 @@ static void acm_rx_tasklet(unsigned long _acm)
dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);

tty_buffer_request_room(tty, buf->size);
if (!acm->throttle)
spin_lock(&acm->throttle_lock);
throttled = acm->throttle;
spin_unlock(&acm->throttle_lock);
if (!throttled)
tty_insert_flip_string(tty, buf->base, buf->size);
tty_flip_buffer_push(tty);

spin_lock(&acm->throttle_lock);
if (acm->throttle) {
dbg("Throtteling noticed");
memmove(buf->base, buf->base + i, buf->size - i);
buf->size -= i;
spin_unlock(&acm->throttle_lock);
if (throttled) {
dbg("Throttling noticed");
spin_lock_irqsave(&acm->read_lock, flags);
list_add(&buf->list, &acm->filled_read_bufs);
spin_unlock_irqrestore(&acm->read_lock, flags);
return;
}
spin_unlock(&acm->throttle_lock);

spin_lock_irqsave(&acm->read_lock, flags);
list_add(&buf->list, &acm->spare_read_bufs);
Expand Down Expand Up @@ -467,7 +471,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
goto bail_out;
}

if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS))
if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) &&
(acm->ctrl_caps & USB_CDC_CAP_LINE))
goto full_bailout;

INIT_LIST_HEAD(&acm->spare_read_urbs);
Expand All @@ -480,6 +485,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
list_add(&(acm->rb[i].list), &acm->spare_read_bufs);
}

acm->throttle = 0;

tasklet_schedule(&acm->urb_task);

done:
Expand Down Expand Up @@ -1092,6 +1099,10 @@ static struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */
.driver_info = SINGLE_RX_URB, /* firmware bug */
},
{ USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
},

/* control interfaces with various AT-command sets */
{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
USB_CDC_ACM_PROTO_AT_V25TER) },
Expand Down
9 changes: 5 additions & 4 deletions drivers/usb/core/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,17 +604,18 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
lock_kernel();
if (!st) {
st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
if (!st) {
unlock_kernel();
return POLLIN;
}

/* we may have dropped BKL - need to check for having lost the race */
if (file->private_data) {
kfree(st);
st = file->private_data;
goto lost_race;
}
/* we haven't lost - check for allocation failure now */
if (!st) {
unlock_kernel();
return POLLIN;
}

/*
* need to prevent the module from being unloaded, since
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,11 +857,11 @@ static int proc_setintf(struct dev_state *ps, void __user *arg)

static int proc_setconfig(struct dev_state *ps, void __user *arg)
{
unsigned int u;
int u;
int status = 0;
struct usb_host_config *actconfig;

if (get_user(u, (unsigned int __user *)arg))
if (get_user(u, (int __user *)arg))
return -EFAULT;

actconfig = ps->dev->actconfig;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ EXPORT_SYMBOL_GPL(usb_deregister_device_driver);
* usb_register_driver - register a USB interface driver
* @new_driver: USB operations for the interface driver
* @owner: module owner of this driver.
* @mod_name: module name string
*
* Registers a USB interface driver with the USB core. The list of
* unattached interfaces will be rescanned whenever a new driver is
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int init_endpoint_class(void)
kref_init(&ep_class->kref);
ep_class->class = class_create(THIS_MODULE, "usb_endpoint");
if (IS_ERR(ep_class->class)) {
result = IS_ERR(ep_class->class);
result = PTR_ERR(ep_class->class);
goto class_create_error;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static void generic_disconnect(struct usb_device *udev)
/* if this is only an unbind, not a physical disconnect, then
* unconfigure the device */
if (udev->actconfig)
usb_set_configuration(udev, 0);
usb_set_configuration(udev, -1);

usb_remove_sysfs_dev_files(udev);
}
Expand Down
31 changes: 16 additions & 15 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct usb_hub {
struct usb_hub_status hub;
struct usb_port_status port;
} *status; /* buffer for status reports */
struct mutex status_mutex; /* for the status buffer */

int error; /* last reported error */
int nerrors; /* track consecutive errors */
Expand Down Expand Up @@ -535,6 +536,7 @@ static int hub_hub_status(struct usb_hub *hub,
{
int ret;

mutex_lock(&hub->status_mutex);
ret = get_hub_status(hub->hdev, &hub->status->hub);
if (ret < 0)
dev_err (hub->intfdev,
Expand All @@ -544,6 +546,7 @@ static int hub_hub_status(struct usb_hub *hub,
*change = le16_to_cpu(hub->status->hub.wHubChange);
ret = 0;
}
mutex_unlock(&hub->status_mutex);
return ret;
}

Expand Down Expand Up @@ -617,6 +620,7 @@ static int hub_configure(struct usb_hub *hub,
ret = -ENOMEM;
goto fail;
}
mutex_init(&hub->status_mutex);

hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);
if (!hub->descriptor) {
Expand Down Expand Up @@ -1396,6 +1400,7 @@ static int hub_port_status(struct usb_hub *hub, int port1,
{
int ret;

mutex_lock(&hub->status_mutex);
ret = get_port_status(hub->hdev, port1, &hub->status->port);
if (ret < 4) {
dev_err (hub->intfdev,
Expand All @@ -1407,6 +1412,7 @@ static int hub_port_status(struct usb_hub *hub, int port1,
*change = le16_to_cpu(hub->status->port.wPortChange);
ret = 0;
}
mutex_unlock(&hub->status_mutex);
return ret;
}

Expand Down Expand Up @@ -1904,6 +1910,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
struct usb_hub *hub = usb_get_intfdata (intf);
struct usb_device *hdev = hub->hdev;
unsigned port1;
int status = 0;

/* fail if children aren't already suspended */
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
Expand All @@ -1927,24 +1934,18 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)

dev_dbg(&intf->dev, "%s\n", __FUNCTION__);

/* stop khubd and related activity */
hub_quiesce(hub);

/* "global suspend" of the downstream HC-to-USB interface */
if (!hdev->parent) {
struct usb_bus *bus = hdev->bus;
if (bus) {
int status = hcd_bus_suspend (bus);

if (status != 0) {
dev_dbg(&hdev->dev, "'global' suspend %d\n",
status);
return status;
}
} else
return -EOPNOTSUPP;
status = hcd_bus_suspend(hdev->bus);
if (status != 0) {
dev_dbg(&hdev->dev, "'global' suspend %d\n", status);
hub_activate(hub);
}
}

/* stop khubd and related activity */
hub_quiesce(hub);
return 0;
return status;
}

static int hub_resume(struct usb_interface *intf)
Expand Down
22 changes: 18 additions & 4 deletions drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,14 @@ static void release_interface(struct device *dev)
* use this kind of configurability; many devices only have one
* configuration.
*
* @configuration is the value of the configuration to be installed.
* According to the USB spec (e.g. section 9.1.1.5), configuration values
* must be non-zero; a value of zero indicates that the device in
* unconfigured. However some devices erroneously use 0 as one of their
* configuration values. To help manage such devices, this routine will
* accept @configuration = -1 as indicating the device should be put in
* an unconfigured state.
*
* USB device configurations may affect Linux interoperability,
* power consumption and the functionality available. For example,
* the default configuration is limited to using 100mA of bus power,
Expand Down Expand Up @@ -1347,10 +1355,15 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
struct usb_interface **new_interfaces = NULL;
int n, nintf;

for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
if (dev->config[i].desc.bConfigurationValue == configuration) {
cp = &dev->config[i];
break;
if (configuration == -1)
configuration = 0;
else {
for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
if (dev->config[i].desc.bConfigurationValue ==
configuration) {
cp = &dev->config[i];
break;
}
}
}
if ((!cp && configuration != 0))
Expand All @@ -1359,6 +1372,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
/* The USB spec says configuration 0 means unconfigured.
* But if a device includes a configuration numbered 0,
* we will accept it as a correctly configured state.
* Use -1 if you really want to unconfigure the device.
*/
if (cp && configuration == 0)
dev_warn(&dev->dev, "config 0 descriptor??\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/otg_whitelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static struct usb_device_id whitelist_table [] = {
{ USB_DEVICE_INFO(7, 1, 3) },
#endif

#ifdef CONFIG_USB_CDCETHER
#ifdef CONFIG_USB_NET_CDCETHER
/* Linux-USB CDC Ethernet gadget */
{ USB_DEVICE(0x0525, 0xa4a1), },
/* Linux-USB CDC Ethernet + RNDIS gadget */
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ set_bConfigurationValue(struct device *dev, struct device_attribute *attr,
struct usb_device *udev = to_usb_device(dev);
int config, value;

if (sscanf(buf, "%u", &config) != 1 || config > 255)
if (sscanf(buf, "%d", &config) != 1 || config < -1 || config > 255)
return -EINVAL;
usb_lock_device(udev);
value = usb_set_configuration(udev, config);
Expand Down
15 changes: 7 additions & 8 deletions drivers/usb/gadget/at91_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ static int at91_ep_set_halt(struct usb_ep *_ep, int value)
return status;
}

static struct usb_ep_ops at91_ep_ops = {
static const struct usb_ep_ops at91_ep_ops = {
.enable = at91_ep_enable,
.disable = at91_ep_disable,
.alloc_request = at91_ep_alloc_request,
Expand Down Expand Up @@ -1651,7 +1651,7 @@ static void at91udc_shutdown(struct platform_device *dev)
pullup(platform_get_drvdata(dev), 0);
}

static int __devinit at91udc_probe(struct platform_device *pdev)
static int __init at91udc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct at91_udc *udc;
Expand Down Expand Up @@ -1762,7 +1762,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
return retval;
}

static int __devexit at91udc_remove(struct platform_device *pdev)
static int __exit at91udc_remove(struct platform_device *pdev)
{
struct at91_udc *udc = platform_get_drvdata(pdev);
struct resource *res;
Expand Down Expand Up @@ -1836,8 +1836,7 @@ static int at91udc_resume(struct platform_device *pdev)
#endif

static struct platform_driver at91_udc = {
.probe = at91udc_probe,
.remove = __devexit_p(at91udc_remove),
.remove = __exit_p(at91udc_remove),
.shutdown = at91udc_shutdown,
.suspend = at91udc_suspend,
.resume = at91udc_resume,
Expand All @@ -1847,13 +1846,13 @@ static struct platform_driver at91_udc = {
},
};

static int __devinit udc_init_module(void)
static int __init udc_init_module(void)
{
return platform_driver_register(&at91_udc);
return platform_driver_probe(&at91_udc, at91udc_probe);
}
module_init(udc_init_module);

static void __devexit udc_exit_module(void)
static void __exit udc_exit_module(void)
{
platform_driver_unregister(&at91_udc);
}
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,7 @@ static int gs_setup_class(struct usb_gadget *gadget,
memcpy(&port->port_line_coding, req->buf, ret);
spin_unlock(&port->port_lock);
}
ret = 0;
break;

case USB_CDC_REQ_GET_LINE_CODING:
Expand Down
Loading

0 comments on commit 460223d

Please sign in to comment.