Commit 0cd3abca authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linuxusb.bkbits.net/linus-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 97db62cc f5dbd9a0
...@@ -436,17 +436,21 @@ int usb_clear_halt(struct usb_device *dev, int pipe) ...@@ -436,17 +436,21 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
* Within any given configuration, each interface may have several * Within any given configuration, each interface may have several
* alternative settings. These are often used to control levels of * alternative settings. These are often used to control levels of
* bandwidth consumption. For example, the default setting for a high * bandwidth consumption. For example, the default setting for a high
* speed interrupt endpoint may not send more than about 4KBytes per * speed interrupt endpoint may not send more than 64 bytes per microframe,
* microframe, and isochronous endpoints may never be part of a an * while interrupt transfers of up to 3KBytes per microframe are legal.
* Also, isochronous endpoints may never be part of an
* interface's default setting. To access such bandwidth, alternate * interface's default setting. To access such bandwidth, alternate
* interface setting must be made current. * interface settings must be made current.
* *
* Note that in the Linux USB subsystem, bandwidth associated with * Note that in the Linux USB subsystem, bandwidth associated with
* an endpoint in a given alternate setting is not reserved until an * an endpoint in a given alternate setting is not reserved until an URB
* is submitted that needs that bandwidth. Some other operating systems * is submitted that needs that bandwidth. Some other operating systems
* allocate bandwidth early, when a configuration is chosen. * allocate bandwidth early, when a configuration is chosen.
* *
* This call is synchronous, and may not be used in an interrupt context. * This call is synchronous, and may not be used in an interrupt context.
* Also, drivers must not change altsettings while urbs are scheduled for
* endpoints in that interface; all such urbs must first be completed
* (perhaps forced by unlinking).
* *
* Returns zero on success, or else the status code returned by the * Returns zero on success, or else the status code returned by the
* underlying usb_control_msg() call. * underlying usb_control_msg() call.
......
...@@ -947,8 +947,9 @@ static void usb_find_drivers(struct usb_device *dev) ...@@ -947,8 +947,9 @@ static void usb_find_drivers(struct usb_device *dev)
/* register this interface with driverfs */ /* register this interface with driverfs */
interface->dev.parent = &dev->dev; interface->dev.parent = &dev->dev;
interface->dev.bus = &usb_bus_type; interface->dev.bus = &usb_bus_type;
sprintf (&interface->dev.bus_id[0], "if%d", sprintf (&interface->dev.bus_id[0], "%s:%d",
interface->altsetting->bInterfaceNumber); dev->devpath,
interface->altsetting->bInterfaceNumber);
if (!desc->iInterface if (!desc->iInterface
|| usb_string (dev, desc->iInterface, || usb_string (dev, desc->iInterface,
interface->dev.name, interface->dev.name,
...@@ -1288,56 +1289,59 @@ int usb_set_address(struct usb_device *dev) ...@@ -1288,56 +1289,59 @@ int usb_set_address(struct usb_device *dev)
*/ */
static void set_device_description (struct usb_device *dev) static void set_device_description (struct usb_device *dev)
{ {
char *buf, *here, *end; void *buf;
int mfgr = dev->descriptor.iManufacturer; int mfgr = dev->descriptor.iManufacturer;
int prod = dev->descriptor.iProduct; int prod = dev->descriptor.iProduct;
int vendor_id = dev->descriptor.idVendor;
int product_id = dev->descriptor.idProduct;
char *mfgr_str, *prod_str;
/* set default; keep it if there are no strings */ /* set default; keep it if there are no strings, or kmalloc fails */
sprintf (dev->dev.name, "USB device %04x:%04x", sprintf (dev->dev.name, "USB device %04x:%04x",
dev->descriptor.idVendor, vendor_id, product_id);
dev->descriptor.idProduct);
if (!mfgr && !prod)
return;
if (!(buf = kmalloc(256, GFP_KERNEL))) if (!(buf = kmalloc(256 * 2, GFP_KERNEL)))
return; return;
here = dev->dev.name;
end = here + sizeof dev->dev.name - 2; prod_str = (char *) buf;
*end = 0; mfgr_str = (char *) buf + 256;
/* much like pci ... describe as either: if (prod && usb_string (dev, prod, prod_str, 256) > 0) {
* - both strings: 'product descr (vendor descr)'
* - product only: 'product descr (USB device vvvv:pppp)'
* - vendor only: 'USB device vvvv:pppp (vendor descr)'
* - neither string: 'USB device vvvv:pppp'
*/
if (prod && usb_string (dev, prod, buf, 256) > 0) {
strncpy (here, buf, end - here);
#ifdef DEBUG #ifdef DEBUG
printk (KERN_INFO "Product: %s\n", buf); printk (KERN_INFO "Product: %s\n", prod_str);
#endif #endif
} else { } else {
buf [0] = 0; prod_str = 0;
prod = -1;
} }
here = strchr (here, 0);
if (mfgr && usb_string (dev, mfgr, buf, 256) > 0) { if (mfgr && usb_string (dev, mfgr, mfgr_str, 256) > 0) {
*here++ = ' ';
*here++ = '(';
strncpy (here, buf, end - here - 1);
here = strchr (here, 0);
*here++ = ')';
#ifdef DEBUG #ifdef DEBUG
printk (KERN_INFO "Manufacturer: %s\n", buf); printk (KERN_INFO "Manufacturer: %s\n", mfgr_str);
#endif #endif
} else { } else {
if (prod != -1) mfgr_str = 0;
snprintf (here, end - here - 1,
" (USB device %04x:%04x)",
dev->descriptor.idVendor,
dev->descriptor.idProduct);
/* both strings unavailable, keep the default */
} }
/* much like pci ... describe as either:
* - both strings: 'product descr (vendor descr)'
* - product only: 'product descr (USB device vvvv:pppp)'
* - vendor only: 'USB device vvvv:pppp (vendor descr)'
* - neither string: 'USB device vvvv:pppp'
*/
if (prod_str && mfgr_str) {
snprintf(dev->dev.name, sizeof dev->dev.name,
"%s (%s)", prod_str, mfgr_str);
} else if (prod_str) {
snprintf(dev->dev.name, sizeof dev->dev.name,
"%s (USB device %04x:%04x)",
prod_str, vendor_id, product_id);
} else if (mfgr_str) {
snprintf(dev->dev.name, sizeof dev->dev.name,
"USB device %04x:%04x (%s)",
vendor_id, product_id, mfgr_str);
}
kfree(buf); kfree(buf);
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/arch/assabet.h> #include <asm/arch/assabet.h>
#include <asm/arch/badge4.h> #include <asm/arch/badge4.h>
#include <asm/hardware/sa1111.h> #include <asm/hardware/sa1111.h>
......
...@@ -2053,6 +2053,8 @@ static void start_hc(struct uhci_hcd *uhci) ...@@ -2053,6 +2053,8 @@ static void start_hc(struct uhci_hcd *uhci)
/* Run and mark it configured with a 64-byte max packet */ /* Run and mark it configured with a 64-byte max packet */
outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, io_addr + USBCMD); outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, io_addr + USBCMD);
uhci->hcd.state = USB_STATE_READY;
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -2344,8 +2346,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd) ...@@ -2344,8 +2346,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
/* disable legacy emulation */ /* disable legacy emulation */
pci_write_config_word(dev, USBLEGSUP, USBLEGSUP_DEFAULT); pci_write_config_word(dev, USBLEGSUP, USBLEGSUP_DEFAULT);
hcd->state = USB_STATE_READY;
usb_connect(uhci->rh_dev); usb_connect(uhci->rh_dev);
uhci->rh_dev->speed = USB_SPEED_FULL; uhci->rh_dev->speed = USB_SPEED_FULL;
......
...@@ -83,7 +83,7 @@ int hid_ff_init(struct hid_device* hid) ...@@ -83,7 +83,7 @@ int hid_ff_init(struct hid_device* hid)
hid->dev->descriptor.idProduct); hid->dev->descriptor.idProduct);
if (!init) { if (!init) {
warn("hid_ff_init could not find initializer"); dbg("hid_ff_init could not find initializer");
return -ENOSYS; return -ENOSYS;
} }
return init->init(hid); return init->init(hid);
......
...@@ -146,7 +146,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -146,7 +146,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
retval = -EFAULT; retval = -EFAULT;
goto err_out; goto err_out;
} }
if (rio_cmd.length > PAGE_SIZE) { if (rio_cmd.length < 0 || rio_cmd.length > PAGE_SIZE) {
retval = -EINVAL; retval = -EINVAL;
goto err_out; goto err_out;
} }
...@@ -216,7 +216,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -216,7 +216,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
retval = -EFAULT; retval = -EFAULT;
goto err_out; goto err_out;
} }
if (rio_cmd.length > PAGE_SIZE) { if (rio_cmd.length < 0 || rio_cmd.length > PAGE_SIZE) {
retval = -EINVAL; retval = -EINVAL;
goto err_out; goto err_out;
} }
......
This diff is collapsed.
...@@ -33,7 +33,6 @@ typedef struct ...@@ -33,7 +33,6 @@ typedef struct
{ {
struct usb_device *dev; /* USB device handle */ struct usb_device *dev; /* USB device handle */
struct semaphore mutex; /* locks this struct */ struct semaphore mutex; /* locks this struct */
struct semaphore sem;
wait_queue_head_t wait; /* for timed waits */ wait_queue_head_t wait; /* for timed waits */
wait_queue_head_t remove_ok; wait_queue_head_t remove_ok;
...@@ -44,12 +43,6 @@ typedef struct ...@@ -44,12 +43,6 @@ typedef struct
driver_state_t state; /* started/stopped */ driver_state_t state; /* started/stopped */
int opened; /* tru if open */ int opened; /* tru if open */
int remove_pending; int remove_pending;
char rd_buf[BULK_RCV_MAX]; /* read buffer */
char wr_buf[BULK_SND_MAX]; /* write buffer */
} tiglusb_t, *ptiglusb_t; } tiglusb_t, *ptiglusb_t;
extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */
#endif #endif
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* Version Information */ /* Version Information */
#define DRIVER_VERSION "v0.5.4 (2002/04/11)" #define DRIVER_VERSION "v0.5.5 (2002/07/22)"
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>" #define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
#define DRIVER_DESC "rtl8150 based usb-ethernet driver" #define DRIVER_DESC "rtl8150 based usb-ethernet driver"
...@@ -68,11 +68,15 @@ ...@@ -68,11 +68,15 @@
/* Define these values to match your device */ /* Define these values to match your device */
#define VENDOR_ID_REALTEK 0x0bda #define VENDOR_ID_REALTEK 0x0bda
#define VENDOR_ID_MELCO 0x0411
#define PRODUCT_ID_RTL8150 0x8150 #define PRODUCT_ID_RTL8150 0x8150
#define PRODUCT_ID_LUAKTX 0x0012
/* table of devices that work with this driver */ /* table of devices that work with this driver */
static struct usb_device_id rtl8150_table[] = { static struct usb_device_id rtl8150_table[] = {
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)}, {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
{USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
{} {}
}; };
...@@ -729,11 +733,6 @@ static void *rtl8150_probe(struct usb_device *udev, unsigned int ifnum, ...@@ -729,11 +733,6 @@ static void *rtl8150_probe(struct usb_device *udev, unsigned int ifnum,
err("usb_set_configuration() failed"); err("usb_set_configuration() failed");
return NULL; return NULL;
} }
if ((udev->descriptor.idVendor != VENDOR_ID_REALTEK) ||
(udev->descriptor.idProduct != PRODUCT_ID_RTL8150)) {
err("Not the one we are interested about");
return NULL;
}
dev = kmalloc(sizeof(rtl8150_t), GFP_KERNEL); dev = kmalloc(sizeof(rtl8150_t), GFP_KERNEL);
if (!dev) { if (!dev) {
err("Out of memory"); err("Out of memory");
......
...@@ -71,6 +71,7 @@ static struct usb_device_id id_table [] = { ...@@ -71,6 +71,7 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
{ USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
{ USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -19,3 +19,6 @@ ...@@ -19,3 +19,6 @@
#define ELCOM_VENDOR_ID 0x056e #define ELCOM_VENDOR_ID 0x056e
#define ELCOM_PRODUCT_ID 0x5003 #define ELCOM_PRODUCT_ID 0x5003
#define ITEGNO_VENDOR_ID 0x0eba
#define ITEGNO_PRODUCT_ID 0x1080
...@@ -67,11 +67,40 @@ ...@@ -67,11 +67,40 @@
/* parity check flag */ /* parity check flag */
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
/**
* usb_serial_port: structure for the specific ports of a device.
* @magic: magic number for internal validity of this pointer.
* @serial: pointer back to the struct usb_serial owner of this port.
* @tty: pointer to the coresponding tty for this port.
* @number: the number of the port (the minor number).
* @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
* @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
* @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
* for this port.
* @bulk_in_buffer: pointer to the bulk in buffer for this port.
* @read_urb: pointer to the bulk in struct urb for this port.
* @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
* port.
* @bulk_out_buffer: pointer to the bulk out buffer for this port.
* @bulk_out_size: the size of the bulk_out_buffer, in bytes.
* @write_urb: pointer to the bulk out struct urb for this port.
* @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
* port.
* @write_wait: a wait_queue_head_t used by the port.
* @tqueue: task queue for the line discipline waking up.
* @open_count: number of times this port has been opened.
* @sem: struct semaphore used to lock this structure.
* @private: place to put any driver specific information that is needed. The
* usb-serial driver is required to manage this data, the usb-serial core
* will not touch this.
*
* This structure is used by the usb-serial core and drivers for the specific
* ports of a device.
*/
struct usb_serial_port { struct usb_serial_port {
int magic; int magic;
struct usb_serial *serial; /* pointer back to the owner of this port */ struct usb_serial *serial;
struct tty_struct * tty; /* the coresponding tty for this port */ struct tty_struct * tty;
unsigned char number; unsigned char number;
unsigned char * interrupt_in_buffer; unsigned char * interrupt_in_buffer;
...@@ -88,30 +117,44 @@ struct usb_serial_port { ...@@ -88,30 +117,44 @@ struct usb_serial_port {
__u8 bulk_out_endpointAddress; __u8 bulk_out_endpointAddress;
wait_queue_head_t write_wait; wait_queue_head_t write_wait;
struct tq_struct tqueue;
struct tq_struct tqueue; /* task queue for line discipline waking up */ int open_count;
int open_count; /* number of times this port has been opened */ struct semaphore sem;
struct semaphore sem; /* locks this structure */ void * private;
void * private; /* data private to the specific port */
}; };
/**
* usb_serial - structure used by the usb-serial core for a device
* @magic: magic number for internal validity of this pointer.
* @dev: pointer to the struct usb_device for this device
* @type: pointer to the struct usb_serial_device_type for this device
* @interface: pointer to the struct usb_interface for this device
* @minor: the starting minor number for this device
* @num_ports: the number of ports this device has
* @num_interrupt_in: number of interrupt in endpoints we have
* @num_bulk_in: number of bulk in endpoints we have
* @num_bulk_out: number of bulk out endpoints we have
* @vendor: vendor id of this device
* @product: product id of this device
* @port: array of struct usb_serial_port structures for the different ports.
* @private: place to put any driver specific information that is needed. The
* usb-serial driver is required to manage this data, the usb-serial core
* will not touch this.
*/
struct usb_serial { struct usb_serial {
int magic; int magic;
struct usb_device * dev; struct usb_device * dev;
struct usb_serial_device_type * type; /* the type of usb serial device this is */ struct usb_serial_device_type * type;
struct usb_interface * interface; /* the interface for this device */ struct usb_interface * interface;
struct tty_driver * tty_driver; /* the tty_driver for this device */ unsigned char minor;
unsigned char minor; /* the starting minor number for this device */ unsigned char num_ports;
unsigned char num_ports; /* the number of ports this device has */ char num_interrupt_in;
char num_interrupt_in; /* number of interrupt in endpoints we have */ char num_bulk_in;
char num_bulk_in; /* number of bulk in endpoints we have */ char num_bulk_out;
char num_bulk_out; /* number of bulk out endpoints we have */ __u16 vendor;
__u16 vendor; /* vendor id of this device */ __u16 product;
__u16 product; /* product id of this device */
struct usb_serial_port port[MAX_NUM_PORTS]; struct usb_serial_port port[MAX_NUM_PORTS];
void * private;
void * private; /* data private to the specific driver */
}; };
......
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