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:
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.
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
TYPE: integer (1-4 for OV511, 1-31 for OV511+)
DEFAULT: 1
......@@ -161,13 +151,6 @@ MODULE PARAMETERS:
DESC: This configures the camera's sensor to transmit a colored test-pattern
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
TYPE: integer (0-2)
DEFAULT: 0
......@@ -259,14 +242,6 @@ MODULE PARAMETERS:
13 VIDEO_PALETTE_YUV422P (YUV 4:2:2 Planar)
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
TYPE: integer (Boolean)
DEFAULT: 0 (off)
......
......@@ -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 = {
owner: THIS_MODULE,
llseek: no_llseek,
ioctl: usb_audio_ioctl_mixdev,
open: usb_audio_open_mixdev,
release: usb_audio_release_mixdev,
.owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = usb_audio_ioctl_mixdev,
.open = usb_audio_open_mixdev,
.release = usb_audio_release_mixdev,
};
/* --------------------------------------------------------------------- */
......@@ -2727,15 +2727,15 @@ static int usb_audio_release(struct inode *inode, struct file *file)
}
static /*const*/ struct file_operations usb_audio_fops = {
owner: THIS_MODULE,
llseek: no_llseek,
read: usb_audio_read,
write: usb_audio_write,
poll: usb_audio_poll,
ioctl: usb_audio_ioctl,
mmap: usb_audio_mmap,
open: usb_audio_open,
release: usb_audio_release,
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = usb_audio_read,
.write = usb_audio_write,
.poll = usb_audio_poll,
.ioctl = usb_audio_ioctl,
.mmap = usb_audio_mmap,
.open = usb_audio_open,
.release = usb_audio_release,
};
/* --------------------------------------------------------------------- */
......@@ -2753,11 +2753,11 @@ static struct usb_device_id usb_audio_ids [] = {
MODULE_DEVICE_TABLE (usb, usb_audio_ids);
static struct usb_driver usb_audio_driver = {
name: "audio",
probe: usb_audio_probe,
disconnect: usb_audio_disconnect,
driver_list: LIST_HEAD_INIT(usb_audio_driver.driver_list),
id_table: usb_audio_ids,
.name = "audio",
.probe = usb_audio_probe,
.disconnect = usb_audio_disconnect,
.driver_list = LIST_HEAD_INIT(usb_audio_driver.driver_list),
.id_table = usb_audio_ids,
};
static void *find_descriptor(void *descstart, unsigned int desclen, void *after,
......
......@@ -234,10 +234,10 @@ static struct usb_device_id usb_bluetooth_ids [] = {
MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids);
static struct usb_driver usb_bluetooth_driver = {
name: "bluetty",
probe: usb_bluetooth_probe,
disconnect: usb_bluetooth_disconnect,
id_table: usb_bluetooth_ids,
.name = "bluetty",
.probe = usb_bluetooth_probe,
.disconnect = usb_bluetooth_disconnect,
.id_table = usb_bluetooth_ids,
};
static int bluetooth_refcount;
......@@ -1284,30 +1284,30 @@ static void usb_bluetooth_disconnect(struct usb_device *dev, void *ptr)
static struct tty_driver bluetooth_tty_driver = {
magic: TTY_DRIVER_MAGIC,
driver_name: "usb-bluetooth",
name: "usb/ttub/%d",
major: BLUETOOTH_TTY_MAJOR,
minor_start: 0,
num: BLUETOOTH_TTY_MINORS,
type: TTY_DRIVER_TYPE_SERIAL,
subtype: SERIAL_TYPE_NORMAL,
flags: TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
refcount: &bluetooth_refcount,
table: bluetooth_tty,
termios: bluetooth_termios,
termios_locked: bluetooth_termios_locked,
open: bluetooth_open,
close: bluetooth_close,
write: bluetooth_write,
write_room: bluetooth_write_room,
ioctl: bluetooth_ioctl,
set_termios: bluetooth_set_termios,
throttle: bluetooth_throttle,
unthrottle: bluetooth_unthrottle,
chars_in_buffer: bluetooth_chars_in_buffer,
.magic = TTY_DRIVER_MAGIC,
.driver_name = "usb-bluetooth",
.name = "usb/ttub/%d",
.major = BLUETOOTH_TTY_MAJOR,
.minor_start = 0,
.num = BLUETOOTH_TTY_MINORS,
.type = TTY_DRIVER_TYPE_SERIAL,
.subtype = SERIAL_TYPE_NORMAL,
.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
.refcount = &bluetooth_refcount,
.table = bluetooth_tty,
.termios = bluetooth_termios,
.termios_locked = bluetooth_termios_locked,
.open = bluetooth_open,
.close = bluetooth_close,
.write = bluetooth_write,
.write_room = bluetooth_write_room,
.ioctl = bluetooth_ioctl,
.set_termios = bluetooth_set_termios,
.throttle = bluetooth_throttle,
.unthrottle = bluetooth_unthrottle,
.chars_in_buffer = bluetooth_chars_in_buffer,
};
......
......@@ -683,10 +683,10 @@ static struct usb_device_id acm_ids[] = {
MODULE_DEVICE_TABLE (usb, acm_ids);
static struct usb_driver acm_driver = {
name: "acm",
probe: acm_probe,
disconnect: acm_disconnect,
id_table: acm_ids,
.name = "acm",
.probe = acm_probe,
.disconnect = acm_disconnect,
.id_table = acm_ids,
};
/*
......@@ -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 tty_driver acm_tty_driver = {
magic: TTY_DRIVER_MAGIC,
driver_name: "acm",
name: "usb/acm/%d",
major: ACM_TTY_MAJOR,
minor_start: 0,
num: ACM_TTY_MINORS,
type: TTY_DRIVER_TYPE_SERIAL,
subtype: SERIAL_TYPE_NORMAL,
flags: TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
refcount: &acm_tty_refcount,
table: acm_tty_table,
termios: acm_tty_termios,
termios_locked: acm_tty_termios_locked,
open: acm_tty_open,
close: acm_tty_close,
write: acm_tty_write,
write_room: acm_tty_write_room,
ioctl: acm_tty_ioctl,
throttle: acm_tty_throttle,
unthrottle: acm_tty_unthrottle,
chars_in_buffer: acm_tty_chars_in_buffer,
break_ctl: acm_tty_break_ctl,
set_termios: acm_tty_set_termios
.magic = TTY_DRIVER_MAGIC,
.driver_name = "acm",
.name = "usb/acm/%d",
.major = ACM_TTY_MAJOR,
.minor_start = 0,
.num = ACM_TTY_MINORS,
.type = TTY_DRIVER_TYPE_SERIAL,
.subtype = SERIAL_TYPE_NORMAL,
.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
.refcount = &acm_tty_refcount,
.table = acm_tty_table,
.termios = acm_tty_termios,
.termios_locked = acm_tty_termios_locked,
.open = acm_tty_open,
.close = acm_tty_close,
.write = acm_tty_write,
.write_room = acm_tty_write_room,
.ioctl = acm_tty_ioctl,
.throttle = acm_tty_throttle,
.unthrottle = acm_tty_unthrottle,
.chars_in_buffer = acm_tty_chars_in_buffer,
.break_ctl = acm_tty_break_ctl,
.set_termios = acm_tty_set_termios
};
/*
......
......@@ -655,7 +655,10 @@ static ssize_t usblp_write(struct file *file, const char *buffer, size_t count,
(count - writecount) : USBLP_BUF_SIZE;
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->wcomplete = 0;
......@@ -783,13 +786,13 @@ static unsigned int usblp_quirks (__u16 vendor, __u16 product)
}
static struct file_operations usblp_fops = {
owner: THIS_MODULE,
read: usblp_read,
write: usblp_write,
poll: usblp_poll,
ioctl: usblp_ioctl,
open: usblp_open,
release: usblp_release,
.owner = THIS_MODULE,
.read = usblp_read,
.write = usblp_write,
.poll = usblp_poll,
.ioctl = usblp_ioctl,
.open = usblp_open,
.release = usblp_release,
};
static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
......@@ -1097,11 +1100,11 @@ static struct usb_device_id usblp_ids [] = {
MODULE_DEVICE_TABLE (usb, usblp_ids);
static struct usb_driver usblp_driver = {
owner: THIS_MODULE,
name: "usblp",
probe: usblp_probe,
disconnect: usblp_disconnect,
id_table: usblp_ids,
.owner = THIS_MODULE,
.name = "usblp",
.probe = usblp_probe,
.disconnect = usblp_disconnect,
.id_table = usblp_ids,
};
static int __init usblp_init(void)
......
......@@ -988,12 +988,12 @@ static int usb_midi_release(struct inode *inode, struct file *file)
}
static struct file_operations usb_midi_fops = {
llseek: usb_midi_llseek,
read: usb_midi_read,
write: usb_midi_write,
poll: usb_midi_poll,
open: usb_midi_open,
release: usb_midi_release,
.llseek = usb_midi_llseek,
.read = usb_midi_read,
.write = usb_midi_write,
.poll = usb_midi_poll,
.open = usb_midi_open,
.release = usb_midi_release,
};
/* ------------------------------------------------------------------------- */
......@@ -2095,11 +2095,11 @@ static void usb_midi_disconnect(struct usb_device *dev, void *ptr)
static struct usb_driver usb_midi_driver = {
name: "midi",
probe: usb_midi_probe,
disconnect: usb_midi_disconnect,
id_table: NULL, /* check all devices */
driver_list: LIST_HEAD_INIT(usb_midi_driver.driver_list)
.name = "midi",
.probe = usb_midi_probe,
.disconnect = usb_midi_disconnect,
.id_table = NULL, /* check all devices */
.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,
static snd_rawmidi_ops_t snd_usbmidi_output =
{
open: snd_usbmidi_output_open,
close: snd_usbmidi_output_close,
trigger: snd_usbmidi_output_trigger,
.open = snd_usbmidi_output_open,
.close = snd_usbmidi_output_close,
.trigger = snd_usbmidi_output_trigger,
};
static snd_rawmidi_ops_t snd_usbmidi_input =
{
open: snd_usbmidi_input_open,
close: snd_usbmidi_input_close,
trigger: snd_usbmidi_input_trigger,
.open = snd_usbmidi_input_open,
.close = snd_usbmidi_input_close,
.trigger = snd_usbmidi_input_trigger,
};
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,
int err, idx;
snd_region_t *region;
static snd_device_opt_t ops = {
dev_free: snd_usbmidi_dev_free,
.dev_free = snd_usbmidi_dev_free,
};
*rchip = NULL;
......
......@@ -152,8 +152,8 @@ static const struct class_info clas_info[] =
void usbdevfs_conn_disc_event(void)
{
wake_up(&deviceconndiscwq);
conndiscevcnt++;
wake_up(&deviceconndiscwq);
}
static const char *class_decode(const int class)
......@@ -239,6 +239,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, const struct
if (start > end)
return start;
lock_kernel(); /* driver might be unloaded */
start += sprintf(start, format_iface,
desc->bInterfaceNumber,
desc->bAlternateSetting,
......@@ -248,6 +249,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, const struct
desc->bInterfaceSubClass,
desc->bInterfaceProtocol,
iface->driver ? iface->driver->name : "(none)");
unlock_kernel();
return start;
}
......@@ -597,6 +599,13 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
unlock_kernel();
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
* 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
file->private_data = st;
mask = POLLIN;
}
lost_race:
if (file->f_mode & FMODE_READ)
poll_wait(file, &deviceconndiscwq, wait);
if (st->lastev != conndiscevcnt)
......@@ -656,9 +666,9 @@ static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig)
}
struct file_operations usbdevfs_devices_fops = {
llseek: usb_device_lseek,
read: usb_device_read,
poll: usb_device_poll,
open: usb_device_open,
release: usb_device_release,
.llseek = usb_device_lseek,
.read = usb_device_read,
.poll = usb_device_poll,
.open = usb_device_open,
.release = usb_device_release,
};
......@@ -324,9 +324,9 @@ static void driver_disconnect(struct usb_device *dev, void *context)
}
struct usb_driver usbdevfs_driver = {
name: "usbfs",
probe: driver_probe,
disconnect: driver_disconnect,
.name = "usbfs",
.probe = driver_probe,
.disconnect = driver_disconnect,
};
static int claimintf(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))
return -EINVAL;
err = -EINVAL;
lock_kernel();
dev = ps->dev;
down(&dev->serialize);
if (dev && test_and_clear_bit(intf, &ps->ifclaimed)) {
iface = &dev->actconfig->interface[intf];
usb_driver_release_interface(&usbdevfs_driver, iface);
err = 0;
}
unlock_kernel();
up(&dev->serialize);
return err;
}
......@@ -722,14 +722,11 @@ static int proc_resetdevice(struct dev_state *ps)
if (test_bit(i, &ps->ifclaimed))
continue;
if (intf->driver) {
const struct usb_device_id *id;
down(&intf->driver->serialize);
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);
lock_kernel();
if (intf->driver && ps->dev) {
usb_bind_driver(intf->driver,ps->dev, i);
}
unlock_kernel();
}
return 0;
......@@ -1092,16 +1089,17 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
/* disconnect kernel driver from interface, leaving it unbound. */
case USBDEVFS_DISCONNECT:
/* this function is voodoo. without locking it is a maybe thing */
lock_kernel();
driver = ifp->driver;
if (driver) {
down (&driver->serialize);
dbg ("disconnect '%s' from dev %d interface %d",
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);
up (&driver->serialize);
} else
retval = -EINVAL;
unlock_kernel();
break;
/* let kernel drivers try to (re)bind to the interface */
......@@ -1111,18 +1109,28 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
/* talk directly to the interface's driver */
default:
lock_kernel(); /* against module unload */
driver = ifp->driver;
if (driver == 0 || driver->ioctl == 0)
retval = -ENOSYS;
else {
if (ifp->driver->owner)
if (driver == 0 || driver->ioctl == 0) {
unlock_kernel();
retval = -ENOSYS;
} else {
if (ifp->driver->owner) {
__MOD_INC_USE_COUNT(ifp->driver->owner);
unlock_kernel();
}
/* ifno might usefully be passed ... */
retval = driver->ioctl (ps->dev, ctrl.ioctl_code, buf);
/* size = min_t(int, size, retval)? */
if (ifp->driver->owner)
if (ifp->driver->owner) {
__MOD_DEC_USE_COUNT(ifp->driver->owner);
} else {
unlock_kernel();
}
}
if (retval == -ENOIOCTLCMD)
retval = -ENOTTY;
}
/* cleanup and return */
......@@ -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)
{
struct dev_state *ps = (struct dev_state *)file->private_data;
int ret = -ENOIOCTLCMD;
int ret = -ENOTTY;
if (!(file->f_mode & FMODE_WRITE))
return -EPERM;
......@@ -1248,10 +1256,10 @@ static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wai
}
struct file_operations usbdevfs_device_file_operations = {
llseek: usbdev_lseek,
read: usbdev_read,
poll: usbdev_poll,
ioctl: usbdev_ioctl,
open: usbdev_open,
release: usbdev_release,
.llseek = usbdev_lseek,
.read = usbdev_read,
.poll = usbdev_poll,
.ioctl = usbdev_ioctl,
.open = usbdev_open,
.release = usbdev_release,
};
......@@ -66,6 +66,7 @@ static ssize_t usb_driver_read(struct file *file, char *buf, size_t nbytes, loff
start = page;
end = page + (PAGE_SIZE - 100);
pos = *ppos;
lock_kernel(); /* else drivers might be unloaded */
for (; tmp != &usb_driver_list; tmp = tmp->next) {
struct usb_driver *driver = list_entry(tmp, struct usb_driver, driver_list);
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
break;
}
}
unlock_kernel();
if (start == page)
start += sprintf(start, "(none)\n");
len = start - page;
......@@ -120,6 +122,6 @@ static loff_t usb_driver_lseek(struct file * file, loff_t offset, int orig)
}
struct file_operations usbdevfs_drivers_fops = {
llseek: usb_driver_lseek,
read: usb_driver_read,
.llseek = usb_driver_lseek,
.read = usb_driver_read,
};
......@@ -44,10 +44,13 @@ static int usb_open(struct inode * inode, struct file * file)
spin_lock (&minor_lock);
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;
}
spin_unlock(&minor_lock);
old_fops = file->f_op;
file->f_op = new_fops;
/* Curiouser and curiouser... NULL ->open() as "no device" ? */
......@@ -62,8 +65,8 @@ static int usb_open(struct inode * inode, struct file * file)
}
static struct file_operations usb_fops = {
owner: THIS_MODULE,
open: usb_open,
.owner = THIS_MODULE,
.open = usb_open,
};
int usb_major_init(void)
......
......@@ -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.
*/
struct usb_operations usb_hcd_operations = {
allocate: hcd_alloc_dev,
get_frame_number: hcd_get_frame_number,
submit_urb: hcd_submit_urb,
unlink_urb: hcd_unlink_urb,
deallocate: hcd_free_dev,
.allocate = hcd_alloc_dev,
.get_frame_number = hcd_get_frame_number,
.submit_urb = hcd_submit_urb,
.unlink_urb = hcd_unlink_urb,
.deallocate = hcd_free_dev,
};
EXPORT_SYMBOL (usb_hcd_operations);
......
......@@ -1046,8 +1046,6 @@ static void usb_hub_events(void)
static int usb_hub_thread(void *__hub)
{
lock_kernel();
/*
* This thread doesn't need any user-level access,
* so get rid of all our resources
......@@ -1067,8 +1065,6 @@ static int usb_hub_thread(void *__hub)
} while (!signal_pending(current));
dbg("usb_hub_thread exiting");
unlock_kernel();
complete_and_exit(&khubd_exited, 0);
}
......@@ -1083,11 +1079,11 @@ static struct usb_device_id hub_id_table [] = {
MODULE_DEVICE_TABLE (usb, hub_id_table);
static struct usb_driver hub_driver = {
name: "hub",
probe: hub_probe,
ioctl: hub_ioctl,
disconnect: hub_disconnect,
id_table: hub_id_table,
.name = "hub",
.probe = hub_probe,
.ioctl = hub_ioctl,
.disconnect = hub_disconnect,
.id_table = hub_id_table,
};
/*
......
......@@ -284,23 +284,23 @@ static int default_open (struct inode *inode, struct file *filp)
}
static struct file_operations default_file_operations = {
read: default_read_file,
write: default_write_file,
open: default_open,
llseek: default_file_lseek,
.read = default_read_file,
.write = default_write_file,
.open = default_open,
.llseek = default_file_lseek,
};
static struct inode_operations usbfs_dir_inode_operations = {
create: usbfs_create,
lookup: simple_lookup,
unlink: usbfs_unlink,
mkdir: usbfs_mkdir,
rmdir: usbfs_rmdir,
.create = usbfs_create,
.lookup = simple_lookup,
.unlink = usbfs_unlink,
.mkdir = usbfs_mkdir,
.rmdir = usbfs_rmdir,
};
static struct super_operations usbfs_ops = {
statfs: simple_statfs,
drop_inode: generic_delete_inode,
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
};
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,
}
static struct file_system_type usbdevice_fs_type = {
owner: THIS_MODULE,
name: "usbdevfs",
get_sb: usb_get_sb,
kill_sb: kill_anon_super,
.owner = THIS_MODULE,
.name = "usbdevfs",
.get_sb = usb_get_sb,
.kill_sb = kill_anon_super,
};
static struct file_system_type usb_fs_type = {
owner: THIS_MODULE,
name: "usbfs",
get_sb: usb_get_sb,
kill_sb: kill_anon_super,
.owner = THIS_MODULE,
.name = "usbfs",
.get_sb = usb_get_sb,
.kill_sb = kill_anon_super,
};
/* --------------------------------------------------------------------- */
......
......@@ -32,6 +32,7 @@
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#ifdef CONFIG_USB_DEBUG
#define DEBUG
......@@ -117,6 +118,108 @@ void usb_scan_devices(void)
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,
* removing any instances of a device driver.
......@@ -136,18 +239,12 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev)
if (!dev->actconfig)
return;
for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *interface = &dev->actconfig->interface[i];
if (interface->driver == driver) {
if (driver->owner)
__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);
usb_unbind_driver(dev, interface);
/* if driver->disconnect didn't release the interface */
if (interface->driver)
usb_driver_release_interface(driver, interface);
......@@ -163,7 +260,7 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev)
/**
* usb_deregister - unregister a USB driver
* @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.
*
......@@ -528,9 +625,7 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum)
struct list_head *tmp;
struct usb_interface *interface;
void *private;
const struct usb_device_id *id;
struct usb_driver *driver;
int i;
if ((!dev) || (ifnum >= dev->actconfig->bNumInterfaces)) {
err("bad find_interface_driver params");
......@@ -545,37 +640,12 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum)
goto out_err;
private = NULL;
lock_kernel();
for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) {
driver = list_entry(tmp, struct usb_driver, driver_list);
tmp = tmp->next;
if (driver->owner)
__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);
private = usb_bind_driver(driver, dev, ifnum);
/* probe() may have changed the config on us */
interface = dev->actconfig->interface + ifnum;
......@@ -583,9 +653,11 @@ static int usb_find_interface_driver(struct usb_device *dev, unsigned ifnum)
if (private) {
usb_driver_claim_interface(driver, interface, private);
up(&dev->serialize);
unlock_kernel();
return 0;
}
}
unlock_kernel();
out_err:
up(&dev->serialize);
......@@ -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);
}
static struct driver_file_entry usb_config_entry = {
name: "configuration",
mode: S_IRUGO,
show: show_config,
.name = "configuration",
.mode = S_IRUGO,
.show = show_config,
};
/* interfaces have one current setting; alternates
......@@ -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);
}
static struct driver_file_entry usb_altsetting_entry = {
name: "altsetting",
mode: S_IRUGO,
show: show_altsetting,
.name = "altsetting",
.mode = S_IRUGO,
.show = show_altsetting,
};
/* product driverfs file */
......@@ -804,9 +876,9 @@ static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t
return len+1;
}
static struct driver_file_entry usb_product_entry = {
name: "product",
mode: S_IRUGO,
show: show_product,
.name = "product",
.mode = S_IRUGO,
.show = show_product,
};
/* manufacturer driverfs file */
......@@ -826,9 +898,9 @@ show_manufacturer (struct device *dev, char *buf, size_t count, loff_t off)
return len+1;
}
static struct driver_file_entry usb_manufacturer_entry = {
name: "manufacturer",
mode: S_IRUGO,
show: show_manufacturer,
.name = "manufacturer",
.mode = S_IRUGO,
.show = show_manufacturer,
};
/* serial number driverfs file */
......@@ -848,9 +920,9 @@ show_serial (struct device *dev, char *buf, size_t count, loff_t off)
return len+1;
}
static struct driver_file_entry usb_serial_entry = {
name: "serial",
mode: S_IRUGO,
show: show_serial,
.name = "serial",
.mode = S_IRUGO,
.show = show_serial,
};
/*
......@@ -1121,27 +1193,22 @@ void usb_disconnect(struct usb_device **pdev)
info("USB disconnect on device %d", dev->devnum);
lock_kernel();
if (dev->actconfig) {
for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *interface = &dev->actconfig->interface[i];
struct usb_driver *driver = interface->driver;
if (driver) {
if (driver->owner)
__MOD_INC_USE_COUNT(driver->owner);
down(&driver->serialize);
driver->disconnect(dev, interface->private_data);
up(&driver->serialize);
usb_unbind_driver(dev, interface);
/* if driver->disconnect didn't release the interface */
if (interface->driver)
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 */
put_device(&interface->dev);
}
}
unlock_kernel();
/* Free up all the children.. */
for (i = 0; i < USB_MAXCHILDREN; i++) {
......@@ -1416,7 +1483,7 @@ struct list_head *usb_bus_get_list(void)
#endif
struct bus_type usb_bus_type = {
name: "usb",
.name = "usb",
};
/*
......@@ -1475,6 +1542,8 @@ EXPORT_SYMBOL(usb_new_device);
EXPORT_SYMBOL(usb_reset_device);
EXPORT_SYMBOL(usb_connect);
EXPORT_SYMBOL(usb_disconnect);
EXPORT_SYMBOL(usb_bind_driver);
EXPORT_SYMBOL(usb_unbind_driver);
EXPORT_SYMBOL(__usb_get_extra_descriptor);
......
......@@ -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 ' UHCI HCD (most Intel and VIA) support' CONFIG_USB_UHCI_HCD_ALT $CONFIG_USB
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
fi
......@@ -9,8 +9,6 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
obj-$(CONFIG_USB_OHCI_HCD) += ohci-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
include $(TOPDIR)/Rules.make
......@@ -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 struct hc_driver ehci_driver = {
description: hcd_name,
.description = hcd_name,
/*
* generic hardware linkage
*/
irq: ehci_irq,
flags: HCD_MEMORY | HCD_USB2,
.irq = ehci_irq,
.flags = HCD_MEMORY | HCD_USB2,
/*
* basic lifecycle operations
*/
start: ehci_start,
.start = ehci_start,
#ifdef CONFIG_PM
suspend: ehci_suspend,
resume: ehci_resume,
.suspend = ehci_suspend,
.resume = ehci_resume,
#endif
stop: ehci_stop,
.stop = ehci_stop,
/*
* memory lifecycle (except per-request)
*/
hcd_alloc: ehci_hcd_alloc,
hcd_free: ehci_hcd_free,
.hcd_alloc = ehci_hcd_alloc,
.hcd_free = ehci_hcd_free,
/*
* managing i/o requests and associated device resources
*/
urb_enqueue: ehci_urb_enqueue,
urb_dequeue: ehci_urb_dequeue,
free_config: ehci_free_config,
.urb_enqueue = ehci_urb_enqueue,
.urb_dequeue = ehci_urb_dequeue,
.free_config = ehci_free_config,
/*
* scheduling support
*/
get_frame_number: ehci_get_frame,
.get_frame_number = ehci_get_frame,
/*
* root hub support
*/
hub_status_data: ehci_hub_status_data,
hub_control: ehci_hub_control,
.hub_status_data = ehci_hub_status_data,
.hub_control = ehci_hub_control,
};
/*-------------------------------------------------------------------------*/
......@@ -754,15 +754,15 @@ static const struct pci_device_id __devinitdata pci_ids [] = { {
/* handle any USB 2.0 EHCI controller */
class: ((PCI_CLASS_SERIAL_USB << 8) | 0x20),
class_mask: ~0,
driver_data: (unsigned long) &ehci_driver,
.class = ((PCI_CLASS_SERIAL_USB << 8) | 0x20),
.class_mask = ~0,
.driver_data = (unsigned long) &ehci_driver,
/* no matter who makes it */
vendor: PCI_ANY_ID,
device: PCI_ANY_ID,
subvendor: PCI_ANY_ID,
subdevice: PCI_ANY_ID,
.vendor = PCI_ANY_ID,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ }
};
......@@ -770,15 +770,15 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
/* pci driver glue; this is a "new style" PCI driver module */
static struct pci_driver ehci_pci_driver = {
name: (char *) hcd_name,
id_table: pci_ids,
.name = (char *) hcd_name,
.id_table = pci_ids,
probe: usb_hcd_pci_probe,
remove: usb_hcd_pci_remove,
.probe = usb_hcd_pci_probe,
.remove = usb_hcd_pci_remove,
#ifdef CONFIG_PM
suspend: usb_hcd_pci_suspend,
resume: usb_hcd_pci_resume,
.suspend = usb_hcd_pci_suspend,
.resume = usb_hcd_pci_resume,
#endif
};
......
......@@ -343,11 +343,11 @@ static int hci_get_current_frame_number (struct usb_device *usb_dev)
**************************************************************************/
static struct usb_operations hci_device_operations = {
allocate: hci_alloc_dev,
deallocate: hci_free_dev,
get_frame_number: hci_get_current_frame_number,
submit_urb: hci_submit_urb,
unlink_urb: hci_unlink_urb,
.allocate = hci_alloc_dev,
.deallocate = hci_free_dev,
.get_frame_number = hci_get_current_frame_number,
.submit_urb = hci_submit_urb,
.unlink_urb = hci_unlink_urb,
};
/***************************************************************************
......
......@@ -167,7 +167,7 @@ static int ohci_urb_enqueue (
else if ((urb->transfer_flags & USB_ZERO_PACKET) != 0
&& (urb->transfer_buffer_length
% usb_maxpacket (urb->dev, pipe,
usb_pipeout (pipe))) != 0)
usb_pipeout (pipe))) == 0)
size++;
break;
case PIPE_ISOCHRONOUS: /* number of packets from URB */
......
......@@ -284,47 +284,47 @@ dbg ("sleeping = %d, disabled = %d", ohci->sleeping, ohci->disabled);
/*-------------------------------------------------------------------------*/
static const struct hc_driver ohci_pci_hc_driver = {
description: hcd_name,
.description = hcd_name,
/*
* generic hardware linkage
*/
irq: ohci_irq,
flags: HCD_MEMORY | HCD_USB11,
.irq = ohci_irq,
.flags = HCD_MEMORY | HCD_USB11,
/*
* basic lifecycle operations
*/
start: ohci_pci_start,
.start = ohci_pci_start,
#ifdef CONFIG_PM
suspend: ohci_pci_suspend,
resume: ohci_pci_resume,
.suspend = ohci_pci_suspend,
.resume = ohci_pci_resume,
#endif
stop: ohci_stop,
.stop = ohci_stop,
/*
* memory lifecycle (except per-request)
*/
hcd_alloc: ohci_hcd_alloc,
hcd_free: ohci_hcd_free,
.hcd_alloc = ohci_hcd_alloc,
.hcd_free = ohci_hcd_free,
/*
* managing i/o requests and associated device resources
*/
urb_enqueue: ohci_urb_enqueue,
urb_dequeue: ohci_urb_dequeue,
free_config: ohci_free_config,
.urb_enqueue = ohci_urb_enqueue,
.urb_dequeue = ohci_urb_dequeue,
.free_config = ohci_free_config,
/*
* scheduling support
*/
get_frame_number: ohci_get_frame,
.get_frame_number = ohci_get_frame,
/*
* root hub support
*/
hub_status_data: ohci_hub_status_data,
hub_control: ohci_hub_control,
.hub_status_data = ohci_hub_status_data,
.hub_control = ohci_hub_control,
};
/*-------------------------------------------------------------------------*/
......@@ -333,15 +333,15 @@ static const struct hc_driver ohci_pci_hc_driver = {
static const struct pci_device_id __devinitdata pci_ids [] = { {
/* handle any USB OHCI controller */
class: (PCI_CLASS_SERIAL_USB << 8) | 0x10,
class_mask: ~0,
driver_data: (unsigned long) &ohci_pci_hc_driver,
.class = (PCI_CLASS_SERIAL_USB << 8) | 0x10,
.class_mask = ~0,
.driver_data = (unsigned long) &ohci_pci_hc_driver,
/* no matter who makes it */
vendor: PCI_ANY_ID,
device: PCI_ANY_ID,
subvendor: PCI_ANY_ID,
subdevice: PCI_ANY_ID,
.vendor = PCI_ANY_ID,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ }
};
......@@ -349,15 +349,15 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
/* pci driver glue; this is a "new style" PCI driver module */
static struct pci_driver ohci_pci_driver = {
name: (char *) hcd_name,
id_table: pci_ids,
.name = (char *) hcd_name,
.id_table = pci_ids,
probe: usb_hcd_pci_probe,
remove: usb_hcd_pci_remove,
.probe = usb_hcd_pci_probe,
.remove = usb_hcd_pci_remove,
#ifdef CONFIG_PM
suspend: usb_hcd_pci_suspend,
resume: usb_hcd_pci_resume,
.suspend = usb_hcd_pci_suspend,
.resume = usb_hcd_pci_resume,
#endif
};
......
......@@ -288,47 +288,47 @@ ohci_sa1111_start (struct usb_hcd *hcd)
/*-------------------------------------------------------------------------*/
static const struct hc_driver ohci_sa1111_hc_driver = {
description: hcd_name,
.description = hcd_name,
/*
* generic hardware linkage
*/
irq: ohci_irq,
flags: HCD_USB11,
.irq = ohci_irq,
.flags = HCD_USB11,
/*
* basic lifecycle operations
*/
start: ohci_sa1111_start,
.start = ohci_sa1111_start,
#ifdef CONFIG_PM
/* suspend: ohci_sa1111_suspend, -- tbd */
/* resume: ohci_sa1111_resume, -- tbd */
#endif
stop: ohci_stop,
.stop = ohci_stop,
/*
* memory lifecycle (except per-request)
*/
hcd_alloc: ohci_hcd_alloc,
hcd_free: ohci_hcd_free,
.hcd_alloc = ohci_hcd_alloc,
.hcd_free = ohci_hcd_free,
/*
* managing i/o requests and associated device resources
*/
urb_enqueue: ohci_urb_enqueue,
urb_dequeue: ohci_urb_dequeue,
free_config: ohci_free_config,
.urb_enqueue = ohci_urb_enqueue,
.urb_dequeue = ohci_urb_dequeue,
.free_config = ohci_free_config,
/*
* scheduling support
*/
get_frame_number: ohci_get_frame,
.get_frame_number = ohci_get_frame,
/*
* root hub support
*/
hub_status_data: ohci_hub_status_data,
hub_control: ohci_hub_control,
.hub_status_data = ohci_hub_status_data,
.hub_control = ohci_hub_control,
};
/*-------------------------------------------------------------------------*/
......
......@@ -571,11 +571,11 @@ static int uhci_proc_release(struct inode *inode, struct file *file)
}
static struct file_operations uhci_proc_operations = {
open: uhci_proc_open,
llseek: uhci_proc_lseek,
read: uhci_proc_read,
.open = uhci_proc_open,
.llseek = uhci_proc_lseek,
.read = uhci_proc_read,
// write: uhci_proc_write,
release: uhci_proc_release,
.release = uhci_proc_release,
};
#endif
......@@ -2476,45 +2476,45 @@ static int uhci_hcd_get_frame_number(struct usb_hcd *hcd)
static const char hcd_name[] = "uhci-hcd";
static const struct hc_driver uhci_driver = {
description: hcd_name,
.description = hcd_name,
/* Generic hardware linkage */
irq: uhci_irq,
flags: HCD_USB11,
.irq = uhci_irq,
.flags = HCD_USB11,
/* Basic lifecycle operations */
start: uhci_start,
.start = uhci_start,
#ifdef CONFIG_PM
suspend: uhci_suspend,
resume: uhci_resume,
.suspend = uhci_suspend,
.resume = uhci_resume,
#endif
stop: uhci_stop,
.stop = uhci_stop,
hcd_alloc: uhci_hcd_alloc,
hcd_free: uhci_hcd_free,
.hcd_alloc = uhci_hcd_alloc,
.hcd_free = uhci_hcd_free,
urb_enqueue: uhci_urb_enqueue,
urb_dequeue: uhci_urb_dequeue,
free_config: NULL,
.urb_enqueue = uhci_urb_enqueue,
.urb_dequeue = uhci_urb_dequeue,
.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_control: uhci_hub_control,
.hub_status_data = uhci_hub_status_data,
.hub_control = uhci_hub_control,
};
static const struct pci_device_id __devinitdata uhci_pci_ids[] = { {
/* handle any USB UHCI controller */
class: ((PCI_CLASS_SERIAL_USB << 8) | 0x00),
class_mask: ~0,
driver_data: (unsigned long) &uhci_driver,
.class = ((PCI_CLASS_SERIAL_USB << 8) | 0x00),
.class_mask = ~0,
.driver_data = (unsigned long) &uhci_driver,
/* no matter who makes it */
vendor: PCI_ANY_ID,
device: PCI_ANY_ID,
subvendor: PCI_ANY_ID,
subdevice: PCI_ANY_ID,
.vendor = PCI_ANY_ID,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ }
};
......@@ -2522,15 +2522,15 @@ static const struct pci_device_id __devinitdata uhci_pci_ids[] = { {
MODULE_DEVICE_TABLE(pci, uhci_pci_ids);
static struct pci_driver uhci_pci_driver = {
name: (char *)hcd_name,
id_table: uhci_pci_ids,
.name = (char *)hcd_name,
.id_table = uhci_pci_ids,
probe: usb_hcd_pci_probe,
remove: usb_hcd_pci_remove,
.probe = usb_hcd_pci_probe,
.remove = usb_hcd_pci_remove,
#ifdef CONFIG_PM
suspend: usb_hcd_pci_suspend,
resume: usb_hcd_pci_resume,
.suspend = usb_hcd_pci_suspend,
.resume = usb_hcd_pci_resume,
#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");
static struct usb_driver hpusbscsi_usb_driver = {
name:"hpusbscsi",
probe:hpusbscsi_usb_probe,
disconnect:hpusbscsi_usb_disconnect,
id_table:hpusbscsi_usb_ids,
.name ="hpusbscsi",
.probe =hpusbscsi_usb_probe,
.disconnect =hpusbscsi_usb_disconnect,
.id_table =hpusbscsi_usb_ids,
};
/* module initialisation */
......
......@@ -923,11 +923,11 @@ static ssize_t mdc800_device_write (struct file *file, const char *buf, size_t l
/* File Operations of this drivers */
static struct file_operations mdc800_device_ops =
{
owner: THIS_MODULE,
read: mdc800_device_read,
write: mdc800_device_write,
open: mdc800_device_open,
release: mdc800_device_release,
.owner = THIS_MODULE,
.read = mdc800_device_read,
.write = mdc800_device_write,
.open = mdc800_device_open,
.release = mdc800_device_release,
};
......@@ -943,11 +943,11 @@ MODULE_DEVICE_TABLE (usb, mdc800_table);
*/
static struct usb_driver mdc800_usb_driver =
{
owner: THIS_MODULE,
name: "mdc800",
probe: mdc800_usb_probe,
disconnect: mdc800_usb_disconnect,
id_table: mdc800_table
.owner = THIS_MODULE,
.name = "mdc800",
.probe = mdc800_usb_probe,
.disconnect = mdc800_usb_disconnect,
.id_table = mdc800_table
};
......
......@@ -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_driver mts_usb_driver = {
name: "microtekX6",
probe: mts_usb_probe,
disconnect: mts_usb_disconnect,
id_table: mts_usb_ids,
.name = "microtekX6",
.probe = mts_usb_probe,
.disconnect = mts_usb_disconnect,
.id_table = mts_usb_ids,
};
......@@ -743,22 +743,22 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback )
static Scsi_Host_Template mts_scsi_host_template = {
name: "microtekX6",
detect: mts_scsi_detect,
release: mts_scsi_release,
queuecommand: mts_scsi_queuecommand,
eh_abort_handler: mts_scsi_abort,
eh_host_reset_handler: mts_scsi_host_reset,
sg_tablesize: SG_ALL,
can_queue: 1,
this_id: -1,
cmd_per_lun: 1,
present: 0,
unchecked_isa_dma: FALSE,
use_clustering: TRUE,
emulated: TRUE
.name = "microtekX6",
.detect = mts_scsi_detect,
.release = mts_scsi_release,
.queuecommand = mts_scsi_queuecommand,
.eh_abort_handler = mts_scsi_abort,
.eh_host_reset_handler =mts_scsi_host_reset,
.sg_tablesize = SG_ALL,
.can_queue = 1,
.this_id = -1,
.cmd_per_lun = 1,
.present = 0,
.unchecked_isa_dma = FALSE,
.use_clustering = TRUE,
.emulated = TRUE
};
......
......@@ -811,11 +811,11 @@ ioctl_scanner(struct inode *inode, struct file *file,
static struct
file_operations usb_scanner_fops = {
read: read_scanner,
write: write_scanner,
ioctl: ioctl_scanner,
open: open_scanner,
release: close_scanner,
.read = read_scanner,
.write = write_scanner,
.ioctl = ioctl_scanner,
.open = open_scanner,
.release = close_scanner,
};
static void *
......@@ -1116,10 +1116,10 @@ disconnect_scanner(struct usb_device *dev, void *ptr)
static struct
usb_driver scanner_driver = {
name: "usbscanner",
probe: probe_scanner,
disconnect: disconnect_scanner,
id_table: NULL, /* This would be scanner_device_ids, but we
.name = "usbscanner",
.probe = probe_scanner,
.disconnect = disconnect_scanner,
.id_table = NULL, /* This would be scanner_device_ids, but we
need to check every USB device, in case
we match a user defined vendor/product ID. */
};
......
......@@ -313,10 +313,10 @@ aiptek_disconnect(struct usb_device *dev, void *ptr)
}
static struct usb_driver aiptek_driver = {
name:"aiptek",
probe:aiptek_probe,
disconnect:aiptek_disconnect,
id_table:aiptek_ids,
.name ="aiptek",
.probe =aiptek_probe,
.disconnect =aiptek_disconnect,
.id_table =aiptek_ids,
};
static int __init
......
......@@ -1556,10 +1556,10 @@ static struct usb_device_id hid_usb_ids [] = {
MODULE_DEVICE_TABLE (usb, hid_usb_ids);
static struct usb_driver hid_driver = {
name: "hid",
probe: hid_probe,
disconnect: hid_disconnect,
id_table: hid_usb_ids,
.name = "hid",
.probe = hid_probe,
.disconnect = hid_disconnect,
.id_table = hid_usb_ids,
};
static int __init hid_init(void)
......
......@@ -657,14 +657,14 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
}
static struct file_operations hiddev_fops = {
owner: THIS_MODULE,
read: hiddev_read,
write: hiddev_write,
poll: hiddev_poll,
open: hiddev_open,
release: hiddev_release,
ioctl: hiddev_ioctl,
fasync: hiddev_fasync,
.owner = THIS_MODULE,
.read = hiddev_read,
.write = hiddev_write,
.poll = hiddev_poll,
.open = hiddev_open,
.release = hiddev_release,
.ioctl = hiddev_ioctl,
.fasync = hiddev_fasync,
};
/*
......@@ -759,8 +759,8 @@ static void *hiddev_usbd_probe(struct usb_device *dev, unsigned int ifnum,
static /* const */ struct usb_driver hiddev_driver = {
name: "hiddev",
probe: hiddev_usbd_probe,
.name = "hiddev",
.probe = hiddev_usbd_probe,
};
int __init hiddev_init(void)
......
......@@ -334,10 +334,10 @@ static struct usb_device_id powermate_devices [] = {
MODULE_DEVICE_TABLE (usb, powermate_devices);
static struct usb_driver powermate_driver = {
name: "powermate",
probe: powermate_probe,
disconnect: powermate_disconnect,
id_table: powermate_devices,
.name = "powermate",
.probe = powermate_probe,
.disconnect = powermate_disconnect,
.id_table = powermate_devices,
};
int powermate_init(void)
......
......@@ -287,10 +287,10 @@ static struct usb_device_id usb_kbd_id_table [] = {
MODULE_DEVICE_TABLE (usb, usb_kbd_id_table);
static struct usb_driver usb_kbd_driver = {
name: "keyboard",
probe: usb_kbd_probe,
disconnect: usb_kbd_disconnect,
id_table: usb_kbd_id_table,
.name = "keyboard",
.probe = usb_kbd_probe,
.disconnect = usb_kbd_disconnect,
.id_table = usb_kbd_id_table,
};
static int __init usb_kbd_init(void)
......
......@@ -195,10 +195,10 @@ static struct usb_device_id usb_mouse_id_table [] = {
MODULE_DEVICE_TABLE (usb, usb_mouse_id_table);
static struct usb_driver usb_mouse_driver = {
name: "usb_mouse",
probe: usb_mouse_probe,
disconnect: usb_mouse_disconnect,
id_table: usb_mouse_id_table,
.name = "usb_mouse",
.probe = usb_mouse_probe,
.disconnect = usb_mouse_disconnect,
.id_table = usb_mouse_id_table,
};
static int __init usb_mouse_init(void)
......
......@@ -428,10 +428,10 @@ static void wacom_disconnect(struct usb_device *dev, void *ptr)
}
static struct usb_driver wacom_driver = {
name: "wacom",
probe: wacom_probe,
disconnect: wacom_disconnect,
id_table: wacom_ids,
.name = "wacom",
.probe = wacom_probe,
.disconnect = wacom_disconnect,
.id_table = wacom_ids,
};
static int __init wacom_init(void)
......
......@@ -304,10 +304,10 @@ static void xpad_disconnect(struct usb_device *udev, void *ptr)
}
static struct usb_driver xpad_driver = {
name: "xpad",
probe: xpad_probe,
disconnect: xpad_disconnect,
id_table: xpad_table,
.name = "xpad",
.probe = xpad_probe,
.disconnect = xpad_disconnect,
.id_table = xpad_table,
};
static int __init usb_xpad_init(void)
......
......@@ -704,12 +704,12 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm
static struct file_operations dabusb_fops =
{
owner: THIS_MODULE,
llseek: no_llseek,
read: dabusb_read,
ioctl: dabusb_ioctl,
open: dabusb_open,
release: dabusb_release,
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = dabusb_read,
.ioctl = dabusb_ioctl,
.open = dabusb_open,
.release = dabusb_release,
};
static int dabusb_find_struct (void)
......@@ -806,10 +806,10 @@ MODULE_DEVICE_TABLE (usb, dabusb_ids);
static struct usb_driver dabusb_driver =
{
name: "dabusb",
probe: dabusb_probe,
disconnect: dabusb_disconnect,
id_table: dabusb_ids,
.name = "dabusb",
.probe = dabusb_probe,
.disconnect = dabusb_disconnect,
.id_table = dabusb_ids,
};
/* --------------------------------------------------------------------- */
......
......@@ -100,19 +100,19 @@ typedef struct
static struct file_operations usb_dsbr100_fops = {
owner: THIS_MODULE,
open: usb_dsbr100_open,
release: usb_dsbr100_close,
ioctl: usb_dsbr100_ioctl,
llseek: no_llseek,
.owner = THIS_MODULE,
.open = usb_dsbr100_open,
.release = usb_dsbr100_close,
.ioctl = usb_dsbr100_ioctl,
.llseek = no_llseek,
};
static struct video_device usb_dsbr100_radio=
{
owner: THIS_MODULE,
name: "D-Link DSB R-100 USB radio",
type: VID_TYPE_TUNER,
hardware: VID_HARDWARE_AZTECH,
fops: &usb_dsbr100_fops,
.owner = THIS_MODULE,
.name = "D-Link DSB R-100 USB radio",
.type = VID_TYPE_TUNER,
.hardware = VID_HARDWARE_AZTECH,
.fops = &usb_dsbr100_fops,
};
static int users = 0;
......@@ -125,10 +125,10 @@ static struct usb_device_id usb_dsbr100_table [] = {
MODULE_DEVICE_TABLE (usb, usb_dsbr100_table);
static struct usb_driver usb_dsbr100_driver = {
name: "dsbr100",
probe: usb_dsbr100_probe,
disconnect: usb_dsbr100_disconnect,
id_table: usb_dsbr100_table,
.name = "dsbr100",
.probe = usb_dsbr100_probe,
.disconnect = usb_dsbr100_disconnect,
.id_table = usb_dsbr100_table,
};
......
This diff is collapsed.
......@@ -551,17 +551,11 @@ struct usb_ov511 {
int num_inputs; /* Number of inputs */
int norm; /* NTSC / PAL / SECAM */
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 */
/* I2C interface to kernel */
/* I2C interface */
struct semaphore i2c_lock; /* Protect I2C controller regs */
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 */
unsigned char *cbuf; /* Buffer for payload */
......
This diff is collapsed.
......@@ -1283,20 +1283,20 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma)
}
static struct file_operations se401_fops = {
owner: THIS_MODULE,
open: se401_open,
release: se401_close,
read: se401_read,
mmap: se401_mmap,
ioctl: se401_ioctl,
llseek: no_llseek,
.owner = THIS_MODULE,
.open = se401_open,
.release = se401_close,
.read = se401_read,
.mmap = se401_mmap,
.ioctl = se401_ioctl,
.llseek = no_llseek,
};
static struct video_device se401_template = {
owner: THIS_MODULE,
name: "se401 USB camera",
type: VID_TYPE_CAPTURE,
hardware: VID_HARDWARE_SE401,
fops: &se401_fops,
.owner = THIS_MODULE,
.name = "se401 USB camera",
.type = VID_TYPE_CAPTURE,
.hardware = VID_HARDWARE_SE401,
.fops = &se401_fops,
};
......@@ -1523,7 +1523,7 @@ static inline void usb_se401_remove_disconnected (struct usb_se401 *se401)
static struct usb_driver se401_driver = {
name: "se401",
id_table: device_table,
probe: se401_probe,
.probe = se401_probe,
disconnect: se401_disconnect
};
......
......@@ -1432,20 +1432,20 @@ static int stv680_read (struct file *file, char *buf,
} /* stv680_read */
static struct file_operations stv680_fops = {
owner: THIS_MODULE,
open: stv_open,
release: stv_close,
read: stv680_read,
mmap: stv680_mmap,
ioctl: stv680_ioctl,
llseek: no_llseek,
.owner = THIS_MODULE,
.open = stv_open,
.release = stv_close,
.read = stv680_read,
.mmap = stv680_mmap,
.ioctl = stv680_ioctl,
.llseek = no_llseek,
};
static struct video_device stv680_template = {
owner: THIS_MODULE,
name: "STV0680 USB camera",
type: VID_TYPE_CAPTURE,
hardware: VID_HARDWARE_SE401,
fops: &stv680_fops,
.owner = THIS_MODULE,
.name = "STV0680 USB camera",
.type = VID_TYPE_CAPTURE,
.hardware = VID_HARDWARE_SE401,
.fops = &stv680_fops,
};
static void *stv680_probe (struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)
......@@ -1545,10 +1545,10 @@ static void stv680_disconnect (struct usb_device *dev, void *ptr)
}
static struct usb_driver stv680_driver = {
name: "stv680",
probe: stv680_probe,
disconnect: stv680_disconnect,
id_table: device_table
.name = "stv680",
.probe = stv680_probe,
.disconnect = stv680_disconnect,
.id_table = device_table
};
/********************************************************************
......
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);
static struct usb_driver uss720_driver = {
name: "uss720",
probe: uss720_probe,
disconnect: uss720_disconnect,
id_table: uss720_table,
.name = "uss720",
.probe = uss720_probe,
.disconnect = uss720_disconnect,
.id_table = uss720_table,
};
/* --------------------------------------------------------------------- */
......
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.
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