Commit aaf2a6b6 authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents cd566b34 f0cefc01
...@@ -524,6 +524,29 @@ static void usb_hub_disconnect(struct usb_device *dev) ...@@ -524,6 +524,29 @@ static void usb_hub_disconnect(struct usb_device *dev)
err("cannot disconnect hub %s", dev->devpath); err("cannot disconnect hub %s", dev->devpath);
} }
static int usb_hub_port_status(struct usb_device *hub, int port,
u16 *status, u16 *change)
{
struct usb_port_status *portsts;
int ret = -ENOMEM;
portsts = kmalloc(sizeof(*portsts), GFP_KERNEL);
if (portsts) {
ret = usb_get_port_status(hub, port + 1, portsts);
if (ret < 0)
err("%s(%s) failed (err = %d)", __FUNCTION__, hub->devpath, ret);
else {
*status = le16_to_cpu(portsts->wPortStatus);
*change = le16_to_cpu(portsts->wPortChange);
dbg("port %d, portstatus %x, change %x, %s", port + 1,
*status, *change, portspeed(*status));
ret = 0;
}
kfree(portsts);
}
return ret;
}
#define HUB_RESET_TRIES 5 #define HUB_RESET_TRIES 5
#define HUB_PROBE_TRIES 2 #define HUB_PROBE_TRIES 2
#define HUB_SHORT_RESET_TIME 10 #define HUB_SHORT_RESET_TIME 10
...@@ -535,8 +558,8 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port, ...@@ -535,8 +558,8 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port,
struct usb_device *dev, unsigned int delay) struct usb_device *dev, unsigned int delay)
{ {
int delay_time, ret; int delay_time, ret;
struct usb_port_status portsts; u16 portstatus;
unsigned short portchange, portstatus; u16 portchange;
for (delay_time = 0; for (delay_time = 0;
delay_time < HUB_RESET_TIMEOUT; delay_time < HUB_RESET_TIMEOUT;
...@@ -545,18 +568,11 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port, ...@@ -545,18 +568,11 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port,
wait_ms(delay); wait_ms(delay);
/* read and decode port status */ /* read and decode port status */
ret = usb_get_port_status(hub, port + 1, &portsts); ret = usb_hub_port_status(hub, port, &portstatus, &portchange);
if (ret < 0) { if (ret < 0) {
err("get_port_status(%d) failed (err = %d)",
port + 1, ret);
return -1; return -1;
} }
portstatus = le16_to_cpu(portsts.wPortStatus);
portchange = le16_to_cpu(portsts.wPortChange);
dbg("port %d, portstatus %x, change %x, %s", port + 1,
portstatus, portchange, portspeed (portstatus));
/* Device went away? */ /* Device went away? */
if (!(portstatus & USB_PORT_STAT_CONNECTION)) if (!(portstatus & USB_PORT_STAT_CONNECTION))
return 1; return 1;
...@@ -629,16 +645,13 @@ void usb_hub_port_disable(struct usb_device *hub, int port) ...@@ -629,16 +645,13 @@ void usb_hub_port_disable(struct usb_device *hub, int port)
} }
static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
struct usb_port_status *portsts) u16 portstatus, u16 portchange)
{ {
struct usb_device *hub = hubstate->dev; struct usb_device *hub = hubstate->dev;
struct usb_device *dev; struct usb_device *dev;
unsigned short portstatus, portchange;
unsigned int delay = HUB_SHORT_RESET_TIME; unsigned int delay = HUB_SHORT_RESET_TIME;
int i; int i;
portstatus = le16_to_cpu(portsts->wPortStatus);
portchange = le16_to_cpu(portsts->wPortChange);
dbg("hub %s port %d, portstatus %x, change %x, %s", dbg("hub %s port %d, portstatus %x, change %x, %s",
hub->devpath, port + 1, hub->devpath, port + 1,
portstatus, portchange, portspeed (portstatus)); portstatus, portchange, portspeed (portstatus));
...@@ -759,7 +772,10 @@ static void usb_hub_events(void) ...@@ -759,7 +772,10 @@ static void usb_hub_events(void)
struct usb_device *dev; struct usb_device *dev;
struct usb_hub *hub; struct usb_hub *hub;
struct usb_hub_status hubsts; struct usb_hub_status hubsts;
unsigned short hubstatus, hubchange; u16 hubstatus;
u16 hubchange;
u16 portstatus;
u16 portchange;
int i, ret; int i, ret;
/* /*
...@@ -803,23 +819,15 @@ static void usb_hub_events(void) ...@@ -803,23 +819,15 @@ static void usb_hub_events(void)
} }
for (i = 0; i < hub->descriptor->bNbrPorts; i++) { for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
struct usb_port_status portsts; ret = usb_hub_port_status(dev, i, &portstatus, &portchange);
unsigned short portstatus, portchange;
ret = usb_get_port_status(dev, i + 1, &portsts);
if (ret < 0) { if (ret < 0) {
err("hub %s get_port_status failed (err = %d)",
dev->devpath, ret);
continue; continue;
} }
portstatus = le16_to_cpu(portsts.wPortStatus);
portchange = le16_to_cpu(portsts.wPortChange);
if (portchange & USB_PORT_STAT_C_CONNECTION) { if (portchange & USB_PORT_STAT_C_CONNECTION) {
dbg("hub %s port %d connection change", dbg("hub %s port %d connection change",
dev->devpath, i + 1); dev->devpath, i + 1);
usb_hub_port_connect_change(hub, i, &portsts); usb_hub_port_connect_change(hub, i, portstatus, portchange);
} else if (portchange & USB_PORT_STAT_C_ENABLE) { } else if (portchange & USB_PORT_STAT_C_ENABLE) {
dbg("hub %s port %d enable change, status %x", dbg("hub %s port %d enable change, status %x",
dev->devpath, i + 1, portstatus); dev->devpath, i + 1, portstatus);
...@@ -840,7 +848,7 @@ static void usb_hub_events(void) ...@@ -840,7 +848,7 @@ static void usb_hub_events(void)
"re-enabling...", "re-enabling...",
dev->devpath, i + 1); dev->devpath, i + 1);
usb_hub_port_connect_change(hub, usb_hub_port_connect_change(hub,
i, &portsts); i, portstatus, portchange);
} }
} }
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
static struct super_operations usbfs_ops; static struct super_operations usbfs_ops;
static struct address_space_operations usbfs_aops;
static struct file_operations usbfs_dir_operations; static struct file_operations usbfs_dir_operations;
static struct file_operations default_file_operations; static struct file_operations default_file_operations;
static struct inode_operations usbfs_dir_inode_operations; static struct inode_operations usbfs_dir_inode_operations;
...@@ -168,7 +167,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev) ...@@ -168,7 +167,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev)
inode->i_blksize = PAGE_CACHE_SIZE; inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_rdev = NODEV; inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &usbfs_aops;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
default: default:
...@@ -186,7 +184,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev) ...@@ -186,7 +184,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev)
return inode; return inode;
} }
/* SMP-safe */
static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode, static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
int dev) int dev)
{ {
...@@ -211,18 +208,6 @@ static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode) ...@@ -211,18 +208,6 @@ static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode)
return usbfs_mknod (dir, dentry, mode | S_IFREG, 0); return usbfs_mknod (dir, dentry, mode | S_IFREG, 0);
} }
static int usbfs_link (struct dentry *old_dentry, struct inode *dir,
struct dentry *dentry)
{
struct inode *inode = old_dentry->d_inode;
inode->i_nlink++;
atomic_inc(&inode->i_count);
dget(dentry);
d_instantiate(dentry, inode);
return 0;
}
static inline int usbfs_positive (struct dentry *dentry) static inline int usbfs_positive (struct dentry *dentry)
{ {
return dentry->d_inode && !d_unhashed(dentry); return dentry->d_inode && !d_unhashed(dentry);
...@@ -260,22 +245,6 @@ static int usbfs_unlink (struct inode *dir, struct dentry *dentry) ...@@ -260,22 +245,6 @@ static int usbfs_unlink (struct inode *dir, struct dentry *dentry)
return error; return error;
} }
static int usbfs_rename (struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
int error = -ENOTEMPTY;
if (usbfs_empty(new_dentry)) {
struct inode *inode = new_dentry->d_inode;
if (inode) {
inode->i_nlink--;
dput(new_dentry);
}
error = 0;
}
return error;
}
#define usbfs_rmdir usbfs_unlink #define usbfs_rmdir usbfs_unlink
/* default file operations */ /* default file operations */
...@@ -324,19 +293,9 @@ static int default_open (struct inode *inode, struct file *filp) ...@@ -324,19 +293,9 @@ static int default_open (struct inode *inode, struct file *filp)
return 0; return 0;
} }
static int default_sync_file (struct file *file, struct dentry *dentry,
int datasync)
{
return 0;
}
static struct address_space_operations usbfs_aops = {
};
static struct file_operations usbfs_dir_operations = { static struct file_operations usbfs_dir_operations = {
read: generic_read_dir, read: generic_read_dir,
readdir: dcache_readdir, readdir: dcache_readdir,
fsync: default_sync_file,
}; };
static struct file_operations default_file_operations = { static struct file_operations default_file_operations = {
...@@ -344,19 +303,14 @@ static struct file_operations default_file_operations = { ...@@ -344,19 +303,14 @@ static struct file_operations default_file_operations = {
write: default_write_file, write: default_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
static struct inode_operations usbfs_dir_inode_operations = { static struct inode_operations usbfs_dir_inode_operations = {
create: usbfs_create, create: usbfs_create,
lookup: usbfs_lookup, lookup: usbfs_lookup,
link: usbfs_link,
unlink: usbfs_unlink, unlink: usbfs_unlink,
mkdir: usbfs_mkdir, mkdir: usbfs_mkdir,
rmdir: usbfs_rmdir, rmdir: usbfs_rmdir,
mknod: usbfs_mknod,
rename: usbfs_rename,
}; };
static struct super_operations usbfs_ops = { static struct super_operations usbfs_ops = {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* USB HandSpring Visor, Palm m50x, and Sony Clie driver * USB HandSpring Visor, Palm m50x, and Sony Clie driver
* (supports all of the Palm OS USB devices) * (supports all of the Palm OS USB devices)
* *
* Copyright (C) 1999 - 2001 * Copyright (C) 1999 - 2002
* Greg Kroah-Hartman (greg@kroah.com) * Greg Kroah-Hartman (greg@kroah.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
* *
* See Documentation/usb/usb-serial.txt for more information on using this driver * See Documentation/usb/usb-serial.txt for more information on using this driver
* *
* (02/14/2002) gkh
* Added support for the Clie S-360 device.
*
* (12/18/2001) gkh * (12/18/2001) gkh
* Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand * Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand
* for the patch. * for the patch.
...@@ -131,7 +134,7 @@ ...@@ -131,7 +134,7 @@
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v1.8" #define DRIVER_VERSION "v1.9"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>" #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clié driver" #define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clié driver"
...@@ -158,6 +161,7 @@ static __devinitdata struct usb_device_id combined_id_table [] = { ...@@ -158,6 +161,7 @@ static __devinitdata struct usb_device_id combined_id_table [] = {
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) },
{ USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID) }, { USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_S360_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
...@@ -173,6 +177,7 @@ static __devinitdata struct usb_device_id id_table [] = { ...@@ -173,6 +177,7 @@ static __devinitdata struct usb_device_id id_table [] = {
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_3_5_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_3_5_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_S360_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
/* /*
* USB HandSpring Visor driver * USB HandSpring Visor driver
* *
* Copyright (C) 1999 - 2001 * Copyright (C) 1999 - 2002
* Greg Kroah-Hartman (greg@kroah.com) * Greg Kroah-Hartman (greg@kroah.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define SONY_VENDOR_ID 0x054C #define SONY_VENDOR_ID 0x054C
#define SONY_CLIE_3_5_ID 0x0038 #define SONY_CLIE_3_5_ID 0x0038
#define SONY_CLIE_4_0_ID 0x0066 #define SONY_CLIE_4_0_ID 0x0066
#define SONY_CLIE_S360_ID 0x0095
/**************************************************************************** /****************************************************************************
* Handspring Visor Vendor specific request codes (bRequest values) * Handspring Visor Vendor specific request codes (bRequest values)
......
/* /*
* USB Skeleton driver - 0.6 * USB Skeleton driver - 0.7
* *
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* *
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
* *
* History: * History:
* *
* 2002_02_12 - 0.7 - zero out dev in probe function for devices that do
* not have both a bulk in and bulk out endpoint.
* Thanks to Holger Waechtler for the fix.
* 2001_11_05 - 0.6 - fix minor locking problem in skel_disconnect. * 2001_11_05 - 0.6 - fix minor locking problem in skel_disconnect.
* Thanks to Pete Zaitcev for the fix. * Thanks to Pete Zaitcev for the fix.
* 2001_09_04 - 0.5 - fix devfs bug in skel_disconnect. Thanks to wim delvaux * 2001_09_04 - 0.5 - fix devfs bug in skel_disconnect. Thanks to wim delvaux
...@@ -542,6 +545,7 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru ...@@ -542,6 +545,7 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
err ("Out of memory"); err ("Out of memory");
goto exit; goto exit;
} }
memset (dev, 0x00, sizeof (*dev));
minor_table[minor] = dev; minor_table[minor] = dev;
interface = &udev->actconfig->interface[ifnum]; interface = &udev->actconfig->interface[ifnum];
......
...@@ -1979,11 +1979,11 @@ void usb_disconnect(struct usb_device **pdev) ...@@ -1979,11 +1979,11 @@ void usb_disconnect(struct usb_device **pdev)
if (driver->owner) if (driver->owner)
__MOD_DEC_USE_COUNT(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)
put_device (&interface->dev);
usb_driver_release_interface(driver, interface); usb_driver_release_interface(driver, interface);
} }
} /* remove our device node for this interface */
put_device(&interface->dev);
} }
} }
......
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