Commit 9356a66d 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 4d0b85ea b8036d5a
......@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_PRINTER) += class/
obj-$(CONFIG_USB_STORAGE) += storage/
obj-$(CONFIG_USB_AIPTEK) += input/
obj-$(CONFIG_USB_HID) += input/
obj-$(CONFIG_USB_KBD) += input/
obj-$(CONFIG_USB_MOUSE) += input/
......
......@@ -418,7 +418,8 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
struct usblp *usblp = file->private_data;
int length, err, i;
unsigned char status, newChannel;
unsigned char lpstatus, newChannel;
int status;
int twoints[2];
int retval = 0;
......@@ -569,12 +570,13 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) {
case LPGETSTATUS:
if (usblp_read_status(usblp, &status)) {
if (usblp_read_status(usblp, &lpstatus)) {
err("usblp%d: failed reading printer status", usblp->minor);
retval = -EIO;
goto done;
}
if (copy_to_user ((unsigned char *)arg, &status, 1))
status = lpstatus;
if (copy_to_user ((int *)arg, &status, sizeof(int)))
retval = -EFAULT;
break;
......
......@@ -471,8 +471,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
return 0;
}
if (alternate < 0 || alternate >= iface->num_altsetting)
return -EINVAL;
if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate,
USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
iface->altsetting[alternate].bAlternateSetting,
interface, NULL, 0, HZ * 5)) < 0)
return ret;
......
......@@ -106,7 +106,6 @@
/*-------------------------------------------------------------------------*/
#define OHCI_USE_NPS // force NoPowerSwitching mode
// #define OHCI_VERBOSE_DEBUG /* not always helpful */
/* For initializing controller (mask in an HCFS mode too) */
......@@ -349,16 +348,17 @@ static int ohci_get_frame (struct usb_hcd *hcd)
static int hc_reset (struct ohci_hcd *ohci)
{
int timeout = 30;
int smm_timeout = 50; /* 0,5 sec */
u32 temp;
if (readl (&ohci->regs->control) & OHCI_CTRL_IR) { /* SMM owns the HC */
/* SMM owns the HC? not for long! */
if (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
temp = 50; /* arbitrary: half second */
writel (OHCI_INTR_OC, &ohci->regs->intrenable);
writel (OHCI_OCR, &ohci->regs->cmdstatus);
dbg ("USB HC TakeOver from SMM");
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
wait_ms (10);
if (--smm_timeout == 0) {
if (--temp == 0) {
err ("USB HC TakeOver failed!");
return -1;
}
......@@ -372,31 +372,49 @@ static int hc_reset (struct ohci_hcd *ohci)
ohci->hcd.self.bus_name,
readl (&ohci->regs->control));
/* Reset USB (needed by some controllers) */
writel (0, &ohci->regs->control);
/* Reset USB (needed by some controllers); RemoteWakeupConnected
* saved if boot firmware (BIOS/SMM/...) told us it's connected
*/
ohci->hc_control = readl (&ohci->regs->control);
ohci->hc_control &= OHCI_CTRL_RWC; /* hcfs 0 = RESET */
writel (ohci->hc_control, &ohci->regs->control);
wait_ms (50);
/* HC Reset requires max 10 ms delay */
/* HC Reset requires max 10 us delay */
writel (OHCI_HCR, &ohci->regs->cmdstatus);
temp = 30; /* ... allow extra time */
while ((readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
if (--timeout == 0) {
if (--temp == 0) {
err ("USB HC reset timed out!");
return -1;
}
udelay (1);
}
/* now we're in the SUSPEND state ... must go OPERATIONAL
* within 2msec else HC enters RESUME
*
* ... but some hardware won't init fmInterval "by the book"
* (SiS, OPTi ...), so reset again instead. SiS doesn't need
* this if we write fmInterval after we're OPERATIONAL.
*/
writel (ohci->hc_control, &ohci->regs->control);
return 0;
}
/*-------------------------------------------------------------------------*/
#define FI 0x2edf /* 12000 bits per frame (-1) */
#define LSTHRESH 0x628 /* lowspeed bit threshold */
/* Start an OHCI controller, set the BUS operational
* enable interrupts
* connect the virtual root hub
*/
static int hc_start (struct ohci_hcd *ohci)
{
__u32 mask;
unsigned int fminterval;
u32 mask;
struct usb_device *udev;
spin_lock_init (&ohci->lock);
......@@ -405,21 +423,31 @@ static int hc_start (struct ohci_hcd *ohci)
/* Tell the controller where the control and bulk lists are
* The lists are empty now. */
writel (0, &ohci->regs->ed_controlhead);
writel (0, &ohci->regs->ed_bulkhead);
/* a reset clears this */
writel ((u32) ohci->hcca_dma, &ohci->regs->hcca);
fminterval = 0x2edf;
writel ((fminterval * 9) / 10, &ohci->regs->periodicstart);
fminterval |= ((((fminterval - 210) * 6) / 7) << 16);
writel (fminterval, &ohci->regs->fminterval);
writel (0x628, &ohci->regs->lsthresh);
/* force default fmInterval (we won't adjust it); init thresholds
* for last FS and LS packets, reserve 90% for periodic.
*/
writel ((((6 * (FI - 210)) / 7) << 16) | FI, &ohci->regs->fminterval);
writel (((9 * FI) / 10) & 0x3fff, &ohci->regs->periodicstart);
writel (LSTHRESH, &ohci->regs->lsthresh);
/* some OHCI implementations are finicky about how they init.
* bogus values here mean not even enumeration could work.
*/
if ((readl (&ohci->regs->fminterval) & 0x3fff0000) == 0
|| !readl (&ohci->regs->periodicstart)) {
err ("%s init err", ohci->hcd.self.bus_name);
return -EOVERFLOW;
}
/* start controller operations */
ohci->hc_control = OHCI_CONTROL_INIT | OHCI_USB_OPER;
ohci->hc_control &= OHCI_CTRL_RWC;
ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER;
ohci->disabled = 0;
writel (ohci->hc_control, &ohci->regs->control);
......@@ -428,12 +456,11 @@ static int hc_start (struct ohci_hcd *ohci)
writel (mask, &ohci->regs->intrstatus);
writel (mask, &ohci->regs->intrenable);
#ifdef OHCI_USE_NPS
/* required for AMD-756 and some Mac platforms */
writel ((roothub_a (ohci) | RH_A_NPS) & ~RH_A_PSM,
/* hub power always on: required for AMD-756 and some Mac platforms */
writel ((roothub_a (ohci) | RH_A_NPS) & ~(RH_A_PSM | RH_A_OCPM),
&ohci->regs->roothub.a);
writel (RH_HS_LPSC, &ohci->regs->roothub.status);
#endif /* OHCI_USE_NPS */
writel (0, &ohci->regs->roothub.b);
// POTPGT delay is bits 24-31, in 2 ms units.
mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
......@@ -443,7 +470,8 @@ static int hc_start (struct ohci_hcd *ohci)
ohci->hcd.state = USB_STATE_READY;
if (!udev) {
ohci->disabled = 1;
// FIXME cleanup
ohci->hc_control &= ~OHCI_CTRL_HCFS;
writel (ohci->hc_control, &ohci->regs->control);
return -ENOMEM;
}
......@@ -452,7 +480,8 @@ static int hc_start (struct ohci_hcd *ohci)
if (usb_register_root_hub (udev, ohci->parent_dev) != 0) {
usb_free_dev (udev);
ohci->disabled = 1;
// FIXME cleanup
ohci->hc_control &= ~OHCI_CTRL_HCFS;
writel (ohci->hc_control, &ohci->regs->control);
return -ENODEV;
}
......
......@@ -62,6 +62,17 @@ CONFIG_USB_MOUSE
If even remotely unsure, say N.
CONFIG_USB_AIPTEK
Say Y here if you want to use the USB version of the Aiptek 6000U
or Aiptek 8000U tablet. Make sure to say Y to "Mouse support"
(CONFIG_INPUT_MOUSEDEV) and/or "Event interface support"
(CONFIG_INPUT_EVDEV) as well.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called aiptek.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_USB_WACOM
Say Y here if you want to use the USB version of the Wacom Intuos
or Graphire tablet. Make sure to say Y to "Mouse support"
......
......@@ -14,5 +14,6 @@ if [ "$CONFIG_USB_HID" != "y" ]; then
dep_tristate ' USB HIDBP Mouse (basic) support' CONFIG_USB_MOUSE $CONFIG_USB $CONFIG_INPUT
fi
dep_tristate ' Aiptek 6000U/8000U tablet support' CONFIG_USB_AIPTEK $CONFIG_USB $CONFIG_INPUT
dep_tristate ' Wacom Intuos/Graphire tablet support' CONFIG_USB_WACOM $CONFIG_USB $CONFIG_INPUT
......@@ -13,6 +13,7 @@ ifeq ($(CONFIG_USB_HIDINPUT),y)
hid-objs += hid-input.o
endif
obj-$(CONFIG_USB_AIPTEK) += aiptek.o
obj-$(CONFIG_USB_HID) += hid.o
obj-$(CONFIG_USB_KBD) += usbkbd.o
obj-$(CONFIG_USB_MOUSE) += usbmouse.o
......
/*
* Native support for the Aiptek 8000U
*
* Copyright (c) 2001 Chris Atenasio <chris@crud.net>
*
* based on wacom.c by
* Vojtech Pavlik <vojtech@suse.cz>
* Andreas Bach Aaen <abach@stofanet.dk>
* Clifford Wolf <clifford@clifford.at>
* Sam Mosel <sam.mosel@computer.org>
* James E. Blair <corvus@gnu.org>
* Daniel Egger <egger@suse.de>
*
*
* Many thanks to Oliver Kuechemann for his support.
*
* ChangeLog:
* v0.1 - Initial release
* v0.2 - Hack to get around fake event 28's.
* v0.3 - Make URB dynamic (Bryan W. Headley, Jun-8-2002)
* (kernel 2.5.x variant, June-14-2002)
*/
/*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/usb.h>
/*
* Version Information
*/
#define DRIVER_VERSION "v0.3"
#define DRIVER_AUTHOR "Chris Atenasio <chris@crud.net>"
#define DRIVER_DESC "USB Aiptek 6000U/8000U tablet driver (Linux 2.5.x)"
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
/*
* Aiptek status packet:
*
* bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
* byte0 0 0 0 0 0 0 1 0
* byte1 X7 X6 X5 X4 X3 X2 X1 X0
* byte2 X15 X14 X13 X12 X11 X10 X9 X8
* byte3 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
* byte4 Y15 Y14 Y13 Y12 Y11 Y10 Y9 Y8
* byte5 * * * BS2 BS1 Tip DV IR
* byte6 P7 P6 P5 P4 P3 P2 P1 P0
* byte7 P15 P14 P13 P12 P11 P10 P9 P8
*
* IR: In Range = Proximity on
* DV = Data Valid
*
*
* Command Summary:
*
* Command/Data Description Return Bytes Return Value
* 0x10/0x00 SwitchToMouse 0
* 0x10/0x01 SwitchToTablet 0
* 0x18/0x04 Resolution500LPI 0
* 0x17/0x00 FilterOn 0
* 0x12/0xFF AutoGainOn 0
* 0x01/0x00 GetXExtension 2 MaxX
* 0x01/0x01 GetYExtension 2 MaxY
* 0x02/0x00 GetModelCode 2 ModelCode = LOBYTE
* 0x03/0x00 GetODMCode 2 ODMCode
* 0x08/0x00 GetPressureLevels 2 =512
* 0x04/0x00 GetFirmwareVersion 2 Firmware Version
*
*
* To initialize the tablet:
*
* (1) Send command Resolution500LPI
* (2) Option Commands (GetXExtension, GetYExtension)
* (3) Send command SwitchToTablet
*/
#define USB_VENDOR_ID_AIPTEK 0x08ca
struct aiptek_features {
char *name;
int pktlen;
int x_max;
int y_max;
int pressure_min;
int pressure_max;
void (*irq) (struct urb * urb);
unsigned long evbit;
unsigned long absbit;
unsigned long relbit;
unsigned long btnbit;
unsigned long digibit;
};
struct aiptek {
signed char data[10];
struct input_dev dev;
struct usb_device *usbdev;
struct urb *irq;
struct aiptek_features *features;
int tool;
int open;
};
static void
aiptek_irq(struct urb *urb)
{
struct aiptek *aiptek = urb->context;
unsigned char *data = aiptek->data;
struct input_dev *dev = &aiptek->dev;
int x;
int y;
int pressure;
int proximity;
if (urb->status)
return;
if ((data[0] & 2) == 0) {
dbg("received unknown report #%d", data[0]);
}
proximity = data[5] & 0x01;
input_report_key(dev, BTN_TOOL_PEN, proximity);
x = ((__u32) data[1]) | ((__u32) data[2] << 8);
y = ((__u32) data[3]) | ((__u32) data[4] << 8);
pressure = ((__u32) data[6]) | ((__u32) data[7] << 8);
pressure -= aiptek->features->pressure_min;
if (pressure < 0) {
pressure = 0;
}
if (proximity) {
input_report_abs(dev, ABS_X, x);
input_report_abs(dev, ABS_Y, y);
input_report_abs(dev, ABS_PRESSURE, pressure);
input_report_key(dev, BTN_TOUCH, data[5] & 0x04);
input_report_key(dev, BTN_STYLUS, data[5] & 0x08);
input_report_key(dev, BTN_STYLUS2, data[5] & 0x10);
}
}
struct aiptek_features aiptek_features[] = {
{"Aiptek 6000U/8000U",
8, 3000, 2250, 26, 511, aiptek_irq, 0, 0, 0, 0},
{NULL, 0}
};
struct usb_device_id aiptek_ids[] = {
{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), driver_info:0},
{}
};
MODULE_DEVICE_TABLE(usb, aiptek_ids);
static int
aiptek_open(struct input_dev *dev)
{
struct aiptek *aiptek = dev->private;
if (aiptek->open++)
return 0;
aiptek->irq->dev = aiptek->usbdev;
if (usb_submit_urb(aiptek->irq, GFP_KERNEL))
return -EIO;
return 0;
}
static void
aiptek_close(struct input_dev *dev)
{
struct aiptek *aiptek = dev->private;
if (!--aiptek->open)
usb_unlink_urb(aiptek->irq);
}
static void
aiptek_command(struct usb_device *dev, unsigned int ifnum,
unsigned char command, unsigned char data)
{
__u8 buf[3];
buf[0] = 4;
buf[1] = command;
buf[2] = data;
/*
* FIXME, either remove this call, or talk the maintainer into
* adding it back into the core.
*/
#if 0
if (usb_set_report(dev, ifnum, 3, 2, buf, 3) != 3) {
dbg("aiptek_command: 0x%x 0x%x\n", command, data);
}
#endif
}
static void*
aiptek_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
struct usb_endpoint_descriptor *endpoint;
struct aiptek *aiptek;
if (!(aiptek = kmalloc(sizeof (struct aiptek), GFP_KERNEL)))
return NULL;
memset(aiptek, 0, sizeof (struct aiptek));
aiptek->irq = usb_alloc_urb(0, GFP_KERNEL);
if (!aiptek->irq) {
kfree(aiptek);
return NULL;
}
// Resolution500LPI
aiptek_command(dev, ifnum, 0x18, 0x04);
// SwitchToTablet
aiptek_command(dev, ifnum, 0x10, 0x01);
aiptek->features = aiptek_features + id->driver_info;
aiptek->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC) |
aiptek->features->evbit;
aiptek->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) |
BIT(ABS_MISC) | aiptek->features->absbit;
aiptek->dev.relbit[0] |= aiptek->features->relbit;
aiptek->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) |
BIT(BTN_MIDDLE) | aiptek->features->btnbit;
aiptek->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) |
BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOUCH) |
BIT(BTN_STYLUS) | BIT(BTN_STYLUS2) | aiptek->features->digibit;
aiptek->dev.mscbit[0] = BIT(MSC_SERIAL);
aiptek->dev.absmax[ABS_X] = aiptek->features->x_max;
aiptek->dev.absmax[ABS_Y] = aiptek->features->y_max;
aiptek->dev.absmax[ABS_PRESSURE] = aiptek->features->pressure_max -
aiptek->features->pressure_min;
aiptek->dev.absfuzz[ABS_X] = 0;
aiptek->dev.absfuzz[ABS_Y] = 0;
aiptek->dev.private = aiptek;
aiptek->dev.open = aiptek_open;
aiptek->dev.close = aiptek_close;
aiptek->dev.name = aiptek->features->name;
aiptek->dev.idbus = BUS_USB;
aiptek->dev.idvendor = dev->descriptor.idVendor;
aiptek->dev.idproduct = dev->descriptor.idProduct;
aiptek->dev.idversion = dev->descriptor.bcdDevice;
aiptek->usbdev = dev;
endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0;
FILL_INT_URB(aiptek->irq,
dev,
usb_rcvintpipe(dev, endpoint->bEndpointAddress),
aiptek->data,
aiptek->features->pktlen,
aiptek->features->irq,
aiptek,
endpoint->bInterval);
input_register_device(&aiptek->dev);
printk(KERN_INFO "input%d: %s on usb%d:%d.%d\n",
aiptek->dev.number, aiptek->features->name, dev->bus->busnum,
dev->devnum, ifnum);
return aiptek;
}
static void
aiptek_disconnect(struct usb_device *dev, void *ptr)
{
struct aiptek *aiptek = ptr;
usb_unlink_urb(aiptek->irq);
input_unregister_device(&aiptek->dev);
usb_free_urb(aiptek->irq);
kfree(aiptek);
}
static struct usb_driver aiptek_driver = {
name:"aiptek",
probe:aiptek_probe,
disconnect:aiptek_disconnect,
id_table:aiptek_ids,
};
static int __init
aiptek_init(void)
{
usb_register(&aiptek_driver);
info(DRIVER_VERSION " " DRIVER_AUTHOR);
info(DRIVER_DESC);
return 0;
}
static void __exit
aiptek_exit(void)
{
usb_deregister(&aiptek_driver);
}
module_init(aiptek_init);
module_exit(aiptek_exit);
......@@ -233,7 +233,7 @@ static int i2c_detect_tries = 5;
#define ov51x_mmx_available (0)
#endif
static __devinitdata struct usb_device_id device_table [] = {
static struct usb_device_id device_table [] = {
{ USB_DEVICE(VEND_OMNIVISION, PROD_OV511) },
{ USB_DEVICE(VEND_OMNIVISION, PROD_OV511PLUS) },
{ USB_DEVICE(VEND_OMNIVISION, PROD_OV518) },
......
......@@ -66,7 +66,7 @@
/* Function prototypes and driver templates */
/* hotplug device table support */
static __devinitdata struct usb_device_id pwc_device_table [] = {
static struct usb_device_id pwc_device_table [] = {
{ USB_DEVICE(0x0471, 0x0302) },
{ USB_DEVICE(0x0471, 0x0303) },
{ USB_DEVICE(0x0471, 0x0304) },
......
......@@ -29,7 +29,6 @@ static const char version[] = "0.23";
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/vmalloc.h>
......@@ -42,18 +41,12 @@ static const char version[] = "0.23";
#include <linux/wrapper.h>
#include <linux/mm.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
#define virt_to_page(arg) MAP_NR(arg)
#define vmalloc_32 vmalloc
#endif
#include "se401.h"
static int flickerless=0;
static int video_nr = -1;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 3, 0)
static __devinitdata struct usb_device_id device_table [] = {
static struct usb_device_id device_table [] = {
{ USB_DEVICE(0x03e8, 0x0004) },/* Endpoints/Aox SE401 */
{ USB_DEVICE(0x0471, 0x030b) },/* Philips PCVC665K */
{ USB_DEVICE(0x047d, 0x5001) },/* Kensington 67014 */
......@@ -63,7 +56,6 @@ static __devinitdata struct usb_device_id device_table [] = {
};
MODULE_DEVICE_TABLE(usb, device_table);
#endif
MODULE_AUTHOR("Jeroen Vreeken <pe1rxq@amsat.org>");
MODULE_DESCRIPTION("SE401 USB Camera Driver");
......@@ -1402,12 +1394,8 @@ static int se401_init(struct usb_se401 *se401)
return 0;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
static void* se401_probe(struct usb_device *dev, unsigned int ifnum)
#else
static void* __devinit se401_probe(struct usb_device *dev, unsigned int ifnum,
static void* se401_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
#endif
{
struct usb_interface_descriptor *interface;
struct usb_se401 *se401;
......@@ -1535,9 +1523,7 @@ static inline void usb_se401_remove_disconnected (struct usb_se401 *se401)
static struct usb_driver se401_driver = {
name: "se401",
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 3, 0)
id_table: device_table,
#endif
probe: se401_probe,
disconnect: se401_disconnect
};
......
......@@ -1449,7 +1449,7 @@ static struct video_device stv680_template = {
fops: &stv680_fops,
};
static void *__devinit stv680_probe (struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)
static void *stv680_probe (struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)
{
struct usb_interface_descriptor *interface;
struct usb_stv *stv680;
......
......@@ -45,7 +45,7 @@
/* fmt 4 */
#define STV_VIDEO_PALETTE VIDEO_PALETTE_RGB24
static __devinitdata struct usb_device_id device_table[] = {
static struct usb_device_id device_table[] = {
{USB_DEVICE (USB_PENCAM_VENDOR_ID, USB_PENCAM_PRODUCT_ID)},
{}
};
......
......@@ -787,7 +787,7 @@ static int vicam_init(struct usb_vicam *vicam)
return 1;
}
static void * __devinit vicam_probe(struct usb_device *udev, unsigned int ifnum,
static void *vicam_probe(struct usb_device *udev, unsigned int ifnum,
const struct usb_device_id *id)
{
struct usb_vicam *vicam;
......
......@@ -75,6 +75,7 @@
#define KAWETH_MTU 1514
#define KAWETH_BUF_SIZE 1664
#define KAWETH_TX_TIMEOUT (5 * HZ)
#define KAWETH_SCRATCH_SIZE 32
#define KAWETH_FIRMWARE_BUF_SIZE 4096
#define KAWETH_CONTROL_TIMEOUT (30 * HZ)
......@@ -220,7 +221,8 @@ struct kaweth_device
struct urb *tx_urb;
struct urb *irq_urb;
__u8 firmware_buf[KAWETH_FIRMWARE_BUF_SIZE];
__u8 *firmware_buf;
__u8 scratch[KAWETH_SCRATCH_SIZE];
__u8 tx_buf[KAWETH_BUF_SIZE];
__u8 rx_buf[KAWETH_BUF_SIZE];
__u8 intbuffer[INTBUFFERSIZE];
......@@ -312,7 +314,7 @@ static int kaweth_set_urb_size(struct kaweth_device *kaweth, __u16 urb_size)
USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
urb_size,
0,
(void *)&kaweth->firmware_buf,
(void *)&kaweth->scratch,
0,
KAWETH_CONTROL_TIMEOUT);
......@@ -334,7 +336,7 @@ static int kaweth_set_sofs_wait(struct kaweth_device *kaweth, __u16 sofs_wait)
USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
sofs_wait,
0,
(void *)&kaweth->firmware_buf,
(void *)&kaweth->scratch,
0,
KAWETH_CONTROL_TIMEOUT);
......@@ -357,7 +359,7 @@ static int kaweth_set_receive_filter(struct kaweth_device *kaweth,
USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
receive_filter,
0,
(void *)&kaweth->firmware_buf,
(void *)&kaweth->scratch,
0,
KAWETH_CONTROL_TIMEOUT);
......@@ -399,7 +401,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
0,
0,
(void *)&kaweth->firmware_buf,
(void *)kaweth->firmware_buf,
data_len,
KAWETH_CONTROL_TIMEOUT);
}
......@@ -427,7 +429,7 @@ static int kaweth_trigger_firmware(struct kaweth_device *kaweth,
USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
0,
0,
(void *)&kaweth->firmware_buf,
(void *)kaweth->firmware_buf,
8,
KAWETH_CONTROL_TIMEOUT);
}
......@@ -755,7 +757,7 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
packet_filter_bitmap,
0,
(void *)&kaweth->firmware_buf,
(void *)&kaweth->scratch,
0,
KAWETH_CONTROL_TIMEOUT);
......@@ -840,12 +842,14 @@ static void *kaweth_probe(
} else {
/* Download the firmware */
kaweth_info("Downloading firmware...");
kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
if ((result = kaweth_download_firmware(kaweth,
kaweth_new_code,
len_kaweth_new_code,
100,
2)) < 0) {
kaweth_err("Error downloading firmware (%d)", result);
free_page((unsigned long)kaweth->firmware_buf);
kfree(kaweth);
return NULL;
}
......@@ -856,6 +860,7 @@ static void *kaweth_probe(
100,
3)) < 0) {
kaweth_err("Error downloading firmware fix (%d)", result);
free_page((unsigned long)kaweth->firmware_buf);
kfree(kaweth);
return NULL;
}
......@@ -866,6 +871,7 @@ static void *kaweth_probe(
126,
2)) < 0) {
kaweth_err("Error downloading trigger code (%d)", result);
free_page((unsigned long)kaweth->firmware_buf);
kfree(kaweth);
return NULL;
}
......@@ -876,6 +882,7 @@ static void *kaweth_probe(
126,
3)) < 0) {
kaweth_err("Error downloading trigger code fix (%d)", result);
free_page((unsigned long)kaweth->firmware_buf);
kfree(kaweth);
return NULL;
}
......@@ -883,12 +890,14 @@ static void *kaweth_probe(
if ((result = kaweth_trigger_firmware(kaweth, 126)) < 0) {
kaweth_err("Error triggering firmware (%d)", result);
free_page((unsigned long)kaweth->firmware_buf);
kfree(kaweth);
return NULL;
}
/* Device will now disappear for a moment... */
kaweth_info("Firmware loaded. I'll be back...");
free_page((unsigned long)kaweth->firmware_buf);
kfree(kaweth);
return NULL;
}
......
......@@ -103,7 +103,7 @@ static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file,
static void belkin_sa_break_ctl (struct usb_serial_port *port, int break_state );
static __devinitdata struct usb_device_id id_table_combined [] = {
static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(BELKIN_SA_VID, BELKIN_SA_PID) },
{ USB_DEVICE(BELKIN_OLD_VID, BELKIN_OLD_PID) },
{ USB_DEVICE(PERACOM_VID, PERACOM_PID) },
......@@ -129,7 +129,7 @@ static struct usb_serial_device_type belkin_device = {
ioctl: belkin_sa_ioctl,
set_termios: belkin_sa_set_termios,
break_ctl: belkin_sa_break_ctl,
startup: belkin_sa_startup,
attach: belkin_sa_startup,
shutdown: belkin_sa_shutdown,
};
......
......@@ -66,7 +66,7 @@ static void cyberjack_read_int_callback( struct urb *urb );
static void cyberjack_read_bulk_callback (struct urb *urb);
static void cyberjack_write_bulk_callback (struct urb *urb);
static __devinitdata struct usb_device_id id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(CYBERJACK_VENDOR_ID, CYBERJACK_PRODUCT_ID) },
{ } /* Terminating entry */
};
......@@ -81,7 +81,7 @@ static struct usb_serial_device_type cyberjack_device = {
num_bulk_in: 1,
num_bulk_out: 1,
num_ports: 1,
startup: cyberjack_startup,
attach: cyberjack_startup,
shutdown: cyberjack_shutdown,
open: cyberjack_open,
close: cyberjack_close,
......
......@@ -483,12 +483,12 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id id_table_2 [] = {
static struct usb_device_id id_table_2 [] = {
{ USB_DEVICE(DIGI_VENDOR_ID, DIGI_2_ID) },
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id id_table_4 [] = {
static struct usb_device_id id_table_4 [] = {
{ USB_DEVICE(DIGI_VENDOR_ID, DIGI_4_ID) },
{ } /* Terminating entry */
};
......@@ -517,7 +517,7 @@ static struct usb_serial_device_type digi_acceleport_2_device = {
ioctl: digi_ioctl,
set_termios: digi_set_termios,
break_ctl: digi_break_ctl,
startup: digi_startup,
attach: digi_startup,
shutdown: digi_shutdown,
};
......@@ -541,7 +541,7 @@ static struct usb_serial_device_type digi_acceleport_4_device = {
ioctl: digi_ioctl,
set_termios: digi_set_termios,
break_ctl: digi_break_ctl,
startup: digi_startup,
attach: digi_startup,
shutdown: digi_shutdown,
};
......
......@@ -103,7 +103,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct termios *ol
static void empeg_write_bulk_callback (struct urb *urb);
static void empeg_read_bulk_callback (struct urb *urb);
static __devinitdata struct usb_device_id id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(EMPEG_VENDOR_ID, EMPEG_PRODUCT_ID) },
{ } /* Terminating entry */
};
......@@ -122,7 +122,7 @@ static struct usb_serial_device_type empeg_device = {
close: empeg_close,
throttle: empeg_throttle,
unthrottle: empeg_unthrottle,
startup: empeg_startup,
attach: empeg_startup,
shutdown: empeg_shutdown,
ioctl: empeg_ioctl,
set_termios: empeg_set_termios,
......
......@@ -120,7 +120,7 @@
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>"
#define DRIVER_DESC "USB FTDI RS232 Converters Driver"
static __devinitdata struct usb_device_id id_table_sio [] = {
static struct usb_device_id id_table_sio [] = {
{ USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
{ } /* Terminating entry */
};
......@@ -133,7 +133,7 @@ static __devinitdata struct usb_device_id id_table_sio [] = {
*/
static __devinitdata struct usb_device_id id_table_8U232AM [] = {
static struct usb_device_id id_table_8U232AM [] = {
{ USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
{ USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) },
{ } /* Terminating entry */
......@@ -189,7 +189,7 @@ static struct usb_serial_device_type ftdi_sio_device = {
ioctl: ftdi_sio_ioctl,
set_termios: ftdi_sio_set_termios,
break_ctl: ftdi_sio_break_ctl,
startup: ftdi_sio_startup,
attach: ftdi_sio_startup,
shutdown: ftdi_sio_shutdown,
};
......@@ -210,7 +210,7 @@ static struct usb_serial_device_type ftdi_8U232AM_device = {
ioctl: ftdi_sio_ioctl,
set_termios: ftdi_sio_set_termios,
break_ctl: ftdi_sio_break_ctl,
startup: ftdi_8U232AM_startup,
attach: ftdi_8U232AM_startup,
shutdown: ftdi_sio_shutdown,
};
......
......@@ -14,12 +14,12 @@
#ifndef IO_TABLES_H
#define IO_TABLES_H
static __devinitdata struct usb_device_id edgeport_1port_id_table [] = {
static struct usb_device_id edgeport_1port_id_table [] = {
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_PARALLEL_PORT) },
{ }
};
static __devinitdata struct usb_device_id edgeport_2port_id_table [] = {
static struct usb_device_id edgeport_2port_id_table [] = {
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_2) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_2I) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_421) },
......@@ -33,7 +33,7 @@ static __devinitdata struct usb_device_id edgeport_2port_id_table [] = {
{ }
};
static __devinitdata struct usb_device_id edgeport_4port_id_table [] = {
static struct usb_device_id edgeport_4port_id_table [] = {
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_4) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_RAPIDPORT_4) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_4T) },
......@@ -50,7 +50,7 @@ static __devinitdata struct usb_device_id edgeport_4port_id_table [] = {
{ }
};
static __devinitdata struct usb_device_id edgeport_8port_id_table [] = {
static struct usb_device_id edgeport_8port_id_table [] = {
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_8) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_16_DUAL_CPU) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_8I) },
......@@ -109,7 +109,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
close: edge_close,
throttle: edge_throttle,
unthrottle: edge_unthrottle,
startup: edge_startup,
attach: edge_startup,
shutdown: edge_shutdown,
ioctl: edge_ioctl,
set_termios: edge_set_termios,
......@@ -131,7 +131,7 @@ static struct usb_serial_device_type edgeport_2port_device = {
close: edge_close,
throttle: edge_throttle,
unthrottle: edge_unthrottle,
startup: edge_startup,
attach: edge_startup,
shutdown: edge_shutdown,
ioctl: edge_ioctl,
set_termios: edge_set_termios,
......@@ -153,7 +153,7 @@ static struct usb_serial_device_type edgeport_4port_device = {
close: edge_close,
throttle: edge_throttle,
unthrottle: edge_unthrottle,
startup: edge_startup,
attach: edge_startup,
shutdown: edge_shutdown,
ioctl: edge_ioctl,
set_termios: edge_set_termios,
......@@ -175,7 +175,7 @@ static struct usb_serial_device_type edgeport_8port_device = {
close: edge_close,
throttle: edge_throttle,
unthrottle: edge_unthrottle,
startup: edge_startup,
attach: edge_startup,
shutdown: edge_shutdown,
ioctl: edge_ioctl,
set_termios: edge_set_termios,
......
......@@ -78,7 +78,7 @@ static int ipaq_chars_in_buffer(struct usb_serial_port *port);
static void ipaq_destroy_lists(struct usb_serial_port *port);
static __devinitdata struct usb_device_id ipaq_id_table [] = {
static struct usb_device_id ipaq_id_table [] = {
{ USB_DEVICE(COMPAQ_VENDOR_ID, COMPAQ_IPAQ_ID) },
{ USB_DEVICE(HP_VENDOR_ID, HP_JORNADA_548_ID) },
{ USB_DEVICE(HP_VENDOR_ID, HP_JORNADA_568_ID) },
......@@ -99,7 +99,7 @@ struct usb_serial_device_type ipaq_device = {
num_ports: 1,
open: ipaq_open,
close: ipaq_close,
startup: ipaq_startup,
attach: ipaq_startup,
shutdown: ipaq_shutdown,
write: ipaq_write,
write_room: ipaq_write_room,
......
......@@ -119,7 +119,7 @@ static u8 ir_baud = 0;
static u8 ir_xbof = 0;
static u8 ir_add_bof = 0;
static __devinitdata struct usb_device_id id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x050f, 0x0180) }, /* KC Technology, KC-180 */
{ USB_DEVICE(0x08e9, 0x0100) }, /* XTNDAccess */
{ USB_DEVICE(0x09c4, 0x0011) }, /* ACTiSys ACT-IR2000U */
......@@ -139,7 +139,7 @@ struct usb_serial_device_type ir_device = {
num_bulk_out: 1,
num_ports: 1,
set_termios: ir_set_termios,
startup: ir_startup,
attach: ir_startup,
open: ir_open,
close: ir_close,
write: ir_write,
......
......@@ -435,7 +435,7 @@ static __devinitdata struct usb_device_id keyspan_ids_combined[] = {
MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
/* usb_device_id table for the pre-firmware download keyspan devices */
static __devinitdata struct usb_device_id keyspan_pre_ids[] = {
static struct usb_device_id keyspan_pre_ids[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
......@@ -449,7 +449,7 @@ static __devinitdata struct usb_device_id keyspan_pre_ids[] = {
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id keyspan_1port_ids[] = {
static struct usb_device_id keyspan_1port_ids[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
......@@ -458,14 +458,14 @@ static __devinitdata struct usb_device_id keyspan_1port_ids[] = {
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id keyspan_2port_ids[] = {
static struct usb_device_id keyspan_2port_ids[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id keyspan_4port_ids[] = {
static struct usb_device_id keyspan_4port_ids[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
{ } /* Terminating entry */
};
......@@ -479,7 +479,7 @@ static struct usb_serial_device_type keyspan_pre_device = {
num_bulk_in: NUM_DONT_CARE,
num_bulk_out: NUM_DONT_CARE,
num_ports: 1,
startup: keyspan_fake_startup,
attach: keyspan_fake_startup,
};
static struct usb_serial_device_type keyspan_1port_device = {
......@@ -500,7 +500,7 @@ static struct usb_serial_device_type keyspan_1port_device = {
ioctl: keyspan_ioctl,
set_termios: keyspan_set_termios,
break_ctl: keyspan_break_ctl,
startup: keyspan_startup,
attach: keyspan_startup,
shutdown: keyspan_shutdown,
};
......@@ -521,7 +521,7 @@ static struct usb_serial_device_type keyspan_2port_device = {
unthrottle: keyspan_rx_unthrottle,
ioctl: keyspan_ioctl,
set_termios: keyspan_set_termios,
startup: keyspan_startup,
attach: keyspan_startup,
shutdown: keyspan_shutdown,
};
......@@ -543,7 +543,7 @@ static struct usb_serial_device_type keyspan_4port_device = {
ioctl: keyspan_ioctl,
set_termios: keyspan_set_termios,
break_ctl: keyspan_break_ctl,
startup: keyspan_startup,
attach: keyspan_startup,
shutdown: keyspan_shutdown,
};
......
......@@ -154,20 +154,20 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
MODULE_DEVICE_TABLE (usb, id_table_combined);
static __devinitdata struct usb_device_id id_table_std [] = {
static struct usb_device_id id_table_std [] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
{ } /* Terminating entry */
};
#ifdef KEYSPAN
static __devinitdata struct usb_device_id id_table_fake [] = {
static struct usb_device_id id_table_fake [] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
{ } /* Terminating entry */
};
#endif
#ifdef XIRCOM
static __devinitdata struct usb_device_id id_table_fake_xircom [] = {
static struct usb_device_id id_table_fake_xircom [] = {
{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
{ USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
{ }
......@@ -811,7 +811,7 @@ static struct usb_serial_device_type keyspan_pda_fake_device = {
num_bulk_in: NUM_DONT_CARE,
num_bulk_out: NUM_DONT_CARE,
num_ports: 1,
startup: keyspan_pda_fake_startup,
attach: keyspan_pda_fake_startup,
};
#endif
......@@ -824,7 +824,7 @@ static struct usb_serial_device_type xircom_pgs_fake_device = {
num_bulk_in: NUM_DONT_CARE,
num_bulk_out: NUM_DONT_CARE,
num_ports: 1,
startup: keyspan_pda_fake_startup,
attach: keyspan_pda_fake_startup,
};
#endif
......@@ -848,7 +848,7 @@ static struct usb_serial_device_type keyspan_pda_device = {
ioctl: keyspan_pda_ioctl,
set_termios: keyspan_pda_set_termios,
break_ctl: keyspan_pda_break_ctl,
startup: keyspan_pda_startup,
attach: keyspan_pda_startup,
shutdown: keyspan_pda_shutdown,
};
......
......@@ -109,7 +109,7 @@ static void klsi_105_break_ctl (struct usb_serial_port *port,
/*
* All of the device info needed for the KLSI converters.
*/
static __devinitdata struct usb_device_id id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(PALMCONNECT_VID, PALMCONNECT_PID) },
{ USB_DEVICE(KLSI_VID, KLSI_KL5KUSB105D_PID) },
{ } /* Terminating entry */
......@@ -136,7 +136,7 @@ static struct usb_serial_device_type kl5kusb105d_device = {
ioctl: klsi_105_ioctl,
set_termios: klsi_105_set_termios,
/*break_ctl: klsi_105_break_ctl,*/
startup: klsi_105_startup,
attach: klsi_105_startup,
shutdown: klsi_105_shutdown,
throttle: klsi_105_throttle,
unthrottle: klsi_105_unthrottle,
......
......@@ -129,7 +129,7 @@ static void mct_u232_break_ctl (struct usb_serial_port *port,
/*
* All of the device info needed for the MCT USB-RS232 converter.
*/
static __devinitdata struct usb_device_id id_table_combined [] = {
static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(MCT_U232_VID, MCT_U232_PID) },
{ USB_DEVICE(MCT_U232_VID, MCT_U232_SITECOM_PID) },
{ USB_DEVICE(MCT_U232_VID, MCT_U232_DU_H3SP_PID) },
......@@ -158,7 +158,7 @@ static struct usb_serial_device_type mct_u232_device = {
ioctl: mct_u232_ioctl,
set_termios: mct_u232_set_termios,
break_ctl: mct_u232_break_ctl,
startup: mct_u232_startup,
attach: mct_u232_startup,
shutdown: mct_u232_shutdown,
};
......
......@@ -76,7 +76,7 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const u
static int omninet_write_room (struct usb_serial_port *port);
static void omninet_shutdown (struct usb_serial *serial);
static __devinitdata struct usb_device_id id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) },
{ } /* Terminating entry */
};
......
......@@ -65,7 +65,7 @@
static __devinitdata struct usb_device_id id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) },
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
......@@ -134,7 +134,7 @@ static struct usb_serial_device_type pl2303_device = {
read_bulk_callback: pl2303_read_bulk_callback,
read_int_callback: pl2303_read_int_callback,
write_bulk_callback: pl2303_write_bulk_callback,
startup: pl2303_startup,
attach: pl2303_startup,
shutdown: pl2303_shutdown,
};
......
......@@ -140,7 +140,7 @@ MODULE_PARM_DESC (padded, "Pad to full wMaxPacketSize On/Off");
bInterfaceClass: (ic), \
bInterfaceSubClass: (isc),
static __devinitdata struct usb_device_id id_table[] = {
static struct usb_device_id id_table[] = {
{MY_USB_DEVICE (0x49f, 0xffff, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, // Itsy
{MY_USB_DEVICE (0x3f0, 0x2101, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, // Calypso
{MY_USB_DEVICE (0x4dd, 0x8001, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, // Iris
......@@ -409,7 +409,7 @@ static struct usb_serial_device_type safe_device = {
write: safe_write,
write_room: safe_write_room,
read_bulk_callback: safe_read_bulk_callback,
startup: safe_startup,
attach: safe_startup,
};
static int __init safe_init (void)
......
......@@ -130,9 +130,20 @@ struct usb_serial {
* @num_bulk_in: the number of bulk in endpoints this device will have.
* @num_bulk_out: the number of bulk out endpoints this device will have.
* @num_ports: the number of different ports this device will have.
* @startup: pointer to the driver's startup function. This will be called
* when the driver is inserted into the system. Return 0 to continue
* on with the initialization sequence. Anything else will abort it.
* @calc_num_ports: pointer to a function to determine how many ports this
* device has dynamically. It will be called after the probe()
* callback is called, but before attach()
* @probe: pointer to the driver's probe function.
* This will be called when the device is inserted into the system,
* but before the device has been fully initialized by the usb_serial
* subsystem. Use this function to download any firmware to the device,
* or any other early initialization that might be needed.
* Return 0 to continue on with the initialization sequence. Anything
* else will abort it.
* @attach: pointer to the driver's attach function.
* This will be called when the struct usb_serial structure is fully set
* set up. Do any local initialization of the device, or any private
* memory structure allocation at this point in time.
* @shutdown: pointer to the driver's shutdown function. This will be
* called when the device is removed from the system.
*
......@@ -153,7 +164,10 @@ struct usb_serial_device_type {
struct list_head driver_list;
int (*startup) (struct usb_serial *serial);
int (*probe) (struct usb_serial *serial);
int (*attach) (struct usb_serial *serial);
int (*calc_num_ports) (struct usb_serial *serial);
void (*shutdown) (struct usb_serial *serial);
/* serial function calls */
......
......@@ -433,9 +433,8 @@ static struct usb_serial *get_serial_by_minor (unsigned int minor)
return serial_table[minor];
}
static struct usb_serial *get_free_serial (int num_ports, unsigned int *minor)
static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_ports, unsigned int *minor)
{
struct usb_serial *serial = NULL;
unsigned int i, j;
int good_spot;
......@@ -453,11 +452,14 @@ static struct usb_serial *get_free_serial (int num_ports, unsigned int *minor)
if (good_spot == 0)
continue;
if (!(serial = kmalloc(sizeof(struct usb_serial), GFP_KERNEL))) {
if (!serial) {
serial = kmalloc(sizeof(*serial), GFP_KERNEL);
if (!serial) {
err(__FUNCTION__ " - Out of memory");
return NULL;
}
memset(serial, 0, sizeof(struct usb_serial));
memset(serial, 0, sizeof(*serial));
}
serial->magic = USB_SERIAL_MAGIC;
serial_table[i] = serial;
*minor = i;
......@@ -1140,6 +1142,27 @@ static void port_softint(void *private)
wake_up_interruptible(&tty->write_wait);
}
static struct usb_serial * create_serial (struct usb_device *dev,
struct usb_interface *interface,
struct usb_serial_device_type *type)
{
struct usb_serial *serial;
serial = kmalloc (sizeof (*serial), GFP_KERNEL);
if (!serial) {
err ("%s - out of memory", __FUNCTION__);
return NULL;
}
memset (serial, 0, sizeof(*serial));
serial->dev = dev;
serial->type = type;
serial->interface = interface;
serial->vendor = dev->descriptor.idVendor;
serial->product = dev->descriptor.idProduct;
return serial;
}
static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
......@@ -1161,7 +1184,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
int num_interrupt_in = 0;
int num_bulk_in = 0;
int num_bulk_out = 0;
int num_ports;
int num_ports = 0;
int max_endpoints;
const struct usb_device_id *id_pattern = NULL;
......@@ -1184,6 +1207,27 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
return(NULL);
}
/* if this device type has a probe function, call it */
if (type->probe) {
serial = create_serial (dev, interface, type);
if (!serial) {
err ("%s - out of memory", __FUNCTION__);
return NULL;
}
if (type->owner)
__MOD_INC_USE_COUNT(type->owner);
retval = type->probe (serial);
if (type->owner)
__MOD_DEC_USE_COUNT(type->owner);
if (retval < 0) {
dbg ("sub driver rejected device");
kfree (serial);
return NULL;
}
}
/* descriptor matches, let's find the endpoints needed */
/* check out the endpoints */
iface_desc = &interface->altsetting[0];
......@@ -1251,11 +1295,30 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
err("Generic device with no bulk out, not allowed.");
return NULL;
}
} else
}
#endif
if (!num_ports) {
/* if this device type has a calc_num_ports function, call it */
if (type->calc_num_ports) {
if (!serial) {
serial = create_serial (dev, interface, type);
if (!serial) {
err ("%s - out of memory", __FUNCTION__);
return NULL;
}
}
if (type->owner)
__MOD_INC_USE_COUNT(type->owner);
num_ports = type->calc_num_ports (serial);
if (type->owner)
__MOD_DEC_USE_COUNT(type->owner);
}
if (!num_ports)
num_ports = type->num_ports;
}
serial = get_free_serial (num_ports, &minor);
serial = get_free_serial (serial, num_ports, &minor);
if (serial == NULL) {
err("No more free serial devices");
return NULL;
......@@ -1272,17 +1335,6 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
serial->vendor = dev->descriptor.idVendor;
serial->product = dev->descriptor.idProduct;
/* if this device type has a startup function, call it */
if (type->startup) {
if (type->owner)
__MOD_INC_USE_COUNT(type->owner);
retval = type->startup (serial);
if (type->owner)
__MOD_DEC_USE_COUNT(type->owner);
if (retval)
goto probe_error;
}
/* set up the endpoint information */
for (i = 0; i < num_bulk_in; ++i) {
endpoint = bulk_in_endpoint[i];
......@@ -1374,6 +1426,22 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
init_MUTEX (&port->sem);
}
/* if this device type has an attach function, call it */
if (type->attach) {
if (type->owner)
__MOD_INC_USE_COUNT(type->owner);
retval = type->attach (serial);
if (type->owner)
__MOD_DEC_USE_COUNT(type->owner);
if (retval < 0)
goto probe_error;
if (retval > 0) {
/* quietly accept this device, but don't bind to a serial port
* as it's about to disappear */
return serial;
}
}
/* initialize the devfs nodes for this device and let the user know what ports we are bound to */
for (i = 0; i < serial->num_ports; ++i) {
tty_register_devfs (&serial_tty_driver, 0, serial->port[i].number);
......
......@@ -168,7 +168,8 @@ static int visor_write_room (struct usb_serial_port *port);
static int visor_chars_in_buffer (struct usb_serial_port *port);
static void visor_throttle (struct usb_serial_port *port);
static void visor_unthrottle (struct usb_serial_port *port);
static int visor_startup (struct usb_serial *serial);
static int visor_probe (struct usb_serial *serial);
static int visor_calc_num_ports(struct usb_serial *serial);
static void visor_shutdown (struct usb_serial *serial);
static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
static void visor_set_termios (struct usb_serial_port *port, struct termios *old_termios);
......@@ -177,7 +178,7 @@ static void visor_read_bulk_callback (struct urb *urb);
static int clie_3_5_startup (struct usb_serial *serial);
static __devinitdata struct usb_device_id combined_id_table [] = {
static struct usb_device_id id_table [] = {
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M500_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M505_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M515_ID) },
......@@ -191,12 +192,12 @@ static __devinitdata struct usb_device_id combined_id_table [] = {
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id clie_id_3_5_table [] = {
static struct usb_device_id clie_id_3_5_table [] = {
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_3_5_ID) },
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id id_table [] = {
static __devinitdata struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M500_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M505_ID) },
......@@ -211,7 +212,7 @@ static __devinitdata struct usb_device_id id_table [] = {
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, id_table);
MODULE_DEVICE_TABLE (usb, id_table_combined);
......@@ -219,7 +220,7 @@ MODULE_DEVICE_TABLE (usb, id_table);
static struct usb_serial_device_type handspring_device = {
owner: THIS_MODULE,
name: "Handspring Visor / Palm 4.0 / Clié 4.x",
id_table: combined_id_table,
id_table: id_table,
num_interrupt_in: 0,
num_bulk_in: 2,
num_bulk_out: 2,
......@@ -228,7 +229,8 @@ static struct usb_serial_device_type handspring_device = {
close: visor_close,
throttle: visor_throttle,
unthrottle: visor_unthrottle,
startup: visor_startup,
probe: visor_probe,
calc_num_ports: visor_calc_num_ports,
shutdown: visor_shutdown,
ioctl: visor_ioctl,
set_termios: visor_set_termios,
......@@ -252,7 +254,7 @@ static struct usb_serial_device_type clie_3_5_device = {
close: visor_close,
throttle: visor_throttle,
unthrottle: visor_unthrottle,
startup: clie_3_5_startup,
attach: clie_3_5_startup,
ioctl: visor_ioctl,
set_termios: visor_set_termios,
write: visor_write,
......@@ -531,11 +533,11 @@ static void visor_unthrottle (struct usb_serial_port *port)
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
}
static int visor_startup (struct usb_serial *serial)
static int visor_probe (struct usb_serial *serial)
{
int response;
int i;
int num_ports;
unsigned char *transfer_buffer = kmalloc (256, GFP_KERNEL);
if (!transfer_buffer) {
......@@ -558,8 +560,9 @@ static int visor_startup (struct usb_serial *serial)
char *string;
le16_to_cpus(&connection_info->num_ports);
num_ports = connection_info->num_ports;
info("%s: Number of ports: %d", serial->type->name, connection_info->num_ports);
for (i = 0; i < connection_info->num_ports; ++i) {
for (i = 0; i < num_ports; ++i) {
switch (connection_info->connections[i].port_function_id) {
case VISOR_FUNCTION_GENERIC:
string = "Generic";
......@@ -580,7 +583,10 @@ static int visor_startup (struct usb_serial *serial)
string = "unknown";
break;
}
info("%s: port %d, is for %s use and is bound to ttyUSB%d", serial->type->name, connection_info->connections[i].port, string, serial->minor + i);
info("%s: port %d, is for %s use", serial->type->name,
connection_info->connections[i].port, string);
/* save off our num_ports info so that we can use it in the calc_num_ports call */
serial->private = (void *)num_ports;
}
}
......@@ -621,6 +627,17 @@ static int visor_startup (struct usb_serial *serial)
return 0;
}
static int visor_calc_num_ports (struct usb_serial *serial)
{
int num_ports = 0;
if (serial->private) {
num_ports = (int)serial->private;
serial->private = NULL;
}
return num_ports;
}
static int clie_3_5_startup (struct usb_serial *serial)
{
int result;
......
......@@ -100,12 +100,12 @@
separate ID tables, and then a third table that combines them
just for the purpose of exporting the autoloading information.
*/
static __devinitdata struct usb_device_id id_table_std [] = {
static struct usb_device_id id_table_std [] = {
{ USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_WHITE_HEAT_ID) },
{ } /* Terminating entry */
};
static __devinitdata struct usb_device_id id_table_prerenumeration [] = {
static struct usb_device_id id_table_prerenumeration [] = {
{ USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_FAKE_WHITE_HEAT_ID) },
{ } /* Terminating entry */
};
......@@ -125,9 +125,9 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file,
static void whiteheat_set_termios (struct usb_serial_port *port, struct termios * old);
static void whiteheat_throttle (struct usb_serial_port *port);
static void whiteheat_unthrottle (struct usb_serial_port *port);
static int whiteheat_fake_startup (struct usb_serial *serial);
static int whiteheat_real_startup (struct usb_serial *serial);
static void whiteheat_real_shutdown (struct usb_serial *serial);
static int whiteheat_firmware_download (struct usb_serial *serial);
static int whiteheat_attach (struct usb_serial *serial);
static void whiteheat_shutdown (struct usb_serial *serial);
static struct usb_serial_device_type whiteheat_fake_device = {
owner: THIS_MODULE,
......@@ -137,7 +137,7 @@ static struct usb_serial_device_type whiteheat_fake_device = {
num_bulk_in: NUM_DONT_CARE,
num_bulk_out: NUM_DONT_CARE,
num_ports: 1,
startup: whiteheat_fake_startup,
probe: whiteheat_firmware_download,
};
static struct usb_serial_device_type whiteheat_device = {
......@@ -154,8 +154,8 @@ static struct usb_serial_device_type whiteheat_device = {
unthrottle: whiteheat_unthrottle,
ioctl: whiteheat_ioctl,
set_termios: whiteheat_set_termios,
startup: whiteheat_real_startup,
shutdown: whiteheat_real_shutdown,
attach: whiteheat_attach,
shutdown: whiteheat_shutdown,
};
struct whiteheat_private {
......@@ -504,7 +504,7 @@ static void whiteheat_unthrottle (struct usb_serial_port *port)
- device renumerated itself and comes up as new device id with all
firmware download completed.
*/
static int whiteheat_fake_startup (struct usb_serial *serial)
static int whiteheat_firmware_download (struct usb_serial *serial)
{
int response;
const struct whiteheat_hex_record *record;
......@@ -518,8 +518,8 @@ static int whiteheat_fake_startup (struct usb_serial *serial)
response = ezusb_writememory (serial, record->address,
(unsigned char *)record->data, record->data_size, 0xa0);
if (response < 0) {
err(__FUNCTION__ " - ezusb_writememory failed for loader (%d %04X %p %d)",
response, record->address, record->data, record->data_size);
err("%s - ezusb_writememory failed for loader (%d %04X %p %d)",
__FUNCTION__, response, record->address, record->data, record->data_size);
break;
}
++record;
......@@ -535,8 +535,8 @@ static int whiteheat_fake_startup (struct usb_serial *serial)
response = ezusb_writememory (serial, record->address,
(unsigned char *)record->data, record->data_size, 0xa3);
if (response < 0) {
err(__FUNCTION__ " - ezusb_writememory failed for first firmware step (%d %04X %p %d)",
response, record->address, record->data, record->data_size);
err("%s - ezusb_writememory failed for first firmware step (%d %04X %p %d)",
__FUNCTION__, response, record->address, record->data, record->data_size);
break;
}
++record;
......@@ -549,8 +549,8 @@ static int whiteheat_fake_startup (struct usb_serial *serial)
response = ezusb_writememory (serial, record->address,
(unsigned char *)record->data, record->data_size, 0xa0);
if (response < 0) {
err(__FUNCTION__" - ezusb_writememory failed for second firmware step (%d %04X %p %d)",
response, record->address, record->data, record->data_size);
err("%s - ezusb_writememory failed for second firmware step (%d %04X %p %d)",
__FUNCTION__, response, record->address, record->data, record->data_size);
break;
}
++record;
......@@ -563,7 +563,7 @@ static int whiteheat_fake_startup (struct usb_serial *serial)
}
static int whiteheat_real_startup (struct usb_serial *serial)
static int whiteheat_attach (struct usb_serial *serial)
{
struct whiteheat_hw_info *hw_info;
int pipe;
......@@ -622,7 +622,7 @@ static int whiteheat_real_startup (struct usb_serial *serial)
return 0;
}
static void whiteheat_real_shutdown (struct usb_serial *serial)
static void whiteheat_shutdown (struct usb_serial *serial)
{
struct usb_serial_port *command_port;
......
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