Commit 47d59590 authored by Dave Jones's avatar Dave Jones

Merge tetrachloride.(none):/mnt/stuff/kernel/2.5/bk-linus

into tetrachloride.(none):/mnt/stuff/kernel/2.5/agpgart
parents 4f1824b0 58acbf38
In Linux 2.5 kernels (and later), USB device drivers have additional control
over how DMA may be used to perform I/O operations. The APIs are detailed
in the kernel usb programming guide (kerneldoc, from the source code).
API OVERVIEW
The big picture is that USB drivers can continue to ignore most DMA issues,
though they still must provide DMA-ready buffers (see DMA-mapping.txt).
That's how they've worked through the 2.4 (and earlier) kernels.
OR: they can now be DMA-aware.
- New calls enable DMA-aware drivers, letting them allocate dma buffers and
manage dma mappings for existing dma-ready buffers (see below).
- URBs have an additional "transfer_dma" field, as well as a transfer_flags
bit saying if it's valid. (Control requests also needed "setup_dma".)
- "usbcore" will map those DMA addresses, if a DMA-aware driver didn't do it
first and set URB_NO_DMA_MAP. HCDs don't manage dma mappings for urbs.
- There's a new "generic DMA API", parts of which are usable by USB device
drivers. Never use dma_set_mask() on any USB interface or device; that
would potentially break all devices sharing that bus.
ELIMINATING COPIES
It's good to avoid making CPUs copy data needlessly. The costs can add up,
and effects like cache-trashing can impose subtle penalties.
- When you're allocating a buffer for DMA purposes anyway, use the buffer
primitives. Think of them as kmalloc and kfree that give you the right
kind of addresses to store in urb->transfer_buffer and urb->transfer_dma,
while guaranteeing that hidden copies through DMA "bounce" buffers won't
slow things down. You'd also set URB_NO_DMA_MAP in urb->transfer_flags:
void *usb_buffer_alloc (struct usb_device *dev, size_t size,
int mem_flags, dma_addr_t *dma);
void usb_buffer_free (struct usb_device *dev, size_t size,
void *addr, dma_addr_t dma);
The memory buffer returned is "dma-coherent"; sometimes you might need to
force a consistent memory access ordering by using memory barriers. It's
not using a streaming DMA mapping, so it's good for small transfers on
systems where the I/O would otherwise tie up an IOMMU mapping.
Asking for 1/Nth of a page (as well as asking for N pages) is reasonably
space-efficient.
- Devices on some EHCI controllers could handle DMA to/from high memory.
Driver probe() routines can notice this using a generic DMA call, then
tell higher level code (network, scsi, etc) about it like this:
if (dma_supported (&intf->dev, 0xffffffffffffffffULL))
net->features |= NETIF_F_HIGHDMA;
That can eliminate dma bounce buffering of requests that originate (or
terminate) in high memory, in cases where the buffers aren't allocated
with usb_buffer_alloc() but instead are dma-mapped.
WORKING WITH EXISTING BUFFERS
Existing buffers aren't usable for DMA without first being mapped into the
DMA address space of the device.
- When you're using scatterlists, you can map everything at once. On some
systems, this kicks in an IOMMU and turns the scatterlists into single
DMA transactions:
int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int nents);
void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int n_hw_ents);
void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int n_hw_ents);
It's probably easier to use the new usb_sg_*() calls, which do the DMA
mapping and apply other tweaks to make scatterlist i/o be fast.
- Some drivers may prefer to work with the model that they're mapping large
buffers, synchronizing their safe re-use. (If there's no re-use, then let
usbcore do the map/unmap.) Large periodic transfers make good examples
here, since it's cheaper to just synchronize the buffer than to unmap it
each time an urb completes and then re-map it on during resubmission.
These calls all work with initialized urbs: urb->dev, urb->pipe,
urb->transfer_buffer, and urb->transfer_buffer_length must all be
valid when these calls are used:
struct urb *usb_buffer_map (struct urb *urb);
void usb_buffer_dmasync (struct urb *urb);
void usb_buffer_unmap (struct urb *urb);
The calls manage urb->transfer_dma for you, and set URB_NO_DMA_MAP so that
usbcore won't map or unmap the buffer.
......@@ -91,27 +91,27 @@ HandSpring Visor, Palm USB, and Cli
Kroah-Hartman at greg@kroah.com
Compaq iPAQ, HP Jornada and Casio EM500 driver
PocketPC PDA Driver
This driver can be used to connect to Compaq iPAQ, HP Jornada and Casio EM500
PDAs running Windows CE 3.0 or PocketPC 2002 using a USB cable/cradle.
It's very likely that every device supported by ActiveSync USB works with this
driver. The driver supports the Compaq iPAQ, Jornada 548/568 and the Casio
EM500 out of the box. For others, please use module parameters to specify
the product and vendor id. e.g. modprobe ipaq vendor=0x3f0 product=0x1125
This driver can be used to connect to Compaq iPAQ, HP Jornada, Casio EM500
and other PDAs running Windows CE 3.0 or PocketPC 2002 using a USB
cable/cradle.
Most devices supported by ActiveSync are supported out of the box.
For others, please use module parameters to specify the product and vendor
id. e.g. modprobe ipaq vendor=0x3f0 product=0x1125
The driver presents a serial interface (usually on /dev/ttyUSB0) over
which one may run ppp and establish a TCP/IP link to the iPAQ. Once this
which one may run ppp and establish a TCP/IP link to the PDA. Once this
is done, you can transfer files, backup, download email etc. The most
significant advantage of using USB is speed - you can get 73 to 113
kbytes/sec for download/upload to the iPAQ.
significant advantage of using USB is speed - I can get 73 to 113
kbytes/sec for download/upload to my iPAQ.
This driver is only one of a set of components required to utilize
the USB connection. Please visit http://synce.sourceforge.net which
contains the necessary packages and a simple step-by-step howto.
Once connected, you can use Win CE programs like ftpView, Pocket Outlook
from the iPAQ and xcerdisp, synce utilities from the Linux side.
from the PDA and xcerdisp, synce utilities from the Linux side.
To use Pocket IE, follow the instructions given at
http://www.tekguru.co.uk/EM500/usbtonet.htm to achieve the same thing
......@@ -126,8 +126,18 @@ Compaq iPAQ, HP Jornada and Casio EM500 driver
If it doesn't work for some reason, load both the usbserial and ipaq module
with the module parameter "debug" set to 1 and examine the system log.
You can also try soft-resetting your iPAQ before attempting a connection.
You can also try soft-resetting your PDA before attempting a connection.
Other functionality may be possible depending on your PDA. According to
Wes Cilldhaire <billybobjoehenrybob@hotmail.com>, with the Toshiba E570,
...if you boot into the bootloader (hold down the power when hitting the
reset button, continuing to hold onto the power until the bootloader screen
is displayed), then put it in the cradle with the ipaq driver loaded, open
a terminal on /dev/ttyUSB0, it gives you a "USB Reflash" terminal, which can
be used to flash the ROM, as well as the microP code.. so much for needing
Toshiba's $350 serial cable for flashing!! :D
NOTE: This has NOT been tested. Use at your own risk.
For any questions or problems with the driver, please contact Ganesh
Varadarajan <ganesh@veritas.com>
......
......@@ -762,6 +762,15 @@ L: linux-i2c@pelican.tk.uni-linz.ac.at
W: http://www.tk.uni-linz.ac.at/~simon/private/i2c
S: Maintained
SENSORS DRIVERS
P: Frodo Looijaard
M: frodol@dds.nl
P: Philip Edelbrock
M: phil@netroedge.com
L: sensors@stimpy.netroedge.com
W: http://www.lm-sensors.nu/
S: Maintained
i386 BOOT CODE
P: Riley H. Williams
M: Riley@Williams.Name
......
......@@ -38,6 +38,8 @@ obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_SERIO) += input/serio/
obj-$(CONFIG_I2O) += message/
obj-$(CONFIG_I2C) += i2c/
obj-$(CONFIG_I2C_MAINBOARD) += i2c/busses/
obj-$(CONFIG_SENSORS) += i2c/chips/
obj-$(CONFIG_PHONE) += telephony/
obj-$(CONFIG_MD) += md/
obj-$(CONFIG_BT) += bluetooth/
......
......@@ -763,7 +763,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
goto probe_error;
}
dev_set_drvdata(&intf->dev, husb);
usb_set_intfdata(intf, husb);
return 0;
probe_error:
......@@ -775,12 +775,12 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
static void hci_usb_disconnect(struct usb_interface *intf)
{
struct hci_usb *husb = dev_get_drvdata(&intf->dev);
struct hci_usb *husb = usb_get_intfdata(intf);
struct hci_dev *hdev;
if (!husb)
return;
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
hdev = &husb->hdev;
BT_DBG("%s", hdev->name);
......
......@@ -27,6 +27,12 @@
#include <asm/io.h>
#include <asm/pgalloc.h>
#ifdef CONFIG_I2C_MAINBOARD
extern void i2c_mainboard_init_all(void);
#endif
#ifdef CONFIG_SENSORS
extern void sensors_init_all(void);
#endif
#ifdef CONFIG_I2C
extern int i2c_init_all(void);
#endif
......@@ -705,6 +711,9 @@ int __init chr_dev_init(void)
#ifdef CONFIG_I2C
i2c_init_all();
#endif
#ifdef CONFIG_I2C_MAINBOARD
i2c_mainboard_init_all();
#endif
#if defined (CONFIG_FB)
fbmem_init();
#endif
......@@ -719,6 +728,10 @@ int __init chr_dev_init(void)
#if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR)
tapechar_init();
#endif
#ifdef CONFIG_SENSORS
sensors_init_all();
#endif
return 0;
}
......
......@@ -193,5 +193,8 @@ config I2C_PROC
it as a module, say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-proc.o.
source drivers/i2c/busses/Kconfig
source drivers/i2c/chips/Kconfig
endmenu
#
# Sensor device configuration
# All depend on EXPERIMENTAL, I2C and I2C_PROC.
#
menu "I2C Hardware Sensors Mainboard support"
config I2C_MAINBOARD
bool "Hardware sensors mainboard support"
depends on EXPERIMENTAL && I2C && I2C_PROC
help
Many modern mainboards have some kind of I2C interface integrated. This
is often in the form of a SMBus, or System Management Bus, which is
basically the same as I2C but which uses only a subset of the I2C
protocol.
You will also want the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_AMD756
tristate " AMD 756/766"
depends on I2C_MAINBOARD
help
If you say yes to this option, support will be included for the AMD
756/766/768 mainboard I2C interfaces.
This can also be built as a module which can be inserted and removed
while the kernel is running. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-amd756.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_AMD8111
tristate " AMD 8111"
depends on I2C_MAINBOARD
help
If you say yes to this option, support will be included for the AMD
8111 mainboard I2C interfaces.
This can also be built as a module which can be inserted and removed
while the kernel is running. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-amd8111.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
endmenu
#
# Makefile for the kernel hardware sensors bus drivers.
#
obj-$(CONFIG_I2C_MAINBOARD) += i2c-mainboard.o
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o
obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
This diff is collapsed.
This diff is collapsed.
/*
i2c-mainboard.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Not configurable as a module */
#include <linux/init.h>
extern int i2c_amd756_init(void);
int __init i2c_mainboard_init_all(void)
{
#ifdef CONFIG_I2C_AMD756
i2c_amd756_init();
#endif
return 0;
}
#
# Sensor device configuration
# All depend on EXPERIMENTAL, I2C and I2C_PROC.
#
menu "I2C Hardware Sensors Chip support"
config SENSORS
bool "Hardware sensors chip support"
depends on EXPERIMENTAL && I2C && I2C_PROC
help
Many modern mainboards have some kind of I2C interface integrated.
This is often in the form of a SMBus, or System Management Bus, which
is basically the same as I2C but which uses only a subset of the I2C
protocol.
You will also want the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_ADM1021
tristate " Analog Devices ADM1021 and compatibles"
depends on SENSORS
help
If you say yes here you get support for Analog Devices ADM1021
and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
Genesys Logic GL523SM, National Semi LM84, TI THMC10,
and the XEON processor built-in sensor. This can also
be built as a module which can be inserted and removed while the
kernel is running.
The module will be called adm1021.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_LM75
tristate " National Semiconductors LM75 and compatibles"
depends on SENSORS
help
If you say yes here you get support for National Semiconductor LM75
sensor chips and clones: Dallas Semi DS75 and DS1775, TelCon
TCN75, and National Semi LM77. This can also be built as a module
which can be inserted and removed while the kernel is running.
The module will be called lm75.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
endmenu
#
# Makefile for the kernel hardware sensors chip drivers.
#
obj-$(CONFIG_SENSORS) += sensors.o
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
This diff is collapsed.
This diff is collapsed.
/*
sensors.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Not configurable as a module */
#include <linux/init.h>
extern int sensors_adm1021_init(void);
extern int sensors_lm75_init(void);
int __init sensors_init_all(void)
{
#ifdef CONFIG_SENSORS_ADM1021
sensors_adm1021_init();
#endif
#ifdef CONFIG_SENSORS_LM75
sensors_lm75_init();
#endif
return 0;
}
......@@ -21,7 +21,7 @@
All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> */
/* $Id: i2c-core.c,v 1.86 2002/09/12 06:47:26 ac9410 Exp $ */
/* $Id: i2c-core.c,v 1.89 2002/11/03 16:47:16 mds Exp $ */
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -77,7 +77,8 @@ static int i2c_debug;
#ifdef CONFIG_PROC_FS
static int i2cproc_init(void);
int __init i2cproc_init(void);
void __exit i2cproc_exit(void);
static int i2cproc_cleanup(void);
static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count,
......@@ -1332,15 +1333,15 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
if (read_write == I2C_SMBUS_READ) {
msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX;
} else {
msg[0].len = data->block[0] + 2;
if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 2) {
msg[0].len = data->block[0] + 1;
if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) {
printk("i2c-core.o: i2c_smbus_xfer_emulated called with "
"invalid block write size (%d)\n",
data->block[0]);
return -1;
}
for (i = 0; i < data->block[0]; i++)
msgbuf0[i] = data->block[i+1];
for (i = 1; i <= data->block[0]; i++)
msgbuf0[i] = data->block[i];
}
break;
default:
......@@ -1456,7 +1457,7 @@ static int __init i2c_init(void)
return 0;
}
static void __exit i2c_exit(void)
void __exit i2c_exit(void)
{
i2cproc_cleanup();
}
......
......@@ -28,7 +28,7 @@
/* The devfs code is contributed by Philipp Matthias Hahn
<pmhahn@titan.lahn.de> */
/* $Id: i2c-dev.c,v 1.46 2002/07/06 02:07:39 mds Exp $ */
/* $Id: i2c-dev.c,v 1.48 2002/10/01 14:10:04 ac9410 Exp $ */
#include <linux/config.h>
#include <linux/kernel.h>
......@@ -48,6 +48,10 @@
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
int __init i2c_dev_init(void);
void __exit i2c_dev_exit(void);
static int dev_cleanup(void);
/* struct file_operations changed too often in the 2.1 series for nice code */
static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
......@@ -433,7 +437,7 @@ static int i2cdev_command(struct i2c_client *client, unsigned int cmd,
return -1;
}
static void i2cdev_cleanup(void)
static int dev_cleanup(void)
{
int res;
......@@ -467,6 +471,11 @@ int __init i2c_dev_init(void)
return 0;
}
void __exit i2c_dev_exit(void)
{
dev_cleanup();
}
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and Simon G. Vogl <simon@tk.uni-linz.ac.at>");
......@@ -474,4 +483,4 @@ MODULE_DESCRIPTION("I2C /dev entries driver");
MODULE_LICENSE("GPL");
module_init(i2c_dev_init);
module_exit(i2cdev_cleanup);
module_exit(i2c_dev_exit);
......@@ -40,6 +40,10 @@
#define THIS_MODULE NULL
#endif
int __init sensors_init(void);
void __exit i2c_proc_exit(void);
static int proc_cleanup(void);
static int i2c_create_name(char **name, const char *prefix,
struct i2c_adapter *adapter, int addr);
static int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
......@@ -56,6 +60,7 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
#define SENSORS_ENTRY_MAX 20
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
......@@ -186,6 +191,8 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id;
}
#endif /* DEBUG */
i2c_inodes[id - 256] =
new_header->ctl_table->child->child->de->low_ino;
new_header->ctl_table->child->child->de->owner = controlling_mod;
return id;
......@@ -208,6 +215,49 @@ void i2c_deregister_entry(int id)
}
}
/* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o
impossible if some process still uses it or some file in it */
void i2c_fill_inode(struct inode *inode, int fill)
{
if (fill)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
/* Monitor access for /proc/sys/dev/sensors/ directories; make unloading
the corresponding module impossible if some process still uses it or
some file in it */
void i2c_dir_fill_inode(struct inode *inode, int fill)
{
int i;
struct i2c_client *client;
#ifdef DEBUG
if (!inode) {
printk(KERN_ERR "i2c-proc.o: Warning: inode NULL in fill_inode()\n");
return;
}
#endif /* def DEBUG */
for (i = 0; i < SENSORS_ENTRY_MAX; i++)
if (i2c_clients[i]
&& (i2c_inodes[i] == inode->i_ino)) break;
#ifdef DEBUG
if (i == SENSORS_ENTRY_MAX) {
printk
(KERN_ERR "i2c-proc.o: Warning: inode (%ld) not found in fill_inode()\n",
inode->i_ino);
return;
}
#endif /* def DEBUG */
client = i2c_clients[i];
if (fill)
client->driver->inc_use(client);
else
client->driver->dec_use(client);
}
int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
void *buffer, size_t * lenp)
{
......@@ -813,12 +863,18 @@ int __init sensors_init(void)
return 0;
}
static void __exit i2c_cleanup(void)
void __exit i2c_proc_exit(void)
{
proc_cleanup();
}
static int proc_cleanup(void)
{
if (i2c_initialized >= 1) {
unregister_sysctl_table(i2c_proc_header);
i2c_initialized--;
}
return 0;
}
EXPORT_SYMBOL(i2c_deregister_entry);
......@@ -832,4 +888,4 @@ MODULE_DESCRIPTION("i2c-proc driver");
MODULE_LICENSE("GPL");
module_init(sensors_init);
module_exit(i2c_cleanup);
module_exit(i2c_proc_exit);
......@@ -244,6 +244,14 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing
ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B);
}
/*
* If the drive is an ATAPI device it may need slower address setup timing,
* so we stay on the safe side.
*/
if (drive->media != ide_disk)
p.setup = 120;
/*
* Convert the timing to bus clock counts.
*/
......
......@@ -174,7 +174,7 @@ static int iforce_usb_probe(struct usb_interface *intf,
if (iforce_init_device(iforce)) goto fail;
dev_set_drvdata (&intf->dev, iforce);
usb_set_intfdata(intf, iforce);
return 0;
fail:
......@@ -203,10 +203,10 @@ void iforce_usb_delete(struct iforce* iforce)
static void iforce_usb_disconnect(struct usb_interface *intf)
{
struct iforce *iforce = dev_get_drvdata (&intf->dev);
struct iforce *iforce = usb_get_intfdata(intf);
int open = 0; /* FIXME! iforce->dev.handle->open; */
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (iforce) {
iforce->usbdev = NULL;
input_unregister_device(&iforce->dev);
......
......@@ -152,7 +152,7 @@ static void led_blink(struct st5481_adapter *adapter)
st5481_usb_device_ctrl_msg(adapter, GPIO_OUT, leds, NULL, NULL);
}
static void usb_b_out_complete(struct urb *urb)
static void usb_b_out_complete(struct urb *urb, struct pt_regs *regs)
{
struct st5481_bcs *bcs = urb->context;
struct st5481_b_out *b_out = &bcs->b_out;
......
......@@ -370,7 +370,7 @@ static void fifo_reseted(void *context)
FsmEvent(&adapter->d_out.fsm, EV_DOUT_RESETED, NULL);
}
static void usb_d_out_complete(struct urb *urb)
static void usb_d_out_complete(struct urb *urb, struct pt_regs *regs)
{
struct st5481_adapter *adapter = urb->context;
struct st5481_d_out *d_out = &adapter->d_out;
......
......@@ -114,7 +114,7 @@ static int probe_st5481(struct usb_interface *intf,
hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", protocol);
st5481_start(adapter);
dev_set_drvdata(&intf->dev, adapter);
usb_set_intfdata(intf, adapter);
return 0;
err_b:
......@@ -133,11 +133,11 @@ static int probe_st5481(struct usb_interface *intf,
*/
static void disconnect_st5481(struct usb_interface *intf)
{
struct st5481_adapter *adapter = dev_get_drvdata(&intf->dev);
struct st5481_adapter *adapter = usb_get_intfdata(intf);
DBG(1,"");
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (!adapter)
return;
......
......@@ -474,7 +474,7 @@ void st5481_release_isocpipes(struct urb* urb[2])
* called 50 times per second with 20 ISOC descriptors.
* Called at interrupt.
*/
static void usb_in_complete(struct urb *urb)
static void usb_in_complete(struct urb *urb, struct pt_regs *regs)
{
struct st5481_in *in = urb->context;
unsigned char *ptr;
......
......@@ -486,7 +486,7 @@ static int cpia_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *udev = interface_to_usbdev(intf);
struct usb_interface_descriptor *interface;
struct usb_host_interface *interface;
struct usb_cpia *ucpia;
struct cam_data *cam;
int ret;
......@@ -508,7 +508,7 @@ static int cpia_probe(struct usb_interface *intf,
memset(ucpia, 0, sizeof(*ucpia));
ucpia->dev = udev;
ucpia->iface = interface->bInterfaceNumber;
ucpia->iface = interface->desc.bInterfaceNumber;
init_waitqueue_head(&ucpia->wq_stream);
ucpia->buffers[0] = vmalloc(sizeof(*ucpia->buffers[0]));
......@@ -552,7 +552,7 @@ static int cpia_probe(struct usb_interface *intf,
cpia_add_to_list(&cam_list, &cam);
spin_unlock( &cam_list_lock_usb );
dev_set_drvdata(&intf->dev, cam);
usb_set_intfdata(intf, cam);
return 0;
fail_all:
......@@ -593,11 +593,11 @@ static struct usb_driver cpia_driver = {
/* will do it for us as well as passing a udev structure - jerdfelt */
static void cpia_disconnect(struct usb_interface *intf)
{
struct cam_data *cam = dev_get_drvdata(&intf->dev);
struct cam_data *cam = usb_get_intfdata(intf);
struct usb_cpia *ucpia;
struct usb_device *udev;
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (!cam)
return;
......
......@@ -1524,7 +1524,7 @@ static int irda_usb_probe(struct usb_interface *intf,
if (ret)
return -ENOMEM;
dev_set_drvdata(&intf->dev, self);
usb_set_intfdata(intf, self);
return 0;
}
......@@ -1543,12 +1543,12 @@ static int irda_usb_probe(struct usb_interface *intf,
static void irda_usb_disconnect(struct usb_interface *intf)
{
unsigned long flags;
struct irda_usb_cb *self = dev_get_drvdata (&intf->dev);
struct irda_usb_cb *self = usb_get_intfdata(intf);
int i;
IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (!self)
return;
......
......@@ -285,13 +285,12 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
} else {
/*
* We need to assign a number to this bus which we always
* do in the second pass. We also keep all address decoders
* on the bridge disabled during scanning. FIXME: Why?
* do in the second pass.
*/
if (!pass)
return max;
pci_read_config_word(dev, PCI_COMMAND, &cr);
pci_write_config_word(dev, PCI_COMMAND, 0x0000);
/* Clear errors */
pci_write_config_word(dev, PCI_STATUS, 0xffff);
child = pci_add_new_bus(bus, dev, ++max);
......@@ -319,7 +318,6 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
*/
child->subordinate = max;
pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
pci_write_config_word(dev, PCI_COMMAND, cr);
}
sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number);
......
......@@ -3815,7 +3815,7 @@ static int usb_audio_probe(struct usb_interface *intf,
}
s = usb_audio_parsecontrol(dev, buffer, buflen, intf->altsetting->desc.bInterfaceNumber);
if (s) {
dev_set_drvdata (&intf->dev, s);
usb_set_intfdata (intf, s);
return 0;
}
return -ENODEV;
......@@ -3826,7 +3826,7 @@ static int usb_audio_probe(struct usb_interface *intf,
static void usb_audio_disconnect(struct usb_interface *intf)
{
struct usb_audio_state *s = dev_get_drvdata (&intf->dev);
struct usb_audio_state *s = usb_get_intfdata (intf);
struct list_head *list;
struct usb_audiodev *as;
struct usb_mixerdev *ms;
......@@ -3846,7 +3846,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
down(&open_sem);
list_del_init(&s->audiodev);
s->usbdev = NULL;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
/* deregister all audio and mixer devices, so no new processes can open this device */
for(list = s->audiolist.next; list != &s->audiolist; list = list->next) {
......
......@@ -1207,7 +1207,7 @@ static int usb_bluetooth_probe (struct usb_interface *intf,
bluetooth_table[minor] = bluetooth;
/* success */
dev_set_drvdata (&intf->dev, bluetooth);
usb_set_intfdata (intf, bluetooth);
return 0;
probe_error:
......@@ -1243,10 +1243,10 @@ static int usb_bluetooth_probe (struct usb_interface *intf,
static void usb_bluetooth_disconnect(struct usb_interface *intf)
{
struct usb_bluetooth *bluetooth = dev_get_drvdata (&intf->dev);
struct usb_bluetooth *bluetooth = usb_get_intfdata (intf);
int i;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (bluetooth) {
if ((bluetooth->open_count) && (bluetooth->tty))
tty_hangup(bluetooth->tty);
......
......@@ -652,7 +652,7 @@ static int acm_probe (struct usb_interface *intf,
tty_register_devfs(&acm_tty_driver, 0, minor);
acm_table[minor] = acm;
dev_set_drvdata (&intf->dev, acm);
usb_set_intfdata (intf, acm);
return 0;
}
......@@ -661,7 +661,7 @@ static int acm_probe (struct usb_interface *intf,
static void acm_disconnect(struct usb_interface *intf)
{
struct acm *acm = dev_get_drvdata (&intf->dev);
struct acm *acm = usb_get_intfdata (intf);
if (!acm || !acm->dev) {
dbg("disconnect on nonexisting interface");
......@@ -669,7 +669,7 @@ static void acm_disconnect(struct usb_interface *intf)
}
acm->dev = NULL;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
usb_unlink_urb(acm->ctrlurb);
usb_unlink_urb(acm->readurb);
......
......@@ -2056,14 +2056,14 @@ static int usb_midi_probe(struct usb_interface *intf,
MOD_INC_USE_COUNT;
#endif
dev_set_drvdata (&intf->dev, s);
usb_set_intfdata (intf, s);
return 0;
}
static void usb_midi_disconnect(struct usb_interface *intf)
{
struct usb_midi_state *s = dev_get_drvdata (&intf->dev);
struct usb_midi_state *s = usb_get_intfdata (intf);
struct list_head *list;
struct usb_mididev *m;
......@@ -2080,7 +2080,7 @@ static void usb_midi_disconnect(struct usb_interface *intf)
list_del(&s->mididev);
INIT_LIST_HEAD(&s->mididev);
s->usbdev = NULL;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
for ( list = s->midiDevList.next; list != &s->midiDevList; list = list->next ) {
m = list_entry(list, struct usb_mididev, list);
......
......@@ -338,7 +338,7 @@ static int usblp_open(struct inode *inode, struct file *file)
if (!intf) {
goto out;
}
usblp = dev_get_drvdata (&intf->dev);
usblp = usb_get_intfdata (intf);
if (!usblp || !usblp->dev)
goto out;
......@@ -923,7 +923,7 @@ static int usblp_probe(struct usb_interface *intf,
usblp->current_protocol, usblp->dev->descriptor.idVendor,
usblp->dev->descriptor.idProduct);
dev_set_drvdata (&intf->dev, usblp);
usb_set_intfdata (intf, usblp);
/* add device id so the device works when advertised */
intf->kdev = mk_kdev(USB_MAJOR,usblp->minor);
......@@ -1110,7 +1110,7 @@ static int usblp_cache_device_id_string(struct usblp *usblp)
static void usblp_disconnect(struct usb_interface *intf)
{
struct usblp *usblp = dev_get_drvdata (&intf->dev);
struct usblp *usblp = usb_get_intfdata (intf);
/* remove device id to disable open() */
intf->kdev = NODEV;
......@@ -1123,7 +1123,7 @@ static void usblp_disconnect(struct usb_interface *intf)
down (&usblp->sem);
lock_kernel();
usblp->dev = NULL;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
usblp_unlink_urbs(usblp);
......
......@@ -24,11 +24,14 @@
/*
* DMA-Consistent Buffers
* DMA-Coherent Buffers
*/
/* FIXME tune these based on pool statistics ... */
static const size_t pool_max [HCD_BUFFER_POOLS] = {
/* platforms without dma-friendly caches might need to
* prevent cacheline sharing...
*/
32,
128,
512,
......@@ -133,98 +136,3 @@ void hcd_buffer_free (
}
pci_free_consistent (hcd->pdev, size, addr, dma);
}
/*
* DMA-Mappings for arbitrary memory buffers
*/
int hcd_buffer_map (
struct usb_bus *bus,
void *addr,
dma_addr_t *dma,
size_t size,
int direction
) {
struct usb_hcd *hcd = bus->hcpriv;
// FIXME pci_map_single() has no standard failure mode!
*dma = pci_map_single (hcd->pdev, addr, size,
(direction == USB_DIR_IN)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
return 0;
}
void hcd_buffer_dmasync (
struct usb_bus *bus,
dma_addr_t dma,
size_t size,
int direction
) {
struct usb_hcd *hcd = bus->hcpriv;
pci_dma_sync_single (hcd->pdev, dma, size,
(direction == USB_DIR_IN)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
}
void hcd_buffer_unmap (
struct usb_bus *bus,
dma_addr_t dma,
size_t size,
int direction
) {
struct usb_hcd *hcd = bus->hcpriv;
pci_unmap_single (hcd->pdev, dma, size,
(direction == USB_DIR_IN)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
}
int hcd_buffer_map_sg (
struct usb_bus *bus,
struct scatterlist *sg,
int *n_hw_ents,
int nents,
int direction
) {
struct usb_hcd *hcd = bus->hcpriv;
// FIXME pci_map_sg() has no standard failure mode!
*n_hw_ents = pci_map_sg(hcd->pdev, sg, nents,
(direction == USB_DIR_IN)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
return 0;
}
void hcd_buffer_sync_sg (
struct usb_bus *bus,
struct scatterlist *sg,
int n_hw_ents,
int direction
) {
struct usb_hcd *hcd = bus->hcpriv;
pci_dma_sync_sg(hcd->pdev, sg, n_hw_ents,
(direction == USB_DIR_IN)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
}
void hcd_buffer_unmap_sg (
struct usb_bus *bus,
struct scatterlist *sg,
int n_hw_ents,
int direction
) {
struct usb_hcd *hcd = bus->hcpriv;
pci_unmap_sg(hcd->pdev, sg, n_hw_ents,
(direction == USB_DIR_IN)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
}
......@@ -108,6 +108,7 @@ static int usb_parse_interface(struct usb_interface *interface, unsigned char *b
interface->act_altsetting = 0;
interface->num_altsetting = 0;
interface->max_altsetting = USB_ALTSETTINGALLOC;
device_initialize(&interface->dev);
interface->altsetting = kmalloc(sizeof(*interface->altsetting) * interface->max_altsetting,
GFP_KERNEL);
......
......@@ -322,7 +322,7 @@ static int driver_probe (struct usb_interface *intf,
static void driver_disconnect(struct usb_interface *intf)
{
struct dev_state *ps = dev_get_drvdata (&intf->dev);
struct dev_state *ps = usb_get_intfdata (intf);
if (!ps)
return;
......@@ -333,7 +333,7 @@ static void driver_disconnect(struct usb_interface *intf)
/* prevent new I/O requests */
ps->dev = 0;
ps->ifclaimed = 0;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
/* force async requests to complete */
destroy_all_async (ps);
......
......@@ -138,7 +138,8 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
hcd->pdev = dev;
hcd->self.bus_name = dev->slot_name;
hcd->product_desc = dev->dev.name;
hcd->controller = &dev->dev;
hcd->self.controller = &dev->dev;
hcd->controller = hcd->self.controller;
if ((retval = hcd_buffer_create (hcd)) != 0) {
clean_3:
......
......@@ -1031,19 +1031,19 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags)
/* lower level hcd code should use *_dma exclusively */
if (!(urb->transfer_flags & URB_NO_DMA_MAP)) {
if (usb_pipecontrol (urb->pipe))
urb->setup_dma = pci_map_single (
hcd->pdev,
urb->setup_dma = dma_map_single (
hcd->controller,
urb->setup_packet,
sizeof (struct usb_ctrlrequest),
PCI_DMA_TODEVICE);
DMA_TO_DEVICE);
if (urb->transfer_buffer_length != 0)
urb->transfer_dma = pci_map_single (
hcd->pdev,
urb->transfer_dma = dma_map_single (
hcd->controller,
urb->transfer_buffer,
urb->transfer_buffer_length,
usb_pipein (urb->pipe)
? PCI_DMA_FROMDEVICE
: PCI_DMA_TODEVICE);
? DMA_FROM_DEVICE
: DMA_TO_DEVICE);
}
status = hcd->driver->urb_enqueue (hcd, urb, mem_flags);
......@@ -1265,12 +1265,6 @@ struct usb_operations usb_hcd_operations = {
.deallocate = hcd_free_dev,
.buffer_alloc = hcd_buffer_alloc,
.buffer_free = hcd_buffer_free,
.buffer_map = hcd_buffer_map,
.buffer_dmasync = hcd_buffer_dmasync,
.buffer_unmap = hcd_buffer_unmap,
.buffer_map_sg = hcd_buffer_map_sg,
.buffer_dmasync_sg = hcd_buffer_sync_sg,
.buffer_unmap_sg = hcd_buffer_unmap_sg,
};
EXPORT_SYMBOL (usb_hcd_operations);
......
......@@ -145,26 +145,6 @@ struct usb_operations {
dma_addr_t *dma);
void (*buffer_free)(struct usb_bus *bus, size_t size,
void *addr, dma_addr_t dma);
int (*buffer_map) (struct usb_bus *bus,
void *addr, dma_addr_t *dma,
size_t size, int direction);
void (*buffer_dmasync) (struct usb_bus *bus,
dma_addr_t dma,
size_t size, int direction);
void (*buffer_unmap) (struct usb_bus *bus,
dma_addr_t dma,
size_t size, int direction);
int (*buffer_map_sg) (struct usb_bus *bus,
struct scatterlist *sg, int *n_hw_ents,
int nents, int direction);
void (*buffer_dmasync_sg) (struct usb_bus *bus,
struct scatterlist *sg,
int n_hw_ents, int direction);
void (*buffer_unmap_sg) (struct usb_bus *bus,
struct scatterlist *sg,
int n_hw_ents, int direction);
};
/* each driver provides one of these, and hardware init support */
......@@ -248,23 +228,6 @@ void *hcd_buffer_alloc (struct usb_bus *bus, size_t size,
void hcd_buffer_free (struct usb_bus *bus, size_t size,
void *addr, dma_addr_t dma);
int hcd_buffer_map (struct usb_bus *bus,
void *addr, dma_addr_t *dma,
size_t size, int direction);
void hcd_buffer_dmasync (struct usb_bus *bus,
dma_addr_t dma,
size_t size, int direction);
void hcd_buffer_unmap (struct usb_bus *bus,
dma_addr_t dma,
size_t size, int direction);
int hcd_buffer_map_sg (struct usb_bus *bus, struct scatterlist *sg,
int *n_hw_ents, int nents, int direction);
void hcd_buffer_sync_sg (struct usb_bus *bus, struct scatterlist *sg,
int n_hw_ents, int direction);
void hcd_buffer_unmap_sg (struct usb_bus *bus, struct scatterlist *sg,
int n_hw_ents, int direction);
/* generic bus glue, needed for host controllers that don't use PCI */
extern struct usb_operations usb_hcd_operations;
extern void usb_hcd_irq (int irq, void *__hcd, struct pt_regs *r);
......
......@@ -447,13 +447,13 @@ static int usb_hub_configure(struct usb_hub *hub,
static void hub_disconnect(struct usb_interface *intf)
{
struct usb_hub *hub = dev_get_drvdata (&intf->dev);
struct usb_hub *hub = usb_get_intfdata (intf);
unsigned long flags;
if (!hub)
return;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
spin_lock_irqsave(&hub_event_lock, flags);
/* Delete it and then reset it */
......@@ -546,7 +546,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
list_add(&hub->hub_list, &hub_list);
spin_unlock_irqrestore(&hub_event_lock, flags);
dev_set_drvdata (&intf->dev, hub);
usb_set_intfdata (intf, hub);
if (usb_hub_configure(hub, endpoint) >= 0) {
strcpy (intf->dev.name, "Hub");
......@@ -876,7 +876,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
/* Reset the device, and detect its speed */
if (usb_hub_port_reset(hub, port, dev, delay)) {
usb_free_dev(dev);
usb_put_dev(dev);
break;
}
......@@ -928,7 +928,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
goto done;
/* Free the configuration if there was an error */
usb_free_dev(dev);
usb_put_dev(dev);
/* Switch to a long reset time */
delay = HUB_LONG_RESET_TIME;
......
......@@ -177,7 +177,7 @@ void usb_show_string(struct usb_device *dev, char *id, int index)
if (!(buf = kmalloc(256, GFP_KERNEL)))
return;
if (usb_string(dev, index, buf, 256) > 0)
printk(KERN_INFO "%s: %s\n", id, buf);
dev_printk(KERN_INFO, dev->dev, "%s: %s\n", id, buf);
kfree(buf);
}
......
This diff is collapsed.
......@@ -405,9 +405,10 @@ static int ehci_start (struct usb_hcd *hcd)
* streaming mappings for I/O buffers, like pci_map_single(),
* can return segments above 4GB, if the device allows.
*
* NOTE: layered drivers can't yet tell when we enable that,
* so they can't pass this info along (like NETIF_F_HIGHDMA)
* (or like Scsi_Host.highmem_io) ... usb_bus.flags?
* NOTE: the dma mask is visible through dma_supported(), so
* drivers can pass this info along ... like NETIF_F_HIGHDMA,
* Scsi_Host.highmem_io, and so forth. It's readonly to all
* host side drivers though.
*/
if (HCC_64BIT_ADDR (hcc_params)) {
writel (0, &ehci->regs->segment);
......@@ -475,7 +476,7 @@ static int ehci_start (struct usb_hcd *hcd)
ehci_ready (ehci);
ehci_reset (ehci);
bus->root_hub = 0;
usb_free_dev (udev);
usb_put_dev (udev);
retval = -ENODEV;
goto done2;
}
......
......@@ -566,7 +566,7 @@ static int rh_connect_rh (hci_t * hci)
hci->bus->root_hub = usb_dev;
usb_connect (usb_dev);
if (usb_new_device (usb_dev) != 0) {
usb_free_dev (usb_dev);
usb_put_dev (usb_dev);
return -ENODEV;
}
......
......@@ -515,7 +515,7 @@ static int hc_start (struct ohci_hcd *ohci)
usb_connect (udev);
udev->speed = USB_SPEED_FULL;
if (usb_register_root_hub (udev, ohci->hcd.controller) != 0) {
usb_free_dev (udev);
usb_put_dev (udev);
ohci->hcd.self.root_hub = NULL;
disable (ohci);
ohci->hc_control &= ~OHCI_CTRL_HCFS;
......
......@@ -176,7 +176,8 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
hcd->irq = dev->irq[1];
hcd->regs = dev->mapbase;
hcd->pdev = SA1111_FAKE_PCIDEV;
hcd->controller = &dev->dev;
hcd->self.controller = &dev->dev;
hcd->controller = hcd->self.controller;
retval = hcd_buffer_create (hcd);
if (retval != 0) {
......
......@@ -2280,7 +2280,7 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
uhci->term_td = NULL;
err_alloc_term_td:
usb_free_dev(udev);
usb_put_dev(udev);
hcd->self.root_hub = NULL;
err_alloc_root_hub:
......
......@@ -130,7 +130,7 @@ hpusbscsi_usb_probe (struct usb_interface *intf,
/* adding to list for module unload */
list_add (&hpusbscsi_devices, &new->lh);
dev_set_drvdata(&intf->dev, new);
usb_set_intfdata(intf, new);
return 0;
err_out:
......@@ -143,9 +143,9 @@ hpusbscsi_usb_probe (struct usb_interface *intf,
static void
hpusbscsi_usb_disconnect (struct usb_interface *intf)
{
struct hpusbscsi *desc = dev_get_drvdata(&intf->dev);
struct hpusbscsi *desc = usb_get_intfdata(intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (desc)
usb_unlink_urb(desc->controlurb);
}
......
......@@ -523,7 +523,7 @@ static int mdc800_usb_probe (struct usb_interface *intf,
up (&mdc800->io_lock);
dev_set_drvdata(&intf->dev, mdc800);
usb_set_intfdata(intf, mdc800);
return 0;
}
......@@ -533,7 +533,7 @@ static int mdc800_usb_probe (struct usb_interface *intf,
*/
static void mdc800_usb_disconnect (struct usb_interface *intf)
{
struct mdc800_data* mdc800 = dev_get_drvdata(&intf->dev);
struct mdc800_data* mdc800 = usb_get_intfdata(intf);
dbg ("(mdc800_usb_disconnect) called");
......@@ -552,7 +552,7 @@ static void mdc800_usb_disconnect (struct usb_interface *intf)
usb_driver_release_interface (&mdc800_usb_driver, intf);
mdc800->dev=0;
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
}
info ("Mustek MDC800 disconnected from USB.");
}
......
......@@ -774,11 +774,11 @@ static Scsi_Host_Template mts_scsi_host_template = {
static void mts_usb_disconnect (struct usb_interface *intf)
{
struct mts_desc* to_remove = dev_get_drvdata(&intf->dev);
struct mts_desc* to_remove = usb_get_intfdata(intf);
MTS_DEBUG_GOT_HERE();
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (to_remove) {
/* leave the list - lock it */
down(&mts_list_semaphore);
......@@ -1007,7 +1007,7 @@ static int mts_usb_probe (struct usb_interface *intf,
MTS_DEBUG("completed probe and exiting happily\n");
dev_set_drvdata(&intf->dev, new_desc);
usb_set_intfdata(intf, new_desc);
return 0;
}
......
......@@ -321,10 +321,13 @@
* "Jaeger, Gerhard" <gerhard@gjaeger.de>, Ira Childress
* <ichildress@mn.rr.com>, Till Kamppeter <till.kamppeter@gmx.net>,
* Ed Hamrick <EdHamrick@aol.com>, Oliver Schwartz
* <Oliver.Schwartz@gmx.de> and everyone else who sent ids.
* <Oliver.Schwartz@gmx.de> and everyone else who sent ids.
* - Some Benq, Genius and Plustek ids are identified now.
* - Accept scanners with only one bulk (in) endpoint (thanks to Sergey
* Vlasov <vsu@mivlgu.murom.ru>).
* - Accept devices with more than one interface. Only use interfaces that
* look like belonging to scanners.
* - Fix compilation error when debugging is enabled.
*
* TODO
* - Remove the 2/3 endpoint limitation
......@@ -429,7 +432,7 @@ open_scanner(struct inode * inode, struct file * file)
err("open_scanner(%d): Unable to access minor data", scn_minor);
return -ENODEV;
}
scn = dev_get_drvdata (&intf->dev);
scn = usb_get_intfdata(intf);
dev = scn->scn_dev;
......@@ -858,7 +861,6 @@ probe_scanner(struct usb_interface *intf,
}
dbg("probe_scanner: USB dev address:%p", dev);
dbg("probe_scanner: ifnum:%u", ifnum);
/*
* 1. Check Vendor/Product
......@@ -907,13 +909,15 @@ probe_scanner(struct usb_interface *intf,
return -ENODEV;
}
if (dev->config[0].desc.bNumInterfaces != 1) {
info("probe_scanner: Only one device interface is supported.");
interface = intf->altsetting;
if (interface[0].desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC &&
interface[0].desc.bInterfaceClass != USB_CLASS_PER_INTERFACE &&
interface[0].desc.bInterfaceClass != 16) {
dbg("probe_scanner: This interface doesn't look like a scanner (class=0x%x).", interface[0].desc.bInterfaceClass);
return -ENODEV;
}
interface = intf->altsetting;
/*
* Start checking for one or two bulk endpoints and an optional
* interrupt endpoint. If we have an interrupt endpoint go ahead and
......@@ -1098,7 +1102,7 @@ probe_scanner(struct usb_interface *intf,
up(&scn_mutex);
dev_set_drvdata(&intf->dev, scn);
usb_set_intfdata(intf, scn);
/* add device id so the device works when advertised */
intf->kdev = mk_kdev(USB_MAJOR,scn->scn_minor);
......@@ -1109,12 +1113,12 @@ probe_scanner(struct usb_interface *intf,
static void
disconnect_scanner(struct usb_interface *intf)
{
struct scn_usb_data *scn = dev_get_drvdata(&intf->dev);
struct scn_usb_data *scn = usb_get_intfdata(intf);
/* remove device id to disable open() */
intf->kdev = NODEV;
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (scn) {
down (&scn_mutex);
down (&(scn->sem));
......
......@@ -330,16 +330,16 @@ aiptek_probe(struct usb_interface *intf,
printk(KERN_INFO "input: %s on usb%d:%d\n",
aiptek->features->name, dev->bus->busnum, dev->devnum);
dev_set_drvdata(&intf->dev, aiptek);
usb_set_intfdata(intf, aiptek);
return 0;
}
static void
aiptek_disconnect(struct usb_interface *intf)
{
struct aiptek *aiptek = dev_get_drvdata(&intf->dev);
struct aiptek *aiptek = usb_get_intfdata (intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (aiptek) {
usb_unlink_urb(aiptek->irq);
input_unregister_device(&aiptek->dev);
......
......@@ -1317,6 +1317,9 @@ void hid_init_reports(struct hid_device *hid)
#define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204
#define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205
#define USB_VENDOR_ID_TOPMAX 0x0663
#define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103
#define USB_VENDOR_ID_MGE 0x0463
#define USB_DEVICE_ID_MGE_UPS 0xffff
#define USB_DEVICE_ID_MGE_UPS1 0x0001
......@@ -1355,6 +1358,7 @@ struct hid_blacklist {
{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_HIDDEV },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_HIDDEV },
{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
{ 0, 0 }
};
......@@ -1541,12 +1545,12 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
static void hid_disconnect(struct usb_interface *intf)
{
struct hid_device *hid = dev_get_drvdata(&intf->dev);
struct hid_device *hid = usb_get_intfdata (intf);
if (!hid)
return;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
usb_unlink_urb(hid->urbin);
usb_unlink_urb(hid->urbout);
usb_unlink_urb(hid->urbctrl);
......@@ -1588,7 +1592,7 @@ static int hid_probe (struct usb_interface *intf, const struct usb_device_id *id
if (!hiddev_connect(hid))
hid->claimed |= HID_CLAIMED_HIDDEV;
dev_set_drvdata(&intf->dev, hid);
usb_set_intfdata(intf, hid);
if (!hid->claimed) {
printk ("HID device not claimed by input or hiddev\n");
......
......@@ -357,6 +357,11 @@ static void hidinput_configure_usage(struct hid_device *device, struct hid_field
int a = field->logical_minimum;
int b = field->logical_maximum;
if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) {
a = field->logical_minimum = 0;
b = field->logical_maximum = 255;
}
input->absmin[usage->code] = a;
input->absmax[usage->code] = b;
input->absfuzz[usage->code] = (b - a) >> 8;
......
......@@ -206,6 +206,7 @@ struct hid_item {
#define HID_QUIRK_IGNORE 0x04
#define HID_QUIRK_NOGET 0x08
#define HID_QUIRK_HIDDEV 0x10
#define HID_QUIRK_BADPAD 0x12
/*
* This is the global enviroment of the parser. This information is
......
......@@ -133,6 +133,11 @@ static int hid_pid_erase(struct input_dev *dev, int id)
/* Find field */
field = (struct hid_field *) kmalloc(sizeof(struct hid_field), GFP_KERNEL);
if(!field) {
printk("Couldn't allocate field\n");
return -ENOMEM;
}
ret = hid_set_field(field, ret, pid->effects[id].device_id);
if(!ret) {
printk("Couldn't set field\n");
......
......@@ -388,16 +388,16 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS;
powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters
dev_set_drvdata(&intf->dev, pm);
usb_set_intfdata(intf, pm);
return 0;
}
/* Called when a USB device we've accepted ownership of is removed */
static void powermate_disconnect(struct usb_interface *intf)
{
struct powermate_device *pm = dev_get_drvdata(&intf->dev);
struct powermate_device *pm = usb_get_intfdata (intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (pm) {
down(&pm->lock);
pm->requires_update = 0;
......
......@@ -328,15 +328,15 @@ static int usb_kbd_probe(struct usb_interface *iface,
printk(KERN_INFO "input: %s on %s\n", kbd->name, path);
dev_set_drvdata(&iface->dev, kbd);
usb_set_intfdata(iface, kbd);
return 0;
}
static void usb_kbd_disconnect(struct usb_interface *intf)
{
struct usb_kbd *kbd = dev_get_drvdata(&intf->dev);
struct usb_kbd *kbd = usb_get_intfdata (intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (kbd) {
usb_unlink_urb(kbd->irq);
input_unregister_device(&kbd->dev);
......
......@@ -211,15 +211,15 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
input_register_device(&mouse->dev);
printk(KERN_INFO "input: %s on %s\n", mouse->name, path);
dev_set_drvdata(&intf->dev, mouse);
usb_set_intfdata(intf, mouse);
return 0;
}
static void usb_mouse_disconnect(struct usb_interface *intf)
{
struct usb_mouse *mouse = dev_get_drvdata(&intf->dev);
struct usb_mouse *mouse = usb_get_intfdata (intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (mouse) {
usb_unlink_urb(mouse->irq);
input_unregister_device(&mouse->dev);
......
......@@ -583,16 +583,16 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
printk(KERN_INFO "input: %s on %s\n", wacom->features->name, path);
dev_set_drvdata(&intf->dev, wacom);
usb_set_intfdata(intf, wacom);
return 0;
}
static void wacom_disconnect(struct usb_interface *intf)
{
struct wacom *wacom = dev_get_drvdata(&intf->dev);
struct wacom *wacom = usb_get_intfdata (intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (wacom) {
usb_unlink_urb(wacom->irq);
input_unregister_device(&wacom->dev);
......
......@@ -311,15 +311,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
printk(KERN_INFO "input: %s on %s", xpad->dev.name, path);
dev_set_drvdata(&intf->dev, xpad);
usb_set_intfdata(intf, xpad);
return 0;
}
static void xpad_disconnect(struct usb_interface *intf)
{
struct usb_xpad *xpad = dev_get_drvdata(&intf->dev);
struct usb_xpad *xpad = usb_get_intfdata (intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (xpad) {
usb_unlink_urb(xpad->irq_in);
input_unregister_device(&xpad->dev);
......
......@@ -761,7 +761,7 @@ static int dabusb_probe (struct usb_interface *intf,
dbg("bound to interface: %d", ifnum);
up (&s->mutex);
MOD_INC_USE_COUNT;
dev_set_drvdata (&intf->dev, s);
usb_set_intfdata (intf, s);
return 0;
reject:
......@@ -772,11 +772,11 @@ static int dabusb_probe (struct usb_interface *intf,
static void dabusb_disconnect (struct usb_interface *intf)
{
pdabusb_t s = dev_get_drvdata (&intf->dev);
pdabusb_t s = usb_get_intfdata (intf);
dbg("dabusb_disconnect");
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (s) {
usb_deregister_dev (1, s->devnum);
s->remove_pending = 1;
......
......@@ -190,15 +190,15 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
usb_dsbr100_radio.priv = radio;
radio->dev = interface_to_usbdev (intf);
radio->curfreq = 1454000;
dev_set_drvdata (&intf->dev, radio);
usb_set_intfdata (intf, radio);
return 0;
}
static void usb_dsbr100_disconnect(struct usb_interface *intf)
{
usb_dsbr100 *radio = dev_get_drvdata (&intf->dev);
usb_dsbr100 *radio = usb_get_intfdata (intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (radio) {
lock_kernel();
......
......@@ -3898,7 +3898,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
}
}
MOD_DEC_USE_COUNT;
dev_set_drvdata (&intf->dev, uvd);
usb_set_intfdata (intf, uvd);
return 0;
}
......
......@@ -860,7 +860,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
MOD_DEC_USE_COUNT;
if (uvd) {
dev_set_drvdata (&intf->dev, uvd);
usb_set_intfdata (intf, uvd);
return 0;
}
return -EIO;
......
......@@ -6247,7 +6247,7 @@ ov51x_probe(struct usb_interface *intf,
create_proc_ov511_cam(ov);
dev_set_drvdata (&intf->dev, ov);
usb_set_intfdata (intf, ov);
return 0;
error:
......@@ -6274,12 +6274,12 @@ ov51x_probe(struct usb_interface *intf,
static void
ov51x_disconnect(struct usb_interface *intf)
{
struct usb_ov511 *ov = dev_get_drvdata (&intf->dev);
struct usb_ov511 *ov = usb_get_intfdata (intf);
int n;
PDEBUG(3, "");
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (!ov)
return;
......
......@@ -1840,7 +1840,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
device_hint[hint].pdev = pdev;
Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev);
dev_set_drvdata (&intf->dev, pdev);
usb_set_intfdata (intf, pdev);
return 0;
}
......@@ -1854,8 +1854,8 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
lock_kernel();
free_mem_leak();
pdev = dev_get_drvdata (&intf->dev);
dev_set_drvdata (&intf->dev, NULL);
pdev = usb_get_intfdata (intf);
usb_set_intfdata (intf, NULL);
if (pdev == NULL) {
Err("pwc_disconnect() Called without private pointer.\n");
goto disconnect_out;
......
......@@ -1521,15 +1521,15 @@ static int se401_probe(struct usb_interface *intf,
#endif
info("registered new video device: video%d", se401->vdev.minor);
dev_set_drvdata (&intf->dev, se401);
usb_set_intfdata (intf, se401);
return 0;
}
static void se401_disconnect(struct usb_interface *intf)
{
struct usb_se401 *se401 = dev_get_drvdata (&intf->dev);
struct usb_se401 *se401 = usb_get_intfdata (intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (se401) {
video_unregister_device(&se401->vdev);
if (!se401->user){
......
......@@ -1498,7 +1498,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
#endif
PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev.minor);
dev_set_drvdata (&intf->dev, stv680);
usb_set_intfdata (intf, stv680);
return 0;
}
......@@ -1535,9 +1535,9 @@ static inline void usb_stv680_remove_disconnected (struct usb_stv *stv680)
static void stv680_disconnect (struct usb_interface *intf)
{
struct usb_stv *stv680 = dev_get_drvdata (&intf->dev);
struct usb_stv *stv680 = usb_get_intfdata (intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (stv680) {
/* We don't want people trying to open up the device */
......
/*
* USB NB Camera driver
*
* HISTORY:
* 25-Dec-2002 Dmitri Removed lighting, sharpness parameters, methods.
*/
#include <linux/kernel.h>
......@@ -34,12 +37,6 @@ static int flags = 0; /* FLAGS_DISPLAY_HINTS | FLAGS_OVERLAY_STATS; */
static const int min_canvasWidth = 8;
static const int min_canvasHeight = 4;
//static int lighting = 1; /* Medium */
#define SHARPNESS_MIN 0
#define SHARPNESS_MAX 6
//static int sharpness = 4; /* Low noise, good details */
#define FRAMERATE_MIN 0
#define FRAMERATE_MAX 6
static int framerate = -1;
......@@ -77,10 +74,6 @@ MODULE_PARM_DESC(flags,
"6=clean frames");
MODULE_PARM(framerate, "i");
MODULE_PARM_DESC(framerate, "Framerate setting: 0=slowest, 6=fastest (default=2)");
MODULE_PARM(lighting, "i");
MODULE_PARM_DESC(lighting, "Photosensitivity: 0=bright, 1=medium (default), 2=low light");
MODULE_PARM(sharpness, "i");
MODULE_PARM_DESC(sharpness, "Model1 noise reduction: 0=smooth, 6=sharp (default=4)");
MODULE_PARM(init_brightness, "i");
MODULE_PARM_DESC(init_brightness, "Brightness preconfiguration: 0-255 (default=128)");
......@@ -205,24 +198,6 @@ static void ultracam_adjust_contrast(struct uvd *uvd)
{
}
/*
* ultracam_change_lighting_conditions()
*/
static void ultracam_change_lighting_conditions(struct uvd *uvd)
{
}
/*
* ultracam_set_sharpness()
*
* Cameras model 1 have internal smoothing feature. It is controlled by value in
* range [0..6], where 0 is most smooth and 6 is most sharp (raw image, I guess).
* Recommended value is 4. Cameras model 2 do not have this feature at all.
*/
static void ultracam_set_sharpness(struct uvd *uvd)
{
}
/*
* ultracam_set_brightness()
*
......@@ -272,8 +247,6 @@ static void ultracam_reinit_iso(struct uvd *uvd, int do_stop)
static void ultracam_video_start(struct uvd *uvd)
{
ultracam_change_lighting_conditions(uvd);
ultracam_set_sharpness(uvd);
ultracam_reinit_iso(uvd, 0);
}
......@@ -662,7 +635,7 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id
MOD_DEC_USE_COUNT;
if (uvd) {
dev_set_drvdata (&intf->dev, uvd);
usb_set_intfdata (intf, uvd);
return 0;
}
return -EIO;
......
......@@ -968,7 +968,7 @@ EXPORT_SYMBOL(usbvideo_Deregister);
*/
static void usbvideo_Disconnect(struct usb_interface *intf)
{
struct uvd *uvd = dev_get_drvdata (&intf->dev);
struct uvd *uvd = usb_get_intfdata (intf);
int i;
if (uvd == NULL) {
......@@ -976,7 +976,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf)
return;
}
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
usbvideo_ClientIncModCount(uvd);
if (uvd->debug > 0)
......
......@@ -1307,7 +1307,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor);
dev_set_drvdata(&intf->dev, cam);
usb_set_intfdata (intf, cam);
return 0;
}
......@@ -1316,8 +1316,8 @@ static void
vicam_disconnect(struct usb_interface *intf)
{
int open_count;
struct vicam_camera *cam = dev_get_drvdata(&intf->dev);
dev_set_drvdata ( &intf->dev, NULL );
struct vicam_camera *cam = usb_get_intfdata (intf);
usb_set_intfdata (intf, NULL);
/* we must unregister the device before taking its
* cam_lock. This is because the video open call
......
......@@ -2061,7 +2061,7 @@ static int auerswald_probe (struct usb_interface *intf,
}
/* all OK */
dev_set_drvdata (&intf->dev, cp);
usb_set_intfdata (intf, cp);
return 0;
/* Error exit: clean up the memory */
......@@ -2085,10 +2085,10 @@ pfail: auerswald_delete (cp);
*/
static void auerswald_disconnect (struct usb_interface *intf)
{
pauerswald_t cp = dev_get_drvdata (&intf->dev);
pauerswald_t cp = usb_get_intfdata (intf);
unsigned int u;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (!cp)
return;
......
......@@ -406,7 +406,7 @@ brlvger_probe (struct usb_interface *intf,
out:
up(&reserve_sem);
if (priv) {
dev_set_drvdata (&intf->dev, priv);
usb_set_intfdata (intf, priv);
return 0;
}
return -EIO;
......@@ -415,10 +415,10 @@ brlvger_probe (struct usb_interface *intf,
static void
brlvger_disconnect(struct usb_interface *intf)
{
struct brlvger_priv *priv = dev_get_drvdata (&intf->dev);
struct brlvger_priv *priv = usb_get_intfdata (intf);
int r;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if(priv){
info("Display %d disconnecting", priv->subminor);
......
......@@ -491,15 +491,15 @@ static int probe_rio(struct usb_interface *intf,
init_MUTEX(&(rio->lock));
dev_set_drvdata (&intf->dev, rio);
usb_set_intfdata (intf, rio);
return 0;
}
static void disconnect_rio(struct usb_interface *intf)
{
struct rio_usb_data *rio = dev_get_drvdata (&intf->dev);
struct rio_usb_data *rio = usb_get_intfdata (intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (rio) {
devfs_unregister(rio->devfs);
usb_deregister_dev(1, rio->minor);
......
......@@ -973,16 +973,16 @@ static int udsl_usb_probe (struct usb_interface *intf, const struct usb_device_i
minor_data[instance->minor] = instance;
dev_set_drvdata (&intf->dev, instance);
usb_set_intfdata (intf, instance);
return 0;
}
static void udsl_usb_disconnect (struct usb_interface *intf)
{
struct udsl_instance_data *instance = dev_get_drvdata (&intf->dev);
struct udsl_instance_data *instance = usb_get_intfdata (intf);
int i;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (instance) {
i = instance->minor;
/* unlinking receive buffers */
......
......@@ -383,7 +383,7 @@ tiglusb_probe (struct usb_interface *intf,
dev->descriptor.bcdDevice >> 8,
dev->descriptor.bcdDevice & 0xff);
dev_set_drvdata (&intf->dev, s);
usb_set_intfdata (intf, s);
return 0;
}
......@@ -392,9 +392,9 @@ tiglusb_disconnect (struct usb_interface *intf)
{
char name[32];
ptiglusb_t s = dev_get_drvdata (&intf->dev);
ptiglusb_t s = usb_get_intfdata (intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (!s || !s->dev) {
info ("bogus disconnect");
return;
......
......@@ -290,15 +290,15 @@ static int probe_lcd(struct usb_interface *intf, const struct usb_device_id *id)
}
dbg("probe_lcd: ibuf address:%p", lcd->ibuf);
dev_set_drvdata (&intf->dev, lcd);
usb_set_intfdata (intf, lcd);
return 0;
}
static void disconnect_lcd(struct usb_interface *intf)
{
struct lcd_usb_data *lcd = dev_get_drvdata (&intf->dev);
struct lcd_usb_data *lcd = usb_get_intfdata (intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (lcd) {
usb_deregister_dev(1, lcd->minor);
......
......@@ -635,7 +635,7 @@ static int unlink_simple (struct usbtest_dev *dev, int pipe, int len)
static int
usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
{
struct usbtest_dev *dev = dev_get_drvdata (&intf->dev);
struct usbtest_dev *dev = usb_get_intfdata (intf);
struct usb_device *udev = testdev_to_usbdev (dev);
struct usbtest_param *param = buf;
int retval = -EOPNOTSUPP;
......@@ -957,7 +957,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
}
}
dev_set_drvdata (&intf->dev, dev);
usb_set_intfdata (intf, dev);
info ("%s at %s ... %s speed {control%s%s} tests",
info->name, dev->id,
({ char *tmp;
......@@ -972,13 +972,12 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
static void usbtest_disconnect (struct usb_interface *intf)
{
struct usbtest_dev *dev = dev_get_drvdata (&intf->dev);
struct usbtest_dev *dev = usb_get_intfdata (intf);
down (&dev->sem);
dev_set_drvdata (&intf->dev, 0);
usb_set_intfdata (intf, NULL);
info ("unbound %s", dev->id);
kfree (intf->private_data);
}
/* Basic testing only needs a device that can source or sink bulk traffic.
......
......@@ -608,7 +608,7 @@ static int uss720_probe(struct usb_interface *intf,
parport_announce_port(pp);
MOD_INC_USE_COUNT;
dev_set_drvdata (&intf->dev, pp);
usb_set_intfdata (intf, pp);
return 0;
#if 0
......@@ -622,10 +622,10 @@ static int uss720_probe(struct usb_interface *intf,
static void uss720_disconnect(struct usb_interface *intf)
{
struct parport *pp = dev_get_drvdata (&intf->dev);
struct parport *pp = usb_get_intfdata (intf);
struct parport_uss720_private *priv;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata (intf, NULL);
if (pp) {
priv = pp->private_data;
#if 0
......
......@@ -928,15 +928,15 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
usbdev->bus->bus_name, usbdev->devpath);
for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
printk("%2.2x.\n", netdev->dev_addr[i]);
dev_set_drvdata (&intf->dev, catc);
usb_set_intfdata(intf, catc);
return 0;
}
static void catc_disconnect(struct usb_interface *intf)
{
struct catc *catc = dev_get_drvdata (&intf->dev);
struct catc *catc = usb_get_intfdata(intf);
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (catc) {
unregister_netdev(catc->netdev);
usb_free_urb(catc->ctrl_urb);
......
......@@ -1287,10 +1287,10 @@ static int CDCEther_probe( struct usb_interface *intf,
static void CDCEther_disconnect( struct usb_interface *intf )
{
ether_dev_t *ether_dev = dev_get_drvdata (&intf->dev);
ether_dev_t *ether_dev = usb_get_intfdata(intf);
struct usb_device *usb;
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
// Sanity check!!!
if ( !ether_dev || !ether_dev->usb ) {
......
......@@ -612,8 +612,6 @@ static int kaweth_open(struct net_device *net)
struct kaweth_device *kaweth = (struct kaweth_device *)net->priv;
int res;
kaweth_dbg("Dev usage: %d", kaweth->dev->refcnt.counter);
kaweth_dbg("Opening network device.");
res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL);
......@@ -658,9 +656,6 @@ static int kaweth_close(struct net_device *net)
kaweth->status &= ~KAWETH_STATUS_CLOSING;
printk("Dev usage: %d", kaweth->dev->refcnt.counter);
return 0;
}
......@@ -1066,7 +1061,7 @@ static int kaweth_probe(
kaweth_dbg("Kaweth probe returning.");
dev_set_drvdata (&intf->dev, kaweth);
usb_set_intfdata(intf, kaweth);
return 0;
err_tx_and_rx:
......@@ -1085,11 +1080,11 @@ static int kaweth_probe(
****************************************************************/
static void kaweth_disconnect(struct usb_interface *intf)
{
struct kaweth_device *kaweth = dev_get_drvdata (&intf->dev);
struct kaweth_device *kaweth = usb_get_intfdata(intf);
kaweth_info("Unregistering");
dev_set_drvdata (&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (!kaweth) {
kaweth_warn("unregistering non-existant device");
return;
......
......@@ -1244,7 +1244,7 @@ static int pegasus_probe(struct usb_interface *intf,
exit:
up(&pegasus->sem);
if (pegasus) {
dev_set_drvdata(&intf->dev, pegasus);
usb_set_intfdata(intf, pegasus);
return 0;
}
return -EIO;
......@@ -1252,9 +1252,9 @@ static int pegasus_probe(struct usb_interface *intf,
static void pegasus_disconnect(struct usb_interface *intf)
{
struct pegasus *pegasus = dev_get_drvdata(&intf->dev);
struct pegasus *pegasus = usb_get_intfdata(intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (!pegasus) {
warn("unregistering non-existant device");
return;
......
......@@ -842,7 +842,7 @@ static int rtl8150_probe(struct usb_interface *intf,
info("%s: rtl8150 is detected", netdev->name);
up(&dev->sem);
dev_set_drvdata(&intf->dev, dev);
usb_set_intfdata(intf, dev);
return 0;
err:
unregister_netdev(dev->netdev);
......@@ -854,9 +854,9 @@ static int rtl8150_probe(struct usb_interface *intf,
static void rtl8150_disconnect(struct usb_interface *intf)
{
rtl8150_t *dev = dev_get_drvdata(&intf->dev);
rtl8150_t *dev = usb_get_intfdata(intf);
dev_set_drvdata(&intf->dev, NULL);
usb_set_intfdata(intf, NULL);
if (dev) {
set_bit(RTL8150_UNPLUG, &dev->flags);
unregister_netdev(dev->netdev);
......
......@@ -146,6 +146,11 @@
#endif
#include <linux/usb.h>
#include <asm/io.h>
#include <asm/scatterlist.h>
#include <linux/mm.h>
#include <linux/dma-mapping.h>
/* minidrivers _could_ be individually configured */
#define CONFIG_USB_AN2720
......@@ -2089,8 +2094,8 @@ static void usbnet_disconnect (struct usb_interface *intf)
struct usbnet *dev;
struct usb_device *xdev;
dev = dev_get_drvdata (&intf->dev);
dev_set_drvdata (&intf->dev, NULL);
dev = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
if (!dev)
return;
......@@ -2169,9 +2174,13 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
memcpy (net->dev_addr, node_id, sizeof node_id);
// point-to-point link ... we always use Ethernet headers
// supports win32 interop and the bridge driver.
// supports win32 interop (some devices) and the bridge driver.
ether_setup (net);
// possible with some EHCI controllers
if (dma_supported (&udev->dev, 0xffffffffffffffffULL))
net->features |= NETIF_F_HIGHDMA;
net->change_mtu = usbnet_change_mtu;
net->get_stats = usbnet_get_stats;
net->hard_start_xmit = usbnet_start_xmit;
......@@ -2197,7 +2206,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
#endif
// ok, it's ready to go.
dev_set_drvdata (&udev->dev, dev);
usb_set_intfdata(udev, dev);
mutex_lock (&usbnet_mutex);
list_add (&dev->dev_list, &usbnet_list);
mutex_unlock (&dev->mutex);
......
......@@ -150,11 +150,11 @@ config USB_SERIAL_VISOR
module, say M here and read <file:Documentation/modules.txt>.
config USB_SERIAL_IPAQ
tristate "USB Compaq iPAQ / HP Jornada / Casio EM500 Driver"
tristate "USB PocketPC PDA Driver"
depends on USB_SERIAL
help
Say Y here if you want to connect to your Compaq iPAQ, HP Jornada
548/568 or Casio EM500 running Windows CE 3.0 or PocketPC 2002
or any other PDA running Windows CE 3.0 or PocketPC 2002
using a USB cradle/cable. For information on using the driver,
read <file:Documentation/usb/usb-serial.txt>.
......
......@@ -171,10 +171,9 @@ static int belkin_sa_startup (struct usb_serial *serial)
struct belkin_sa_private *priv;
/* allocate the private data structure */
serial->port->private = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL);
if (!serial->port->private)
priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL);
if (!priv)
return (-1); /* error */
priv = (struct belkin_sa_private *)serial->port->private;
/* set initial values for control structures */
priv->control_state = 0;
priv->last_lsr = 0;
......@@ -184,6 +183,7 @@ static int belkin_sa_startup (struct usb_serial *serial)
info("bcdDevice: %04x, bfc: %d", dev->descriptor.bcdDevice, priv->bad_flow_control);
init_waitqueue_head(&serial->port->write_wait);
usb_set_serial_port_data(serial->port, priv);
return (0);
}
......@@ -191,6 +191,7 @@ static int belkin_sa_startup (struct usb_serial *serial)
static void belkin_sa_shutdown (struct usb_serial *serial)
{
struct belkin_sa_private *priv;
int i;
dbg ("%s", __FUNCTION__);
......@@ -198,8 +199,9 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
/* stop reads and writes on all ports */
for (i=0; i < serial->num_ports; ++i) {
/* My special items, the standard routines free my urbs */
if (serial->port[i].private)
kfree(serial->port[i].private);
priv = usb_get_serial_port_data(&serial->port[i]);
if (priv)
kfree(priv);
}
}
......@@ -286,7 +288,7 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
/* Handle known interrupt data */
/* ignore data[0] and data[1] */
priv = (struct belkin_sa_private *)port->private;
priv = usb_get_serial_port_data(port);
priv->last_msr = data[BELKIN_SA_MSR_INDEX];
/* Record Control Line states */
......@@ -344,7 +346,7 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
static void belkin_sa_set_termios (struct usb_serial_port *port, struct termios *old_termios)
{
struct usb_serial *serial = port->serial;
struct belkin_sa_private *priv = (struct belkin_sa_private *)port->private;
struct belkin_sa_private *priv = usb_get_serial_port_data(port);
unsigned int iflag;
unsigned int cflag;
unsigned int old_iflag = 0;
......@@ -485,7 +487,7 @@ static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, un
{
struct usb_serial *serial = port->serial;
__u16 urb_value; /* Will hold the new flags */
struct belkin_sa_private *priv = (struct belkin_sa_private *)port->private;
struct belkin_sa_private *priv = usb_get_serial_port_data(port);
int ret, mask;
/* Based on code from acm.c and others */
......
......@@ -66,7 +66,7 @@ static int usb_serial_device_probe (struct device *dev)
driver = port->serial->type;
if (driver->port_probe) {
if (!try_module_get(driver->owner)) {
err ("module get failed, exiting");
dev_err(*dev, "module get failed, exiting\n");
retval = -EIO;
goto exit;
}
......@@ -79,8 +79,8 @@ static int usb_serial_device_probe (struct device *dev)
minor = port->number;
tty_register_devfs (&usb_serial_tty_driver, 0, minor);
info("%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)",
driver->name, minor, minor);
dev_info(*dev, "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
driver->name, minor, minor);
exit:
return retval;
......@@ -101,7 +101,7 @@ static int usb_serial_device_remove (struct device *dev)
driver = port->serial->type;
if (driver->port_remove) {
if (!try_module_get(driver->owner)) {
err ("module get failed, exiting");
dev_err(*dev, "module get failed, exiting\n");
retval = -EIO;
goto exit;
}
......@@ -111,8 +111,8 @@ static int usb_serial_device_remove (struct device *dev)
exit:
minor = port->number;
tty_unregister_devfs (&usb_serial_tty_driver, minor);
info("%s converter now disconnected from ttyUSB%d",
driver->name, minor);
dev_info(*dev, "%s converter now disconnected from ttyUSB%d\n",
driver->name, minor);
return retval;
}
......
......@@ -114,15 +114,15 @@ static int cyberjack_startup (struct usb_serial *serial)
dbg("%s", __FUNCTION__);
/* allocate the private data structure */
serial->port->private = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL);
if (!serial->port->private)
return (-1); /* error */
priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL);
if (!priv)
return -ENOMEM;
/* set initial values */
priv = (struct cyberjack_private *)serial->port->private;
priv->rdtodo = 0;
priv->wrfilled = 0;
priv->wrsent = 0;
usb_set_serial_port_data(serial->port, priv);
init_waitqueue_head(&serial->port->write_wait);
......@@ -137,8 +137,8 @@ static void cyberjack_shutdown (struct usb_serial *serial)
for (i=0; i < serial->num_ports; ++i) {
/* My special items, the standard routines free my urbs */
if (serial->port[i].private)
kfree(serial->port[i].private);
kfree(usb_get_serial_port_data(&serial->port[i]));
usb_set_serial_port_data(&serial->port[i], NULL);
}
}
......@@ -158,7 +158,7 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
*/
port->tty->low_latency = 1;
priv = (struct cyberjack_private *)port->private;
priv = usb_get_serial_port_data(port);
priv->rdtodo = 0;
priv->wrfilled = 0;
priv->wrsent = 0;
......@@ -192,7 +192,7 @@ static void cyberjack_close (struct usb_serial_port *port, struct file *filp)
static int cyberjack_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
{
struct usb_serial *serial = port->serial;
struct cyberjack_private *priv = (struct cyberjack_private *)port->private;
struct cyberjack_private *priv = usb_get_serial_port_data(port);
int result;
int wrexpected;
......@@ -280,7 +280,7 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs )
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct cyberjack_private *priv = (struct cyberjack_private *)port->private;
struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial;
unsigned char *data = urb->transfer_buffer;
......@@ -334,7 +334,7 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs )
static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct cyberjack_private *priv = (struct cyberjack_private *)port->private;
struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
......@@ -389,7 +389,7 @@ static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
static void cyberjack_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct cyberjack_private *priv = (struct cyberjack_private *)port->private;
struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
dbg("%s - port %d", __FUNCTION__, port->number);
......
This diff is collapsed.
......@@ -181,7 +181,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result)
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
dev_err(port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result);
return result;
}
......@@ -205,7 +205,7 @@ static void empeg_close (struct usb_serial_port *port, struct file * filp)
usb_unlink_urb (port->read_urb);
}
/* Uncomment the following line if you want to see some statistics in your syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
/* dev_info (port->dev, "Bytes In = %d Bytes Out = %d\n", bytes_in, bytes_out); */
}
......@@ -248,7 +248,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
if (urb->transfer_buffer == NULL) {
urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
if (urb->transfer_buffer == NULL) {
err("%s no more kernel memory...", __FUNCTION__);
dev_err(port->dev, "%s no more kernel memory...\n", __FUNCTION__);
goto exit;
}
}
......@@ -278,7 +278,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
/* send it down the pipe */
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
err("%s - usb_submit_urb(write bulk) failed with status = %d", __FUNCTION__, status);
dev_err(port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __FUNCTION__, status);
bytes_sent = status;
break;
}
......@@ -426,7 +426,7 @@ static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
dev_err(urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
return;
......@@ -451,7 +451,7 @@ static void empeg_unthrottle (struct usb_serial_port *port)
result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
dev_err(port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result);
return;
}
......
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.
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