Commit 67d0f1a8 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.5
parents cd03e0b9 9c11ee97
......@@ -2185,7 +2185,7 @@ S: Fullarton 5063
S: South Australia
N. Wolfgang Muees
E: wmues@nexgo.de
E: wolfgang@iksw-muees.de
D: Auerswald USB driver
N: Ian A. Murdock
......
......@@ -27,4 +27,4 @@ Future plans
============
- Connection to ISDN4LINUX (the hisax interface)
The maintainer of this driver is wmues@nexgo.de
The maintainer of this driver is wolfgang@iksw-muees.de
......@@ -1816,7 +1816,7 @@ S: Maintained
USB AUERSWALD DRIVER
P: Wolfgang Muees
M: wmues@nexgo.de
M: wolfgang@iksw-muees.de
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
S: Maintained
......
......@@ -491,7 +491,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
*/
lock_kernel();
ret = -ENOENT;
dev = inode->u.generic_ip;
dev = file->f_dentry->d_parent->d_fsdata;
if (!dev)
goto out;
ret = -ENOMEM;
......
......@@ -876,10 +876,11 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
* (quite rare, since most hubs have 4-6 ports).
*/
pdev = dev->parent;
if (pdev->devpath [0] != '/') /* parent not root */
if (pdev->devpath [0] != '0') /* parent not root? */
len = snprintf (dev->devpath, sizeof dev->devpath,
"%s.%d", pdev->devpath, port + 1);
else /* root == "/", root port 2 == "2", port 3 that hub "/2.3" */
/* root == "0", root port 2 == "2", port 3 that hub "2.3" */
else
len = snprintf (dev->devpath, sizeof dev->devpath,
"%d", port + 1);
if (len == sizeof dev->devpath)
......
......@@ -4,7 +4,7 @@
* inode.c -- Inode/Dentry functions for the USB device file system.
*
* Copyright (C) 2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001,2002 Greg Kroah-Hartman (greg@kroah.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -176,7 +176,10 @@ static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
int dev)
{
struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC;
int error = -EPERM;
if (dentry->d_inode)
return -EEXIST;
if (inode) {
d_instantiate(dentry, inode);
......@@ -188,12 +191,19 @@ static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode)
{
return usbfs_mknod (dir, dentry, mode | S_IFDIR, 0);
int res;
mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
res = usbfs_mknod (dir, dentry, mode, 0);
if (!res)
dir->i_nlink++;
return res;
}
static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode)
{
return usbfs_mknod (dir, dentry, mode | S_IFREG, 0);
mode = (mode & S_IALLUGO) | S_IFREG;
return usbfs_mknod (dir, dentry, mode, 0);
}
static inline int usbfs_positive (struct dentry *dentry)
......@@ -220,22 +230,54 @@ static int usbfs_empty (struct dentry *dentry)
}
static int usbfs_unlink (struct inode *dir, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
down(&inode->i_sem);
dentry->d_inode->i_nlink--;
dput(dentry);
up(&inode->i_sem);
d_delete(dentry);
return 0;
}
static void d_unhash(struct dentry *dentry)
{
dget(dentry);
spin_lock(&dcache_lock);
switch (atomic_read(&dentry->d_count)) {
default:
spin_unlock(&dcache_lock);
shrink_dcache_parent(dentry);
spin_lock(&dcache_lock);
if (atomic_read(&dentry->d_count) != 2)
break;
case 2:
list_del_init(&dentry->d_hash);
}
spin_unlock(&dcache_lock);
}
static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
{
int error = -ENOTEMPTY;
struct inode * inode = dentry->d_inode;
down(&inode->i_sem);
d_unhash(dentry);
if (usbfs_empty(dentry)) {
struct inode *inode = dentry->d_inode;
lock_kernel();
inode->i_nlink--;
unlock_kernel();
dentry->d_inode->i_nlink -= 2;
dput(dentry);
inode->i_flags |= S_DEAD;
dir->i_nlink--;
error = 0;
}
up(&inode->i_sem);
if (!error)
d_delete(dentry);
dput(dentry);
return error;
}
#define usbfs_rmdir usbfs_unlink
/* default file operations */
static ssize_t default_read_file (struct file *file, char *buf,
......@@ -254,7 +296,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
{
loff_t retval = -EINVAL;
lock_kernel();
down(&file->f_dentry->d_inode->i_sem);
switch(orig) {
case 0:
if (offset > 0) {
......@@ -271,14 +313,18 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
default:
break;
}
unlock_kernel();
up(&file->f_dentry->d_inode->i_sem);
return retval;
}
static int default_open (struct inode *inode, struct file *filp)
static int default_open (struct inode *inode, struct file *file)
{
if (inode->u.generic_ip)
filp->private_data = inode->u.generic_ip;
void *data;
data = file->f_dentry->d_parent->d_fsdata;
if (!data)
return -EFAULT;
file->private_data = data;
return 0;
}
......@@ -291,11 +337,7 @@ static struct file_operations default_file_operations = {
};
static struct inode_operations usbfs_dir_inode_operations = {
.create = usbfs_create,
.lookup = simple_lookup,
.unlink = usbfs_unlink,
.mkdir = usbfs_mkdir,
.rmdir = usbfs_rmdir,
};
static struct super_operations usbfs_ops = {
......@@ -334,26 +376,32 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
return 0;
}
/**
static struct dentry * get_dentry(struct dentry *parent, const char *name)
{
struct qstr qstr;
qstr.name = name;
qstr.len = strlen(name);
qstr.hash = full_name_hash(name,qstr.len);
return lookup_hash(&qstr,parent);
}
/*
* fs_create_by_name - create a file, given a name
* @name: name of file
* @mode: type of file
* @parent: dentry of directory to create it in
* @dentry: resulting dentry of file
* @data: data to put in this dentry
*
* There is a bit of overhead in creating a file - basically, we
* have to hash the name of the file, then look it up. This will
* prevent files of the same name.
* We then call the proper vfs_ function to take care of all the
* file creation details.
* This function handles both regular files and directories.
*/
static int fs_create_by_name (const char *name, mode_t mode,
struct dentry *parent, struct dentry **dentry)
struct dentry *parent, struct dentry **dentry,
void *data)
{
struct dentry *d = NULL;
struct qstr qstr;
int error;
int error = 0;
/* If the parent is not specified, we create it in the root.
* We need the root dentry to do this, which is in the super
......@@ -372,34 +420,18 @@ static int fs_create_by_name (const char *name, mode_t mode,
}
*dentry = NULL;
qstr.name = name;
qstr.len = strlen(name);
qstr.hash = full_name_hash(name,qstr.len);
parent = dget(parent);
down(&parent->d_inode->i_sem);
d = lookup_hash(&qstr,parent);
error = PTR_ERR(d);
if (!IS_ERR(d)) {
switch(mode & S_IFMT) {
case 0:
case S_IFREG:
error = vfs_create(parent->d_inode,d,mode);
break;
case S_IFDIR:
error = vfs_mkdir(parent->d_inode,d,mode);
break;
default:
err("cannot create special files");
}
*dentry = d;
}
*dentry = get_dentry (parent, name);
if (!IS_ERR(dentry)) {
(*dentry)->d_fsdata = data;
if ((mode & S_IFMT) == S_IFDIR)
error = usbfs_mkdir (parent->d_inode, *dentry, mode);
else
error = usbfs_create (parent->d_inode, *dentry, mode);
} else
error = PTR_ERR(dentry);
up(&parent->d_inode->i_sem);
dput(parent);
return error;
}
......@@ -413,13 +445,11 @@ static struct dentry *fs_create_file (const char *name, mode_t mode,
dbg("creating file '%s'",name);
error = fs_create_by_name(name,mode,parent,&dentry);
error = fs_create_by_name (name, mode, parent, &dentry, data);
if (error) {
dentry = NULL;
} else {
if (dentry->d_inode) {
if (data)
dentry->d_inode->u.generic_ip = data;
if (fops)
dentry->d_inode->i_fop = fops;
dentry->d_inode->i_uid = uid;
......@@ -441,12 +471,11 @@ static void fs_remove_file (struct dentry *dentry)
if (usbfs_positive(dentry)) {
if (dentry->d_inode) {
if (S_ISDIR(dentry->d_inode->i_mode))
vfs_rmdir(parent->d_inode,dentry);
usbfs_rmdir(parent->d_inode, dentry);
else
vfs_unlink(parent->d_inode,dentry);
}
usbfs_unlink(parent->d_inode, dentry);
dput(dentry);
}
}
up(&parent->d_inode->i_sem);
}
......@@ -471,14 +500,14 @@ static struct file_system_type usbdevice_fs_type = {
.owner = THIS_MODULE,
.name = "usbdevfs",
.get_sb = usb_get_sb,
.kill_sb = kill_anon_super,
.kill_sb = kill_litter_super,
};
static struct file_system_type usb_fs_type = {
.owner = THIS_MODULE,
.name = "usbfs",
.get_sb = usb_get_sb,
.kill_sb = kill_anon_super,
.kill_sb = kill_litter_super,
};
/* --------------------------------------------------------------------- */
......@@ -536,7 +565,7 @@ static int create_special_files (void)
{
int retval;
/* create the devices and drivers special files */
/* create the devices special file */
retval = get_mount ();
if (retval)
return retval;
......
......@@ -995,7 +995,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus)
usb_bus_get(bus);
if (!parent)
dev->devpath [0] = '/';
dev->devpath [0] = '0';
dev->bus = bus;
dev->parent = parent;
atomic_set(&dev->refcnt, 1);
......
......@@ -172,7 +172,7 @@ struct aiptek_features aiptek_features[] = {
};
struct usb_device_id aiptek_ids[] = {
{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), driver_info:0},
{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), .driver_info = 0},
{}
};
......
......@@ -1521,10 +1521,10 @@ static inline void usb_se401_remove_disconnected (struct usb_se401 *se401)
}
static struct usb_driver se401_driver = {
name: "se401",
id_table: device_table,
.name = "se401",
.id_table = device_table,
.probe = se401_probe,
disconnect: se401_disconnect
.disconnect = se401_disconnect
};
......
......@@ -2,7 +2,7 @@
/*
* auerswald.c -- Auerswald PBX/System Telephone usb driver.
*
* Copyright (C) 2001 Wolfgang Mes (wmues@nexgo.de)
* Copyright (C) 2001 Wolfgang Mes (wolfgang@iksw-muees.de)
*
* Very much code of this driver is borrowed from dabusb.c (Deti Fliegl)
* and from the USB Skeleton driver (Greg Kroah-Hartman). Thank you.
......@@ -51,7 +51,7 @@ do { \
/*-------------------------------------------------------------------*/
/* Version Information */
#define DRIVER_VERSION "0.9.11"
#define DRIVER_AUTHOR "Wolfgang Mes <wmues@nexgo.de>"
#define DRIVER_AUTHOR "Wolfgang Mes <wolfgang@iksw-muees.de>"
#define DRIVER_DESC "Auerswald PBX/System Telephone usb driver"
/*-------------------------------------------------------------------*/
......
......@@ -152,6 +152,7 @@ static struct usb_device_id usb_klsi_table[] = {
{ USB_DEVICE(0x10bd, 0x1427) }, /* ASANTE USB To Ethernet Adapter */
{ USB_DEVICE(0x1342, 0x0204) }, /* Mobility USB-Ethernet Adapter */
{ USB_DEVICE(0x13d2, 0x0400) }, /* Shark Pocket Adapter */
{ USB_DEVICE(0x1485, 0x0001) }, /* Silicom U2E */
{ USB_DEVICE(0x1645, 0x0005) }, /* Entrega E45 */
{ USB_DEVICE(0x1645, 0x0008) }, /* Entrega USB Ethernet Adapter */
{ USB_DEVICE(0x1645, 0x8005) }, /* PortGear Ethernet Adapter */
......
......@@ -9,6 +9,10 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* (26/7/2002) ganesh
* Fixed up broken error handling in ipaq_open. Retry the "kickstart"
* packet much harder - this drastically reduces connection failures.
*
* (30/4/2002) ganesh
* Added support for the Casio EM500. Completely untested. Thanks
* to info from Nathan <wfilardo@fuse.net>
......@@ -54,6 +58,8 @@
#include "usb-serial.h"
#include "ipaq.h"
#define KP_RETRIES 100
/*
* Version Information
*/
......@@ -118,6 +124,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
struct ipaq_private *priv;
struct ipaq_packet *pkt;
int i, result = 0;
int retries = KP_RETRIES;
if (port_paranoia_check(port, __FUNCTION__)) {
return -ENODEV;
......@@ -192,31 +199,35 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result) {
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
goto error;
}
/*
* Send out two control messages observed in win98 sniffs. Not sure what
* they do.
* Send out control message observed in win98 sniffs. Not sure what
* it does, but from empirical observations, it seems that the device
* will start the chat sequence once one of these messages gets
* through. Since this has a reasonably high failure rate, we retry
* several times.
*/
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err(__FUNCTION__ " - failed doing control urb, error %d", result);
}
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err(__FUNCTION__ " - failed doing control urb, error %d", result);
while (retries--) {
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, HZ / 10 + 1);
if (result == 0) {
return 0;
}
}
return result;
err(__FUNCTION__ " - failed doing control urb, error %d", result);
goto error;
enomem:
result = -ENOMEM;
err(__FUNCTION__ " - Out of memory");
error:
ipaq_destroy_lists(port);
kfree(priv);
err(__FUNCTION__ " - Out of memory");
return -ENOMEM;
return result;
}
......
......@@ -86,7 +86,6 @@
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#ifdef CONFIG_USB_SERIAL_DEBUG
static int debug = 1;
......
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