Commit c5b7c7c3 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

[PATCH] drivers/usb/input: convert to dynamic input_dev allocation

Input: convert drivers/iusb/input to dynamic input_dev allocation

This is required for input_dev sysfs integration
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3c42f0c3
......@@ -53,7 +53,7 @@ struct usb_acecad {
char name[128];
char phys[64];
struct usb_device *usbdev;
struct input_dev dev;
struct input_dev *input;
struct urb *irq;
signed char *data;
......@@ -64,7 +64,7 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs)
{
struct usb_acecad *acecad = urb->context;
unsigned char *data = acecad->data;
struct input_dev *dev = &acecad->dev;
struct input_dev *dev = acecad->input;
int prox, status;
switch (urb->status) {
......@@ -135,8 +135,8 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
struct usb_host_interface *interface = intf->cur_altsetting;
struct usb_endpoint_descriptor *endpoint;
struct usb_acecad *acecad;
struct input_dev *input_dev;
int pipe, maxp;
char path[64];
if (interface->desc.bNumEndpoints != 1)
return -ENODEV;
......@@ -153,8 +153,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL);
if (!acecad)
return -ENOMEM;
input_dev = input_allocate_device();
if (!acecad || !input_dev)
goto fail1;
acecad->data = usb_buffer_alloc(dev, 8, SLAB_KERNEL, &acecad->data_dma);
if (!acecad->data)
......@@ -164,6 +165,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
if (!acecad->irq)
goto fail2;
acecad->usbdev = dev;
acecad->input = input_dev;
if (dev->manufacturer)
strlcpy(acecad->name, dev->manufacturer, sizeof(acecad->name));
......@@ -173,48 +177,48 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
strlcat(acecad->name, dev->product, sizeof(acecad->name));
}
usb_make_path(dev, path, sizeof(path));
snprintf(acecad->phys, sizeof(acecad->phys), "%s/input0", path);
usb_make_path(dev, acecad->phys, sizeof(acecad->phys));
strlcat(acecad->phys, "/input0", sizeof(acecad->phys));
acecad->usbdev = dev;
input_dev->name = acecad->name;
input_dev->phys = acecad->phys;
usb_to_input_id(dev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = acecad;
acecad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
acecad->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
acecad->dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
acecad->dev.keybit[LONG(BTN_DIGI)] = BIT(BTN_TOOL_PEN) |BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2);
input_dev->open = usb_acecad_open;
input_dev->close = usb_acecad_close;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
input_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
input_dev->keybit[LONG(BTN_DIGI)] = BIT(BTN_TOOL_PEN) |BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2);
switch (id->driver_info) {
case 0:
acecad->dev.absmax[ABS_X] = 5000;
acecad->dev.absmax[ABS_Y] = 3750;
acecad->dev.absmax[ABS_PRESSURE] = 512;
input_dev->absmax[ABS_X] = 5000;
input_dev->absmax[ABS_Y] = 3750;
input_dev->absmax[ABS_PRESSURE] = 512;
if (!strlen(acecad->name))
snprintf(acecad->name, sizeof(acecad->name),
"USB Acecad Flair Tablet %04x:%04x",
dev->descriptor.idVendor, dev->descriptor.idProduct);
le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct));
break;
case 1:
acecad->dev.absmax[ABS_X] = 3000;
acecad->dev.absmax[ABS_Y] = 2250;
acecad->dev.absmax[ABS_PRESSURE] = 1024;
input_dev->absmax[ABS_X] = 3000;
input_dev->absmax[ABS_Y] = 2250;
input_dev->absmax[ABS_PRESSURE] = 1024;
if (!strlen(acecad->name))
snprintf(acecad->name, sizeof(acecad->name),
"USB Acecad 302 Tablet %04x:%04x",
dev->descriptor.idVendor, dev->descriptor.idProduct);
le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct));
break;
}
acecad->dev.absfuzz[ABS_X] = 4;
acecad->dev.absfuzz[ABS_Y] = 4;
acecad->dev.private = acecad;
acecad->dev.open = usb_acecad_open;
acecad->dev.close = usb_acecad_close;
acecad->dev.name = acecad->name;
acecad->dev.phys = acecad->phys;
usb_to_input_id(dev, &acecad->dev.id);
acecad->dev.dev = &intf->dev;
input_dev->absfuzz[ABS_X] = 4;
input_dev->absfuzz[ABS_Y] = 4;
usb_fill_int_urb(acecad->irq, dev, pipe,
acecad->data, maxp > 8 ? 8 : maxp,
......@@ -222,17 +226,15 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
acecad->irq->transfer_dma = acecad->data_dma;
acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
input_register_device(&acecad->dev);
printk(KERN_INFO "input: %s with packet size %d on %s\n",
acecad->name, maxp, path);
input_register_device(acecad->input);
usb_set_intfdata(intf, acecad);
return 0;
fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma);
fail1: kfree(acecad);
fail1: input_free_device(input_dev);
kfree(acecad);
return -ENOMEM;
}
......@@ -243,7 +245,7 @@ static void usb_acecad_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL);
if (acecad) {
usb_kill_urb(acecad->irq);
input_unregister_device(&acecad->dev);
input_unregister_device(acecad->input);
usb_free_urb(acecad->irq);
usb_buffer_free(interface_to_usbdev(intf), 10, acecad->data, acecad->data_dma);
kfree(acecad);
......
This diff is collapsed.
......@@ -39,7 +39,7 @@
#define APPLE_VENDOR_ID 0x05AC
#define ATP_DEVICE(prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
.idVendor = APPLE_VENDOR_ID, \
......@@ -78,9 +78,9 @@ MODULE_DEVICE_TABLE (usb, atp_table);
* We try to keep the touchpad aspect ratio while still doing only simple
* arithmetics.
* The factors below give coordinates like:
* 0 <= x < 960 on 12" and 15" Powerbooks
* 0 <= x < 1600 on 17" Powerbooks
* 0 <= y < 646
* 0 <= x < 960 on 12" and 15" Powerbooks
* 0 <= x < 1600 on 17" Powerbooks
* 0 <= y < 646
*/
#define ATP_XFACT 64
#define ATP_YFACT 43
......@@ -93,11 +93,12 @@ MODULE_DEVICE_TABLE (usb, atp_table);
/* Structure to hold all of our device specific stuff */
struct atp {
char phys[64];
struct usb_device * udev; /* usb device */
struct urb * urb; /* usb request block */
signed char * data; /* transferred data */
int open; /* non-zero if opened */
struct input_dev input; /* input dev */
struct input_dev *input; /* input dev */
int valid; /* are the sensors valid ? */
int x_old; /* last reported x/y, */
int y_old; /* used for smoothing */
......@@ -114,11 +115,11 @@ struct atp {
int i; \
printk("appletouch: %s %lld", msg, (long long)jiffies); \
for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) \
printk(" %02x", tab[i]); \
printk("\n"); \
printk(" %02x", tab[i]); \
printk("\n"); \
}
#define dprintk(format, a...) \
#define dprintk(format, a...) \
do { \
if (debug) printk(format, ##a); \
} while (0)
......@@ -219,8 +220,8 @@ static void atp_complete(struct urb* urb, struct pt_regs* regs)
for (i = 16; i < ATP_XSENSORS; i++)
if (dev->xy_cur[i]) {
printk("appletouch: 17\" model detected.\n");
input_set_abs_params(&dev->input, ABS_X, 0,
(ATP_XSENSORS - 1) *
input_set_abs_params(dev->input, ABS_X, 0,
(ATP_XSENSORS - 1) *
ATP_XFACT - 1,
ATP_FUZZ, 0);
break;
......@@ -260,12 +261,12 @@ static void atp_complete(struct urb* urb, struct pt_regs* regs)
"Xz: %3d Yz: %3d\n",
x, y, x_z, y_z);
input_report_key(&dev->input, BTN_TOUCH, 1);
input_report_abs(&dev->input, ABS_X, x);
input_report_abs(&dev->input, ABS_Y, y);
input_report_abs(&dev->input, ABS_PRESSURE,
input_report_key(dev->input, BTN_TOUCH, 1);
input_report_abs(dev->input, ABS_X, x);
input_report_abs(dev->input, ABS_Y, y);
input_report_abs(dev->input, ABS_PRESSURE,
min(ATP_PRESSURE, x_z + y_z));
atp_report_fingers(&dev->input, max(x_f, y_f));
atp_report_fingers(dev->input, max(x_f, y_f));
}
dev->x_old = x;
dev->y_old = y;
......@@ -273,17 +274,17 @@ static void atp_complete(struct urb* urb, struct pt_regs* regs)
else if (!x && !y) {
dev->x_old = dev->y_old = -1;
input_report_key(&dev->input, BTN_TOUCH, 0);
input_report_abs(&dev->input, ABS_PRESSURE, 0);
atp_report_fingers(&dev->input, 0);
input_report_key(dev->input, BTN_TOUCH, 0);
input_report_abs(dev->input, ABS_PRESSURE, 0);
atp_report_fingers(dev->input, 0);
/* reset the accumulator on release */
memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
}
input_report_key(&dev->input, BTN_LEFT, !!dev->data[80]);
input_report_key(dev->input, BTN_LEFT, !!dev->data[80]);
input_sync(&dev->input);
input_sync(dev->input);
exit:
retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
......@@ -314,21 +315,14 @@ static void atp_close(struct input_dev *input)
static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id)
{
struct atp *dev = NULL;
struct atp *dev;
struct input_dev *input_dev;
struct usb_device *udev = interface_to_usbdev(iface);
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int int_in_endpointAddr = 0;
int i, retval = -ENOMEM;
/* allocate memory for our device state and initialize it */
dev = kmalloc(sizeof(struct atp), GFP_KERNEL);
if (dev == NULL) {
err("Out of memory");
goto err_kmalloc;
}
memset(dev, 0, sizeof(struct atp));
dev->udev = interface_to_usbdev(iface);
/* set up the endpoint information */
/* use only the first interrupt-in endpoint */
......@@ -345,70 +339,82 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
}
}
if (!int_in_endpointAddr) {
retval = -EIO;
err("Could not find int-in endpoint");
goto err_endpoint;
return -EIO;
}
/* save our data pointer in this interface device */
usb_set_intfdata(iface, dev);
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(struct atp), GFP_KERNEL);
input_dev = input_allocate_device();
if (!dev || !input_dev) {
err("Out of memory");
goto err_free_devs;
}
dev->udev = udev;
dev->input = input_dev;
dev->urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->urb) {
retval = -ENOMEM;
goto err_usballoc;
goto err_free_devs;
}
dev->data = usb_buffer_alloc(dev->udev, ATP_DATASIZE, GFP_KERNEL,
&dev->urb->transfer_dma);
if (!dev->data) {
retval = -ENOMEM;
goto err_usbbufalloc;
goto err_free_urb;
}
usb_fill_int_urb(dev->urb, dev->udev,
usb_rcvintpipe(dev->udev, int_in_endpointAddr),
usb_fill_int_urb(dev->urb, udev,
usb_rcvintpipe(udev, int_in_endpointAddr),
dev->data, ATP_DATASIZE, atp_complete, dev, 1);
init_input_dev(&dev->input);
dev->input.name = "appletouch";
dev->input.dev = &iface->dev;
dev->input.private = dev;
dev->input.open = atp_open;
dev->input.close = atp_close;
usb_make_path(udev, dev->phys, sizeof(dev->phys));
strlcat(dev->phys, "/input0", sizeof(dev->phys));
input_dev->name = "appletouch";
input_dev->phys = dev->phys;
usb_to_input_id(dev->udev, &input_dev->id);
input_dev->cdev.dev = &iface->dev;
usb_to_input_id(dev->udev, &dev->input.id);
input_dev->private = dev;
input_dev->open = atp_open;
input_dev->close = atp_close;
set_bit(EV_ABS, dev->input.evbit);
set_bit(EV_ABS, input_dev->evbit);
/*
* 12" and 15" Powerbooks only have 16 x sensors,
* 17" models are detected later.
*/
input_set_abs_params(&dev->input, ABS_X, 0,
input_set_abs_params(input_dev, ABS_X, 0,
(16 - 1) * ATP_XFACT - 1, ATP_FUZZ, 0);
input_set_abs_params(&dev->input, ABS_Y, 0,
input_set_abs_params(input_dev, ABS_Y, 0,
(ATP_YSENSORS - 1) * ATP_YFACT - 1, ATP_FUZZ, 0);
input_set_abs_params(&dev->input, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0);
input_set_abs_params(input_dev, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0);
set_bit(EV_KEY, dev->input.evbit);
set_bit(BTN_TOUCH, dev->input.keybit);
set_bit(BTN_TOOL_FINGER, dev->input.keybit);
set_bit(BTN_TOOL_DOUBLETAP, dev->input.keybit);
set_bit(BTN_TOOL_TRIPLETAP, dev->input.keybit);
set_bit(BTN_LEFT, dev->input.keybit);
set_bit(EV_KEY, input_dev->evbit);
set_bit(BTN_TOUCH, input_dev->keybit);
set_bit(BTN_TOOL_FINGER, input_dev->keybit);
set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
set_bit(BTN_LEFT, input_dev->keybit);
input_register_device(&dev->input);
input_register_device(dev->input);
printk(KERN_INFO "input: appletouch connected\n");
/* save our data pointer in this interface device */
usb_set_intfdata(iface, dev);
return 0;
err_usbbufalloc:
err_free_urb:
usb_free_urb(dev->urb);
err_usballoc:
err_free_devs:
usb_set_intfdata(iface, NULL);
err_endpoint:
kfree(dev);
err_kmalloc:
input_free_device(input_dev);
return retval;
}
......@@ -419,7 +425,7 @@ static void atp_disconnect(struct usb_interface *iface)
usb_set_intfdata(iface, NULL);
if (dev) {
usb_kill_urb(dev->urb);
input_unregister_device(&dev->input);
input_unregister_device(dev->input);
usb_free_urb(dev->urb);
usb_buffer_free(dev->udev, ATP_DATASIZE,
dev->data, dev->urb->transfer_dma);
......
......@@ -112,7 +112,6 @@
#define NAME_BUFSIZE 80 /* size of product name, path buffers */
#define DATA_BUFSIZE 63 /* size of URB data buffers */
#define ATI_INPUTNUM 1 /* Which input device to register as */
static unsigned long channel_mask;
module_param(channel_mask, ulong, 0444);
......@@ -162,7 +161,7 @@ static char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
static DECLARE_MUTEX(disconnect_sem);
struct ati_remote {
struct input_dev idev;
struct input_dev *idev;
struct usb_device *udev;
struct usb_interface *interface;
......@@ -198,15 +197,13 @@ struct ati_remote {
#define KIND_ACCEL 7 /* Directional keypad - left, right, up, down.*/
/* Translation table from hardware messages to input events. */
static struct
{
static struct {
short kind;
unsigned char data1, data2;
int type;
unsigned int code;
int value;
} ati_remote_tbl[] =
{
} ati_remote_tbl[] = {
/* Directional control pad axes */
{KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */
{KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */
......@@ -286,7 +283,6 @@ static struct
/* Local function prototypes */
static void ati_remote_dump (unsigned char *data, unsigned int actual_length);
static void ati_remote_delete (struct ati_remote *dev);
static int ati_remote_open (struct input_dev *inputdev);
static void ati_remote_close (struct input_dev *inputdev);
static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data);
......@@ -428,7 +424,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
{
struct ati_remote *ati_remote = urb->context;
unsigned char *data= ati_remote->inbuf;
struct input_dev *dev = &ati_remote->idev;
struct input_dev *dev = ati_remote->idev;
int index, acc;
int remote_num;
......@@ -587,38 +583,55 @@ static void ati_remote_irq_in(struct urb *urb, struct pt_regs *regs)
}
/*
* ati_remote_delete
* ati_remote_alloc_buffers
*/
static void ati_remote_delete(struct ati_remote *ati_remote)
static int ati_remote_alloc_buffers(struct usb_device *udev,
struct ati_remote *ati_remote)
{
if (ati_remote->irq_urb)
usb_kill_urb(ati_remote->irq_urb);
ati_remote->inbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC,
&ati_remote->inbuf_dma);
if (!ati_remote->inbuf)
return -1;
if (ati_remote->out_urb)
usb_kill_urb(ati_remote->out_urb);
ati_remote->outbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC,
&ati_remote->outbuf_dma);
if (!ati_remote->outbuf)
return -1;
input_unregister_device(&ati_remote->idev);
ati_remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ati_remote->irq_urb)
return -1;
if (ati_remote->inbuf)
usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
ati_remote->inbuf, ati_remote->inbuf_dma);
ati_remote->out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ati_remote->out_urb)
return -1;
if (ati_remote->outbuf)
usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
ati_remote->outbuf, ati_remote->outbuf_dma);
return 0;
}
/*
* ati_remote_free_buffers
*/
static void ati_remote_free_buffers(struct ati_remote *ati_remote)
{
if (ati_remote->irq_urb)
usb_free_urb(ati_remote->irq_urb);
if (ati_remote->out_urb)
usb_free_urb(ati_remote->out_urb);
kfree(ati_remote);
if (ati_remote->inbuf)
usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
ati_remote->inbuf, ati_remote->inbuf_dma);
if (ati_remote->outbuf)
usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
ati_remote->inbuf, ati_remote->outbuf_dma);
}
static void ati_remote_input_init(struct ati_remote *ati_remote)
{
struct input_dev *idev = &(ati_remote->idev);
struct input_dev *idev = ati_remote->idev;
int i;
idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
......@@ -637,7 +650,7 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
idev->phys = ati_remote->phys;
usb_to_input_id(ati_remote->udev, &idev->id);
idev->dev = &ati_remote->udev->dev;
idev->cdev.dev = &ati_remote->udev->dev;
}
static int ati_remote_initialize(struct ati_remote *ati_remote)
......@@ -674,7 +687,7 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
(ati_remote_sendpacket(ati_remote, 0x8007, init2))) {
dev_err(&ati_remote->interface->dev,
"Initializing ati_remote hardware failed.\n");
return 1;
return -EIO;
}
return 0;
......@@ -686,95 +699,83 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
static int ati_remote_probe(struct usb_interface *interface, const struct usb_device_id *id)
{
struct usb_device *udev = interface_to_usbdev(interface);
struct ati_remote *ati_remote = NULL;
struct usb_host_interface *iface_host;
int retval = -ENOMEM;
char path[64];
/* Allocate and clear an ati_remote struct */
if (!(ati_remote = kmalloc(sizeof (struct ati_remote), GFP_KERNEL)))
return -ENOMEM;
memset(ati_remote, 0x00, sizeof (struct ati_remote));
struct usb_host_interface *iface_host = interface->cur_altsetting;
struct usb_endpoint_descriptor *endpoint_in, *endpoint_out;
struct ati_remote *ati_remote;
struct input_dev *input_dev;
int err = -ENOMEM;
iface_host = interface->cur_altsetting;
if (iface_host->desc.bNumEndpoints != 2) {
err("%s: Unexpected desc.bNumEndpoints\n", __FUNCTION__);
retval = -ENODEV;
goto error;
return -ENODEV;
}
ati_remote->endpoint_in = &(iface_host->endpoint[0].desc);
ati_remote->endpoint_out = &(iface_host->endpoint[1].desc);
ati_remote->udev = udev;
ati_remote->interface = interface;
endpoint_in = &iface_host->endpoint[0].desc;
endpoint_out = &iface_host->endpoint[1].desc;
if (!(ati_remote->endpoint_in->bEndpointAddress & 0x80)) {
if (!(endpoint_in->bEndpointAddress & USB_DIR_IN)) {
err("%s: Unexpected endpoint_in->bEndpointAddress\n", __FUNCTION__);
retval = -ENODEV;
goto error;
return -ENODEV;
}
if ((ati_remote->endpoint_in->bmAttributes & 3) != 3) {
if ((endpoint_in->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) {
err("%s: Unexpected endpoint_in->bmAttributes\n", __FUNCTION__);
retval = -ENODEV;
goto error;
return -ENODEV;
}
if (le16_to_cpu(ati_remote->endpoint_in->wMaxPacketSize) == 0) {
if (le16_to_cpu(endpoint_in->wMaxPacketSize) == 0) {
err("%s: endpoint_in message size==0? \n", __FUNCTION__);
retval = -ENODEV;
goto error;
return -ENODEV;
}
/* Allocate URB buffers, URBs */
ati_remote->inbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC,
&ati_remote->inbuf_dma);
if (!ati_remote->inbuf)
goto error;
ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL);
input_dev = input_allocate_device();
if (!ati_remote || !input_dev)
goto fail1;
ati_remote->outbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC,
&ati_remote->outbuf_dma);
if (!ati_remote->outbuf)
goto error;
/* Allocate URB buffers, URBs */
if (ati_remote_alloc_buffers(udev, ati_remote))
goto fail2;
ati_remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ati_remote->irq_urb)
goto error;
ati_remote->endpoint_in = endpoint_in;
ati_remote->endpoint_out = endpoint_out;
ati_remote->udev = udev;
ati_remote->idev = input_dev;
ati_remote->interface = interface;
ati_remote->out_urb = usb_alloc_urb(0, GFP_KERNEL);