提交 7791bdae 编写于 作者: D Dmitry Torokhov

Input: drivers/usb/input - don't access dev->private directly

Use input_get_drvdata() and input_set_drvdata() instead.
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 373f9713
......@@ -111,7 +111,7 @@ static void usb_acecad_irq(struct urb *urb)
static int usb_acecad_open(struct input_dev *dev)
{
struct usb_acecad *acecad = dev->private;
struct usb_acecad *acecad = input_get_drvdata(dev);
acecad->irq->dev = acecad->usbdev;
if (usb_submit_urb(acecad->irq, GFP_KERNEL))
......@@ -122,7 +122,7 @@ static int usb_acecad_open(struct input_dev *dev)
static void usb_acecad_close(struct input_dev *dev)
{
struct usb_acecad *acecad = dev->private;
struct usb_acecad *acecad = input_get_drvdata(dev);
usb_kill_urb(acecad->irq);
}
......@@ -186,7 +186,8 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
input_dev->phys = acecad->phys;
usb_to_input_id(dev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = acecad;
input_set_drvdata(input_dev, acecad);
input_dev->open = usb_acecad_open;
input_dev->close = usb_acecad_close;
......
......@@ -798,7 +798,7 @@ MODULE_DEVICE_TABLE(usb, aiptek_ids);
*/
static int aiptek_open(struct input_dev *inputdev)
{
struct aiptek *aiptek = inputdev->private;
struct aiptek *aiptek = input_get_drvdata(inputdev);
aiptek->urb->dev = aiptek->usbdev;
if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
......@@ -812,7 +812,7 @@ static int aiptek_open(struct input_dev *inputdev)
*/
static void aiptek_close(struct input_dev *inputdev)
{
struct aiptek *aiptek = inputdev->private;
struct aiptek *aiptek = input_get_drvdata(inputdev);
usb_kill_urb(aiptek->urb);
}
......@@ -2045,7 +2045,9 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
inputdev->phys = aiptek->features.usbPath;
usb_to_input_id(usbdev, &inputdev->id);
inputdev->cdev.dev = &intf->dev;
inputdev->private = aiptek;
input_set_drvdata(inputdev, aiptek);
inputdev->open = aiptek_open;
inputdev->close = aiptek_close;
......
......@@ -466,7 +466,7 @@ static void atp_complete(struct urb* urb)
static int atp_open(struct input_dev *input)
{
struct atp *dev = input->private;
struct atp *dev = input_get_drvdata(input);
if (usb_submit_urb(dev->urb, GFP_ATOMIC))
return -EIO;
......@@ -477,7 +477,7 @@ static int atp_open(struct input_dev *input)
static void atp_close(struct input_dev *input)
{
struct atp *dev = input->private;
struct atp *dev = input_get_drvdata(input);
usb_kill_urb(dev->urb);
dev->open = 0;
......@@ -586,7 +586,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
usb_to_input_id(dev->udev, &input_dev->id);
input_dev->cdev.dev = &iface->dev;
input_dev->private = dev;
input_set_drvdata(input_dev, dev);
input_dev->open = atp_open;
input_dev->close = atp_close;
......
......@@ -318,7 +318,7 @@ static void ati_remote_dump(unsigned char *data, unsigned int len)
*/
static int ati_remote_open(struct input_dev *inputdev)
{
struct ati_remote *ati_remote = inputdev->private;
struct ati_remote *ati_remote = input_get_drvdata(inputdev);
/* On first open, submit the read urb which was set up previously. */
ati_remote->irq_urb->dev = ati_remote->udev;
......@@ -336,7 +336,7 @@ static int ati_remote_open(struct input_dev *inputdev)
*/
static void ati_remote_close(struct input_dev *inputdev)
{
struct ati_remote *ati_remote = inputdev->private;
struct ati_remote *ati_remote = input_get_drvdata(inputdev);
usb_kill_urb(ati_remote->irq_urb);
}
......@@ -653,7 +653,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
if (ati_remote_tbl[i].type == EV_KEY)
set_bit(ati_remote_tbl[i].code, idev->keybit);
idev->private = ati_remote;
input_set_drvdata(idev, ati_remote);
idev->open = ati_remote_open;
idev->close = ati_remote_close;
......
......@@ -131,7 +131,7 @@ static struct usb_driver ati_remote2_driver = {
static int ati_remote2_open(struct input_dev *idev)
{
struct ati_remote2 *ar2 = idev->private;
struct ati_remote2 *ar2 = input_get_drvdata(idev);
int r;
r = usb_submit_urb(ar2->urb[0], GFP_KERNEL);
......@@ -153,7 +153,7 @@ static int ati_remote2_open(struct input_dev *idev)
static void ati_remote2_close(struct input_dev *idev)
{
struct ati_remote2 *ar2 = idev->private;
struct ati_remote2 *ar2 = input_get_drvdata(idev);
usb_kill_urb(ar2->urb[0]);
usb_kill_urb(ar2->urb[1]);
......@@ -344,7 +344,7 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
return -ENOMEM;
ar2->idev = idev;
idev->private = ar2;
input_set_drvdata(idev, ar2);
idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL);
idev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
......
......@@ -540,8 +540,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
*/
static int gtco_input_open(struct input_dev *inputdev)
{
struct gtco *device;
device = inputdev->private;
struct gtco *device = input_get_drvdata(inputdev);
device->urbinfo->dev = device->usbdev;
if (usb_submit_urb(device->urbinfo, GFP_KERNEL))
......@@ -555,7 +554,7 @@ static int gtco_input_open(struct input_dev *inputdev)
*/
static void gtco_input_close(struct input_dev *inputdev)
{
struct gtco *device = inputdev->private;
struct gtco *device = input_get_drvdata(inputdev);
usb_kill_urb(device->urbinfo);
}
......@@ -569,9 +568,9 @@ static void gtco_input_close(struct input_dev *inputdev)
* placed in the struct gtco structure
*
*/
static void gtco_setup_caps(struct input_dev *inputdev)
static void gtco_setup_caps(struct input_dev *inputdev)
{
struct gtco *device = inputdev->private;
struct gtco *device = input_get_drvdata(inputdev);
/* Which events */
inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC);
......@@ -945,7 +944,8 @@ static int gtco_probe(struct usb_interface *usbinterface,
/* Set input device information */
input_dev->name = "GTCO_CalComp";
input_dev->phys = gtco->usbpath;
input_dev->private = gtco;
input_set_drvdata(input_dev, gtco);
/* Now set up all the input device capabilities */
gtco_setup_caps(input_dev);
......
......@@ -100,7 +100,7 @@ MODULE_DEVICE_TABLE(usb, kbtab_ids);
static int kbtab_open(struct input_dev *dev)
{
struct kbtab *kbtab = dev->private;
struct kbtab *kbtab = input_get_drvdata(dev);
kbtab->irq->dev = kbtab->usbdev;
if (usb_submit_urb(kbtab->irq, GFP_KERNEL))
......@@ -111,7 +111,7 @@ static int kbtab_open(struct input_dev *dev)
static void kbtab_close(struct input_dev *dev)
{
struct kbtab *kbtab = dev->private;
struct kbtab *kbtab = input_get_drvdata(dev);
usb_kill_urb(kbtab->irq);
}
......@@ -147,7 +147,8 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
input_dev->phys = kbtab->phys;
usb_to_input_id(dev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = kbtab;
input_set_drvdata(input_dev, kbtab);
input_dev->open = kbtab_open;
input_dev->close = kbtab_close;
......
......@@ -394,7 +394,7 @@ static void keyspan_irq_recv(struct urb *urb)
static int keyspan_open(struct input_dev *dev)
{
struct usb_keyspan *remote = dev->private;
struct usb_keyspan *remote = input_get_drvdata(dev);
remote->irq_urb->dev = remote->udev;
if (usb_submit_urb(remote->irq_urb, GFP_KERNEL))
......@@ -405,7 +405,7 @@ static int keyspan_open(struct input_dev *dev)
static void keyspan_close(struct input_dev *dev)
{
struct usb_keyspan *remote = dev->private;
struct usb_keyspan *remote = input_get_drvdata(dev);
usb_kill_urb(remote->irq_urb);
}
......@@ -502,7 +502,8 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
if (keyspan_key_table[i] != KEY_RESERVED)
set_bit(keyspan_key_table[i], input_dev->keybit);
input_dev->private = remote;
input_set_drvdata(input_dev, remote);
input_dev->open = keyspan_open;
input_dev->close = keyspan_close;
......
......@@ -252,7 +252,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne
static int powermate_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int _value)
{
unsigned int command = (unsigned int)_value;
struct powermate_device *pm = dev->private;
struct powermate_device *pm = input_get_drvdata(dev);
if (type == EV_MSC && code == MSC_PULSELED){
/*
......@@ -360,7 +360,8 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
input_dev->phys = pm->phys;
usb_to_input_id(udev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = pm;
input_set_drvdata(input_dev, pm);
input_dev->event = powermate_input_event;
......
......@@ -647,7 +647,7 @@ static void usbtouch_irq(struct urb *urb)
static int usbtouch_open(struct input_dev *input)
{
struct usbtouch_usb *usbtouch = input->private;
struct usbtouch_usb *usbtouch = input_get_drvdata(input);
usbtouch->irq->dev = usbtouch->udev;
......@@ -659,7 +659,7 @@ static int usbtouch_open(struct input_dev *input)
static void usbtouch_close(struct input_dev *input)
{
struct usbtouch_usb *usbtouch = input->private;
struct usbtouch_usb *usbtouch = input_get_drvdata(input);
usb_kill_urb(usbtouch->irq);
}
......@@ -741,7 +741,9 @@ static int usbtouch_probe(struct usb_interface *intf,
input_dev->phys = usbtouch->phys;
usb_to_input_id(udev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = usbtouch;
input_set_drvdata(input_dev, usbtouch);
input_dev->open = usbtouch_open;
input_dev->close = usbtouch_close;
......
......@@ -122,7 +122,7 @@ void wacom_input_sync(void *wcombo)
static int wacom_open(struct input_dev *dev)
{
struct wacom *wacom = dev->private;
struct wacom *wacom = input_get_drvdata(dev);
wacom->irq->dev = wacom->usbdev;
if (usb_submit_urb(wacom->irq, GFP_KERNEL))
......@@ -133,7 +133,7 @@ static int wacom_open(struct input_dev *dev)
static void wacom_close(struct input_dev *dev)
{
struct wacom *wacom = dev->private;
struct wacom *wacom = input_get_drvdata(dev);
usb_kill_urb(wacom->irq);
}
......@@ -231,7 +231,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
usb_to_input_id(dev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = wacom;
input_set_drvdata(input_dev, wacom);
input_dev->open = wacom_open;
input_dev->close = wacom_close;
......
......@@ -267,7 +267,7 @@ static void xpad_irq_in(struct urb *urb)
static int xpad_open (struct input_dev *dev)
{
struct usb_xpad *xpad = dev->private;
struct usb_xpad *xpad = input_get_drvdata(dev);
xpad->irq_in->dev = xpad->udev;
if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
......@@ -278,7 +278,7 @@ static int xpad_open (struct input_dev *dev)
static void xpad_close (struct input_dev *dev)
{
struct usb_xpad *xpad = dev->private;
struct usb_xpad *xpad = input_get_drvdata(dev);
usb_kill_urb(xpad->irq_in);
}
......@@ -346,7 +346,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
input_dev->phys = xpad->phys;
usb_to_input_id(udev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = xpad;
input_set_drvdata(input_dev, xpad);
input_dev->open = xpad_open;
input_dev->close = xpad_close;
......
......@@ -502,7 +502,7 @@ static int input_ev(struct input_dev *dev, unsigned int type,
static int input_open(struct input_dev *dev)
{
struct yealink_dev *yld = dev->private;
struct yealink_dev *yld = input_get_drvdata(dev);
int i, ret;
dbg("%s", __FUNCTION__);
......@@ -529,7 +529,7 @@ static int input_open(struct input_dev *dev)
static void input_close(struct input_dev *dev)
{
struct yealink_dev *yld = dev->private;
struct yealink_dev *yld = input_get_drvdata(dev);
usb_kill_urb(yld->urb_ctl);
usb_kill_urb(yld->urb_irq);
......@@ -939,7 +939,8 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
usb_to_input_id(udev, &input_dev->id);
input_dev->cdev.dev = &intf->dev;
input_dev->private = yld;
input_set_drvdata(input_dev, yld);
input_dev->open = input_open;
input_dev->close = input_close;
/* input_dev->event = input_ev; TODO */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册