Commit 047cef32 authored by Linus Torvalds's avatar Linus Torvalds

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

into home.transmeta.com:/home/torvalds/v2.5/linux
parents b6938a7b 23c7f059
...@@ -128,16 +128,6 @@ MODULE PARAMETERS: ...@@ -128,16 +128,6 @@ MODULE PARAMETERS:
programs that expect RGB data (e.g. gqcam) to work with this driver. If programs that expect RGB data (e.g. gqcam) to work with this driver. If
your colors look VERY wrong, you may want to change this. your colors look VERY wrong, you may want to change this.
NAME: buf_timeout (Temporarily disabled. Memory is deallocated immediately)
TYPE: integer
DEFAULT: 5 (seconds)
DESC: Number of seconds before unused frame buffers are deallocated.
Previously, memory was allocated upon open() and deallocated upon
close(). Deallocation now occurs only if the driver is closed and this
timeout is reached. If you are capturing frames less frequently than
the default timeout, increase this. This will not make any difference
with programs that capture multiple frames during an open/close cycle.
NAME: cams NAME: cams
TYPE: integer (1-4 for OV511, 1-31 for OV511+) TYPE: integer (1-4 for OV511, 1-31 for OV511+)
DEFAULT: 1 DEFAULT: 1
...@@ -161,13 +151,6 @@ MODULE PARAMETERS: ...@@ -161,13 +151,6 @@ MODULE PARAMETERS:
DESC: This configures the camera's sensor to transmit a colored test-pattern DESC: This configures the camera's sensor to transmit a colored test-pattern
instead of an image. This does not work correctly yet. instead of an image. This does not work correctly yet.
NAME: sensor_gbr (*** TEMPORARILY DISABLED ***)
TYPE: integer (Boolean)
DEFAULT: 0
DESC: This makes the sensor output GBR422 instead of YUV420. This saves the
driver the trouble of converting YUV to RGB, but it currently does not
work very well (the colors are not quite right)
NAME: dumppix NAME: dumppix
TYPE: integer (0-2) TYPE: integer (0-2)
DEFAULT: 0 DEFAULT: 0
...@@ -259,14 +242,6 @@ MODULE PARAMETERS: ...@@ -259,14 +242,6 @@ MODULE PARAMETERS:
13 VIDEO_PALETTE_YUV422P (YUV 4:2:2 Planar) 13 VIDEO_PALETTE_YUV422P (YUV 4:2:2 Planar)
15 VIDEO_PALETTE_YUV420P (YUV 4:2:0 Planar, same as 10) 15 VIDEO_PALETTE_YUV420P (YUV 4:2:0 Planar, same as 10)
NAME: tuner
TYPE: integer
DEFAULT: -1 (autodetect)
DESC: This sets the exact type of the tuner module in a device. This is set
automatically based on the custom ID of the OV511 device. In cases
where this fails, you can override this auto-detection. Please see
linux/drivers/media/video/tuner.h for a complete list.
NAME: backlight NAME: backlight
TYPE: integer (Boolean) TYPE: integer (Boolean)
DEFAULT: 0 (off) DEFAULT: 0 (off)
......
...@@ -2091,11 +2091,11 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign ...@@ -2091,11 +2091,11 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign
} }
static /*const*/ struct file_operations usb_mixer_fops = { static /*const*/ struct file_operations usb_mixer_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
llseek: no_llseek, .llseek = no_llseek,
ioctl: usb_audio_ioctl_mixdev, .ioctl = usb_audio_ioctl_mixdev,
open: usb_audio_open_mixdev, .open = usb_audio_open_mixdev,
release: usb_audio_release_mixdev, .release = usb_audio_release_mixdev,
}; };
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -2727,15 +2727,15 @@ static int usb_audio_release(struct inode *inode, struct file *file) ...@@ -2727,15 +2727,15 @@ static int usb_audio_release(struct inode *inode, struct file *file)
} }
static /*const*/ struct file_operations usb_audio_fops = { static /*const*/ struct file_operations usb_audio_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
llseek: no_llseek, .llseek = no_llseek,
read: usb_audio_read, .read = usb_audio_read,
write: usb_audio_write, .write = usb_audio_write,
poll: usb_audio_poll, .poll = usb_audio_poll,
ioctl: usb_audio_ioctl, .ioctl = usb_audio_ioctl,
mmap: usb_audio_mmap, .mmap = usb_audio_mmap,
open: usb_audio_open, .open = usb_audio_open,
release: usb_audio_release, .release = usb_audio_release,
}; };
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -2753,11 +2753,11 @@ static struct usb_device_id usb_audio_ids [] = { ...@@ -2753,11 +2753,11 @@ static struct usb_device_id usb_audio_ids [] = {
MODULE_DEVICE_TABLE (usb, usb_audio_ids); MODULE_DEVICE_TABLE (usb, usb_audio_ids);
static struct usb_driver usb_audio_driver = { static struct usb_driver usb_audio_driver = {
name: "audio", .name = "audio",
probe: usb_audio_probe, .probe = usb_audio_probe,
disconnect: usb_audio_disconnect, .disconnect = usb_audio_disconnect,
driver_list: LIST_HEAD_INIT(usb_audio_driver.driver_list), .driver_list = LIST_HEAD_INIT(usb_audio_driver.driver_list),
id_table: usb_audio_ids, .id_table = usb_audio_ids,
}; };
static void *find_descriptor(void *descstart, unsigned int desclen, void *after, static void *find_descriptor(void *descstart, unsigned int desclen, void *after,
......
...@@ -234,10 +234,10 @@ static struct usb_device_id usb_bluetooth_ids [] = { ...@@ -234,10 +234,10 @@ static struct usb_device_id usb_bluetooth_ids [] = {
MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids); MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids);
static struct usb_driver usb_bluetooth_driver = { static struct usb_driver usb_bluetooth_driver = {
name: "bluetty", .name = "bluetty",
probe: usb_bluetooth_probe, .probe = usb_bluetooth_probe,
disconnect: usb_bluetooth_disconnect, .disconnect = usb_bluetooth_disconnect,
id_table: usb_bluetooth_ids, .id_table = usb_bluetooth_ids,
}; };
static int bluetooth_refcount; static int bluetooth_refcount;
...@@ -1284,30 +1284,30 @@ static void usb_bluetooth_disconnect(struct usb_device *dev, void *ptr) ...@@ -1284,30 +1284,30 @@ static void usb_bluetooth_disconnect(struct usb_device *dev, void *ptr)
static struct tty_driver bluetooth_tty_driver = { static struct tty_driver bluetooth_tty_driver = {
magic: TTY_DRIVER_MAGIC, .magic = TTY_DRIVER_MAGIC,
driver_name: "usb-bluetooth", .driver_name = "usb-bluetooth",
name: "usb/ttub/%d", .name = "usb/ttub/%d",
major: BLUETOOTH_TTY_MAJOR, .major = BLUETOOTH_TTY_MAJOR,
minor_start: 0, .minor_start = 0,
num: BLUETOOTH_TTY_MINORS, .num = BLUETOOTH_TTY_MINORS,
type: TTY_DRIVER_TYPE_SERIAL, .type = TTY_DRIVER_TYPE_SERIAL,
subtype: SERIAL_TYPE_NORMAL, .subtype = SERIAL_TYPE_NORMAL,
flags: TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS, .flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
refcount: &bluetooth_refcount, .refcount = &bluetooth_refcount,
table: bluetooth_tty, .table = bluetooth_tty,
termios: bluetooth_termios, .termios = bluetooth_termios,
termios_locked: bluetooth_termios_locked, .termios_locked = bluetooth_termios_locked,
open: bluetooth_open, .open = bluetooth_open,
close: bluetooth_close, .close = bluetooth_close,
write: bluetooth_write, .write = bluetooth_write,
write_room: bluetooth_write_room, .write_room = bluetooth_write_room,
ioctl: bluetooth_ioctl, .ioctl = bluetooth_ioctl,
set_termios: bluetooth_set_termios, .set_termios = bluetooth_set_termios,
throttle: bluetooth_throttle, .throttle = bluetooth_throttle,
unthrottle: bluetooth_unthrottle, .unthrottle = bluetooth_unthrottle,
chars_in_buffer: bluetooth_chars_in_buffer, .chars_in_buffer = bluetooth_chars_in_buffer,
}; };
......
...@@ -683,10 +683,10 @@ static struct usb_device_id acm_ids[] = { ...@@ -683,10 +683,10 @@ static struct usb_device_id acm_ids[] = {
MODULE_DEVICE_TABLE (usb, acm_ids); MODULE_DEVICE_TABLE (usb, acm_ids);
static struct usb_driver acm_driver = { static struct usb_driver acm_driver = {
name: "acm", .name = "acm",
probe: acm_probe, .probe = acm_probe,
disconnect: acm_disconnect, .disconnect = acm_disconnect,
id_table: acm_ids, .id_table = acm_ids,
}; };
/* /*
...@@ -700,32 +700,32 @@ static struct termios *acm_tty_termios[ACM_TTY_MINORS]; ...@@ -700,32 +700,32 @@ static struct termios *acm_tty_termios[ACM_TTY_MINORS];
static struct termios *acm_tty_termios_locked[ACM_TTY_MINORS]; static struct termios *acm_tty_termios_locked[ACM_TTY_MINORS];
static struct tty_driver acm_tty_driver = { static struct tty_driver acm_tty_driver = {
magic: TTY_DRIVER_MAGIC, .magic = TTY_DRIVER_MAGIC,
driver_name: "acm", .driver_name = "acm",
name: "usb/acm/%d", .name = "usb/acm/%d",
major: ACM_TTY_MAJOR, .major = ACM_TTY_MAJOR,
minor_start: 0, .minor_start = 0,
num: ACM_TTY_MINORS, .num = ACM_TTY_MINORS,
type: TTY_DRIVER_TYPE_SERIAL, .type = TTY_DRIVER_TYPE_SERIAL,
subtype: SERIAL_TYPE_NORMAL, .subtype = SERIAL_TYPE_NORMAL,
flags: TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS, .flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
refcount: &acm_tty_refcount, .refcount = &acm_tty_refcount,
table: acm_tty_table, .table = acm_tty_table,
termios: acm_tty_termios, .termios = acm_tty_termios,
termios_locked: acm_tty_termios_locked, .termios_locked = acm_tty_termios_locked,
open: acm_tty_open, .open = acm_tty_open,
close: acm_tty_close, .close = acm_tty_close,
write: acm_tty_write, .write = acm_tty_write,
write_room: acm_tty_write_room, .write_room = acm_tty_write_room,
ioctl: acm_tty_ioctl, .ioctl = acm_tty_ioctl,
throttle: acm_tty_throttle, .throttle = acm_tty_throttle,
unthrottle: acm_tty_unthrottle, .unthrottle = acm_tty_unthrottle,
chars_in_buffer: acm_tty_chars_in_buffer, .chars_in_buffer = acm_tty_chars_in_buffer,
break_ctl: acm_tty_break_ctl, .break_ctl = acm_tty_break_ctl,
set_termios: acm_tty_set_termios .set_termios = acm_tty_set_termios
}; };
/* /*
......
...@@ -655,7 +655,10 @@ static ssize_t usblp_write(struct file *file, const char *buffer, size_t count, ...@@ -655,7 +655,10 @@ static ssize_t usblp_write(struct file *file, const char *buffer, size_t count,
(count - writecount) : USBLP_BUF_SIZE; (count - writecount) : USBLP_BUF_SIZE;
if (copy_from_user(usblp->writeurb->transfer_buffer, buffer + writecount, if (copy_from_user(usblp->writeurb->transfer_buffer, buffer + writecount,
usblp->writeurb->transfer_buffer_length)) return -EFAULT; usblp->writeurb->transfer_buffer_length)) {
up(&usblp->sem);
return writecount ? writecount : -EFAULT;
}
usblp->writeurb->dev = usblp->dev; usblp->writeurb->dev = usblp->dev;
usblp->wcomplete = 0; usblp->wcomplete = 0;
...@@ -783,13 +786,13 @@ static unsigned int usblp_quirks (__u16 vendor, __u16 product) ...@@ -783,13 +786,13 @@ static unsigned int usblp_quirks (__u16 vendor, __u16 product)
} }
static struct file_operations usblp_fops = { static struct file_operations usblp_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
read: usblp_read, .read = usblp_read,
write: usblp_write, .write = usblp_write,
poll: usblp_poll, .poll = usblp_poll,
ioctl: usblp_ioctl, .ioctl = usblp_ioctl,
open: usblp_open, .open = usblp_open,
release: usblp_release, .release = usblp_release,
}; };
static void *usblp_probe(struct usb_device *dev, unsigned int ifnum, static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
...@@ -1097,11 +1100,11 @@ static struct usb_device_id usblp_ids [] = { ...@@ -1097,11 +1100,11 @@ static struct usb_device_id usblp_ids [] = {
MODULE_DEVICE_TABLE (usb, usblp_ids); MODULE_DEVICE_TABLE (usb, usblp_ids);
static struct usb_driver usblp_driver = { static struct usb_driver usblp_driver = {
owner: THIS_MODULE, .owner = THIS_MODULE,
name: "usblp", .name = "usblp",
probe: usblp_probe, .probe = usblp_probe,
disconnect: usblp_disconnect, .disconnect = usblp_disconnect,
id_table: usblp_ids, .id_table = usblp_ids,
}; };
static int __init usblp_init(void) static int __init usblp_init(void)
......
...@@ -988,12 +988,12 @@ static int usb_midi_release(struct inode *inode, struct file *file) ...@@ -988,12 +988,12 @@ static int usb_midi_release(struct inode *inode, struct file *file)
} }
static struct file_operations usb_midi_fops = { static struct file_operations usb_midi_fops = {
llseek: usb_midi_llseek, .llseek = usb_midi_llseek,
read: usb_midi_read, .read = usb_midi_read,
write: usb_midi_write, .write = usb_midi_write,
poll: usb_midi_poll, .poll = usb_midi_poll,
open: usb_midi_open, .open = usb_midi_open,
release: usb_midi_release, .release = usb_midi_release,
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
...@@ -2095,11 +2095,11 @@ static void usb_midi_disconnect(struct usb_device *dev, void *ptr) ...@@ -2095,11 +2095,11 @@ static void usb_midi_disconnect(struct usb_device *dev, void *ptr)
static struct usb_driver usb_midi_driver = { static struct usb_driver usb_midi_driver = {
name: "midi", .name = "midi",
probe: usb_midi_probe, .probe = usb_midi_probe,
disconnect: usb_midi_disconnect, .disconnect = usb_midi_disconnect,
id_table: NULL, /* check all devices */ .id_table = NULL, /* check all devices */
driver_list: LIST_HEAD_INIT(usb_midi_driver.driver_list) .driver_list = LIST_HEAD_INIT(usb_midi_driver.driver_list)
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
...@@ -2168,15 +2168,15 @@ static void snd_usb_midi_output_trigger(snd_rawmidi_substream_t * substream, ...@@ -2168,15 +2168,15 @@ static void snd_usb_midi_output_trigger(snd_rawmidi_substream_t * substream,
static snd_rawmidi_ops_t snd_usbmidi_output = static snd_rawmidi_ops_t snd_usbmidi_output =
{ {
open: snd_usbmidi_output_open, .open = snd_usbmidi_output_open,
close: snd_usbmidi_output_close, .close = snd_usbmidi_output_close,
trigger: snd_usbmidi_output_trigger, .trigger = snd_usbmidi_output_trigger,
}; };
static snd_rawmidi_ops_t snd_usbmidi_input = static snd_rawmidi_ops_t snd_usbmidi_input =
{ {
open: snd_usbmidi_input_open, .open = snd_usbmidi_input_open,
close: snd_usbmidi_input_close, .close = snd_usbmidi_input_close,
trigger: snd_usbmidi_input_trigger, .trigger = snd_usbmidi_input_trigger,
}; };
int snd_usbmidi_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rrawmidi) int snd_usbmidi_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rrawmidi)
...@@ -2211,7 +2211,7 @@ int snd_usbmidi_create( snd_card_t * card, ...@@ -2211,7 +2211,7 @@ int snd_usbmidi_create( snd_card_t * card,
int err, idx; int err, idx;
snd_region_t *region; snd_region_t *region;
static snd_device_opt_t ops = { static snd_device_opt_t ops = {
dev_free: snd_usbmidi_dev_free, .dev_free = snd_usbmidi_dev_free,
}; };
*rchip = NULL; *rchip = NULL;
......
...@@ -152,8 +152,8 @@ static const struct class_info clas_info[] = ...@@ -152,8 +152,8 @@ static const struct class_info clas_info[] =
void usbdevfs_conn_disc_event(void) void usbdevfs_conn_disc_event(void)
{ {
wake_up(&deviceconndiscwq);
conndiscevcnt++; conndiscevcnt++;
wake_up(&deviceconndiscwq);
} }
static const char *class_decode(const int class) static const char *class_decode(const int class)
...@@ -239,6 +239,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, const struct ...@@ -239,6 +239,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, const struct
if (start > end) if (start > end)
return start; return start;
lock_kernel(); /* driver might be unloaded */
start += sprintf(start, format_iface, start += sprintf(start, format_iface,
desc->bInterfaceNumber, desc->bInterfaceNumber,
desc->bAlternateSetting, desc->bAlternateSetting,
...@@ -248,6 +249,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, const struct ...@@ -248,6 +249,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, const struct
desc->bInterfaceSubClass, desc->bInterfaceSubClass,
desc->bInterfaceProtocol, desc->bInterfaceProtocol,
iface->driver ? iface->driver->name : "(none)"); iface->driver ? iface->driver->name : "(none)");
unlock_kernel();
return start; return start;
} }
...@@ -597,6 +599,13 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct ...@@ -597,6 +599,13 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
unlock_kernel(); unlock_kernel();
return POLLIN; return POLLIN;
} }
/* we may have dropped BKL - need to check for having lost the race */
if (file->private_data) {
kfree(st);
goto lost_race;
}
/* /*
* need to prevent the module from being unloaded, since * need to prevent the module from being unloaded, since
* proc_unregister does not call the release method and * proc_unregister does not call the release method and
...@@ -606,6 +615,7 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct ...@@ -606,6 +615,7 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
file->private_data = st; file->private_data = st;
mask = POLLIN; mask = POLLIN;
} }
lost_race:
if (file->f_mode & FMODE_READ) if (file->f_mode & FMODE_READ)
poll_wait(file, &deviceconndiscwq, wait); poll_wait(file, &deviceconndiscwq, wait);
if (st->lastev != conndiscevcnt) if (st->lastev != conndiscevcnt)
...@@ -656,9 +666,9 @@ static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig) ...@@ -656,9 +666,9 @@ static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig)
} }
struct file_operations usbdevfs_devices_fops = { struct file_operations usbdevfs_devices_fops = {
llseek: usb_device_lseek, .llseek = usb_device_lseek,
read: usb_device_read, .read = usb_device_read,
poll: usb_device_poll, .poll = usb_device_poll,
open: usb_device_open, .open = usb_device_open,
release: usb_device_release, .release = usb_device_release,
}; };
...@@ -324,9 +324,9 @@ static void driver_disconnect(struct usb_device *dev, void *context) ...@@ -324,9 +324,9 @@ static void driver_disconnect(struct usb_device *dev, void *context)
} }
struct usb_driver usbdevfs_driver = { struct usb_driver usbdevfs_driver = {
name: "usbfs", .name = "usbfs",
probe: driver_probe, .probe = driver_probe,
disconnect: driver_disconnect, .disconnect = driver_disconnect,
}; };
static int claimintf(struct dev_state *ps, unsigned int intf) static int claimintf(struct dev_state *ps, unsigned int intf)
...@@ -361,14 +361,14 @@ static int releaseintf(struct dev_state *ps, unsigned int intf) ...@@ -361,14 +361,14 @@ static int releaseintf(struct dev_state *ps, unsigned int intf)
if (intf >= 8*sizeof(ps->ifclaimed)) if (intf >= 8*sizeof(ps->ifclaimed))
return -EINVAL; return -EINVAL;
err = -EINVAL; err = -EINVAL;
lock_kernel();
dev = ps->dev; dev = ps->dev;
down(&dev->serialize);
if (dev && test_and_clear_bit(intf, &ps->ifclaimed)) { if (dev && test_and_clear_bit(intf, &ps->ifclaimed)) {
iface = &dev->actconfig->interface[intf]; iface = &dev->actconfig->interface[intf];
usb_driver_release_interface(&usbdevfs_driver, iface); usb_driver_release_interface(&usbdevfs_driver, iface);
err = 0; err = 0;
} }
unlock_kernel(); up(&dev->serialize);
return err; return err;
} }
...@@ -722,14 +722,11 @@ static int proc_resetdevice(struct dev_state *ps) ...@@ -722,14 +722,11 @@ static int proc_resetdevice(struct dev_state *ps)
if (test_bit(i, &ps->ifclaimed)) if (test_bit(i, &ps->ifclaimed))
continue; continue;
if (intf->driver) { lock_kernel();
const struct usb_device_id *id; if (intf->driver && ps->dev) {
down(&intf->driver->serialize); usb_bind_driver(intf->driver,ps->dev, i);
intf->driver->disconnect(ps->dev, intf->private_data);
id = usb_match_id(ps->dev,intf,intf->driver->id_table);
intf->driver->probe(ps->dev, i, id);
up(&intf->driver->serialize);
} }
unlock_kernel();
} }
return 0; return 0;
...@@ -1092,16 +1089,17 @@ static int proc_ioctl (struct dev_state *ps, void *arg) ...@@ -1092,16 +1089,17 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
/* disconnect kernel driver from interface, leaving it unbound. */ /* disconnect kernel driver from interface, leaving it unbound. */
case USBDEVFS_DISCONNECT: case USBDEVFS_DISCONNECT:
/* this function is voodoo. without locking it is a maybe thing */
lock_kernel();
driver = ifp->driver; driver = ifp->driver;
if (driver) { if (driver) {
down (&driver->serialize);
dbg ("disconnect '%s' from dev %d interface %d", dbg ("disconnect '%s' from dev %d interface %d",
driver->name, ps->dev->devnum, ctrl.ifno); driver->name, ps->dev->devnum, ctrl.ifno);
driver->disconnect (ps->dev, ifp->private_data); usb_unbind_driver(ps->dev, ifp);
usb_driver_release_interface (driver, ifp); usb_driver_release_interface (driver, ifp);
up (&driver->serialize);
} else } else
retval = -EINVAL; retval = -EINVAL;
unlock_kernel();
break; break;
/* let kernel drivers try to (re)bind to the interface */ /* let kernel drivers try to (re)bind to the interface */
...@@ -1111,18 +1109,28 @@ static int proc_ioctl (struct dev_state *ps, void *arg) ...@@ -1111,18 +1109,28 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
/* talk directly to the interface's driver */ /* talk directly to the interface's driver */
default: default:
lock_kernel(); /* against module unload */
driver = ifp->driver; driver = ifp->driver;
if (driver == 0 || driver->ioctl == 0) if (driver == 0 || driver->ioctl == 0) {
unlock_kernel();
retval = -ENOSYS; retval = -ENOSYS;
else { } else {
if (ifp->driver->owner) if (ifp->driver->owner) {
__MOD_INC_USE_COUNT(ifp->driver->owner); __MOD_INC_USE_COUNT(ifp->driver->owner);
unlock_kernel();
}
/* ifno might usefully be passed ... */ /* ifno might usefully be passed ... */
retval = driver->ioctl (ps->dev, ctrl.ioctl_code, buf); retval = driver->ioctl (ps->dev, ctrl.ioctl_code, buf);
/* size = min_t(int, size, retval)? */ /* size = min_t(int, size, retval)? */
if (ifp->driver->owner) if (ifp->driver->owner) {
__MOD_DEC_USE_COUNT(ifp->driver->owner); __MOD_DEC_USE_COUNT(ifp->driver->owner);
} else {
unlock_kernel();
}
} }
if (retval == -ENOIOCTLCMD)
retval = -ENOTTY;
} }
/* cleanup and return */ /* cleanup and return */
...@@ -1139,7 +1147,7 @@ static int proc_ioctl (struct dev_state *ps, void *arg) ...@@ -1139,7 +1147,7 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct dev_state *ps = (struct dev_state *)file->private_data; struct dev_state *ps = (struct dev_state *)file->private_data;
int ret = -ENOIOCTLCMD; int ret = -ENOTTY;
if (!(file->f_mode & FMODE_WRITE)) if (!(file->f_mode & FMODE_WRITE))
return -EPERM; return -EPERM;
...@@ -1248,10 +1256,10 @@ static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wai ...@@ -1248,10 +1256,10 @@ static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wai
} }
struct file_operations usbdevfs_device_file_operations = { struct file_operations usbdevfs_device_file_operations = {
llseek: usbdev_lseek, .llseek = usbdev_lseek,
read: usbdev_read, .read = usbdev_read,
poll: usbdev_poll, .poll = usbdev_poll,
ioctl: usbdev_ioctl, .ioctl = usbdev_ioctl,
open: usbdev_open, .open = usbdev_open,
release: usbdev_release, .release = usbdev_release,
}; };
...@@ -66,6 +66,7 @@ static ssize_t usb_driver_read(struct file *file, char *buf, size_t nbytes, loff ...@@ -66,6 +66,7 @@ static ssize_t usb_driver_read(struct file *file, char *buf, size_t nbytes, loff
start = page; start = page;
end = page + (PAGE_SIZE - 100); end = page + (PAGE_SIZE - 100);
pos = *ppos; pos = *ppos;
lock_kernel(); /* else drivers might be unloaded */
for (; tmp != &usb_driver_list; tmp = tmp->next) { for (; tmp != &usb_driver_list; tmp = tmp->next) {
struct usb_driver *driver = list_entry(tmp, struct usb_driver, driver_list); struct usb_driver *driver = list_entry(tmp, struct usb_driver, driver_list);
int minor = driver->fops ? driver->minor : -1; int minor = driver->fops ? driver->minor : -1;
...@@ -80,6 +81,7 @@ static ssize_t usb_driver_read(struct file *file, char *buf, size_t nbytes, loff ...@@ -80,6 +81,7 @@ static ssize_t usb_driver_read(struct file *file, char *buf, size_t nbytes, loff
break; break;
} }
} }
unlock_kernel();
if (start == page) if (start == page)
start += sprintf(start, "(none)\n"); start += sprintf(start, "(none)\n");
len = start - page; len = start - page;
...@@ -120,6 +122,6 @@ static loff_t usb_driver_lseek(struct file * file, loff_t offset, int orig) ...@@ -120,6 +122,6 @@ static loff_t usb_driver_lseek(struct file * file, loff_t offset, int orig)
} }
struct file_operations usbdevfs_drivers_fops = { struct file_operations usbdevfs_drivers_fops = {
llseek: usb_driver_lseek, .llseek = usb_driver_lseek,
read: usb_driver_read, .read = usb_driver_read,
}; };
...@@ -44,10 +44,13 @@ static int usb_open(struct inode * inode, struct file * file) ...@@ -44,10 +44,13 @@ static int usb_open(struct inode * inode, struct file * file)
spin_lock (&minor_lock); spin_lock (&minor_lock);
c = usb_minors[minor]; c = usb_minors[minor];
spin_unlock (&minor_lock);
if (!c || !(new_fops = fops_get(c))) if (!c || !(new_fops = fops_get(c))) {
spin_unlock(&minor_lock);
return err; return err;
}
spin_unlock(&minor_lock);
old_fops = file->f_op; old_fops = file->f_op;
file->f_op = new_fops; file->f_op = new_fops;
/* Curiouser and curiouser... NULL ->open() as "no device" ? */ /* Curiouser and curiouser... NULL ->open() as "no device" ? */
...@@ -62,8 +65,8 @@ static int usb_open(struct inode * inode, struct file * file) ...@@ -62,8 +65,8 @@ static int usb_open(struct inode * inode, struct file * file)
} }
static struct file_operations usb_fops = { static struct file_operations usb_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
open: usb_open, .open = usb_open,
}; };
int usb_major_init(void) int usb_major_init(void)
......
...@@ -1240,11 +1240,11 @@ static int hcd_free_dev (struct usb_device *udev) ...@@ -1240,11 +1240,11 @@ static int hcd_free_dev (struct usb_device *udev)
* bus glue for non-PCI system busses will need to use this. * bus glue for non-PCI system busses will need to use this.
*/ */
struct usb_operations usb_hcd_operations = { struct usb_operations usb_hcd_operations = {
allocate: hcd_alloc_dev, .allocate = hcd_alloc_dev,
get_frame_number: hcd_get_frame_number, .get_frame_number = hcd_get_frame_number,
submit_urb: hcd_submit_urb, .submit_urb = hcd_submit_urb,
unlink_urb: hcd_unlink_urb, .unlink_urb = hcd_unlink_urb,
deallocate: hcd_free_dev, .deallocate = hcd_free_dev,
}; };
EXPORT_SYMBOL (usb_hcd_operations); EXPORT_SYMBOL (usb_hcd_operations);
......
...@@ -1046,8 +1046,6 @@ static void usb_hub_events(void) ...@@ -1046,8 +1046,6 @@ static void usb_hub_events(void)
static int usb_hub_thread(void *__hub) static int usb_hub_thread(void *__hub)
{ {
lock_kernel();
/* /*
* This thread doesn't need any user-level access, * This thread doesn't need any user-level access,
* so get rid of all our resources * so get rid of all our resources
...@@ -1067,8 +1065,6 @@ static int usb_hub_thread(void *__hub) ...@@ -1067,8 +1065,6 @@ static int usb_hub_thread(void *__hub)
} while (!signal_pending(current)); } while (!signal_pending(current));
dbg("usb_hub_thread exiting"); dbg("usb_hub_thread exiting");
unlock_kernel();
complete_and_exit(&khubd_exited, 0); complete_and_exit(&khubd_exited, 0);
} }
...@@ -1083,11 +1079,11 @@ static struct usb_device_id hub_id_table [] = { ...@@ -1083,11 +1079,11 @@ static struct usb_device_id hub_id_table [] = {
MODULE_DEVICE_TABLE (usb, hub_id_table); MODULE_DEVICE_TABLE (usb, hub_id_table);
static struct usb_driver hub_driver = { static struct usb_driver hub_driver = {
name: "hub", .name = "hub",
probe: hub_probe, .probe = hub_probe,
ioctl: hub_ioctl, .ioctl = hub_ioctl,
disconnect: hub_disconnect, .disconnect = hub_disconnect,
id_table: hub_id_table, .id_table = hub_id_table,
}; };
/* /*
......
...@@ -284,23 +284,23 @@ static int default_open (struct inode *inode, struct file *filp) ...@@ -284,23 +284,23 @@ static int default_open (struct inode *inode, struct file *filp)
} }
static struct file_operations default_file_operations = { static struct file_operations default_file_operations = {
read: default_read_file, .read = default_read_file,
write: default_write_file, .write = default_write_file,
open: default_open, .open = default_open,
llseek: default_file_lseek, .llseek = default_file_lseek,
}; };
static struct inode_operations usbfs_dir_inode_operations = { static struct inode_operations usbfs_dir_inode_operations = {
create: usbfs_create, .create = usbfs_create,
lookup: simple_lookup, .lookup = simple_lookup,
unlink: usbfs_unlink, .unlink = usbfs_unlink,
mkdir: usbfs_mkdir, .mkdir = usbfs_mkdir,
rmdir: usbfs_rmdir, .rmdir = usbfs_rmdir,
}; };
static struct super_operations usbfs_ops = { static struct super_operations usbfs_ops = {
statfs: simple_statfs, .statfs = simple_statfs,
drop_inode: generic_delete_inode, .drop_inode = generic_delete_inode,
}; };
static int usbfs_fill_super(struct super_block *sb, void *data, int silent) static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
...@@ -468,17 +468,17 @@ static struct super_block *usb_get_sb(struct file_system_type *fs_type, ...@@ -468,17 +468,17 @@ static struct super_block *usb_get_sb(struct file_system_type *fs_type,
} }
static struct file_system_type usbdevice_fs_type = { static struct file_system_type usbdevice_fs_type = {
owner: THIS_MODULE, .owner = THIS_MODULE,
name: "usbdevfs", .name = "usbdevfs",
get_sb: usb_get_sb, .get_sb = usb_get_sb,
kill_sb: kill_anon_super, .kill_sb = kill_anon_super,
}; };
static struct file_system_type usb_fs_type = { static struct file_system_type usb_fs_type = {
owner: THIS_MODULE, .owner = THIS_MODULE,
name: "usbfs", .name = "usbfs",
get_sb: usb_get_sb, .get_sb = usb_get_sb,
kill_sb: kill_anon_super, .kill_sb = kill_anon_super,
}; };
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/smp_lock.h>
#ifdef CONFIG_USB_DEBUG #ifdef CONFIG_USB_DEBUG
#define DEBUG #define DEBUG
...@@ -117,6 +118,108 @@ void usb_scan_devices(void) ...@@ -117,6 +118,108 @@ void usb_scan_devices(void)
up (&usb_bus_list_lock); up (&usb_bus_list_lock);
} }
/**
* usb_unbind_driver - disconnects a driver from a device
* @device: usb device to be disconnected
* @intf: interface of the device to be disconnected
* Context: BKL held
*
* Handles module usage count correctly
*/
void usb_unbind_driver(struct usb_device *device, struct usb_interface *intf)
{
struct usb_driver *driver;
void *priv;
int m;
driver = intf->driver;
priv = intf->private_data;
if (!driver)
return;
/* as soon as we increase the module use count we drop the BKL
before that we must not sleep */
if (driver->owner) {
m = try_inc_mod_count(driver->owner);
if (m == 0) {
err("Dieing driver still bound to device.\n");
return;
}
unlock_kernel();
}
down(&driver->serialize); /* if we sleep here on an umanaged driver
the holder of the lock guards against
module unload */
driver->disconnect(device, priv);
up(&driver->serialize);
if (driver->owner) {
lock_kernel();
__MOD_DEC_USE_COUNT(driver->owner);
}
}
/**
* usb_bind_driver - connect a driver to a device's interface
* @driver: device driver to be bound to a devices interface
* @dev: device to be bound
* @ifnum: index number of the interface to be used
*
* Does a save binding of a driver to a device's interface
* Returns a pointer to the drivers private description of the binding
*/
void *usb_bind_driver(struct usb_driver *driver, struct usb_device *dev, unsigned int ifnum)
{
int i,m;
void *private = NULL;
const struct usb_device_id *id;
struct usb_interface *interface;
if (driver->owner) {
m = try_inc_mod_count(driver->owner);
if (m == 0)
return NULL; /* this horse is dead - don't ride*/
unlock_kernel();
}
interface = &dev->actconfig->interface[ifnum];
id = driver->id_table;
/* new style driver? */
if (id) {
for (i = 0; i < interface->num_altsetting; i++) {
interface->act_altsetting = i;
id = usb_match_id(dev, interface, id);
if (id) {
down(&driver->serialize);
private = driver->probe(dev,ifnum,id);
up(&driver->serialize);
if (private != NULL)
break;
}
}
/* if driver not bound, leave defaults unchanged */
if (private == NULL)
interface->act_altsetting = 0;
} else { /* "old style" driver */
down(&driver->serialize);
private = driver->probe(dev, ifnum, NULL);
up(&driver->serialize);
}
if (driver->owner) {
lock_kernel();
__MOD_DEC_USE_COUNT(driver->owner);
}
return private;
}
/* /*
* This function is part of a depth-first search down the device tree, * This function is part of a depth-first search down the device tree,
* removing any instances of a device driver. * removing any instances of a device driver.
...@@ -141,13 +244,7 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev) ...@@ -141,13 +244,7 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev)
struct usb_interface *interface = &dev->actconfig->interface[i]; struct usb_interface *interface = &dev->actconfig->interface[i];
if (interface->driver == driver) { if (interface->driver == driver) {
if (driver->owner) usb_unbind_driver(dev, interface);
__MOD_INC_USE_COUNT(driver->owner);
down(&driver->serialize);
driver->disconnect(dev, interface->private_data);
up(&driver->serialize);
if (driver->owner)
__MOD_DEC_USE_COUNT(driver->owner);
/* if driver->disconnect didn't release the interface */ /* if driver->disconnect didn't release the interface */
if (interface->driver) if (interface->driver)
usb_driver_release_interface(driver, interface); usb_driver_release_interface(driver, interface);
...@@ -163,7 +260,7 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev) ...@@ -163,7 +260,7 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev)
/** /**
* usb_deregister - unregister a USB driver * usb_deregister - unregister a USB driver
* @driver: USB operations of the driver to unregister * @driver: USB operations of the driver to unregister
* Context: !in_interrupt () * Context: !in_interrupt (), must be called with BKL held
* *
* Unlinks the specified driver from the internal USB driver list. * Unlinks the specified driver from the internal USB driver list.
* *
...@@ -528,9 +625,7 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum) ...@@ -528,9 +625,7 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum)
struct list_head *tmp; struct list_head *tmp;
struct usb_interface *interface; struct usb_interface *interface;
void *private; void *private;
const struct usb_device_id *id;
struct usb_driver *driver; struct usb_driver *driver;
int i;
if ((!dev) || (ifnum >= dev->actconfig->bNumInterfaces)) { if ((!dev) || (ifnum >= dev->actconfig->bNumInterfaces)) {
err("bad find_interface_driver params"); err("bad find_interface_driver params");
...@@ -545,37 +640,12 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum) ...@@ -545,37 +640,12 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum)
goto out_err; goto out_err;
private = NULL; private = NULL;
lock_kernel();
for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) { for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) {
driver = list_entry(tmp, struct usb_driver, driver_list); driver = list_entry(tmp, struct usb_driver, driver_list);
tmp = tmp->next; tmp = tmp->next;
if (driver->owner) private = usb_bind_driver(driver, dev, ifnum);
__MOD_INC_USE_COUNT(driver->owner);
id = driver->id_table;
/* new style driver? */
if (id) {
for (i = 0; i < interface->num_altsetting; i++) {
interface->act_altsetting = i;
id = usb_match_id(dev, interface, id);
if (id) {
down(&driver->serialize);
private = driver->probe(dev,ifnum,id);
up(&driver->serialize);
if (private != NULL)
break;
}
}
/* if driver not bound, leave defaults unchanged */
if (private == NULL)
interface->act_altsetting = 0;
} else { /* "old style" driver */
down(&driver->serialize);
private = driver->probe(dev, ifnum, NULL);
up(&driver->serialize);
}
if (driver->owner)
__MOD_DEC_USE_COUNT(driver->owner);
/* probe() may have changed the config on us */ /* probe() may have changed the config on us */
interface = dev->actconfig->interface + ifnum; interface = dev->actconfig->interface + ifnum;
...@@ -583,9 +653,11 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum) ...@@ -583,9 +653,11 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum)
if (private) { if (private) {
usb_driver_claim_interface(driver, interface, private); usb_driver_claim_interface(driver, interface, private);
up(&dev->serialize); up(&dev->serialize);
unlock_kernel();
return 0; return 0;
} }
} }
unlock_kernel();
out_err: out_err:
up(&dev->serialize); up(&dev->serialize);
...@@ -764,9 +836,9 @@ show_config (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -764,9 +836,9 @@ show_config (struct device *dev, char *buf, size_t count, loff_t off)
return sprintf (buf, "%u\n", udev->actconfig->bConfigurationValue); return sprintf (buf, "%u\n", udev->actconfig->bConfigurationValue);
} }
static struct driver_file_entry usb_config_entry = { static struct driver_file_entry usb_config_entry = {
name: "configuration", .name = "configuration",
mode: S_IRUGO, .mode = S_IRUGO,
show: show_config, .show = show_config,
}; };
/* interfaces have one current setting; alternates /* interfaces have one current setting; alternates
...@@ -783,9 +855,9 @@ show_altsetting (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -783,9 +855,9 @@ show_altsetting (struct device *dev, char *buf, size_t count, loff_t off)
return sprintf (buf, "%u\n", interface->altsetting->bAlternateSetting); return sprintf (buf, "%u\n", interface->altsetting->bAlternateSetting);
} }
static struct driver_file_entry usb_altsetting_entry = { static struct driver_file_entry usb_altsetting_entry = {
name: "altsetting", .name = "altsetting",
mode: S_IRUGO, .mode = S_IRUGO,
show: show_altsetting, .show = show_altsetting,
}; };
/* product driverfs file */ /* product driverfs file */
...@@ -804,9 +876,9 @@ static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t ...@@ -804,9 +876,9 @@ static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t
return len+1; return len+1;
} }
static struct driver_file_entry usb_product_entry = { static struct driver_file_entry usb_product_entry = {
name: "product", .name = "product",
mode: S_IRUGO, .mode = S_IRUGO,
show: show_product, .show = show_product,
}; };
/* manufacturer driverfs file */ /* manufacturer driverfs file */
...@@ -826,9 +898,9 @@ show_manufacturer (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -826,9 +898,9 @@ show_manufacturer (struct device *dev, char *buf, size_t count, loff_t off)
return len+1; return len+1;
} }
static struct driver_file_entry usb_manufacturer_entry = { static struct driver_file_entry usb_manufacturer_entry = {
name: "manufacturer", .name = "manufacturer",
mode: S_IRUGO, .mode = S_IRUGO,
show: show_manufacturer, .show = show_manufacturer,
}; };
/* serial number driverfs file */ /* serial number driverfs file */
...@@ -848,9 +920,9 @@ show_serial (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -848,9 +920,9 @@ show_serial (struct device *dev, char *buf, size_t count, loff_t off)
return len+1; return len+1;
} }
static struct driver_file_entry usb_serial_entry = { static struct driver_file_entry usb_serial_entry = {
name: "serial", .name = "serial",
mode: S_IRUGO, .mode = S_IRUGO,
show: show_serial, .show = show_serial,
}; };
/* /*
...@@ -1121,27 +1193,22 @@ void usb_disconnect(struct usb_device **pdev) ...@@ -1121,27 +1193,22 @@ void usb_disconnect(struct usb_device **pdev)
info("USB disconnect on device %d", dev->devnum); info("USB disconnect on device %d", dev->devnum);
lock_kernel();
if (dev->actconfig) { if (dev->actconfig) {
for (i = 0; i < dev->actconfig->bNumInterfaces; i++) { for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *interface = &dev->actconfig->interface[i]; struct usb_interface *interface = &dev->actconfig->interface[i];
struct usb_driver *driver = interface->driver; struct usb_driver *driver = interface->driver;
if (driver) { if (driver) {
if (driver->owner) usb_unbind_driver(dev, interface);
__MOD_INC_USE_COUNT(driver->owner);
down(&driver->serialize);
driver->disconnect(dev, interface->private_data);
up(&driver->serialize);
/* if driver->disconnect didn't release the interface */ /* if driver->disconnect didn't release the interface */
if (interface->driver) if (interface->driver)
usb_driver_release_interface(driver, interface); usb_driver_release_interface(driver, interface);
/* we don't need the driver any longer */
if (driver->owner)
__MOD_DEC_USE_COUNT(driver->owner);
} }
/* remove our device node for this interface */ /* remove our device node for this interface */
put_device(&interface->dev); put_device(&interface->dev);
} }
} }
unlock_kernel();
/* Free up all the children.. */ /* Free up all the children.. */
for (i = 0; i < USB_MAXCHILDREN; i++) { for (i = 0; i < USB_MAXCHILDREN; i++) {
...@@ -1416,7 +1483,7 @@ struct list_head *usb_bus_get_list(void) ...@@ -1416,7 +1483,7 @@ struct list_head *usb_bus_get_list(void)
#endif #endif
struct bus_type usb_bus_type = { struct bus_type usb_bus_type = {
name: "usb", .name = "usb",
}; };
/* /*
...@@ -1475,6 +1542,8 @@ EXPORT_SYMBOL(usb_new_device); ...@@ -1475,6 +1542,8 @@ EXPORT_SYMBOL(usb_new_device);
EXPORT_SYMBOL(usb_reset_device); EXPORT_SYMBOL(usb_reset_device);
EXPORT_SYMBOL(usb_connect); EXPORT_SYMBOL(usb_connect);
EXPORT_SYMBOL(usb_disconnect); EXPORT_SYMBOL(usb_disconnect);
EXPORT_SYMBOL(usb_bind_driver);
EXPORT_SYMBOL(usb_unbind_driver);
EXPORT_SYMBOL(__usb_get_extra_descriptor); EXPORT_SYMBOL(__usb_get_extra_descriptor);
......
...@@ -6,6 +6,5 @@ dep_tristate ' EHCI HCD (USB 2.0) support' CONFIG_USB_EHCI_HCD $CONFIG_USB ...@@ -6,6 +6,5 @@ dep_tristate ' EHCI HCD (USB 2.0) support' CONFIG_USB_EHCI_HCD $CONFIG_USB
dep_tristate ' OHCI HCD support' CONFIG_USB_OHCI_HCD $CONFIG_USB dep_tristate ' OHCI HCD support' CONFIG_USB_OHCI_HCD $CONFIG_USB
dep_tristate ' UHCI HCD (most Intel and VIA) support' CONFIG_USB_UHCI_HCD_ALT $CONFIG_USB dep_tristate ' UHCI HCD (most Intel and VIA) support' CONFIG_USB_UHCI_HCD_ALT $CONFIG_USB
if [ "$CONFIG_ARM" = "y" ]; then if [ "$CONFIG_ARM" = "y" ]; then
dep_tristate ' SA1111 OHCI-compatible host interface support' CONFIG_USB_OHCI_SA1111 $CONFIG_USB
dep_tristate ' SL811HS support' CONFIG_USB_SL811HS $CONFIG_USB dep_tristate ' SL811HS support' CONFIG_USB_SL811HS $CONFIG_USB
fi fi
...@@ -9,8 +9,6 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o ...@@ -9,8 +9,6 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
obj-$(CONFIG_USB_UHCI_HCD_ALT) += uhci-hcd.o obj-$(CONFIG_USB_UHCI_HCD_ALT) += uhci-hcd.o
obj-$(CONFIG_USB_OHCI) += usb-ohci.o usb-ohci-pci.o
obj-$(CONFIG_USB_OHCI_SA1111) += usb-ohci.o usb-ohci-sa1111.o
obj-$(CONFIG_USB_SL811HS) += hc_sl811.o obj-$(CONFIG_USB_SL811HS) += hc_sl811.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -702,47 +702,47 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev) ...@@ -702,47 +702,47 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev)
static const char hcd_name [] = "ehci-hcd"; static const char hcd_name [] = "ehci-hcd";
static const struct hc_driver ehci_driver = { static const struct hc_driver ehci_driver = {
description: hcd_name, .description = hcd_name,
/* /*
* generic hardware linkage * generic hardware linkage
*/ */
irq: ehci_irq, .irq = ehci_irq,
flags: HCD_MEMORY | HCD_USB2, .flags = HCD_MEMORY | HCD_USB2,
/* /*
* basic lifecycle operations * basic lifecycle operations
*/ */
start: ehci_start, .start = ehci_start,
#ifdef CONFIG_PM #ifdef CONFIG_PM
suspend: ehci_suspend, .suspend = ehci_suspend,
resume: ehci_resume, .resume = ehci_resume,
#endif #endif
stop: ehci_stop, .stop = ehci_stop,
/* /*
* memory lifecycle (except per-request) * memory lifecycle (except per-request)
*/ */
hcd_alloc: ehci_hcd_alloc, .hcd_alloc = ehci_hcd_alloc,
hcd_free: ehci_hcd_free, .hcd_free = ehci_hcd_free,
/* /*
* managing i/o requests and associated device resources * managing i/o requests and associated device resources
*/ */
urb_enqueue: ehci_urb_enqueue, .urb_enqueue = ehci_urb_enqueue,
urb_dequeue: ehci_urb_dequeue, .urb_dequeue = ehci_urb_dequeue,
free_config: ehci_free_config, .free_config = ehci_free_config,
/* /*
* scheduling support * scheduling support
*/ */
get_frame_number: ehci_get_frame, .get_frame_number = ehci_get_frame,
/* /*
* root hub support * root hub support
*/ */
hub_status_data: ehci_hub_status_data, .hub_status_data = ehci_hub_status_data,
hub_control: ehci_hub_control, .hub_control = ehci_hub_control,
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -754,15 +754,15 @@ static const struct pci_device_id __devinitdata pci_ids [] = { { ...@@ -754,15 +754,15 @@ static const struct pci_device_id __devinitdata pci_ids [] = { {
/* handle any USB 2.0 EHCI controller */ /* handle any USB 2.0 EHCI controller */
class: ((PCI_CLASS_SERIAL_USB << 8) | 0x20), .class = ((PCI_CLASS_SERIAL_USB << 8) | 0x20),
class_mask: ~0, .class_mask = ~0,
driver_data: (unsigned long) &ehci_driver, .driver_data = (unsigned long) &ehci_driver,
/* no matter who makes it */ /* no matter who makes it */
vendor: PCI_ANY_ID, .vendor = PCI_ANY_ID,
device: PCI_ANY_ID, .device = PCI_ANY_ID,
subvendor: PCI_ANY_ID, .subvendor = PCI_ANY_ID,
subdevice: PCI_ANY_ID, .subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ } }, { /* end: all zeroes */ }
}; };
...@@ -770,15 +770,15 @@ MODULE_DEVICE_TABLE (pci, pci_ids); ...@@ -770,15 +770,15 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
/* pci driver glue; this is a "new style" PCI driver module */ /* pci driver glue; this is a "new style" PCI driver module */
static struct pci_driver ehci_pci_driver = { static struct pci_driver ehci_pci_driver = {
name: (char *) hcd_name, .name = (char *) hcd_name,
id_table: pci_ids, .id_table = pci_ids,
probe: usb_hcd_pci_probe, .probe = usb_hcd_pci_probe,
remove: usb_hcd_pci_remove, .remove = usb_hcd_pci_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
suspend: usb_hcd_pci_suspend, .suspend = usb_hcd_pci_suspend,
resume: usb_hcd_pci_resume, .resume = usb_hcd_pci_resume,
#endif #endif
}; };
......
...@@ -343,11 +343,11 @@ static int hci_get_current_frame_number (struct usb_device *usb_dev) ...@@ -343,11 +343,11 @@ static int hci_get_current_frame_number (struct usb_device *usb_dev)
**************************************************************************/ **************************************************************************/
static struct usb_operations hci_device_operations = { static struct usb_operations hci_device_operations = {
allocate: hci_alloc_dev, .allocate = hci_alloc_dev,
deallocate: hci_free_dev, .deallocate = hci_free_dev,
get_frame_number: hci_get_current_frame_number, .get_frame_number = hci_get_current_frame_number,
submit_urb: hci_submit_urb, .submit_urb = hci_submit_urb,
unlink_urb: hci_unlink_urb, .unlink_urb = hci_unlink_urb,
}; };
/*************************************************************************** /***************************************************************************
......
...@@ -167,7 +167,7 @@ static int ohci_urb_enqueue ( ...@@ -167,7 +167,7 @@ static int ohci_urb_enqueue (
else if ((urb->transfer_flags & USB_ZERO_PACKET) != 0 else if ((urb->transfer_flags & USB_ZERO_PACKET) != 0
&& (urb->transfer_buffer_length && (urb->transfer_buffer_length
% usb_maxpacket (urb->dev, pipe, % usb_maxpacket (urb->dev, pipe,
usb_pipeout (pipe))) != 0) usb_pipeout (pipe))) == 0)
size++; size++;
break; break;
case PIPE_ISOCHRONOUS: /* number of packets from URB */ case PIPE_ISOCHRONOUS: /* number of packets from URB */
......
...@@ -284,47 +284,47 @@ dbg ("sleeping = %d, disabled = %d", ohci->sleeping, ohci->disabled); ...@@ -284,47 +284,47 @@ dbg ("sleeping = %d, disabled = %d", ohci->sleeping, ohci->disabled);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static const struct hc_driver ohci_pci_hc_driver = { static const struct hc_driver ohci_pci_hc_driver = {
description: hcd_name, .description = hcd_name,
/* /*
* generic hardware linkage * generic hardware linkage
*/ */
irq: ohci_irq, .irq = ohci_irq,
flags: HCD_MEMORY | HCD_USB11, .flags = HCD_MEMORY | HCD_USB11,
/* /*
* basic lifecycle operations * basic lifecycle operations
*/ */
start: ohci_pci_start, .start = ohci_pci_start,
#ifdef CONFIG_PM #ifdef CONFIG_PM
suspend: ohci_pci_suspend, .suspend = ohci_pci_suspend,
resume: ohci_pci_resume, .resume = ohci_pci_resume,
#endif #endif
stop: ohci_stop, .stop = ohci_stop,
/* /*
* memory lifecycle (except per-request) * memory lifecycle (except per-request)
*/ */
hcd_alloc: ohci_hcd_alloc, .hcd_alloc = ohci_hcd_alloc,
hcd_free: ohci_hcd_free, .hcd_free = ohci_hcd_free,
/* /*
* managing i/o requests and associated device resources * managing i/o requests and associated device resources
*/ */
urb_enqueue: ohci_urb_enqueue, .urb_enqueue = ohci_urb_enqueue,
urb_dequeue: ohci_urb_dequeue, .urb_dequeue = ohci_urb_dequeue,
free_config: ohci_free_config, .free_config = ohci_free_config,
/* /*
* scheduling support * scheduling support
*/ */
get_frame_number: ohci_get_frame, .get_frame_number = ohci_get_frame,
/* /*
* root hub support * root hub support
*/ */
hub_status_data: ohci_hub_status_data, .hub_status_data = ohci_hub_status_data,
hub_control: ohci_hub_control, .hub_control = ohci_hub_control,
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -333,15 +333,15 @@ static const struct hc_driver ohci_pci_hc_driver = { ...@@ -333,15 +333,15 @@ static const struct hc_driver ohci_pci_hc_driver = {
static const struct pci_device_id __devinitdata pci_ids [] = { { static const struct pci_device_id __devinitdata pci_ids [] = { {
/* handle any USB OHCI controller */ /* handle any USB OHCI controller */
class: (PCI_CLASS_SERIAL_USB << 8) | 0x10, .class = (PCI_CLASS_SERIAL_USB << 8) | 0x10,
class_mask: ~0, .class_mask = ~0,
driver_data: (unsigned long) &ohci_pci_hc_driver, .driver_data = (unsigned long) &ohci_pci_hc_driver,
/* no matter who makes it */ /* no matter who makes it */
vendor: PCI_ANY_ID, .vendor = PCI_ANY_ID,
device: PCI_ANY_ID, .device = PCI_ANY_ID,
subvendor: PCI_ANY_ID, .subvendor = PCI_ANY_ID,
subdevice: PCI_ANY_ID, .subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ } }, { /* end: all zeroes */ }
}; };
...@@ -349,15 +349,15 @@ MODULE_DEVICE_TABLE (pci, pci_ids); ...@@ -349,15 +349,15 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
/* pci driver glue; this is a "new style" PCI driver module */ /* pci driver glue; this is a "new style" PCI driver module */
static struct pci_driver ohci_pci_driver = { static struct pci_driver ohci_pci_driver = {
name: (char *) hcd_name, .name = (char *) hcd_name,
id_table: pci_ids, .id_table = pci_ids,
probe: usb_hcd_pci_probe, .probe = usb_hcd_pci_probe,
remove: usb_hcd_pci_remove, .remove = usb_hcd_pci_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
suspend: usb_hcd_pci_suspend, .suspend = usb_hcd_pci_suspend,
resume: usb_hcd_pci_resume, .resume = usb_hcd_pci_resume,
#endif #endif
}; };
......
...@@ -288,47 +288,47 @@ ohci_sa1111_start (struct usb_hcd *hcd) ...@@ -288,47 +288,47 @@ ohci_sa1111_start (struct usb_hcd *hcd)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static const struct hc_driver ohci_sa1111_hc_driver = { static const struct hc_driver ohci_sa1111_hc_driver = {
description: hcd_name, .description = hcd_name,
/* /*
* generic hardware linkage * generic hardware linkage
*/ */
irq: ohci_irq, .irq = ohci_irq,
flags: HCD_USB11, .flags = HCD_USB11,
/* /*
* basic lifecycle operations * basic lifecycle operations
*/ */
start: ohci_sa1111_start, .start = ohci_sa1111_start,
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* suspend: ohci_sa1111_suspend, -- tbd */ /* suspend: ohci_sa1111_suspend, -- tbd */
/* resume: ohci_sa1111_resume, -- tbd */ /* resume: ohci_sa1111_resume, -- tbd */
#endif #endif
stop: ohci_stop, .stop = ohci_stop,
/* /*
* memory lifecycle (except per-request) * memory lifecycle (except per-request)
*/ */
hcd_alloc: ohci_hcd_alloc, .hcd_alloc = ohci_hcd_alloc,
hcd_free: ohci_hcd_free, .hcd_free = ohci_hcd_free,
/* /*
* managing i/o requests and associated device resources * managing i/o requests and associated device resources
*/ */
urb_enqueue: ohci_urb_enqueue, .urb_enqueue = ohci_urb_enqueue,
urb_dequeue: ohci_urb_dequeue, .urb_dequeue = ohci_urb_dequeue,
free_config: ohci_free_config, .free_config = ohci_free_config,
/* /*
* scheduling support * scheduling support
*/ */
get_frame_number: ohci_get_frame, .get_frame_number = ohci_get_frame,
/* /*
* root hub support * root hub support
*/ */
hub_status_data: ohci_hub_status_data, .hub_status_data = ohci_hub_status_data,
hub_control: ohci_hub_control, .hub_control = ohci_hub_control,
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
...@@ -571,11 +571,11 @@ static int uhci_proc_release(struct inode *inode, struct file *file) ...@@ -571,11 +571,11 @@ static int uhci_proc_release(struct inode *inode, struct file *file)
} }
static struct file_operations uhci_proc_operations = { static struct file_operations uhci_proc_operations = {
open: uhci_proc_open, .open = uhci_proc_open,
llseek: uhci_proc_lseek, .llseek = uhci_proc_lseek,
read: uhci_proc_read, .read = uhci_proc_read,
// write: uhci_proc_write, // write: uhci_proc_write,
release: uhci_proc_release, .release = uhci_proc_release,
}; };
#endif #endif
...@@ -2476,45 +2476,45 @@ static int uhci_hcd_get_frame_number(struct usb_hcd *hcd) ...@@ -2476,45 +2476,45 @@ static int uhci_hcd_get_frame_number(struct usb_hcd *hcd)
static const char hcd_name[] = "uhci-hcd"; static const char hcd_name[] = "uhci-hcd";
static const struct hc_driver uhci_driver = { static const struct hc_driver uhci_driver = {
description: hcd_name, .description = hcd_name,
/* Generic hardware linkage */ /* Generic hardware linkage */
irq: uhci_irq, .irq = uhci_irq,
flags: HCD_USB11, .flags = HCD_USB11,
/* Basic lifecycle operations */ /* Basic lifecycle operations */
start: uhci_start, .start = uhci_start,
#ifdef CONFIG_PM #ifdef CONFIG_PM
suspend: uhci_suspend, .suspend = uhci_suspend,
resume: uhci_resume, .resume = uhci_resume,
#endif #endif
stop: uhci_stop, .stop = uhci_stop,
hcd_alloc: uhci_hcd_alloc, .hcd_alloc = uhci_hcd_alloc,
hcd_free: uhci_hcd_free, .hcd_free = uhci_hcd_free,
urb_enqueue: uhci_urb_enqueue, .urb_enqueue = uhci_urb_enqueue,
urb_dequeue: uhci_urb_dequeue, .urb_dequeue = uhci_urb_dequeue,
free_config: NULL, .free_config = NULL,
get_frame_number: uhci_hcd_get_frame_number, .get_frame_number = uhci_hcd_get_frame_number,
hub_status_data: uhci_hub_status_data, .hub_status_data = uhci_hub_status_data,
hub_control: uhci_hub_control, .hub_control = uhci_hub_control,
}; };
static const struct pci_device_id __devinitdata uhci_pci_ids[] = { { static const struct pci_device_id __devinitdata uhci_pci_ids[] = { {
/* handle any USB UHCI controller */ /* handle any USB UHCI controller */
class: ((PCI_CLASS_SERIAL_USB << 8) | 0x00), .class = ((PCI_CLASS_SERIAL_USB << 8) | 0x00),
class_mask: ~0, .class_mask = ~0,
driver_data: (unsigned long) &uhci_driver, .driver_data = (unsigned long) &uhci_driver,
/* no matter who makes it */ /* no matter who makes it */
vendor: PCI_ANY_ID, .vendor = PCI_ANY_ID,
device: PCI_ANY_ID, .device = PCI_ANY_ID,
subvendor: PCI_ANY_ID, .subvendor = PCI_ANY_ID,
subdevice: PCI_ANY_ID, .subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ } }, { /* end: all zeroes */ }
}; };
...@@ -2522,15 +2522,15 @@ static const struct pci_device_id __devinitdata uhci_pci_ids[] = { { ...@@ -2522,15 +2522,15 @@ static const struct pci_device_id __devinitdata uhci_pci_ids[] = { {
MODULE_DEVICE_TABLE(pci, uhci_pci_ids); MODULE_DEVICE_TABLE(pci, uhci_pci_ids);
static struct pci_driver uhci_pci_driver = { static struct pci_driver uhci_pci_driver = {
name: (char *)hcd_name, .name = (char *)hcd_name,
id_table: uhci_pci_ids, .id_table = uhci_pci_ids,
probe: usb_hcd_pci_probe, .probe = usb_hcd_pci_probe,
remove: usb_hcd_pci_remove, .remove = usb_hcd_pci_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
suspend: usb_hcd_pci_suspend, .suspend = usb_hcd_pci_suspend,
resume: usb_hcd_pci_resume, .resume = usb_hcd_pci_resume,
#endif /* PM */ #endif /* PM */
}; };
......
This diff is collapsed.
/*
* linux/drivers/usb/usb-ohci-sa1111.c
*
* The outline of this code was taken from Brad Parkers <brad@heeltoe.com>
* original OHCI driver modifications, and reworked into a cleaner form
* by Russell King <rmk@arm.linux.org.uk>.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/arch/assabet.h>
#include <asm/arch/badge4.h>
#include <asm/hardware/sa1111.h>
#include "usb-ohci.h"
int __devinit
hc_add_ohci(struct pci_dev *dev, int irq, void *membase, unsigned long flags,
ohci_t **ohci, const char *name, const char *slot_name);
extern void hc_remove_ohci(ohci_t *ohci);
extern int hc_start (ohci_t * ohci, struct device *parent_dev);
extern int hc_reset (ohci_t * ohci);
static ohci_t *sa1111_ohci;
static void __init sa1111_ohci_configure(void)
{
unsigned int usb_rst = 0;
printk(KERN_DEBUG __FILE__
": starting SA-1111 OHCI USB Controller\n");
#ifdef CONFIG_SA1100_BADGE4
if (machine_is_badge4())
/* power the bus */
badge4_set_5V(BADGE4_5V_USB, 1);
#endif
if (machine_is_xp860() ||
machine_has_neponset() ||
machine_is_pfs168() ||
machine_is_badge4())
usb_rst = USB_RESET_PWRSENSELOW | USB_RESET_PWRCTRLLOW;
/*
* Configure the power sense and control lines. Place the USB
* host controller in reset.
*/
USB_RESET = usb_rst | USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET;
/*
* Now, carefully enable the USB clock, and take
* the USB host controller out of reset.
*/
SKPCR |= SKPCR_UCLKEN;
udelay(11);
USB_RESET = usb_rst;
}
static void __exit sa1111_ohci_unconfigure(void)
{
printk(KERN_DEBUG __FILE__
": stopping SA-1111 OHCI USB Controller\n");
/*
* Put the USB host controller into reset.
*/
USB_RESET |= USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET;
/*
* Stop the USB clock.
*/
SKPCR &= ~SKPCR_UCLKEN;
#ifdef CONFIG_SA1100_BADGE4
if (machine_is_badge4())
badge4_set_5V(BADGE4_5V_USB, 0);
#endif
}
static int __init sa1111_ohci_init(void)
{
int ret;
if (!sa1111)
return -ENODEV;
/*
* Request memory resources.
*/
if (!request_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT, "usb-ohci"))
return -EBUSY;
sa1111_ohci_configure();
/*
* Initialise the generic OHCI driver.
*/
sa1111_ohci = 0;
ret = hc_add_ohci(SA1111_FAKE_PCIDEV, NIRQHCIM,
(void *)&USB_OHCI_OP_BASE, 0, &sa1111_ohci,
"usb-ohci", "sa1111");
if (ret || !sa1111_ohci) {
sa1111_ohci = 0;
sa1111_ohci_unconfigure();
release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
return -EBUSY;
}
if (hc_start (sa1111_ohci, &sa1111->dev) < 0) {
err ("can't start usb-%s", sa1111_ohci->slot_name);
hc_remove_ohci (sa1111_ohci);
sa1111_ohci = 0;
sa1111_ohci_unconfigure();
release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
return -EBUSY;
}
return 0;
}
static void __exit sa1111_ohci_exit(void)
{
printk(KERN_DEBUG __FUNCTION__ ": cleaning up\n");
if (sa1111_ohci) {
hc_remove_ohci(sa1111_ohci);
sa1111_ohci = 0;
}
sa1111_ohci_unconfigure();
release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
printk(KERN_DEBUG __FUNCTION__ ": exiting\n");
}
module_init(sa1111_ohci_init);
module_exit(sa1111_ohci_exit);
MODULE_LICENSE("GPL");
This diff is collapsed.
This diff is collapsed.
...@@ -164,10 +164,10 @@ MODULE_LICENSE("GPL"); ...@@ -164,10 +164,10 @@ MODULE_LICENSE("GPL");
static struct usb_driver hpusbscsi_usb_driver = { static struct usb_driver hpusbscsi_usb_driver = {
name:"hpusbscsi", .name ="hpusbscsi",
probe:hpusbscsi_usb_probe, .probe =hpusbscsi_usb_probe,
disconnect:hpusbscsi_usb_disconnect, .disconnect =hpusbscsi_usb_disconnect,
id_table:hpusbscsi_usb_ids, .id_table =hpusbscsi_usb_ids,
}; };
/* module initialisation */ /* module initialisation */
......
...@@ -923,11 +923,11 @@ static ssize_t mdc800_device_write (struct file *file, const char *buf, size_t l ...@@ -923,11 +923,11 @@ static ssize_t mdc800_device_write (struct file *file, const char *buf, size_t l
/* File Operations of this drivers */ /* File Operations of this drivers */
static struct file_operations mdc800_device_ops = static struct file_operations mdc800_device_ops =
{ {
owner: THIS_MODULE, .owner = THIS_MODULE,
read: mdc800_device_read, .read = mdc800_device_read,
write: mdc800_device_write, .write = mdc800_device_write,
open: mdc800_device_open, .open = mdc800_device_open,
release: mdc800_device_release, .release = mdc800_device_release,
}; };
...@@ -943,11 +943,11 @@ MODULE_DEVICE_TABLE (usb, mdc800_table); ...@@ -943,11 +943,11 @@ MODULE_DEVICE_TABLE (usb, mdc800_table);
*/ */
static struct usb_driver mdc800_usb_driver = static struct usb_driver mdc800_usb_driver =
{ {
owner: THIS_MODULE, .owner = THIS_MODULE,
name: "mdc800", .name = "mdc800",
probe: mdc800_usb_probe, .probe = mdc800_usb_probe,
disconnect: mdc800_usb_disconnect, .disconnect = mdc800_usb_disconnect,
id_table: mdc800_table .id_table = mdc800_table
}; };
......
...@@ -161,10 +161,10 @@ static void mts_usb_disconnect(struct usb_device *dev, void *ptr); ...@@ -161,10 +161,10 @@ static void mts_usb_disconnect(struct usb_device *dev, void *ptr);
static struct usb_device_id mts_usb_ids []; static struct usb_device_id mts_usb_ids [];
static struct usb_driver mts_usb_driver = { static struct usb_driver mts_usb_driver = {
name: "microtekX6", .name = "microtekX6",
probe: mts_usb_probe, .probe = mts_usb_probe,
disconnect: mts_usb_disconnect, .disconnect = mts_usb_disconnect,
id_table: mts_usb_ids, .id_table = mts_usb_ids,
}; };
...@@ -743,22 +743,22 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback ) ...@@ -743,22 +743,22 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback )
static Scsi_Host_Template mts_scsi_host_template = { static Scsi_Host_Template mts_scsi_host_template = {
name: "microtekX6", .name = "microtekX6",
detect: mts_scsi_detect, .detect = mts_scsi_detect,
release: mts_scsi_release, .release = mts_scsi_release,
queuecommand: mts_scsi_queuecommand, .queuecommand = mts_scsi_queuecommand,
eh_abort_handler: mts_scsi_abort, .eh_abort_handler = mts_scsi_abort,
eh_host_reset_handler: mts_scsi_host_reset, .eh_host_reset_handler =mts_scsi_host_reset,
sg_tablesize: SG_ALL, .sg_tablesize = SG_ALL,
can_queue: 1, .can_queue = 1,
this_id: -1, .this_id = -1,
cmd_per_lun: 1, .cmd_per_lun = 1,
present: 0, .present = 0,
unchecked_isa_dma: FALSE, .unchecked_isa_dma = FALSE,
use_clustering: TRUE, .use_clustering = TRUE,
emulated: TRUE .emulated = TRUE
}; };
......
...@@ -811,11 +811,11 @@ ioctl_scanner(struct inode *inode, struct file *file, ...@@ -811,11 +811,11 @@ ioctl_scanner(struct inode *inode, struct file *file,
static struct static struct
file_operations usb_scanner_fops = { file_operations usb_scanner_fops = {
read: read_scanner, .read = read_scanner,
write: write_scanner, .write = write_scanner,
ioctl: ioctl_scanner, .ioctl = ioctl_scanner,
open: open_scanner, .open = open_scanner,
release: close_scanner, .release = close_scanner,
}; };
static void * static void *
...@@ -1116,10 +1116,10 @@ disconnect_scanner(struct usb_device *dev, void *ptr) ...@@ -1116,10 +1116,10 @@ disconnect_scanner(struct usb_device *dev, void *ptr)
static struct static struct
usb_driver scanner_driver = { usb_driver scanner_driver = {
name: "usbscanner", .name = "usbscanner",
probe: probe_scanner, .probe = probe_scanner,
disconnect: disconnect_scanner, .disconnect = disconnect_scanner,
id_table: NULL, /* This would be scanner_device_ids, but we .id_table = NULL, /* This would be scanner_device_ids, but we
need to check every USB device, in case need to check every USB device, in case
we match a user defined vendor/product ID. */ we match a user defined vendor/product ID. */
}; };
......
...@@ -313,10 +313,10 @@ aiptek_disconnect(struct usb_device *dev, void *ptr) ...@@ -313,10 +313,10 @@ aiptek_disconnect(struct usb_device *dev, void *ptr)
} }
static struct usb_driver aiptek_driver = { static struct usb_driver aiptek_driver = {
name:"aiptek", .name ="aiptek",
probe:aiptek_probe, .probe =aiptek_probe,
disconnect:aiptek_disconnect, .disconnect =aiptek_disconnect,
id_table:aiptek_ids, .id_table =aiptek_ids,
}; };
static int __init static int __init
......
...@@ -1556,10 +1556,10 @@ static struct usb_device_id hid_usb_ids [] = { ...@@ -1556,10 +1556,10 @@ static struct usb_device_id hid_usb_ids [] = {
MODULE_DEVICE_TABLE (usb, hid_usb_ids); MODULE_DEVICE_TABLE (usb, hid_usb_ids);
static struct usb_driver hid_driver = { static struct usb_driver hid_driver = {
name: "hid", .name = "hid",
probe: hid_probe, .probe = hid_probe,
disconnect: hid_disconnect, .disconnect = hid_disconnect,
id_table: hid_usb_ids, .id_table = hid_usb_ids,
}; };
static int __init hid_init(void) static int __init hid_init(void)
......
...@@ -657,14 +657,14 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -657,14 +657,14 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
} }
static struct file_operations hiddev_fops = { static struct file_operations hiddev_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
read: hiddev_read, .read = hiddev_read,
write: hiddev_write, .write = hiddev_write,
poll: hiddev_poll, .poll = hiddev_poll,
open: hiddev_open, .open = hiddev_open,
release: hiddev_release, .release = hiddev_release,
ioctl: hiddev_ioctl, .ioctl = hiddev_ioctl,
fasync: hiddev_fasync, .fasync = hiddev_fasync,
}; };
/* /*
...@@ -759,8 +759,8 @@ static void *hiddev_usbd_probe(struct usb_device *dev, unsigned int ifnum, ...@@ -759,8 +759,8 @@ static void *hiddev_usbd_probe(struct usb_device *dev, unsigned int ifnum,
static /* const */ struct usb_driver hiddev_driver = { static /* const */ struct usb_driver hiddev_driver = {
name: "hiddev", .name = "hiddev",
probe: hiddev_usbd_probe, .probe = hiddev_usbd_probe,
}; };
int __init hiddev_init(void) int __init hiddev_init(void)
......
...@@ -334,10 +334,10 @@ static struct usb_device_id powermate_devices [] = { ...@@ -334,10 +334,10 @@ static struct usb_device_id powermate_devices [] = {
MODULE_DEVICE_TABLE (usb, powermate_devices); MODULE_DEVICE_TABLE (usb, powermate_devices);
static struct usb_driver powermate_driver = { static struct usb_driver powermate_driver = {
name: "powermate", .name = "powermate",
probe: powermate_probe, .probe = powermate_probe,
disconnect: powermate_disconnect, .disconnect = powermate_disconnect,
id_table: powermate_devices, .id_table = powermate_devices,
}; };
int powermate_init(void) int powermate_init(void)
......
...@@ -287,10 +287,10 @@ static struct usb_device_id usb_kbd_id_table [] = { ...@@ -287,10 +287,10 @@ static struct usb_device_id usb_kbd_id_table [] = {
MODULE_DEVICE_TABLE (usb, usb_kbd_id_table); MODULE_DEVICE_TABLE (usb, usb_kbd_id_table);
static struct usb_driver usb_kbd_driver = { static struct usb_driver usb_kbd_driver = {
name: "keyboard", .name = "keyboard",
probe: usb_kbd_probe, .probe = usb_kbd_probe,
disconnect: usb_kbd_disconnect, .disconnect = usb_kbd_disconnect,
id_table: usb_kbd_id_table, .id_table = usb_kbd_id_table,
}; };
static int __init usb_kbd_init(void) static int __init usb_kbd_init(void)
......
...@@ -195,10 +195,10 @@ static struct usb_device_id usb_mouse_id_table [] = { ...@@ -195,10 +195,10 @@ static struct usb_device_id usb_mouse_id_table [] = {
MODULE_DEVICE_TABLE (usb, usb_mouse_id_table); MODULE_DEVICE_TABLE (usb, usb_mouse_id_table);
static struct usb_driver usb_mouse_driver = { static struct usb_driver usb_mouse_driver = {
name: "usb_mouse", .name = "usb_mouse",
probe: usb_mouse_probe, .probe = usb_mouse_probe,
disconnect: usb_mouse_disconnect, .disconnect = usb_mouse_disconnect,
id_table: usb_mouse_id_table, .id_table = usb_mouse_id_table,
}; };
static int __init usb_mouse_init(void) static int __init usb_mouse_init(void)
......
...@@ -428,10 +428,10 @@ static void wacom_disconnect(struct usb_device *dev, void *ptr) ...@@ -428,10 +428,10 @@ static void wacom_disconnect(struct usb_device *dev, void *ptr)
} }
static struct usb_driver wacom_driver = { static struct usb_driver wacom_driver = {
name: "wacom", .name = "wacom",
probe: wacom_probe, .probe = wacom_probe,
disconnect: wacom_disconnect, .disconnect = wacom_disconnect,
id_table: wacom_ids, .id_table = wacom_ids,
}; };
static int __init wacom_init(void) static int __init wacom_init(void)
......
...@@ -304,10 +304,10 @@ static void xpad_disconnect(struct usb_device *udev, void *ptr) ...@@ -304,10 +304,10 @@ static void xpad_disconnect(struct usb_device *udev, void *ptr)
} }
static struct usb_driver xpad_driver = { static struct usb_driver xpad_driver = {
name: "xpad", .name = "xpad",
probe: xpad_probe, .probe = xpad_probe,
disconnect: xpad_disconnect, .disconnect = xpad_disconnect,
id_table: xpad_table, .id_table = xpad_table,
}; };
static int __init usb_xpad_init(void) static int __init usb_xpad_init(void)
......
...@@ -704,12 +704,12 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm ...@@ -704,12 +704,12 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm
static struct file_operations dabusb_fops = static struct file_operations dabusb_fops =
{ {
owner: THIS_MODULE, .owner = THIS_MODULE,
llseek: no_llseek, .llseek = no_llseek,
read: dabusb_read, .read = dabusb_read,
ioctl: dabusb_ioctl, .ioctl = dabusb_ioctl,
open: dabusb_open, .open = dabusb_open,
release: dabusb_release, .release = dabusb_release,
}; };
static int dabusb_find_struct (void) static int dabusb_find_struct (void)
...@@ -806,10 +806,10 @@ MODULE_DEVICE_TABLE (usb, dabusb_ids); ...@@ -806,10 +806,10 @@ MODULE_DEVICE_TABLE (usb, dabusb_ids);
static struct usb_driver dabusb_driver = static struct usb_driver dabusb_driver =
{ {
name: "dabusb", .name = "dabusb",
probe: dabusb_probe, .probe = dabusb_probe,
disconnect: dabusb_disconnect, .disconnect = dabusb_disconnect,
id_table: dabusb_ids, .id_table = dabusb_ids,
}; };
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
...@@ -100,19 +100,19 @@ typedef struct ...@@ -100,19 +100,19 @@ typedef struct
static struct file_operations usb_dsbr100_fops = { static struct file_operations usb_dsbr100_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
open: usb_dsbr100_open, .open = usb_dsbr100_open,
release: usb_dsbr100_close, .release = usb_dsbr100_close,
ioctl: usb_dsbr100_ioctl, .ioctl = usb_dsbr100_ioctl,
llseek: no_llseek, .llseek = no_llseek,
}; };
static struct video_device usb_dsbr100_radio= static struct video_device usb_dsbr100_radio=
{ {
owner: THIS_MODULE, .owner = THIS_MODULE,
name: "D-Link DSB R-100 USB radio", .name = "D-Link DSB R-100 USB radio",
type: VID_TYPE_TUNER, .type = VID_TYPE_TUNER,
hardware: VID_HARDWARE_AZTECH, .hardware = VID_HARDWARE_AZTECH,
fops: &usb_dsbr100_fops, .fops = &usb_dsbr100_fops,
}; };
static int users = 0; static int users = 0;
...@@ -125,10 +125,10 @@ static struct usb_device_id usb_dsbr100_table [] = { ...@@ -125,10 +125,10 @@ static struct usb_device_id usb_dsbr100_table [] = {
MODULE_DEVICE_TABLE (usb, usb_dsbr100_table); MODULE_DEVICE_TABLE (usb, usb_dsbr100_table);
static struct usb_driver usb_dsbr100_driver = { static struct usb_driver usb_dsbr100_driver = {
name: "dsbr100", .name = "dsbr100",
probe: usb_dsbr100_probe, .probe = usb_dsbr100_probe,
disconnect: usb_dsbr100_disconnect, .disconnect = usb_dsbr100_disconnect,
id_table: usb_dsbr100_table, .id_table = usb_dsbr100_table,
}; };
......
This diff is collapsed.
...@@ -551,17 +551,11 @@ struct usb_ov511 { ...@@ -551,17 +551,11 @@ struct usb_ov511 {
int num_inputs; /* Number of inputs */ int num_inputs; /* Number of inputs */
int norm; /* NTSC / PAL / SECAM */ int norm; /* NTSC / PAL / SECAM */
int has_decoder; /* Device has a video decoder */ int has_decoder; /* Device has a video decoder */
int has_tuner; /* Device has a TV tuner */
int has_audio_proc; /* Device has an audio processor */
int freq; /* Current tuner frequency */
int tuner_type; /* Specific tuner model */
int pal; /* Device is designed for PAL resolution */ int pal; /* Device is designed for PAL resolution */
/* I2C interface to kernel */ /* I2C interface */
struct semaphore i2c_lock; /* Protect I2C controller regs */ struct semaphore i2c_lock; /* Protect I2C controller regs */
unsigned char primary_i2c_slave; /* I2C write id of sensor */ unsigned char primary_i2c_slave; /* I2C write id of sensor */
unsigned char tuner_i2c_slave; /* I2C write id of tuner */
unsigned char audio_i2c_slave; /* I2C write id of audio processor */
/* Control transaction stuff */ /* Control transaction stuff */
unsigned char *cbuf; /* Buffer for payload */ unsigned char *cbuf; /* Buffer for payload */
......
...@@ -91,10 +91,10 @@ static void usb_pwc_disconnect(struct usb_device *udev, void *ptr); ...@@ -91,10 +91,10 @@ static void usb_pwc_disconnect(struct usb_device *udev, void *ptr);
static struct usb_driver pwc_driver = static struct usb_driver pwc_driver =
{ {
name: "Philips webcam", /* name */ .name = "Philips webcam", /* name */
id_table: pwc_device_table, .id_table = pwc_device_table,
probe: usb_pwc_probe, /* probe() */ .probe = usb_pwc_probe, /* probe() */
disconnect: usb_pwc_disconnect, /* disconnect() */ .disconnect = usb_pwc_disconnect, /* disconnect() */
}; };
#define MAX_DEV_HINTS 10 #define MAX_DEV_HINTS 10
...@@ -130,21 +130,21 @@ static int pwc_video_ioctl(struct inode *inode, struct file *file, ...@@ -130,21 +130,21 @@ static int pwc_video_ioctl(struct inode *inode, struct file *file,
static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma); static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma);
static struct file_operations pwc_fops = { static struct file_operations pwc_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
open: pwc_video_open, .open = pwc_video_open,
release: pwc_video_close, .release = pwc_video_close,
read: pwc_video_read, .read = pwc_video_read,
poll: pwc_video_poll, .poll = pwc_video_poll,
mmap: pwc_video_mmap, .mmap = pwc_video_mmap,
ioctl: pwc_video_ioctl, .ioctl = pwc_video_ioctl,
llseek: no_llseek, .llseek = no_llseek,
}; };
static struct video_device pwc_template = { static struct video_device pwc_template = {
owner: THIS_MODULE, .owner = THIS_MODULE,
name: "Philips Webcam", /* Filled in later */ .name = "Philips Webcam", /* Filled in later */
type: VID_TYPE_CAPTURE, .type = VID_TYPE_CAPTURE,
hardware: VID_HARDWARE_PWC, .hardware = VID_HARDWARE_PWC,
fops: &pwc_fops, .fops = &pwc_fops,
}; };
/***************************************************************************/ /***************************************************************************/
...@@ -1756,20 +1756,20 @@ static void usb_pwc_disconnect(struct usb_device *udev, void *ptr) ...@@ -1756,20 +1756,20 @@ static void usb_pwc_disconnect(struct usb_device *udev, void *ptr)
pdev = (struct pwc_device *)ptr; pdev = (struct pwc_device *)ptr;
if (pdev == NULL) { if (pdev == NULL) {
Err("pwc_disconnect() Called without private pointer.\n"); Err("pwc_disconnect() Called without private pointer.\n");
return; goto out_err;
} }
if (pdev->udev == NULL) { if (pdev->udev == NULL) {
Err("pwc_disconnect() already called for %p\n", pdev); Err("pwc_disconnect() already called for %p\n", pdev);
return; goto out_err;
} }
if (pdev->udev != udev) { if (pdev->udev != udev) {
Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");
return; goto out_err;
} }
#ifdef PWC_MAGIC #ifdef PWC_MAGIC
if (pdev->magic != PWC_MAGIC) { if (pdev->magic != PWC_MAGIC) {
Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n");
return; goto out_err;
} }
#endif #endif
...@@ -1815,6 +1815,7 @@ static void usb_pwc_disconnect(struct usb_device *udev, void *ptr) ...@@ -1815,6 +1815,7 @@ static void usb_pwc_disconnect(struct usb_device *udev, void *ptr)
device_hint[hint].pdev = NULL; device_hint[hint].pdev = NULL;
pdev->udev = NULL; pdev->udev = NULL;
out_err:
unlock_kernel(); unlock_kernel();
kfree(pdev); kfree(pdev);
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -646,10 +646,10 @@ MODULE_DEVICE_TABLE (usb, uss720_table); ...@@ -646,10 +646,10 @@ MODULE_DEVICE_TABLE (usb, uss720_table);
static struct usb_driver uss720_driver = { static struct usb_driver uss720_driver = {
name: "uss720", .name = "uss720",
probe: uss720_probe, .probe = uss720_probe,
disconnect: uss720_disconnect, .disconnect = uss720_disconnect,
id_table: uss720_table, .id_table = uss720_table,
}; };
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
...@@ -941,10 +941,10 @@ static struct usb_device_id catc_id_table [] = { ...@@ -941,10 +941,10 @@ static struct usb_device_id catc_id_table [] = {
MODULE_DEVICE_TABLE(usb, catc_id_table); MODULE_DEVICE_TABLE(usb, catc_id_table);
static struct usb_driver catc_driver = { static struct usb_driver catc_driver = {
name: "catc", .name = "catc",
probe: catc_probe, .probe = catc_probe,
disconnect: catc_disconnect, .disconnect = catc_disconnect,
id_table: catc_id_table, .id_table = catc_id_table,
}; };
static int __init catc_init(void) static int __init catc_init(void)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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