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

Use input_get_drvdata() and input_set_drvdata() instead.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Dmitry Torokhov 2007-04-12 01:34:14 -04:00
parent 40b9b0b82e
commit 8715c1cfad
20 changed files with 59 additions and 49 deletions

View File

@ -241,7 +241,7 @@ static void a3d_adc_close(struct gameport *gameport)
static int a3d_open(struct input_dev *dev)
{
struct a3d *a3d = dev->private;
struct a3d *a3d = input_get_drvdata(dev);
gameport_start_polling(a3d->gameport);
return 0;
@ -253,7 +253,7 @@ static int a3d_open(struct input_dev *dev)
static void a3d_close(struct input_dev *dev)
{
struct a3d *a3d = dev->private;
struct a3d *a3d = input_get_drvdata(dev);
gameport_stop_polling(a3d->gameport);
}
@ -315,10 +315,11 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.product = a3d->mode;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev;
input_dev->private = a3d;
input_dev->open = a3d_open;
input_dev->close = a3d_close;
input_set_drvdata(input_dev, a3d);
if (a3d->mode == A3D_MODE_PXL) {
int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER };

View File

@ -290,7 +290,7 @@ static void adi_poll(struct gameport *gameport)
static int adi_open(struct input_dev *dev)
{
struct adi_port *port = dev->private;
struct adi_port *port = input_get_drvdata(dev);
gameport_start_polling(port->gameport);
return 0;
@ -302,7 +302,7 @@ static int adi_open(struct input_dev *dev)
static void adi_close(struct input_dev *dev)
{
struct adi_port *port = dev->private;
struct adi_port *port = input_get_drvdata(dev);
gameport_stop_polling(port->gameport);
}
@ -425,7 +425,8 @@ static int adi_init_input(struct adi *adi, struct adi_port *port, int half)
input_dev->id.product = adi->id;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &port->gameport->dev;
input_dev->private = port;
input_set_drvdata(input_dev, port);
input_dev->open = adi_open;
input_dev->close = adi_close;

View File

@ -343,7 +343,7 @@ static void analog_poll(struct gameport *gameport)
static int analog_open(struct input_dev *dev)
{
struct analog_port *port = dev->private;
struct analog_port *port = input_get_drvdata(dev);
gameport_start_polling(port->gameport);
return 0;
@ -355,7 +355,7 @@ static int analog_open(struct input_dev *dev)
static void analog_close(struct input_dev *dev)
{
struct analog_port *port = dev->private;
struct analog_port *port = input_get_drvdata(dev);
gameport_stop_polling(port->gameport);
}
@ -450,9 +450,11 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
input_dev->id.product = analog->mask >> 4;
input_dev->id.version = 0x0100;
input_set_drvdata(input_dev, port);
input_dev->open = analog_open;
input_dev->close = analog_close;
input_dev->private = port;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = j = 0; i < 4; i++)

View File

@ -142,7 +142,7 @@ static void cobra_poll(struct gameport *gameport)
static int cobra_open(struct input_dev *dev)
{
struct cobra *cobra = dev->private;
struct cobra *cobra = input_get_drvdata(dev);
gameport_start_polling(cobra->gameport);
return 0;
@ -150,7 +150,7 @@ static int cobra_open(struct input_dev *dev)
static void cobra_close(struct input_dev *dev)
{
struct cobra *cobra = dev->private;
struct cobra *cobra = input_get_drvdata(dev);
gameport_stop_polling(cobra->gameport);
}
@ -212,7 +212,8 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.product = 0x0008;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev;
input_dev->private = cobra;
input_set_drvdata(input_dev, cobra);
input_dev->open = cobra_open;
input_dev->close = cobra_close;

View File

@ -518,7 +518,7 @@ static void db9_timer(unsigned long private)
static int db9_open(struct input_dev *dev)
{
struct db9 *db9 = dev->private;
struct db9 *db9 = input_get_drvdata(dev);
struct parport *port = db9->pd->port;
int err;
@ -542,7 +542,7 @@ static int db9_open(struct input_dev *dev)
static void db9_close(struct input_dev *dev)
{
struct db9 *db9 = dev->private;
struct db9 *db9 = input_get_drvdata(dev);
struct parport *port = db9->pd->port;
mutex_lock(&db9->mutex);
@ -625,7 +625,8 @@ static struct db9 __init *db9_probe(int parport, int mode)
input_dev->id.vendor = 0x0002;
input_dev->id.product = mode;
input_dev->id.version = 0x0100;
input_dev->private = db9;
input_set_drvdata(input_dev, db9);
input_dev->open = db9_open;
input_dev->close = db9_close;

View File

@ -591,7 +591,7 @@ static void gc_timer(unsigned long private)
static int gc_open(struct input_dev *dev)
{
struct gc *gc = dev->private;
struct gc *gc = input_get_drvdata(dev);
int err;
err = mutex_lock_interruptible(&gc->mutex);
@ -610,7 +610,7 @@ static int gc_open(struct input_dev *dev)
static void gc_close(struct input_dev *dev)
{
struct gc *gc = dev->private;
struct gc *gc = input_get_drvdata(dev);
mutex_lock(&gc->mutex);
if (!--gc->used) {
@ -646,7 +646,8 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
input_dev->id.vendor = 0x0001;
input_dev->id.product = pad_type;
input_dev->id.version = 0x0100;
input_dev->private = gc;
input_set_drvdata(input_dev, gc);
input_dev->open = gc_open;
input_dev->close = gc_close;

View File

@ -220,7 +220,7 @@ static void gf2k_poll(struct gameport *gameport)
static int gf2k_open(struct input_dev *dev)
{
struct gf2k *gf2k = dev->private;
struct gf2k *gf2k = input_get_drvdata(dev);
gameport_start_polling(gf2k->gameport);
return 0;
@ -228,7 +228,7 @@ static int gf2k_open(struct input_dev *dev)
static void gf2k_close(struct input_dev *dev)
{
struct gf2k *gf2k = dev->private;
struct gf2k *gf2k = input_get_drvdata(dev);
gameport_stop_polling(gf2k->gameport);
}
@ -309,10 +309,12 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.product = gf2k->id;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev;
input_dev->private = gf2k;
input_set_drvdata(input_dev, gf2k);
input_dev->open = gf2k_open;
input_dev->close = gf2k_close;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; i < gf2k_axes[gf2k->id]; i++)

View File

@ -285,7 +285,7 @@ static void grip_poll(struct gameport *gameport)
static int grip_open(struct input_dev *dev)
{
struct grip *grip = dev->private;
struct grip *grip = input_get_drvdata(dev);
gameport_start_polling(grip->gameport);
return 0;
@ -293,7 +293,7 @@ static int grip_open(struct input_dev *dev)
static void grip_close(struct input_dev *dev)
{
struct grip *grip = dev->private;
struct grip *grip = input_get_drvdata(dev);
gameport_stop_polling(grip->gameport);
}
@ -364,7 +364,8 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.product = grip->mode[i];
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev;
input_dev->private = grip;
input_set_drvdata(input_dev, grip);
input_dev->open = grip_open;
input_dev->close = grip_close;

View File

@ -562,7 +562,7 @@ static void grip_poll(struct gameport *gameport)
static int grip_open(struct input_dev *dev)
{
struct grip_mp *grip = dev->private;
struct grip_mp *grip = input_get_drvdata(dev);
gameport_start_polling(grip->gameport);
return 0;
@ -574,9 +574,9 @@ static int grip_open(struct input_dev *dev)
static void grip_close(struct input_dev *dev)
{
struct grip_mp *grip = dev->private;
struct grip_mp *grip = input_get_drvdata(dev);
gameport_start_polling(grip->gameport);
gameport_stop_polling(grip->gameport);
}
/*
@ -600,7 +600,8 @@ static int register_slot(int slot, struct grip_mp *grip)
input_dev->id.product = 0x0100 + port->mode;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &grip->gameport->dev;
input_dev->private = grip;
input_set_drvdata(input_dev, grip);
input_dev->open = grip_open;
input_dev->close = grip_close;

View File

@ -156,7 +156,7 @@ static void guillemot_poll(struct gameport *gameport)
static int guillemot_open(struct input_dev *dev)
{
struct guillemot *guillemot = dev->private;
struct guillemot *guillemot = input_get_drvdata(dev);
gameport_start_polling(guillemot->gameport);
return 0;
@ -168,7 +168,7 @@ static int guillemot_open(struct input_dev *dev)
static void guillemot_close(struct input_dev *dev)
{
struct guillemot *guillemot = dev->private;
struct guillemot *guillemot = input_get_drvdata(dev);
gameport_stop_polling(guillemot->gameport);
}
@ -232,7 +232,8 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver *
input_dev->id.product = guillemot_type[i].id;
input_dev->id.version = (int)data[14] << 8 | data[15];
input_dev->cdev.dev = &gameport->dev;
input_dev->private = guillemot;
input_set_drvdata(input_dev, guillemot);
input_dev->open = guillemot_open;
input_dev->close = guillemot_close;

View File

@ -185,7 +185,7 @@ static void interact_poll(struct gameport *gameport)
static int interact_open(struct input_dev *dev)
{
struct interact *interact = dev->private;
struct interact *interact = input_get_drvdata(dev);
gameport_start_polling(interact->gameport);
return 0;
@ -197,7 +197,7 @@ static int interact_open(struct input_dev *dev)
static void interact_close(struct input_dev *dev)
{
struct interact *interact = dev->private;
struct interact *interact = input_get_drvdata(dev);
gameport_stop_polling(interact->gameport);
}
@ -262,7 +262,8 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d
input_dev->id.vendor = GAMEPORT_ID_VENDOR_INTERACT;
input_dev->id.product = interact_type[i].id;
input_dev->id.version = 0x0100;
input_dev->private = interact;
input_set_drvdata(input_dev, interact);
input_dev->open = interact_open;
input_dev->close = interact_close;

View File

@ -169,7 +169,6 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = magellan;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);

View File

@ -509,7 +509,7 @@ static void sw_poll(struct gameport *gameport)
static int sw_open(struct input_dev *dev)
{
struct sw *sw = dev->private;
struct sw *sw = input_get_drvdata(dev);
gameport_start_polling(sw->gameport);
return 0;
@ -517,7 +517,7 @@ static int sw_open(struct input_dev *dev)
static void sw_close(struct input_dev *dev)
{
struct sw *sw = dev->private;
struct sw *sw = input_get_drvdata(dev);
gameport_stop_polling(sw->gameport);
}
@ -752,7 +752,8 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.product = sw->type;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev;
input_dev->private = sw;
input_set_drvdata(input_dev, sw);
input_dev->open = sw_open;
input_dev->close = sw_close;

View File

@ -227,7 +227,6 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.product = id;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = spaceball;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);

View File

@ -184,7 +184,6 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = spaceorb;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);

View File

@ -155,7 +155,6 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = stinger;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) |

View File

@ -265,7 +265,7 @@ static void tmdc_poll(struct gameport *gameport)
static int tmdc_open(struct input_dev *dev)
{
struct tmdc *tmdc = dev->private;
struct tmdc *tmdc = input_get_drvdata(dev);
gameport_start_polling(tmdc->gameport);
return 0;
@ -273,7 +273,7 @@ static int tmdc_open(struct input_dev *dev)
static void tmdc_close(struct input_dev *dev)
{
struct tmdc *tmdc = dev->private;
struct tmdc *tmdc = input_get_drvdata(dev);
gameport_stop_polling(tmdc->gameport);
}
@ -327,7 +327,8 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data)
input_dev->id.product = model->id;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &tmdc->gameport->dev;
input_dev->private = tmdc;
input_set_drvdata(input_dev, tmdc);
input_dev->open = tmdc_open;
input_dev->close = tmdc_close;

View File

@ -122,7 +122,7 @@ static void tgfx_timer(unsigned long private)
static int tgfx_open(struct input_dev *dev)
{
struct tgfx *tgfx = dev->private;
struct tgfx *tgfx = input_get_drvdata(dev);
int err;
err = mutex_lock_interruptible(&tgfx->sem);
@ -141,7 +141,7 @@ static int tgfx_open(struct input_dev *dev)
static void tgfx_close(struct input_dev *dev)
{
struct tgfx *tgfx = dev->private;
struct tgfx *tgfx = input_get_drvdata(dev);
mutex_lock(&tgfx->sem);
if (!--tgfx->used) {
@ -224,7 +224,8 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
input_dev->id.product = n_buttons[i];
input_dev->id.version = 0x0100;
input_dev->private = tgfx;
input_set_drvdata(input_dev, tgfx);
input_dev->open = tgfx_open;
input_dev->close = tgfx_close;

View File

@ -206,7 +206,6 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = twidjoy;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y);

View File

@ -161,7 +161,6 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = warrior;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2);