diff options
Diffstat (limited to 'drivers')
83 files changed, 298 insertions, 331 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index c06e98fbd77c..4fe386fa86af 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -126,9 +126,8 @@ EXPORT_SYMBOL(input_mt_destroy_slots); * * Reports a contact via ABS_MT_TRACKING_ID, and optionally * ABS_MT_TOOL_TYPE. If active is true and the slot is currently - * inactive, or if the tool type is changed, a new tracking id is - * assigned to the slot. The tool type is only reported if the - * corresponding absbit field is set. + * inactive, a new tracking id is assigned to the slot. The tool + * type is only reported if the corresponding absbit field is set. * * Returns true if contact is active. */ diff --git a/drivers/input/input.c b/drivers/input/input.c index 01c91fec9b7e..0859b60ca924 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -391,7 +391,7 @@ void input_handle_event(struct input_dev *dev, void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { - if (is_event_supported(type, dev->evbit, EV_MAX)) { + if (type == EV_SYN || is_event_supported(type, dev->evbit, EV_MAX)) { guard(spinlock_irqsave)(&dev->event_lock); input_handle_event(dev, type, code, value); } @@ -415,7 +415,7 @@ void input_inject_event(struct input_handle *handle, struct input_dev *dev = handle->dev; struct input_handle *grab; - if (is_event_supported(type, dev->evbit, EV_MAX)) { + if (type == EV_SYN || is_event_supported(type, dev->evbit, EV_MAX)) { guard(spinlock_irqsave)(&dev->event_lock); guard(rcu)(); @@ -2396,6 +2396,14 @@ int input_register_device(struct input_dev *dev) } if (dev->devres_managed) { + if (!dev->dev.parent || + !devres_find(dev->dev.parent, devm_input_device_release, + devm_input_device_match, dev)) { + dev_err(&dev->dev, + "Parent of managed input device was overridden, refusing to register\n"); + return -EINVAL; + } + devres = devres_alloc(devm_input_device_unregister, sizeof(*devres), GFP_KERNEL); if (!devres) diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index 6293b6e8148b..eb28ff8d7222 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c @@ -58,6 +58,8 @@ static void dc_pad_callback(struct mapleq *mq) input_report_abs(dev, ABS_Y, res[13]); input_report_abs(dev, ABS_RX, res[14]); input_report_abs(dev, ABS_RY, res[15]); + + input_sync(dev); } static int dc_pad_open(struct input_dev *dev) @@ -74,8 +76,7 @@ static void dc_pad_close(struct input_dev *dev) { struct dc_pad *pad = dev_get_platdata(&dev->dev); - maple_getcond_callback(pad->mdev, dc_pad_callback, 0, - MAPLE_FUNC_CONTROLLER); + maple_getcond_callback(pad->mdev, NULL, 0, MAPLE_FUNC_CONTROLLER); } /* allow the controller to be used */ @@ -96,7 +97,6 @@ static int probe_maple_controller(struct device *dev) }; struct maple_device *mdev = to_maple_dev(dev); - struct maple_driver *mdrv = to_maple_driver(dev->driver); int i, error; struct dc_pad *pad; struct input_dev *idev; @@ -118,26 +118,19 @@ static int probe_maple_controller(struct device *dev) idev->close = dc_pad_close; for (i = 0; i < 32; i++) { - if (data & (1 << i)) { + if (data & BIT(i)) { if (btn_bit[i] >= 0) __set_bit(btn_bit[i], idev->keybit); - else if (abs_bit[i] >= 0) - __set_bit(abs_bit[i], idev->absbit); + else if (abs_bit[i] >= ABS_X && abs_bit[i] <= ABS_BRAKE) + input_set_abs_params(idev, abs_bit[i], 0, 255, 0, 0); + else if (abs_bit[i] >= ABS_HAT0X && abs_bit[i] <= ABS_HAT3Y) + input_set_abs_params(idev, abs_bit[i], -1, 1, 0, 0); } } if (idev->keybit[BIT_WORD(BTN_JOYSTICK)]) idev->evbit[0] |= BIT_MASK(EV_KEY); - if (idev->absbit[0]) - idev->evbit[0] |= BIT_MASK(EV_ABS); - - for (i = ABS_X; i <= ABS_BRAKE; i++) - input_set_abs_params(idev, i, 0, 255, 0, 0); - - for (i = ABS_HAT0X; i <= ABS_HAT3Y; i++) - input_set_abs_params(idev, i, 1, -1, 0, 0); - idev->dev.platform_data = pad; idev->dev.parent = &mdev->dev; idev->name = mdev->product_name; @@ -146,15 +139,11 @@ static int probe_maple_controller(struct device *dev) error = input_register_device(idev); if (error) goto fail; - - mdev->driver = mdrv; - return 0; fail: input_free_device(idev); kfree(pad); - maple_set_drvdata(mdev, NULL); return error; } @@ -163,9 +152,7 @@ static int remove_maple_controller(struct device *dev) struct maple_device *mdev = to_maple_dev(dev); struct dc_pad *pad = maple_get_drvdata(mdev); - mdev->callback = NULL; input_unregister_device(pad->dev); - maple_set_drvdata(mdev, NULL); kfree(pad); return 0; diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 810e52782ae8..d2eb48d98fea 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -408,6 +408,7 @@ static const struct xpad_device { { 0x3537, 0x1004, "GameSir T4 Kaleid", 0, XTYPE_XBOX360 }, { 0x3537, 0x100f, "GameSir Nova 2 Lite", 0, XTYPE_XBOX360 }, { 0x3537, 0x1010, "GameSir G7 SE", 0, XTYPE_XBOXONE }, + { 0x3537, 0x1040, "GameSir Nova Lite", 0, XTYPE_XBOX360 }, { 0x3651, 0x1000, "CRKD SG", 0, XTYPE_XBOX360 }, { 0x366c, 0x0005, "ByoWave Proteus Controller", MAP_SHARE_BUTTON, XTYPE_XBOXONE, FLAG_DELAY_INIT }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c index 980d739e45b8..d778af2750ea 100644 --- a/drivers/input/keyboard/adp5520-keys.c +++ b/drivers/input/keyboard/adp5520-keys.c @@ -104,7 +104,6 @@ static int adp5520_keys_probe(struct platform_device *pdev) input->name = pdev->name; input->phys = "adp5520-keys/input0"; - input->dev.parent = &pdev->dev; input->id.bustype = BUS_I2C; input->id.vendor = 0x0001; diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index b5ff71cd5a70..7d5ed45845bc 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -1259,7 +1259,6 @@ applespi_register_touchpad_device(struct applespi_data *applespi, touchpad_input_dev->name = "Apple SPI Touchpad"; touchpad_input_dev->phys = "applespi/input1"; - touchpad_input_dev->dev.parent = &applespi->spi->dev; touchpad_input_dev->id.bustype = BUS_SPI; touchpad_input_dev->id.vendor = SYNAPTICS_VENDOR_ID; touchpad_input_dev->id.product = @@ -1686,7 +1685,6 @@ static int applespi_probe(struct spi_device *spi) applespi->keyboard_input_dev->name = "Apple SPI Keyboard"; applespi->keyboard_input_dev->phys = "applespi/input0"; - applespi->keyboard_input_dev->dev.parent = &spi->dev; applespi->keyboard_input_dev->id.bustype = BUS_SPI; applespi->keyboard_input_dev->evbit[0] = @@ -1904,7 +1902,7 @@ static int applespi_resume(struct device *dev) } static const struct acpi_device_id applespi_acpi_match[] = { - { "APP000D", 0 }, + { .id = "APP000D" }, { } }; MODULE_DEVICE_TABLE(acpi, applespi_acpi_match); diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index b5ee5697a136..019cfa8553f9 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -357,10 +357,7 @@ static void atkbd_calculate_xl_bit(struct atkbd *atkbd, u8 code) for (i = 0; i < ARRAY_SIZE(xl_table); i++) { if (!((code ^ xl_table[i]) & 0x7f)) { - if (code & 0x80) - __clear_bit(i, &atkbd->xl_bit); - else - __set_bit(i, &atkbd->xl_bit); + __assign_bit(i, &atkbd->xl_bit, !(code & 0x80)); break; } } diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c index 6b46f83a9edb..f76cc6e7b787 100644 --- a/drivers/input/keyboard/bcm-keypad.c +++ b/drivers/input/keyboard/bcm-keypad.c @@ -327,7 +327,6 @@ static int bcm_kp_probe(struct platform_device *pdev) input_dev->name = pdev->name; input_dev->phys = "keypad/input0"; - input_dev->dev.parent = &pdev->dev; input_dev->open = bcm_kp_open; input_dev->close = bcm_kp_close; diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c index ddabd789861b..6a21ee17e164 100644 --- a/drivers/input/keyboard/clps711x-keypad.c +++ b/drivers/input/keyboard/clps711x-keypad.c @@ -130,7 +130,6 @@ static int clps711x_keypad_probe(struct platform_device *pdev) input_set_drvdata(input, priv); input->name = pdev->name; - input->dev.parent = dev; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 177e5d4a3382..0a817680171c 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -602,7 +602,6 @@ static int cros_ec_keyb_register_bs(struct cros_ec_keyb *ckdev, idev->id.bustype = BUS_VIRTUAL; idev->id.version = 1; idev->id.product = 0; - idev->dev.parent = dev; input_set_drvdata(idev, ckdev); ckdev->bs_idev = idev; @@ -776,7 +775,6 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev) idev->id.bustype = BUS_VIRTUAL; idev->id.version = 1; idev->id.product = 0; - idev->dev.parent = dev; idev->setkeycode = cros_ec_keyb_setkeycode; ckdev->ghost_filter = device_property_read_bool(dev, "google,needs-ghost-filter"); @@ -911,7 +909,7 @@ static void cros_ec_keyb_remove(struct platform_device *pdev) #ifdef CONFIG_ACPI static const struct acpi_device_id cros_ec_keyb_acpi_match[] = { - { "GOOG0007", true }, + { .id = "GOOG0007", .driver_data = true }, { } }; MODULE_DEVICE_TABLE(acpi, cros_ec_keyb_acpi_match); diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c index 57d435fc5c73..d0e387f22faf 100644 --- a/drivers/input/keyboard/goldfish_events.c +++ b/drivers/input/keyboard/goldfish_events.c @@ -179,8 +179,8 @@ MODULE_DEVICE_TABLE(of, goldfish_events_of_match); #ifdef CONFIG_ACPI static const struct acpi_device_id goldfish_events_acpi_match[] = { - { "GFSH0002", 0 }, - { }, + { .id = "GFSH0002" }, + { } }; MODULE_DEVICE_TABLE(acpi, goldfish_events_acpi_match); #endif diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 129fc4212a5e..fbc31c5db3db 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -886,7 +886,6 @@ static int gpio_keys_probe(struct platform_device *pdev) input->name = pdata->name ? : pdev->name; input->phys = "gpio-keys/input0"; - input->dev.parent = dev; input->open = gpio_keys_open; input->close = gpio_keys_close; diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index ccde60cd6bb3..6f6f99b28a2c 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -458,7 +458,6 @@ static int imx_keypad_probe(struct platform_device *pdev) /* Init the Input device */ input_dev->name = pdev->name; input_dev->id.bustype = BUS_HOST; - input_dev->dev.parent = &pdev->dev; input_dev->open = imx_keypad_open; input_dev->close = imx_keypad_close; diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index cd9af5221c3d..26b579f0280f 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c @@ -113,7 +113,6 @@ static int jornada720_kbd_probe(struct platform_device *pdev) input_dev->keycodesize = sizeof(unsigned short); input_dev->keycodemax = ARRAY_SIZE(jornada_std_keymap); input_dev->id.bustype = BUS_HOST; - input_dev->dev.parent = &pdev->dev; for (i = 0; i < ARRAY_SIZE(jornadakbd->keymap); i++) __set_bit(jornadakbd->keymap[i], input_dev->keybit); diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c index 2392e7ec3b19..285d5c32fe70 100644 --- a/drivers/input/keyboard/lpc32xx-keys.c +++ b/drivers/input/keyboard/lpc32xx-keys.c @@ -198,7 +198,6 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev) input->id.version = 0x0100; input->open = lpc32xx_kscan_open; input->close = lpc32xx_kscan_close; - input->dev.parent = &pdev->dev; input_set_capability(input, EV_MSC, MSC_SCAN); diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index 3d5538dd4f23..e277b929a375 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c @@ -107,7 +107,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd) } ptr = memchr(kbd->old + 2, kbd->new[i], 6); code = kbd->new[i]; - if (code > 3 && ptr) { + if (code > 3 && !ptr) { keycode = kbd->keycode[code]; if (keycode) { input_event(dev, EV_MSC, MSC_SCAN, code); @@ -140,16 +140,32 @@ static void dc_kbd_callback(struct mapleq *mq) } } +static int dc_kbd_open(struct input_dev *dev) +{ + struct maple_device *mdev = input_get_drvdata(dev); + + /* Maple polling is locked to VBLANK - which may be just 50/s */ + maple_getcond_callback(mdev, dc_kbd_callback, HZ / 50, + MAPLE_FUNC_KEYBOARD); + + return 0; +} + +static void dc_kbd_close(struct input_dev *dev) +{ + struct maple_device *mdev = input_get_drvdata(dev); + + maple_getcond_callback(mdev, NULL, 0, MAPLE_FUNC_KEYBOARD); +} + static int probe_maple_kbd(struct device *dev) { struct maple_device *mdev; - struct maple_driver *mdrv; int i, error; struct dc_kbd *kbd; struct input_dev *idev; mdev = to_maple_dev(dev); - mdrv = to_maple_driver(dev->driver); kbd = kzalloc_obj(*kbd); if (!kbd) { @@ -167,6 +183,7 @@ static int probe_maple_kbd(struct device *dev) memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); maple_set_drvdata(mdev, kbd); + input_set_drvdata(idev, mdev); idev->name = mdev->product_name; idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); @@ -175,6 +192,8 @@ static int probe_maple_kbd(struct device *dev) idev->keycodemax = ARRAY_SIZE(kbd->keycode); idev->id.bustype = BUS_HOST; idev->dev.parent = &mdev->dev; + idev->open = dc_kbd_open; + idev->close = dc_kbd_close; for (i = 0; i < NR_SCANCODES; i++) __set_bit(dc_kbd_keycode[i], idev->keybit); @@ -185,17 +204,9 @@ static int probe_maple_kbd(struct device *dev) error = input_register_device(idev); if (error) goto fail_register; - - /* Maple polling is locked to VBLANK - which may be just 50/s */ - maple_getcond_callback(mdev, dc_kbd_callback, HZ/50, - MAPLE_FUNC_KEYBOARD); - - mdev->driver = mdrv; - return error; fail_register: - maple_set_drvdata(mdev, NULL); input_free_device(idev); fail_idev_alloc: kfree(kbd); @@ -213,7 +224,6 @@ static int remove_maple_kbd(struct device *dev) input_unregister_device(kbd->dev); kfree(kbd); - maple_set_drvdata(mdev, NULL); return 0; } diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 8863b741d1a3..d14d1d727487 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -134,9 +134,6 @@ static void matrix_keypad_scan(struct work_struct *work) memset(new_state, 0, sizeof(new_state)); - for (row = 0; row < keypad->num_row_gpios; row++) - gpiod_direction_input(keypad->row_gpios[row]); - /* assert each column and read the row status out */ for (col = 0; col < keypad->num_col_gpios; col++) { @@ -443,7 +440,7 @@ static int matrix_keypad_probe(struct platform_device *pdev) NULL, input_dev); if (err) { dev_err(&pdev->dev, "failed to build keymap\n"); - return -ENOMEM; + return err; } if (!device_property_read_bool(&pdev->dev, "linux,no-autorepeat")) diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c index f8fb44bc4915..94ebb875df1f 100644 --- a/drivers/input/keyboard/max7359_keypad.c +++ b/drivers/input/keyboard/max7359_keypad.c @@ -198,7 +198,6 @@ static int max7359_probe(struct i2c_client *client) input_dev->id.bustype = BUS_I2C; input_dev->open = max7359_open; input_dev->close = max7359_close; - input_dev->dev.parent = &client->dev; input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); input_dev->keycodesize = sizeof(keypad->keycodes[0]); diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index a1a102855590..204426834371 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -235,7 +235,6 @@ static int mpr_touchkey_probe(struct i2c_client *client) input_dev->name = "Freescale MPR121 Touchkey"; input_dev->id.bustype = BUS_I2C; - input_dev->dev.parent = dev; if (device_property_read_bool(dev, "autorepeat")) __set_bit(EV_REP, input_dev->evbit); input_set_capability(input_dev, EV_MSC, MSC_SCAN); diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 4519eecb317b..059bce760401 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -645,7 +645,6 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) input_dev->id.bustype = BUS_HOST; input_dev->open = pxa27x_keypad_open; input_dev->close = pxa27x_keypad_close; - input_dev->dev.parent = &pdev->dev; input_dev->keycode = keypad->keycodes; input_dev->keycodesize = sizeof(keypad->keycodes[0]); diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c index f9f480c91032..c6ab8e501f83 100644 --- a/drivers/input/keyboard/qt1050.c +++ b/drivers/input/keyboard/qt1050.c @@ -476,7 +476,6 @@ static int qt1050_probe(struct i2c_client *client) } input->name = "AT42QT1050 QTouch Sensor"; - input->dev.parent = &client->dev; input->id.bustype = BUS_I2C; /* Add the keycode */ diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index 9d51c7ff1ebb..72d43d8deb78 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -179,7 +179,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) clk = devm_clk_get_optional_enabled(dev, NULL); if (IS_ERR(clk)) return dev_err_probe(dev, PTR_ERR(clk), - "Failed to get snvs clock (%pe)\n", clk); + "Failed to get snvs clock\n"); pdata->wakeup = of_property_read_bool(np, "wakeup-source"); @@ -236,14 +236,13 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) pdata->input = input; platform_set_drvdata(pdev, pdata); - error = devm_request_irq(dev, pdata->irq, - imx_snvs_pwrkey_interrupt, + error = devm_request_irq(dev, pdata->irq, imx_snvs_pwrkey_interrupt, 0, pdev->name, pdev); if (error) - return dev_err_probe(dev, error, "interrupt not available.\n"); + return error; error = input_register_device(input); - if (error < 0) + if (error) return dev_err_probe(dev, error, "failed to register input device\n"); device_init_wakeup(dev, pdata->wakeup); diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c index e53ef4c670e4..2fbdf373fe99 100644 --- a/drivers/input/keyboard/st-keyscan.c +++ b/drivers/input/keyboard/st-keyscan.c @@ -75,6 +75,8 @@ static int keyscan_start(struct st_keyscan *keypad) writel(KEYSCAN_CONFIG_ENABLE, keypad->base + KEYSCAN_CONFIG_OFF); + enable_irq(keypad->irq); + return 0; } @@ -82,6 +84,8 @@ static void keyscan_stop(struct st_keyscan *keypad) { writel(0, keypad->base + KEYSCAN_CONFIG_OFF); + disable_irq(keypad->irq); + clk_disable(keypad->clk); } @@ -145,7 +149,6 @@ static int keyscan_probe(struct platform_device *pdev) input_dev->name = pdev->name; input_dev->phys = "keyscan-keys/input0"; - input_dev->dev.parent = &pdev->dev; input_dev->open = keyscan_open; input_dev->close = keyscan_close; @@ -173,29 +176,18 @@ static int keyscan_probe(struct platform_device *pdev) return PTR_ERR(keypad_data->base); keypad_data->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(keypad_data->clk)) { - dev_err(&pdev->dev, "cannot get clock\n"); - return PTR_ERR(keypad_data->clk); - } - - error = clk_enable(keypad_data->clk); - if (error) { - dev_err(&pdev->dev, "failed to enable clock\n"); - return error; - } - - keyscan_stop(keypad_data); + if (IS_ERR(keypad_data->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->clk), + "cannot get clock\n"); keypad_data->irq = platform_get_irq(pdev, 0); if (keypad_data->irq < 0) - return -EINVAL; + return keypad_data->irq; - error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr, 0, - pdev->name, keypad_data); - if (error) { - dev_err(&pdev->dev, "failed to request IRQ\n"); + error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr, + IRQF_NO_AUTOEN, pdev->name, keypad_data); + if (error) return error; - } error = input_register_device(input_dev); if (error) { diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c index 0acded4fb9c9..bc5d0217be5c 100644 --- a/drivers/input/keyboard/stmpe-keypad.c +++ b/drivers/input/keyboard/stmpe-keypad.c @@ -361,7 +361,6 @@ static int stmpe_keypad_probe(struct platform_device *pdev) input->name = "STMPE keypad"; input->id.bustype = BUS_I2C; - input->dev.parent = &pdev->dev; error = matrix_keypad_parse_properties(&pdev->dev, &rows, &cols); if (error) diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index 11988cffdfae..137f9fa554f0 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c @@ -405,7 +405,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) input->id.bustype = BUS_I2C; input->name = pdev->name; - input->dev.parent = &pdev->dev; input->open = tc3589x_keypad_open; input->close = tc3589x_keypad_close; diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index bc1c80a456f2..e6177f2bdf8d 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -641,7 +641,6 @@ static int tegra_kbc_probe(struct platform_device *pdev) kbc->idev->name = pdev->name; kbc->idev->id.bustype = BUS_HOST; - kbc->idev->dev.parent = &pdev->dev; kbc->idev->open = tegra_kbc_open; kbc->idev->close = tegra_kbc_close; diff --git a/drivers/input/matrix-keymap.c b/drivers/input/matrix-keymap.c index 3bea3575a0a9..e4227e96aa4e 100644 --- a/drivers/input/matrix-keymap.c +++ b/drivers/input/matrix-keymap.c @@ -35,6 +35,13 @@ static bool matrix_keypad_map_key(struct input_dev *input_dev, return false; } + if (code > KEY_MAX) { + dev_err(input_dev->dev.parent, + "%s: invalid keycode %u in keymap entry 0x%x\n", + __func__, code, key); + return false; + } + keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code; __set_bit(code, input_dev->keybit); diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c index 0f8b7ffb3aff..2d398119a620 100644 --- a/drivers/input/misc/88pm860x_onkey.c +++ b/drivers/input/misc/88pm860x_onkey.c @@ -85,7 +85,6 @@ static int pm860x_onkey_probe(struct platform_device *pdev) info->idev->name = "88pm860x_on"; info->idev->phys = "88pm860x_on/input0"; info->idev->id.bustype = BUS_I2C; - info->idev->dev.parent = &pdev->dev; info->idev->evbit[0] = BIT_MASK(EV_KEY); info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER); diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index a9b9013680d6..4ace4739eee2 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c @@ -77,7 +77,6 @@ static int ab8500_ponkey_probe(struct platform_device *pdev) ponkey->irq_dbr = irq_dbr; input->name = "AB8500 POn(PowerOn) Key"; - input->dev.parent = &pdev->dev; input_set_capability(input, EV_KEY, KEY_POWER); diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c index c9fa789337ba..2aee2a4a027d 100644 --- a/drivers/input/misc/ad714x.c +++ b/drivers/input/misc/ad714x.c @@ -1046,7 +1046,6 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, input->id.product = ad714x->product; input->id.version = ad714x->version; input->name = "ad714x_captouch_slider"; - input->dev.parent = dev; error = input_register_device(input); if (error) @@ -1076,7 +1075,6 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, input->id.product = ad714x->product; input->id.version = ad714x->version; input->name = "ad714x_captouch_wheel"; - input->dev.parent = dev; error = input_register_device(input); if (error) @@ -1109,7 +1107,6 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, input->id.product = ad714x->product; input->id.version = ad714x->version; input->name = "ad714x_captouch_pad"; - input->dev.parent = dev; error = input_register_device(input); if (error) @@ -1139,7 +1136,6 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, input->id.product = ad714x->product; input->id.version = ad714x->version; input->name = "ad714x_captouch_button"; - input->dev.parent = dev; error = input_register_device(input); if (error) diff --git a/drivers/input/misc/ariel-pwrbutton.c b/drivers/input/misc/ariel-pwrbutton.c index f0e06ee604d6..e22f8985e7eb 100644 --- a/drivers/input/misc/ariel-pwrbutton.c +++ b/drivers/input/misc/ariel-pwrbutton.c @@ -113,7 +113,6 @@ static int ariel_pwrbutton_probe(struct spi_device *spi) if (!priv->input) return -ENOMEM; priv->input->name = "Power Button"; - priv->input->dev.parent = &spi->dev; input_set_capability(priv->input, EV_KEY, KEY_POWER); error = input_register_device(priv->input); if (error) { diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index 5805a1a3bb05..e77e53ee9d41 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c @@ -128,8 +128,8 @@ static void atlas_acpi_button_remove(struct platform_device *pdev) } static const struct acpi_device_id atlas_device_ids[] = { - { "ASIM0000" }, - { "" } + { .id = "ASIM0000" }, + { } }; MODULE_DEVICE_TABLE(acpi, atlas_device_ids); diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index 24f9e9d893de..c34e002258ee 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -241,7 +241,6 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek, idev->name = "axp20x-pek"; idev->phys = "m1kbd/input2"; - idev->dev.parent = &pdev->dev; input_set_capability(idev, EV_KEY, KEY_POWER); diff --git a/drivers/input/misc/da7280.c b/drivers/input/misc/da7280.c index 77fcf868dca2..e607836efb50 100644 --- a/drivers/input/misc/da7280.c +++ b/drivers/input/misc/da7280.c @@ -1218,7 +1218,6 @@ static int da7280_probe(struct i2c_client *client) } input_dev->name = "da7280-haptic"; - input_dev->dev.parent = client->dev.parent; input_dev->open = da7280_haptic_open; input_dev->close = da7280_haptic_close; input_set_drvdata(input_dev, haptics); diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index 6c5c4c53753b..8a3d74d65d63 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -640,7 +640,7 @@ MODULE_DEVICE_TABLE(i2c, drv260x_id); #ifdef CONFIG_ACPI static const struct acpi_device_id drv260x_acpi_match[] = { - { "DRV2604" }, + { .id = "DRV2604" }, { } }; MODULE_DEVICE_TABLE(acpi, drv260x_acpi_match); diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c index 4f8c1f69aa63..134d65fdcf2d 100644 --- a/drivers/input/misc/drv2665.c +++ b/drivers/input/misc/drv2665.c @@ -180,7 +180,6 @@ static int drv2665_probe(struct i2c_client *client) } haptics->input_dev->name = "drv2665:haptics"; - haptics->input_dev->dev.parent = client->dev.parent; haptics->input_dev->close = drv2665_close; input_set_drvdata(haptics->input_dev, haptics); input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE); diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c index 97309984fa7c..bbda7b4cbdcb 100644 --- a/drivers/input/misc/drv2667.c +++ b/drivers/input/misc/drv2667.c @@ -357,7 +357,6 @@ static int drv2667_probe(struct i2c_client *client) } haptics->input_dev->name = "drv2667:haptics"; - haptics->input_dev->dev.parent = client->dev.parent; haptics->input_dev->close = drv2667_close; input_set_drvdata(haptics->input_dev, haptics); input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE); diff --git a/drivers/input/misc/e3x0-button.c b/drivers/input/misc/e3x0-button.c index 5bd527117470..5b399284723d 100644 --- a/drivers/input/misc/e3x0-button.c +++ b/drivers/input/misc/e3x0-button.c @@ -78,7 +78,6 @@ static int e3x0_button_probe(struct platform_device *pdev) input->name = "NI Ettus Research USRP E3x0 Button Driver"; input->phys = "e3x0_button/input0"; - input->dev.parent = &pdev->dev; input_set_capability(input, EV_KEY, KEY_POWER); diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 5d45680d74a4..10325c1296da 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -356,7 +356,6 @@ static int max77693_haptic_probe(struct platform_device *pdev) haptic->input_dev->name = "max77693-haptic"; haptic->input_dev->id.version = 1; - haptic->input_dev->dev.parent = &pdev->dev; haptic->input_dev->open = max77693_haptic_open; haptic->input_dev->close = max77693_haptic_close; input_set_drvdata(haptic->input_dev, haptic); diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 62619e4fed20..d185b3ca353d 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c @@ -96,7 +96,6 @@ static int max8925_onkey_probe(struct platform_device *pdev) input->name = "max8925_on"; input->phys = "max8925_on/input0"; input->id.bustype = BUS_I2C; - input->dev.parent = &pdev->dev; input_set_capability(input, EV_KEY, KEY_POWER); error = devm_request_threaded_irq(&pdev->dev, irq[0], NULL, diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 3e5ed685ed8f..53ca3b1d7360 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -202,7 +202,6 @@ static int pwm_vibrator_probe(struct platform_device *pdev) vibrator->input->name = "pwm-vibrator"; vibrator->input->id.bustype = BUS_HOST; - vibrator->input->dev.parent = &pdev->dev; vibrator->input->close = pwm_vibrator_close; input_set_drvdata(vibrator->input, vibrator); diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/regulator-haptic.c index 9711f5c7c78a..bd26c8e1b338 100644 --- a/drivers/input/misc/regulator-haptic.c +++ b/drivers/input/misc/regulator-haptic.c @@ -179,7 +179,6 @@ static int regulator_haptic_probe(struct platform_device *pdev) haptic->input_dev = input_dev; haptic->input_dev->name = "regulator-haptic"; - haptic->input_dev->dev.parent = &pdev->dev; haptic->input_dev->close = regulator_haptic_close; input_set_drvdata(haptic->input_dev, haptic); input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE); diff --git a/drivers/input/misc/retu-pwrbutton.c b/drivers/input/misc/retu-pwrbutton.c index 64023ac08e2b..65603826b957 100644 --- a/drivers/input/misc/retu-pwrbutton.c +++ b/drivers/input/misc/retu-pwrbutton.c @@ -57,7 +57,6 @@ static int retu_pwrbutton_probe(struct platform_device *pdev) return -ENOMEM; idev->name = "retu-pwrbutton"; - idev->dev.parent = &pdev->dev; input_set_capability(idev, EV_KEY, KEY_POWER); input_set_drvdata(idev, rdev); diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index 064243677fcf..dbf86ea778e6 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -603,14 +603,14 @@ static const struct soc_device_data soc_device_MSHW0040 = { }; static const struct acpi_device_id soc_button_acpi_match[] = { - { "PNP0C40", (unsigned long)&soc_device_PNP0C40 }, - { "INT33D3", (unsigned long)&soc_device_INT33D3 }, - { "ID9001", (unsigned long)&soc_device_INT33D3 }, - { "ACPI0011", 0 }, + { .id = "PNP0C40", .driver_data = (unsigned long)&soc_device_PNP0C40 }, + { .id = "INT33D3", .driver_data = (unsigned long)&soc_device_INT33D3 }, + { .id = "ID9001", .driver_data = (unsigned long)&soc_device_INT33D3 }, + { .id = "ACPI0011" }, /* Microsoft Surface Devices (3th, 5th and 6th generation) */ - { "MSHW0028", (unsigned long)&soc_device_MSHW0028 }, - { "MSHW0040", (unsigned long)&soc_device_MSHW0040 }, + { .id = "MSHW0028", .driver_data = (unsigned long)&soc_device_MSHW0028 }, + { .id = "MSHW0040", .driver_data = (unsigned long)&soc_device_MSHW0040 }, { } }; diff --git a/drivers/input/misc/tps65218-pwrbutton.c b/drivers/input/misc/tps65218-pwrbutton.c index fc450fce0932..5c4de3a285d5 100644 --- a/drivers/input/misc/tps65218-pwrbutton.c +++ b/drivers/input/misc/tps65218-pwrbutton.c @@ -105,7 +105,6 @@ static int tps6521x_pb_probe(struct platform_device *pdev) snprintf(pwr->phys, sizeof(pwr->phys), "%s/input0", pwr->data->name); idev->phys = pwr->phys; - idev->dev.parent = dev; idev->id.bustype = BUS_I2C; input_set_capability(idev, EV_KEY, KEY_POWER); diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index 3e94a5995766..949d57f32958 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c @@ -90,7 +90,6 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev) input_set_capability(pwr, EV_KEY, KEY_POWER); pwr->name = "twl4030_pwrbutton"; pwr->phys = "twl4030_pwrbutton/input0"; - pwr->dev.parent = &pdev->dev; err = devm_request_threaded_irq(&pdev->dev, irq, NULL, powerbutton_irq, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index 18eb319bc6f7..a885873bcbd8 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c @@ -96,7 +96,6 @@ static int wm831x_on_probe(struct platform_device *pdev) wm831x_on->dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER); wm831x_on->dev->name = "wm831x_on"; wm831x_on->dev->phys = "wm831x_on/input0"; - wm831x_on->dev->dev.parent = &pdev->dev; ret = request_threaded_irq(irq, NULL, wm831x_on_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT, diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 47000c30e4d8..a8e9b9ab9f84 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -449,7 +449,6 @@ static int cyapa_create_input_dev(struct cyapa *cyapa) input->id.bustype = BUS_I2C; input->id.version = 1; input->id.product = 0; /* Means any product in eventcomm. */ - input->dev.parent = &cyapa->client->dev; input->open = cyapa_open; input->close = cyapa_close; @@ -1463,9 +1462,9 @@ MODULE_DEVICE_TABLE(i2c, cyapa_id_table); #ifdef CONFIG_ACPI static const struct acpi_device_id cyapa_acpi_id[] = { - { "CYAP0000", 0 }, /* Gen3 trackpad with 0x67 I2C address. */ - { "CYAP0001", 0 }, /* Gen5 trackpad with 0x24 I2C address. */ - { "CYAP0002", 0 }, /* Gen6 trackpad with 0x24 I2C address. */ + { .id = "CYAP0000" }, /* Gen3 trackpad with 0x67 I2C address. */ + { .id = "CYAP0001" }, /* Gen5 trackpad with 0x24 I2C address. */ + { .id = "CYAP0002" }, /* Gen6 trackpad with 0x24 I2C address. */ { } }; MODULE_DEVICE_TABLE(acpi, cyapa_acpi_id); diff --git a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c index 0c8f7d1b02aa..f67e3eb5841b 100644 --- a/drivers/input/mouse/maplemouse.c +++ b/drivers/input/mouse/maplemouse.c @@ -60,15 +60,13 @@ static void dc_mouse_close(struct input_dev *dev) { struct dc_mouse *mse = input_get_drvdata(dev); - maple_getcond_callback(mse->mdev, dc_mouse_callback, 0, - MAPLE_FUNC_MOUSE); + maple_getcond_callback(mse->mdev, NULL, 0, MAPLE_FUNC_MOUSE); } /* allow the mouse to be used */ static int probe_maple_mouse(struct device *dev) { struct maple_device *mdev = to_maple_dev(dev); - struct maple_driver *mdrv = to_maple_driver(dev->driver); int error; struct input_dev *input_dev; struct dc_mouse *mse; @@ -103,14 +101,10 @@ static int probe_maple_mouse(struct device *dev) error = input_register_device(input_dev); if (error) goto fail_register; - - mdev->driver = mdrv; - return error; fail_register: input_free_device(input_dev); - maple_set_drvdata(mdev, NULL); fail_nomem: kfree(mse); fail: @@ -122,9 +116,7 @@ static int remove_maple_mouse(struct device *dev) struct maple_device *mdev = to_maple_dev(dev); struct dc_mouse *mse = maple_get_drvdata(mdev); - mdev->callback = NULL; input_unregister_device(mse->dev); - maple_set_drvdata(mdev, NULL); kfree(mse); return 0; diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index 43453ec533b2..985539f1d088 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -1,6 +1,4 @@ /* - * drivers/input/serio/gscps2.c - * * Copyright (c) 2004-2006 Helge Deller <deller@gmx.de> * Copyright (c) 2002 Laurent Canet <canetl@esiee.fr> * Copyright (c) 2002 Thibaut Varene <varenet@parisc-linux.org> @@ -28,6 +26,7 @@ #include <linux/io.h> #include <linux/ioport.h> #include <linux/property.h> +#include <linux/rcupdate.h> #include <linux/serio.h> #include <asm/irq.h> @@ -37,16 +36,10 @@ MODULE_AUTHOR("Laurent Canet <canetl@esiee.fr>, Thibaut Varene <varenet@parisc-l MODULE_DESCRIPTION("HP GSC PS2 port driver"); MODULE_LICENSE("GPL"); -#define PFX "gscps2.c: " - /* * Driver constants */ -/* various constants */ -#define ENABLE 1 -#define DISABLE 0 - #define GSC_DINO_OFFSET 0x0800 /* offset for DINO controller versus LASI one */ /* PS/2 IO port offsets */ @@ -77,23 +70,21 @@ MODULE_LICENSE("GPL"); #define GSC_ID_KEYBOARD 0 /* device ID values */ #define GSC_ID_MOUSE 1 -#ifndef CONFIG_SERIO_GSCPS2_RDI_KEYCODES -# define CONFLICT(x, y) x -#else -# define CONFLICT(x, y) y -#endif +#define RDI_CONFLICT(x, y) \ + ((x) * !IS_ENABLED(CONFIG_SERIO_GSCPS2_RDI_KEYCODES) + \ + (y) * IS_ENABLED(CONFIG_SERIO_GSCPS2_RDI_KEYCODES)) /* * Sadly RDI (Tadpole) decided to ship a different keyboard layout * than HP for their PS/2 laptop keyboard which leads to conflicting * keycodes between a normal HP PS/2 keyboard and a RDI PrecisionBook. - * HP: RDI: + * HP: RDI: */ -#define C_07 CONFLICT(KEY_F12, KEY_F1) -#define C_11 CONFLICT(KEY_LEFTALT, KEY_LEFTCTRL) -#define C_14 CONFLICT(KEY_LEFTCTRL, KEY_CAPSLOCK) -#define C_58 CONFLICT(KEY_CAPSLOCK, KEY_RIGHTCTRL) -#define C_61 CONFLICT(KEY_102ND, KEY_LEFT) +#define C_07 RDI_CONFLICT(KEY_F12, KEY_F1) +#define C_11 RDI_CONFLICT(KEY_LEFTALT, KEY_LEFTCTRL) +#define C_14 RDI_CONFLICT(KEY_LEFTCTRL, KEY_CAPSLOCK) +#define C_58 RDI_CONFLICT(KEY_CAPSLOCK, KEY_RIGHTCTRL) +#define C_61 RDI_CONFLICT(KEY_102ND, KEY_LEFT) /* * Special keycode value recognized by atkbd (ATKBD_KEY_NULL) to silently @@ -188,8 +179,6 @@ static const struct software_node gscps2_keyboard_node = { .properties = gscps2_props, }; -static irqreturn_t gscps2_interrupt(int irq, void *dev); - #define BUFFER_SIZE 0x0f /* GSC PS/2 port device struct */ @@ -197,33 +186,35 @@ struct gscps2port { struct list_head node; struct parisc_device *padev; struct serio *port; - spinlock_t lock; + spinlock_t lock; /* serializes HW access */ char __iomem *addr; u8 act, append; /* position in buffer[] */ struct { u8 data; u8 str; - } buffer[BUFFER_SIZE+1]; + } buffer[BUFFER_SIZE + 1]; int id; }; +static DEFINE_SPINLOCK(ps2port_list_lock); +static LIST_HEAD(ps2port_list); + /* * Various HW level routines */ -#define gscps2_readb_input(x) readb((x)+GSC_RCVDATA) -#define gscps2_readb_control(x) readb((x)+GSC_CONTROL) -#define gscps2_readb_status(x) readb((x)+GSC_STATUS) -#define gscps2_writeb_control(x, y) writeb((x), (y)+GSC_CONTROL) - +#define gscps2_readb_input(x) readb((x) + GSC_RCVDATA) +#define gscps2_readb_control(x) readb((x) + GSC_CONTROL) +#define gscps2_readb_status(x) readb((x) + GSC_STATUS) +#define gscps2_writeb_control(x, y) writeb((x), (y) + GSC_CONTROL) /* * wait_TBE() - wait for Transmit Buffer Empty */ - static int wait_TBE(char __iomem *addr) { int timeout = 25000; /* device is expected to react within 250 msec */ + while (gscps2_readb_status(addr) & GSC_STAT_TBNE) { if (!--timeout) return 0; /* This should not happen */ @@ -232,102 +223,39 @@ static int wait_TBE(char __iomem *addr) return 1; } - /* * gscps2_flush() - flush the receive buffer */ - static void gscps2_flush(struct gscps2port *ps2port) { + lockdep_assert_held(&ps2port->lock); + while (gscps2_readb_status(ps2port->addr) & GSC_STAT_RBNE) gscps2_readb_input(ps2port->addr); - ps2port->act = ps2port->append = 0; + ps2port->act = 0; + ps2port->append = 0; } -/* - * gscps2_writeb_output() - write a byte to the port - * - * returns 1 on success, 0 on error - */ - -static inline int gscps2_writeb_output(struct gscps2port *ps2port, u8 data) +static bool gscps2_read_data(struct gscps2port *ps2port) { - char __iomem *addr = ps2port->addr; - - if (!wait_TBE(addr)) { - printk(KERN_DEBUG PFX "timeout - could not write byte %#x\n", data); - return 0; - } - - while (gscps2_readb_status(addr) & GSC_STAT_RBNE) - /* wait */; - - scoped_guard(spinlock_irqsave, &ps2port->lock) - writeb(data, addr+GSC_XMTDATA); - - /* this is ugly, but due to timing of the port it seems to be necessary. */ - mdelay(6); - - /* make sure any received data is returned as fast as possible */ - /* this is important e.g. when we set the LEDs on the keyboard */ - gscps2_interrupt(0, NULL); - - return 1; -} - - -/* - * gscps2_enable() - enables or disables the port - */ - -static void gscps2_enable(struct gscps2port *ps2port, int enable) -{ - u8 data; - - /* now enable/disable the port */ - scoped_guard(spinlock_irqsave, &ps2port->lock) { - gscps2_flush(ps2port); - data = gscps2_readb_control(ps2port->addr); - if (enable) - data |= GSC_CTRL_ENBL; - else - data &= ~GSC_CTRL_ENBL; - gscps2_writeb_control(data, ps2port->addr); - } - - wait_TBE(ps2port->addr); - gscps2_flush(ps2port); -} - -/* - * gscps2_reset() - resets the PS/2 port - */ + bool read_any = false; + u8 status; -static void gscps2_reset(struct gscps2port *ps2port) -{ - /* reset the interface */ guard(spinlock_irqsave)(&ps2port->lock); - gscps2_flush(ps2port); - writeb(0xff, ps2port->addr + GSC_RESET); - gscps2_flush(ps2port); -} - -static LIST_HEAD(ps2port_list); - -static void gscps2_read_data(struct gscps2port *ps2port) -{ - u8 status; do { status = gscps2_readb_status(ps2port->addr); if (!(status & GSC_STAT_RBNE)) break; + read_any = true; ps2port->buffer[ps2port->append].str = status; ps2port->buffer[ps2port->append].data = gscps2_readb_input(ps2port->addr); ps2port->append = (ps2port->append + 1) & BUFFER_SIZE; } while (true); + + return read_any; } static bool gscps2_report_data(struct gscps2port *ps2port) @@ -335,7 +263,7 @@ static bool gscps2_report_data(struct gscps2port *ps2port) unsigned int rxflags; u8 data, status; - while (ps2port->act != ps2port->append) { + while (true) { /* * Did new data arrived while we read existing data ? * If yes, exit now and let the new irq handler start @@ -344,19 +272,24 @@ static bool gscps2_report_data(struct gscps2port *ps2port) if (gscps2_readb_status(ps2port->addr) & GSC_STAT_CMPINTR) return true; - status = ps2port->buffer[ps2port->act].str; - data = ps2port->buffer[ps2port->act].data; + scoped_guard(spinlock_irqsave, &ps2port->lock) { + if (ps2port->act == ps2port->append) + return false; - ps2port->act = (ps2port->act + 1) & BUFFER_SIZE; - rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0 ) | - ((status & GSC_STAT_PERR) ? SERIO_PARITY : 0 ); + status = ps2port->buffer[ps2port->act].str; + data = ps2port->buffer[ps2port->act].data; + ps2port->act = (ps2port->act + 1) & BUFFER_SIZE; + } + + rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0) | + ((status & GSC_STAT_PERR) ? SERIO_PARITY : 0); serio_interrupt(ps2port->port, data, rxflags); } - - return false; } +static DEFINE_SPINLOCK(gscps2_interrupt_lock); + /** * gscps2_interrupt() - Interruption service routine * @irq: interrupt number which triggered (unused) @@ -370,39 +303,106 @@ static bool gscps2_report_data(struct gscps2port *ps2port) * the data as fast as possible and handle the reporting to the upper layer * later. */ - static irqreturn_t gscps2_interrupt(int irq, void *dev) { struct gscps2port *ps2port; + bool handled = false; + bool more_data; - list_for_each_entry(ps2port, &ps2port_list, node) { - guard(spinlock_irqsave)(&ps2port->lock); + ACQUIRE(spinlock_irqsave_try, lock)(&gscps2_interrupt_lock); + if (ACQUIRE_ERR(spinlock_irqsave_try, &lock)) + return IRQ_NONE; - gscps2_read_data(ps2port); - } /* list_for_each_entry */ + guard(rcu)(); - /* all data was read from the ports - now report the data to upper layer */ - list_for_each_entry(ps2port, &ps2port_list, node) { - if (gscps2_report_data(ps2port)) { - /* More data ready - break early to restart interrupt */ - break; + do { + more_data = false; + + list_for_each_entry_rcu(ps2port, &ps2port_list, node) { + if (gscps2_read_data(ps2port)) + handled = true; } + + /* all data was read from the ports - now report the data to upper layer */ + list_for_each_entry_rcu(ps2port, &ps2port_list, node) { + if (gscps2_report_data(ps2port)) { + /* More data ready - restart loop to read new data */ + more_data = true; + break; + } + } + } while (more_data); + + return IRQ_RETVAL(handled); +} + +/* + * gscps2_writeb_output() - write a byte to the port + * + * returns 1 on success, 0 on error + */ +static inline int gscps2_writeb_output(struct gscps2port *ps2port, u8 data) +{ + char __iomem *addr = ps2port->addr; + + if (!wait_TBE(addr)) { + dev_dbg(&ps2port->padev->dev, "timeout - could not write byte %#x\n", data); + return 0; + } + + while (gscps2_readb_status(addr) & GSC_STAT_RBNE) + cpu_relax(); + + scoped_guard(spinlock_irqsave, &ps2port->lock) + writeb(data, addr + GSC_XMTDATA); + + return 1; +} + +/* + * gscps2_enable() - enables or disables the port + */ +static void gscps2_enable(struct gscps2port *ps2port, bool enable) +{ + u8 data; + + /* now enable/disable the port */ + scoped_guard(spinlock_irqsave, &ps2port->lock) { + gscps2_flush(ps2port); + data = gscps2_readb_control(ps2port->addr); + if (enable) + data |= GSC_CTRL_ENBL; + else + data &= ~GSC_CTRL_ENBL; + gscps2_writeb_control(data, ps2port->addr); } - return IRQ_HANDLED; + wait_TBE(ps2port->addr); + scoped_guard(spinlock_irqsave, &ps2port->lock) + gscps2_flush(ps2port); } +/* + * gscps2_reset() - resets the PS/2 port + */ +static void gscps2_reset(struct gscps2port *ps2port) +{ + /* reset the interface */ + guard(spinlock_irqsave)(&ps2port->lock); + gscps2_flush(ps2port); + writeb(0xff, ps2port->addr + GSC_RESET); + gscps2_flush(ps2port); +} /* * gscps2_write() - send a byte out through the aux interface. */ - static int gscps2_write(struct serio *port, unsigned char data) { struct gscps2port *ps2port = port->port_data; if (!gscps2_writeb_output(ps2port, data)) { - printk(KERN_DEBUG PFX "sending byte %#x failed.\n", data); + dev_dbg(&ps2port->padev->dev, "sending byte %#x failed.\n", data); return -1; } return 0; @@ -412,15 +412,17 @@ static int gscps2_write(struct serio *port, unsigned char data) * gscps2_open() is called when a port is opened by the higher layer. * It resets and enables the port. */ - static int gscps2_open(struct serio *port) { struct gscps2port *ps2port = port->port_data; gscps2_reset(ps2port); + scoped_guard(spinlock_irqsave, &ps2port_list_lock) + list_add_tail_rcu(&ps2port->node, &ps2port_list); + /* enable it */ - gscps2_enable(ps2port, ENABLE); + gscps2_enable(ps2port, true); gscps2_interrupt(0, NULL); @@ -430,11 +432,16 @@ static int gscps2_open(struct serio *port) /* * gscps2_close() disables the port */ - static void gscps2_close(struct serio *port) { struct gscps2port *ps2port = port->port_data; - gscps2_enable(ps2port, DISABLE); + + gscps2_enable(ps2port, false); + + scoped_guard(spinlock_irqsave, &ps2port_list_lock) + list_del_rcu(&ps2port->node); + + synchronize_rcu(); } /** @@ -443,7 +450,6 @@ static void gscps2_close(struct serio *port) * * @return: success/error report */ - static int __init gscps2_probe(struct parisc_device *dev) { struct gscps2port *ps2port; @@ -469,6 +475,7 @@ static int __init gscps2_probe(struct parisc_device *dev) ps2port->port = serio; ps2port->padev = dev; + INIT_LIST_HEAD(&ps2port->node); ps2port->addr = ioremap(hpa, GSC_STATUS + 4); if (!ps2port->addr) { ret = -ENOMEM; @@ -494,8 +501,8 @@ static int __init gscps2_probe(struct parisc_device *dev) goto fail_miserably; if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) { - printk(KERN_WARNING PFX "Unsupported PS/2 port at 0x%08lx (id=%d) ignored\n", - hpa, ps2port->id); + dev_warn(&dev->dev, "Unsupported PS/2 port at 0x%08lx (id=%d) ignored\n", + hpa, ps2port->id); ret = -ENODEV; goto fail; } @@ -524,8 +531,6 @@ static int __init gscps2_probe(struct parisc_device *dev) serio_register_port(ps2port->port); - list_add_tail(&ps2port->node, &ps2port_list); - return 0; fail: @@ -552,7 +557,6 @@ fail_nomem: * * @return: success/error report */ - static void __exit gscps2_remove(struct parisc_device *dev) { struct gscps2port *ps2port = dev_get_drvdata(&dev->dev); @@ -562,17 +566,15 @@ static void __exit gscps2_remove(struct parisc_device *dev) serio_unregister_port(ps2port->port); free_irq(dev->irq, ps2port); - gscps2_flush(ps2port); - list_del(&ps2port->node); + scoped_guard(spinlock_irqsave, &ps2port->lock) + gscps2_flush(ps2port); iounmap(ps2port->addr); #if 0 release_mem_region(dev->hpa, GSC_STATUS + 4); #endif - dev_set_drvdata(&dev->dev, NULL); kfree(ps2port); } - static const struct parisc_device_id gscps2_device_tbl[] __initconst = { { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00084 }, /* LASI PS/2 */ #ifdef DINO_TESTED @@ -610,6 +612,5 @@ static void __exit gscps2_exit(void) software_node_unregister(&gscps2_keyboard_node); } - module_init(gscps2_init); module_exit(gscps2_exit); diff --git a/drivers/input/tests/input_test.c b/drivers/input/tests/input_test.c index e105ce71a920..b8c8f04c041b 100644 --- a/drivers/input/tests/input_test.c +++ b/drivers/input/tests/input_test.c @@ -8,6 +8,7 @@ #include <linux/delay.h> #include <linux/input.h> +#include <kunit/device.h> #include <kunit/test.h> #define POLL_INTERVAL 100 @@ -161,11 +162,44 @@ static void input_test_grab(struct kunit *test) input_put_device(input_dev); } +static void input_test_managed_parent_override(struct kunit *test) +{ + struct device *owner, *other_dev; + struct input_dev *input_dev; + + owner = kunit_device_register(test, "input-test-owner"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, owner); + + other_dev = kunit_device_register(test, "input-test-other"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, other_dev); + + /* Overriding dev.parent to another device must be rejected */ + input_dev = devm_input_allocate_device(owner); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, input_dev); + input_dev->name = "Managed input device (reparented)"; + input_dev->dev.parent = other_dev; + KUNIT_EXPECT_EQ(test, input_register_device(input_dev), -EINVAL); + + /* Clearing dev.parent to NULL must be rejected */ + input_dev = devm_input_allocate_device(owner); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, input_dev); + input_dev->name = "Managed input device (null parent)"; + input_dev->dev.parent = NULL; + KUNIT_EXPECT_EQ(test, input_register_device(input_dev), -EINVAL); + + /* Preserving original owner as dev.parent succeeds */ + input_dev = devm_input_allocate_device(owner); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, input_dev); + input_dev->name = "Managed input device (valid parent)"; + KUNIT_EXPECT_EQ(test, input_register_device(input_dev), 0); +} + static struct kunit_case input_tests[] = { KUNIT_CASE(input_test_polling), KUNIT_CASE(input_test_timestamp), KUNIT_CASE(input_test_match_device_id), KUNIT_CASE(input_test_grab), + KUNIT_CASE(input_test_managed_parent_override), { /* sentinel */ } }; diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c index 0468ce2b216f..dd545a719019 100644 --- a/drivers/input/touchscreen/88pm860x-ts.c +++ b/drivers/input/touchscreen/88pm860x-ts.c @@ -246,7 +246,6 @@ static int pm860x_touch_probe(struct platform_device *pdev) touch->idev->name = "88pm860x-touch"; touch->idev->phys = "88pm860x/input0"; touch->idev->id.bustype = BUS_I2C; - touch->idev->dev.parent = &pdev->dev; touch->idev->open = pm860x_touch_open; touch->idev->close = pm860x_touch_close; touch->chip = chip; diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index cc39057d0117..90311df47e4f 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c @@ -725,7 +725,6 @@ static int ad7877_probe(struct spi_device *spi) input_dev->name = "AD7877 Touchscreen"; input_dev->phys = ts->phys; - input_dev->dev.parent = &spi->dev; __set_bit(EV_KEY, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 31d2a3029d5f..0789d8e19eab 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -545,7 +545,6 @@ int ad7879_probe(struct device *dev, struct regmap *regmap, input_dev->name = "AD7879 Touchscreen"; input_dev->phys = ts->phys; - input_dev->dev.parent = dev; input_dev->id.bustype = bustype; input_dev->open = ad7879_open; diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c index aa43fc1549df..a56b114bcb36 100644 --- a/drivers/input/touchscreen/ar1021_i2c.c +++ b/drivers/input/touchscreen/ar1021_i2c.c @@ -111,7 +111,6 @@ static int ar1021_i2c_probe(struct i2c_client *client) input->name = "ar1021 I2C Touchscreen"; input->id.bustype = BUS_I2C; - input->dev.parent = &client->dev; input->open = ar1021_i2c_open; input->close = ar1021_i2c_close; diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 2c0e5a67135b..522e1ea405a6 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3409,8 +3409,8 @@ MODULE_DEVICE_TABLE(of, mxt_of_match); #ifdef CONFIG_ACPI static const struct acpi_device_id mxt_acpi_id[] = { - { "ATML0000", 0 }, /* Touchpad */ - { "ATML0001", 0 }, /* Touchscreen */ + { .id = "ATML0000" }, /* Touchpad */ + { .id = "ATML0001" }, /* Touchscreen */ { } }; MODULE_DEVICE_TABLE(acpi, mxt_acpi_id); diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c index e49bde50d77a..42c27b2ef949 100644 --- a/drivers/input/touchscreen/bcm_iproc_tsc.c +++ b/drivers/input/touchscreen/bcm_iproc_tsc.c @@ -459,7 +459,6 @@ static int iproc_ts_probe(struct platform_device *pdev) /* Set input device info */ idev->name = IPROC_TS_NAME; - idev->dev.parent = &pdev->dev; idev->id.bustype = BUS_HOST; idev->id.vendor = SERIO_UNKNOWN; diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c index 1b10a757313c..03b62706e39f 100644 --- a/drivers/input/touchscreen/chipone_icn8318.c +++ b/drivers/input/touchscreen/chipone_icn8318.c @@ -202,7 +202,6 @@ static int icn8318_probe(struct i2c_client *client) input->id.bustype = BUS_I2C; input->open = icn8318_start; input->close = icn8318_stop; - input->dev.parent = dev; input_set_capability(input, EV_ABS, ABS_MT_POSITION_X); input_set_capability(input, EV_ABS, ABS_MT_POSITION_Y); diff --git a/drivers/input/touchscreen/chipone_icn8505.c b/drivers/input/touchscreen/chipone_icn8505.c index cde0e4789503..7d0a488166bb 100644 --- a/drivers/input/touchscreen/chipone_icn8505.c +++ b/drivers/input/touchscreen/chipone_icn8505.c @@ -486,7 +486,7 @@ static int icn8505_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(icn8505_pm_ops, icn8505_suspend, icn8505_resume); static const struct acpi_device_id icn8505_acpi_match[] = { - { "CHPN0001" }, + { .id = "CHPN0001" }, { } }; MODULE_DEVICE_TABLE(acpi, icn8505_acpi_match); diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c index 89c4d7b2b89e..6067bf061125 100644 --- a/drivers/input/touchscreen/colibri-vf50-ts.c +++ b/drivers/input/touchscreen/colibri-vf50-ts.c @@ -303,7 +303,6 @@ static int vf50_ts_probe(struct platform_device *pdev) input->name = DRIVER_NAME; input->id.bustype = BUS_HOST; - input->dev.parent = dev; input->open = vf50_ts_open; input->close = vf50_ts_close; diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c index e878a02dc9b7..c6f7c0b041a1 100644 --- a/drivers/input/touchscreen/cyttsp5.c +++ b/drivers/input/touchscreen/cyttsp5.c @@ -943,7 +943,7 @@ static const struct i2c_device_id cyttsp5_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, cyttsp5_i2c_id); -static int __maybe_unused cyttsp5_suspend(struct device *dev) +static int cyttsp5_suspend(struct device *dev) { struct cyttsp5 *ts = dev_get_drvdata(dev); @@ -953,7 +953,7 @@ static int __maybe_unused cyttsp5_suspend(struct device *dev) return 0; } -static int __maybe_unused cyttsp5_resume(struct device *dev) +static int cyttsp5_resume(struct device *dev) { struct cyttsp5 *ts = dev_get_drvdata(dev); @@ -963,13 +963,13 @@ static int __maybe_unused cyttsp5_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(cyttsp5_pm, cyttsp5_suspend, cyttsp5_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cyttsp5_pm, cyttsp5_suspend, cyttsp5_resume); static struct i2c_driver cyttsp5_i2c_driver = { .driver = { .name = CYTTSP5_NAME, .of_match_table = cyttsp5_of_match, - .pm = &cyttsp5_pm, + .pm = pm_sleep_ptr(&cyttsp5_pm), }, .probe = cyttsp5_i2c_probe, .id_table = cyttsp5_i2c_id, diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 012dfcae01cc..b535e38f895f 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -658,7 +658,6 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, input_dev->name = "Cypress TTSP TouchScreen"; input_dev->id.bustype = bus_ops->bustype; - input_dev->dev.parent = ts->dev; input_dev->open = cyttsp_open; input_dev->close = cyttsp_close; diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c index 2943f6a58388..2c46079e47d0 100644 --- a/drivers/input/touchscreen/da9034-ts.c +++ b/drivers/input/touchscreen/da9034-ts.c @@ -330,7 +330,6 @@ static int da9034_touch_probe(struct platform_device *pdev) input_dev->name = pdev->name; input_dev->open = da9034_touch_open; input_dev->close = da9034_touch_close; - input_dev->dev.parent = &pdev->dev; __set_bit(EV_ABS, input_dev->evbit); __set_bit(ABS_X, input_dev->absbit); diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index d6c3d033b83d..e69d64c3db2d 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1292,7 +1292,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client) input->name = tsdata->name; input->id.bustype = BUS_I2C; - input->dev.parent = &client->dev; input_set_abs_params(input, ABS_MT_POSITION_X, 0, tsdata->num_x * 64 - 1, 0, 0); diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 17175adcaebb..7a651899feb1 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -1360,9 +1360,9 @@ static void elants_i2c_power_off(void *_data) #ifdef CONFIG_ACPI static const struct acpi_device_id i2c_hid_ids[] = { - {"ACPI0C50", 0 }, - {"PNP0C50", 0 }, - { }, + { .id = "ACPI0C50" }, + { .id = "PNP0C50" }, + { } }; static const guid_t i2c_hid_guid = @@ -1624,7 +1624,7 @@ MODULE_DEVICE_TABLE(i2c, elants_i2c_id); #ifdef CONFIG_ACPI static const struct acpi_device_id elants_acpi_id[] = { - { "ELAN0001", EKTH3500 }, + { .id = "ELAN0001", .driver_data = EKTH3500 }, { } }; MODULE_DEVICE_TABLE(acpi, elants_acpi_id); diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c index 037bb35238a3..d1f9b44d9d76 100644 --- a/drivers/input/touchscreen/exc3000.c +++ b/drivers/input/touchscreen/exc3000.c @@ -453,7 +453,7 @@ MODULE_DEVICE_TABLE(of, exc3000_of_match); #ifdef CONFIG_ACPI static const struct acpi_device_id exc3000_acpi_match[] = { - { "EGA00001", .driver_data = (kernel_ulong_t)&exc3000_info[EETI_EXC80H60] }, + { .id = "EGA00001", .driver_data = (kernel_ulong_t)&exc3000_info[EETI_EXC80H60] }, { } }; MODULE_DEVICE_TABLE(acpi, exc3000_acpi_match); diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 03efc0c792c2..7609366f0b78 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -1531,10 +1531,10 @@ MODULE_DEVICE_TABLE(i2c, goodix_ts_id); #ifdef CONFIG_ACPI static const struct acpi_device_id goodix_acpi_match[] = { - { "GDIX1001", 0 }, - { "GDIX1002", 0 }, - { "GDIX1003", 0 }, - { "GDX9110", 0 }, + { .id = "GDIX1001" }, + { .id = "GDIX1002" }, + { .id = "GDIX1003" }, + { .id = "GDX9110" }, { } }; MODULE_DEVICE_TABLE(acpi, goodix_acpi_match); diff --git a/drivers/input/touchscreen/hideep.c b/drivers/input/touchscreen/hideep.c index 58e00c314ace..68ee61c71df6 100644 --- a/drivers/input/touchscreen/hideep.c +++ b/drivers/input/touchscreen/hideep.c @@ -1088,7 +1088,7 @@ MODULE_DEVICE_TABLE(i2c, hideep_i2c_id); #ifdef CONFIG_ACPI static const struct acpi_device_id hideep_acpi_id[] = { - { "HIDP0001", 0 }, + { .id = "HIDP0001" }, { } }; MODULE_DEVICE_TABLE(acpi, hideep_acpi_id); diff --git a/drivers/input/touchscreen/hycon-hy46xx.c b/drivers/input/touchscreen/hycon-hy46xx.c index 1513f20cbf51..8ca408d66caf 100644 --- a/drivers/input/touchscreen/hycon-hy46xx.c +++ b/drivers/input/touchscreen/hycon-hy46xx.c @@ -499,7 +499,6 @@ static int hycon_hy46xx_probe(struct i2c_client *client) input->name = "Hycon Capacitive Touch"; input->id.bustype = BUS_I2C; - input->dev.parent = &client->dev; input_set_abs_params(input, ABS_MT_POSITION_X, 0, -1, 0, 0); input_set_abs_params(input, ABS_MT_POSITION_Y, 0, -1, 0, 0); diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c index 3de0fbf8da38..cdd02b7b6f67 100644 --- a/drivers/input/touchscreen/ilitek_ts_i2c.c +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c @@ -646,8 +646,8 @@ MODULE_DEVICE_TABLE(i2c, ilitek_ts_i2c_id); #ifdef CONFIG_ACPI static const struct acpi_device_id ilitekts_acpi_id[] = { - { "ILTK0001", 0 }, - { }, + { .id = "ILTK0001" }, + { } }; MODULE_DEVICE_TABLE(acpi, ilitekts_acpi_id); #endif diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index 974521102178..ba4e3c6e5c91 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c @@ -123,7 +123,6 @@ static int jornada720_ts_probe(struct platform_device *pdev) input_dev->name = "HP Jornada 7xx Touchscreen"; input_dev->phys = "jornadats/input0"; input_dev->id.bustype = BUS_HOST; - input_dev->dev.parent = &pdev->dev; input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c index 3996e4a61ff7..2191b4f8a00b 100644 --- a/drivers/input/touchscreen/max11801_ts.c +++ b/drivers/input/touchscreen/max11801_ts.c @@ -186,7 +186,6 @@ static int max11801_ts_probe(struct i2c_client *client) input_dev->name = "max11801_ts"; input_dev->id.bustype = BUS_I2C; - input_dev->dev.parent = &client->dev; __set_bit(EV_ABS, input_dev->evbit); __set_bit(EV_KEY, input_dev->evbit); diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index fd6c0ac301a2..0c8a922e2f2e 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1529,8 +1529,8 @@ MODULE_DEVICE_TABLE(of, mip4_of_match); #ifdef CONFIG_ACPI static const struct acpi_device_id mip4_acpi_match[] = { - { "MLFS0000", 0}, - { }, + { .id = "MLFS0000" }, + { } }; MODULE_DEVICE_TABLE(acpi, mip4_acpi_match); #endif diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 27911a9f4e9e..f6039a47f7e9 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -626,7 +626,6 @@ static int mms114_probe(struct i2c_client *client) return -ENOMEM; input_dev->id.bustype = BUS_I2C; - input_dev->dev.parent = &client->dev; input_dev->open = mms114_input_open; input_dev->close = mms114_input_close; @@ -679,6 +678,13 @@ static int mms114_suspend(struct device *dev) struct input_dev *input_dev = data->input_dev; int id; + guard(mutex)(&input_dev->mutex); + + if (!input_device_enabled(input_dev)) + return 0; + + mms114_stop(data); + /* Release all touch */ for (id = 0; id < MMS114_MAX_TOUCH; id++) { input_mt_slot(input_dev, id); @@ -688,11 +694,6 @@ static int mms114_suspend(struct device *dev) input_mt_report_pointer_emulation(input_dev, true); input_sync(input_dev); - guard(mutex)(&input_dev->mutex); - - if (input_device_enabled(input_dev)) - mms114_stop(data); - return 0; } diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index 0256055abcef..d046eba4b12d 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -1227,8 +1227,8 @@ MODULE_DEVICE_TABLE(i2c, raydium_i2c_id); #ifdef CONFIG_ACPI static const struct acpi_device_id raydium_acpi_id[] = { - { "RAYD0001", 0 }, - { /* sentinel */ } + { .id = "RAYD0001" }, + { } }; MODULE_DEVICE_TABLE(acpi, raydium_acpi_id); #endif diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c index 899c179fb2d3..1bd4ddffe4e1 100644 --- a/drivers/input/touchscreen/s6sy761.c +++ b/drivers/input/touchscreen/s6sy761.c @@ -433,8 +433,6 @@ static int s6sy761_probe(struct i2c_client *client) input_set_abs_params(sdata->input, ABS_MT_POSITION_Y, 0, max_y, 0, 0); input_set_abs_params(sdata->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); input_set_abs_params(sdata->input, ABS_MT_TOUCH_MINOR, 0, 255, 0, 0); - input_set_abs_params(sdata->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); - input_set_abs_params(sdata->input, ABS_MT_TOUCH_MINOR, 0, 255, 0, 0); input_set_abs_params(sdata->input, ABS_MT_PRESSURE, 0, 255, 0, 0); touchscreen_parse_properties(sdata->input, true, &sdata->prop); diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index 44d7141103f4..6014c4e049a6 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -788,15 +788,15 @@ MODULE_DEVICE_TABLE(i2c, silead_ts_id); #ifdef CONFIG_ACPI static const struct acpi_device_id silead_ts_acpi_match[] = { - { "GSL1680", 0 }, - { "GSL1688", 0 }, - { "GSL3670", 0 }, - { "GSL3675", 0 }, - { "GSL3692", 0 }, - { "MSSL1680", 0 }, - { "MSSL0001", 0 }, - { "MSSL0002", 0 }, - { "MSSL0017", 0 }, + { .id = "GSL1680" }, + { .id = "GSL1688" }, + { .id = "GSL3670" }, + { .id = "GSL3675" }, + { .id = "GSL3692" }, + { .id = "MSSL1680" }, + { .id = "MSSL0001" }, + { .id = "MSSL0002" }, + { .id = "MSSL0017" }, { } }; MODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match); diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c index 6074b7730e86..9d74efc8d986 100644 --- a/drivers/input/touchscreen/surface3_spi.c +++ b/drivers/input/touchscreen/surface3_spi.c @@ -392,7 +392,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(surface3_spi_pm_ops, #ifdef CONFIG_ACPI static const struct acpi_device_id surface3_spi_acpi_match[] = { - { "MSHW0037", 0 }, + { .id = "MSHW0037" }, { } }; MODULE_DEVICE_TABLE(acpi, surface3_spi_acpi_match); diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c index 0d92aaeea3e0..7311b5cd573f 100644 --- a/drivers/input/touchscreen/sx8654.c +++ b/drivers/input/touchscreen/sx8654.c @@ -345,7 +345,6 @@ static int sx8654_probe(struct i2c_client *client) input->name = "SX8654 I2C Touchscreen"; input->id.bustype = BUS_I2C; - input->dev.parent = &client->dev; input->open = sx8654_open; input->close = sx8654_close; diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index f48871767763..e84dc3ea1fcb 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -251,7 +251,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev) input_dev->name = "TPS6507x Touchscreen"; input_dev->phys = tsc->phys; - input_dev->dev.parent = tsc->dev; input_dev->id.bustype = BUS_I2C; if (init_data) { input_dev->id.vendor = init_data->vendor; diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c index 1af309252092..858c7efd0c29 100644 --- a/drivers/input/touchscreen/wdt87xx_i2c.c +++ b/drivers/input/touchscreen/wdt87xx_i2c.c @@ -1147,7 +1147,7 @@ MODULE_DEVICE_TABLE(i2c, wdt87xx_dev_id); #ifdef CONFIG_ACPI static const struct acpi_device_id wdt87xx_acpi_id[] = { - { "WDHT0001", 0 }, + { .id = "WDHT0001" }, { } }; MODULE_DEVICE_TABLE(acpi, wdt87xx_acpi_id); diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 98f8ec408cad..17c58b6fa123 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c @@ -356,7 +356,6 @@ static int wm831x_ts_probe(struct platform_device *pdev) input_set_abs_params(input_dev, ABS_PRESSURE, 0, 4095, 5, 0); input_set_drvdata(input_dev, wm831x_ts); - input_dev->dev.parent = &pdev->dev; error = input_register_device(input_dev); if (error) diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index c51822563f3f..f6b7c03f654f 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -567,7 +567,6 @@ static int wm97xx_register_touch(struct wm97xx *wm) abs_p[2], 0); input_set_drvdata(wm->input_dev, wm); - wm->input_dev->dev.parent = wm->dev; ret = input_register_device(wm->input_dev); if (ret) |
