From 24e491c21b4e214a980a5daf2a5bc80e8c410ce6 Mon Sep 17 00:00:00 2001 From: Shubhrajyoti D Date: Wed, 10 Oct 2012 09:35:38 -0700 Subject: Input: as5011 - use C99-style structure initializators Convert the struct i2c_msg initialization to C99 format. This makes maintaining and editing the code simpler. Also helps once other fields like transferred are added in future. Thanks to Julia Lawall for automating the conversion. Signed-off-by: Shubhrajyoti D Acked-by: Jean Delvare Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/as5011.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'drivers/input/joystick') diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index c96653b..9d869e2 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c @@ -85,7 +85,10 @@ static int as5011_i2c_write(struct i2c_client *client, { uint8_t data[2] = { aregaddr, avalue }; struct i2c_msg msg = { - client->addr, I2C_M_IGNORE_NAK, 2, (uint8_t *)data + .addr = client->addr, + .flags = I2C_M_IGNORE_NAK, + .len = 2, + .buf = (uint8_t *)data }; int error; @@ -98,8 +101,18 @@ static int as5011_i2c_read(struct i2c_client *client, { uint8_t data[2] = { aregaddr }; struct i2c_msg msg_set[2] = { - { client->addr, I2C_M_REV_DIR_ADDR, 1, (uint8_t *)data }, - { client->addr, I2C_M_RD | I2C_M_NOSTART, 1, (uint8_t *)data } + { + .addr = client->addr, + .flags = I2C_M_REV_DIR_ADDR, + .len = 1, + .buf = (uint8_t *)data + }, + { + .addr = client->addr, + .flags = I2C_M_RD | I2C_M_NOSTART, + .len = 1, + .buf = (uint8_t *)data + } }; int error; -- cgit v1.1 From 1cb0aa88179b7a71c240529e9d781d7bbb43d2e8 Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Fri, 23 Nov 2012 21:27:39 -0800 Subject: Input: remove use of __devexit_p CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton Acked-by: Russell King Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/as5011.c | 2 +- drivers/input/joystick/maplecontrol.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input/joystick') diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 9d869e2..94f3327 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c @@ -366,7 +366,7 @@ static struct i2c_driver as5011_driver = { .name = "as5011", }, .probe = as5011_probe, - .remove = __devexit_p(as5011_remove), + .remove = as5011_remove, .id_table = as5011_id, }; diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index 77cfde5..c843457 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c @@ -175,7 +175,7 @@ static struct maple_driver dc_pad_driver = { .drv = { .name = "Dreamcast_controller", .probe = probe_maple_controller, - .remove = __devexit_p(remove_maple_controller), + .remove = remove_maple_controller, }, }; -- cgit v1.1 From 5298cc4cc753bbe4c530b41341834f6ef3344d0d Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Fri, 23 Nov 2012 21:38:25 -0800 Subject: Input: remove use of __devinit CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton Acked-by: Mark Brown Acked-by: Javier Martinez Canillas Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/as5011.c | 6 +++--- drivers/input/joystick/maplecontrol.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/input/joystick') diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 94f3327..ad76733 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c @@ -157,7 +157,7 @@ out: return IRQ_HANDLED; } -static int __devinit as5011_configure_chip(struct as5011_device *as5011, +static int as5011_configure_chip(struct as5011_device *as5011, const struct as5011_platform_data *plat_dat) { struct i2c_client *client = as5011->i2c_client; @@ -225,8 +225,8 @@ static int __devinit as5011_configure_chip(struct as5011_device *as5011, return 0; } -static int __devinit as5011_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int as5011_probe(struct i2c_client *client, + const struct i2c_device_id *id) { const struct as5011_platform_data *plat_data; struct as5011_device *as5011; diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index c843457..5ff3cb4 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c @@ -78,7 +78,7 @@ static void dc_pad_close(struct input_dev *dev) } /* allow the controller to be used */ -static int __devinit probe_maple_controller(struct device *dev) +static int probe_maple_controller(struct device *dev) { static const short btn_bit[32] = { BTN_C, BTN_B, BTN_A, BTN_START, -1, -1, -1, -1, -- cgit v1.1 From e2619cf78e19476bfd7ceaefa9eff0847529346e Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Fri, 23 Nov 2012 21:50:47 -0800 Subject: Input: remove use of __devexit CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton Acked-by: Mark Brown Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/as5011.c | 2 +- drivers/input/joystick/maplecontrol.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input/joystick') diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index ad76733..121cd63 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c @@ -341,7 +341,7 @@ err_free_mem: return error; } -static int __devexit as5011_remove(struct i2c_client *client) +static int as5011_remove(struct i2c_client *client) { struct as5011_device *as5011 = i2c_get_clientdata(client); diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index 5ff3cb4..59c10ec 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c @@ -157,7 +157,7 @@ fail: return error; } -static int __devexit remove_maple_controller(struct device *dev) +static int remove_maple_controller(struct device *dev) { struct maple_device *mdev = to_maple_dev(dev); struct dc_pad *pad = maple_get_drvdata(mdev); -- cgit v1.1 From a455e2985f57e2a71566bb8850094af38b2c932d Mon Sep 17 00:00:00 2001 From: Peter Popovec Date: Fri, 14 Dec 2012 22:57:25 -0800 Subject: Input: walkera0701 - fix crash on startup The driver's timer must be set up before enabling IRQ handler, otherwise bad things may happen. Reported-and-tested-by: Fengguang Wu Signed-off-by: Peter Popovec CC: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/walkera0701.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/input/joystick') diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c index 4dfa1ee..f8f892b 100644 --- a/drivers/input/joystick/walkera0701.c +++ b/drivers/input/joystick/walkera0701.c @@ -196,6 +196,7 @@ static void walkera0701_close(struct input_dev *dev) struct walkera_dev *w = input_get_drvdata(dev); parport_disable_irq(w->parport); + hrtimer_cancel(&w->timer); } static int walkera0701_connect(struct walkera_dev *w, int parport) @@ -224,6 +225,9 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) if (parport_claim(w->pardevice)) goto init_err1; + hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + w->timer.function = timer_handler; + w->input_dev = input_allocate_device(); if (!w->input_dev) goto init_err2; @@ -254,8 +258,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) if (err) goto init_err3; - hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - w->timer.function = timer_handler; return 0; init_err3: @@ -271,7 +273,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) static void walkera0701_disconnect(struct walkera_dev *w) { - hrtimer_cancel(&w->timer); input_unregister_device(w->input_dev); parport_release(w->pardevice); parport_unregister_device(w->pardevice); -- cgit v1.1