Merge tag 'input-for-v6.7-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 9 Nov 2023 22:18:42 +0000 (14:18 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 9 Nov 2023 22:18:42 +0000 (14:18 -0800)
Pull input updates from Dmitry Torokhov:

 - a number of input drivers has been converted to use facilities
   provided by the device core to instantiate driver-specific attributes
   instead of using devm_device_add_group() and similar APIs

 - platform input devices have been converted to use remove() callback
   returning void

 - a fix for use-after-free when tearing down a Synaptics RMI device

 - a few flexible arrays in input structures have been annotated with
   __counted_by to help hardening efforts

 - handling of vddio supply in cyttsp5 driver

 - other miscellaneous fixups

* tag 'input-for-v6.7-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (86 commits)
  Input: walkera0701 - use module_parport_driver macro to simplify the code
  Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
  dt-bindings: input: fsl,scu-key: Document wakeup-source
  Input: cyttsp5 - add handling for vddio regulator
  dt-bindings: input: cyttsp5: document vddio-supply
  Input: tegra-kbc - use device_get_match_data()
  Input: Annotate struct ff_device with __counted_by
  Input: axp20x-pek - avoid needless newline removal
  Input: mt - annotate struct input_mt with __counted_by
  Input: leds - annotate struct input_leds with __counted_by
  Input: evdev - annotate struct evdev_client with __counted_by
  Input: synaptics-rmi4 - replace deprecated strncpy
  Input: wm97xx-core - convert to platform remove callback returning void
  Input: wm831x-ts - convert to platform remove callback returning void
  Input: ti_am335x_tsc - convert to platform remove callback returning void
  Input: sun4i-ts - convert to platform remove callback returning void
  Input: stmpe-ts - convert to platform remove callback returning void
  Input: pcap_ts - convert to platform remove callback returning void
  Input: mc13783_ts - convert to platform remove callback returning void
  Input: mainstone-wm97xx - convert to platform remove callback returning void
  ...

91 files changed:
Documentation/devicetree/bindings/input/fsl,scu-key.yaml
Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml
drivers/input/evdev.c
drivers/input/input-leds.c
drivers/input/joystick/walkera0701.c
drivers/input/keyboard/adp5520-keys.c
drivers/input/keyboard/cros_ec_keyb.c
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/iqs62x-keys.c
drivers/input/keyboard/matrix_keypad.c
drivers/input/keyboard/omap-keypad.c
drivers/input/keyboard/omap4-keypad.c
drivers/input/keyboard/samsung-keypad.c
drivers/input/keyboard/sh_keysc.c
drivers/input/keyboard/spear-keyboard.c
drivers/input/keyboard/stmpe-keypad.c
drivers/input/keyboard/tegra-kbc.c
drivers/input/misc/88pm80x_onkey.c
drivers/input/misc/axp20x-pek.c
drivers/input/misc/da9052_onkey.c
drivers/input/misc/da9055_onkey.c
drivers/input/misc/ideapad_slidebar.c
drivers/input/misc/iqs269a.c
drivers/input/misc/kxtj9.c
drivers/input/misc/m68kspkr.c
drivers/input/misc/max8997_haptic.c
drivers/input/misc/mc13783-pwrbutton.c
drivers/input/misc/palmas-pwrbutton.c
drivers/input/misc/pcap_keys.c
drivers/input/misc/pcf50633-input.c
drivers/input/misc/pcspkr.c
drivers/input/misc/pm8941-pwrkey.c
drivers/input/misc/soc_button_array.c
drivers/input/misc/sparcspkr.c
drivers/input/misc/wistron_btns.c
drivers/input/misc/wm831x-on.c
drivers/input/mouse/cyapa.c
drivers/input/mouse/navpoint.c
drivers/input/rmi4/rmi_bus.c
drivers/input/rmi4/rmi_f34.c
drivers/input/serio/altera_ps2.c
drivers/input/serio/ams_delta_serio.c
drivers/input/serio/apbps2.c
drivers/input/serio/arc_ps2.c
drivers/input/serio/ct82c710.c
drivers/input/serio/i8042-sparcio.h
drivers/input/serio/i8042.c
drivers/input/serio/ioc3kbd.c
drivers/input/serio/maceps2.c
drivers/input/serio/olpc_apsp.c
drivers/input/serio/ps2-gpio.c
drivers/input/serio/q40kbd.c
drivers/input/serio/rpckbd.c
drivers/input/serio/sun4i-ps2.c
drivers/input/serio/xilinx_ps2.c
drivers/input/touchscreen/ad7877.c
drivers/input/touchscreen/ad7879-i2c.c
drivers/input/touchscreen/ad7879-spi.c
drivers/input/touchscreen/ad7879.c
drivers/input/touchscreen/ad7879.h
drivers/input/touchscreen/ads7846.c
drivers/input/touchscreen/cyttsp5.c
drivers/input/touchscreen/da9052_tsi.c
drivers/input/touchscreen/edt-ft5x06.c
drivers/input/touchscreen/elants_i2c.c
drivers/input/touchscreen/exc3000.c
drivers/input/touchscreen/hideep.c
drivers/input/touchscreen/hycon-hy46xx.c
drivers/input/touchscreen/ili210x.c
drivers/input/touchscreen/ilitek_ts_i2c.c
drivers/input/touchscreen/iqs5xx.c
drivers/input/touchscreen/mainstone-wm97xx.c
drivers/input/touchscreen/mc13783_ts.c
drivers/input/touchscreen/melfas_mip4.c
drivers/input/touchscreen/pcap_ts.c
drivers/input/touchscreen/raydium_i2c_ts.c
drivers/input/touchscreen/rohm_bu21023.c
drivers/input/touchscreen/s6sy761.c
drivers/input/touchscreen/stmfts.c
drivers/input/touchscreen/stmpe-ts.c
drivers/input/touchscreen/sun4i-ts.c
drivers/input/touchscreen/ti_am335x_tsc.c
drivers/input/touchscreen/tsc2004.c
drivers/input/touchscreen/tsc2005.c
drivers/input/touchscreen/tsc200x-core.c
drivers/input/touchscreen/tsc200x-core.h
drivers/input/touchscreen/wdt87xx_i2c.c
drivers/input/touchscreen/wm831x-ts.c
drivers/input/touchscreen/wm97xx-core.c
include/linux/input.h
include/linux/input/mt.h

index e5a3c355ee1f05a62faa181b45f94146d0d26c98..29921aab9d9713c475654fd1e1e1ebe26a5e08d1 100644 (file)
@@ -24,6 +24,8 @@ properties:
   linux,keycodes:
     maxItems: 1
 
+  wakeup-source: true
+
 required:
   - compatible
   - linux,keycodes
index 4080422a9eb5c2fe26116217e346480323a784ee..037e5d3c447f8a0d0c4585d2a9f2a5a3805ceca6 100644 (file)
@@ -34,6 +34,9 @@ properties:
   vdd-supply:
     description: Regulator for voltage.
 
+  vddio-supply:
+    description: Optional Regulator for I/O voltage.
+
   reset-gpios:
     maxItems: 1
 
index 95f90699d2b17b4e42e067bf44b6deac611fdb8b..51e0c4954600196081cfbc774c5a790c21be6e48 100644 (file)
@@ -50,7 +50,7 @@ struct evdev_client {
        bool revoked;
        unsigned long *evmasks[EV_CNT];
        unsigned int bufsize;
-       struct input_event buffer[];
+       struct input_event buffer[] __counted_by(bufsize);
 };
 
 static size_t evdev_get_mask_cnt(unsigned int type)
index 0b11990ade465022ecaa329ff9653376bb12a695..0e935914bc3aa1ba7cea72a2a6c1e8e01a4a321c 100644 (file)
@@ -44,7 +44,7 @@ struct input_led {
 struct input_leds {
        struct input_handle handle;
        unsigned int num_leds;
-       struct input_led leds[];
+       struct input_led leds[] __counted_by(num_leds);
 };
 
 static enum led_brightness input_leds_brightness_get(struct led_classdev *cdev)
index 56abc8c6c763a35f92fac92dd15c29bcbe0f791c..27d95d6cf56e342e6d76695a3fa6ed3245e43262 100644 (file)
@@ -296,15 +296,4 @@ static struct parport_driver walkera0701_parport_driver = {
        .devmodel = true,
 };
 
-static int __init walkera0701_init(void)
-{
-       return parport_register_driver(&walkera0701_parport_driver);
-}
-
-static void __exit walkera0701_exit(void)
-{
-       parport_unregister_driver(&walkera0701_parport_driver);
-}
-
-module_init(walkera0701_init);
-module_exit(walkera0701_exit);
+module_parport_driver(walkera0701_parport_driver);
index 7851ffd678a8fdc67e0972fb9cb59b492834539c..10c248f0c1fcda0bdf926f18411ff1a2d94938dd 100644 (file)
@@ -168,14 +168,12 @@ static int adp5520_keys_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int adp5520_keys_remove(struct platform_device *pdev)
+static void adp5520_keys_remove(struct platform_device *pdev)
 {
        struct adp5520_keys *dev = platform_get_drvdata(pdev);
 
        adp5520_unregister_notifier(dev->master, &dev->notifier,
                                ADP5520_KP_IEN | ADP5520_KR_IEN);
-
-       return 0;
 }
 
 static struct platform_driver adp5520_keys_driver = {
@@ -183,7 +181,7 @@ static struct platform_driver adp5520_keys_driver = {
                .name   = "adp5520-keys",
        },
        .probe          = adp5520_keys_probe,
-       .remove         = adp5520_keys_remove,
+       .remove_new     = adp5520_keys_remove,
 };
 module_platform_driver(adp5520_keys_driver);
 
index e7ecfca838df4076f6b2301fb5496e5976593b99..30678a34cf6476fe404b6d7148a1192fadede922 100644 (file)
@@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,
        return attr->mode;
 }
 
-static const struct attribute_group cros_ec_keyb_attr_group = {
+static const struct attribute_group cros_ec_keyb_group = {
        .is_visible = cros_ec_keyb_attr_is_visible,
        .attrs = cros_ec_keyb_attrs,
 };
+__ATTRIBUTE_GROUPS(cros_ec_keyb);
 
 static int cros_ec_keyb_probe(struct platform_device *pdev)
 {
@@ -730,12 +731,6 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
                return err;
        }
 
-       err = devm_device_add_group(dev, &cros_ec_keyb_attr_group);
-       if (err) {
-               dev_err(dev, "failed to create attributes: %d\n", err);
-               return err;
-       }
-
        ckdev->notifier.notifier_call = cros_ec_keyb_work;
        err = blocking_notifier_chain_register(&ckdev->ec->event_notifier,
                                               &ckdev->notifier);
@@ -748,14 +743,12 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int cros_ec_keyb_remove(struct platform_device *pdev)
+static void cros_ec_keyb_remove(struct platform_device *pdev)
 {
        struct cros_ec_keyb *ckdev = dev_get_drvdata(&pdev->dev);
 
        blocking_notifier_chain_unregister(&ckdev->ec->event_notifier,
                                           &ckdev->notifier);
-
-       return 0;
 }
 
 #ifdef CONFIG_ACPI
@@ -779,9 +772,10 @@ static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);
 
 static struct platform_driver cros_ec_keyb_driver = {
        .probe = cros_ec_keyb_probe,
-       .remove = cros_ec_keyb_remove,
+       .remove_new = cros_ec_keyb_remove,
        .driver = {
                .name = "cros-ec-keyb",
+               .dev_groups = cros_ec_keyb_groups,
                .of_match_table = of_match_ptr(cros_ec_keyb_of_match),
                .acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match),
                .pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops),
index 55075addcac2618b9ed49a53b150953ed2a0d0bc..6b811d6bf6258c8dd5e5c52f3f6868d5b02bdb64 100644 (file)
@@ -308,11 +308,9 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ep93xx_keypad_remove(struct platform_device *pdev)
+static void ep93xx_keypad_remove(struct platform_device *pdev)
 {
        dev_pm_clear_wake_irq(&pdev->dev);
-
-       return 0;
 }
 
 static struct platform_driver ep93xx_keypad_driver = {
@@ -321,7 +319,7 @@ static struct platform_driver ep93xx_keypad_driver = {
                .pm     = pm_sleep_ptr(&ep93xx_keypad_pm_ops),
        },
        .probe          = ep93xx_keypad_probe,
-       .remove         = ep93xx_keypad_remove,
+       .remove_new     = ep93xx_keypad_remove,
 };
 module_platform_driver(ep93xx_keypad_driver);
 
index 02ceebad7bdaaddc3e24436d4f0ac97ae06ceb6e..688d61244b5fdf6640777adeb6aea536e94d35f0 100644 (file)
@@ -310,7 +310,7 @@ static int iqs62x_keys_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int iqs62x_keys_remove(struct platform_device *pdev)
+static void iqs62x_keys_remove(struct platform_device *pdev)
 {
        struct iqs62x_keys_private *iqs62x_keys = platform_get_drvdata(pdev);
        int ret;
@@ -319,8 +319,6 @@ static int iqs62x_keys_remove(struct platform_device *pdev)
                                                 &iqs62x_keys->notifier);
        if (ret)
                dev_err(&pdev->dev, "Failed to unregister notifier: %d\n", ret);
-
-       return 0;
 }
 
 static struct platform_driver iqs62x_keys_platform_driver = {
@@ -328,7 +326,7 @@ static struct platform_driver iqs62x_keys_platform_driver = {
                .name = "iqs62x-keys",
        },
        .probe = iqs62x_keys_probe,
-       .remove = iqs62x_keys_remove,
+       .remove_new = iqs62x_keys_remove,
 };
 module_platform_driver(iqs62x_keys_platform_driver);
 
index a1b037891af25f0b173e5bb35aed03ee1c3d907a..50fa764c82d2b3e9bb0e6670066dd18a7c938a84 100644 (file)
@@ -549,15 +549,13 @@ err_free_mem:
        return err;
 }
 
-static int matrix_keypad_remove(struct platform_device *pdev)
+static void matrix_keypad_remove(struct platform_device *pdev)
 {
        struct matrix_keypad *keypad = platform_get_drvdata(pdev);
 
        matrix_keypad_free_gpio(keypad);
        input_unregister_device(keypad->input_dev);
        kfree(keypad);
-
-       return 0;
 }
 
 #ifdef CONFIG_OF
@@ -570,7 +568,7 @@ MODULE_DEVICE_TABLE(of, matrix_keypad_dt_match);
 
 static struct platform_driver matrix_keypad_driver = {
        .probe          = matrix_keypad_probe,
-       .remove         = matrix_keypad_remove,
+       .remove_new     = matrix_keypad_remove,
        .driver         = {
                .name   = "matrix-keypad",
                .pm     = pm_sleep_ptr(&matrix_keypad_pm_ops),
index 24440b4986457b18edb16a5976e501fdc91c0299..454fb8675657302ca1281c211a2be027fc520163 100644 (file)
@@ -287,7 +287,7 @@ err2:
        return -EINVAL;
 }
 
-static int omap_kp_remove(struct platform_device *pdev)
+static void omap_kp_remove(struct platform_device *pdev)
 {
        struct omap_kp *omap_kp = platform_get_drvdata(pdev);
 
@@ -303,13 +303,11 @@ static int omap_kp_remove(struct platform_device *pdev)
        input_unregister_device(omap_kp->input);
 
        kfree(omap_kp);
-
-       return 0;
 }
 
 static struct platform_driver omap_kp_driver = {
        .probe          = omap_kp_probe,
-       .remove         = omap_kp_remove,
+       .remove_new     = omap_kp_remove,
        .driver         = {
                .name   = "omap-keypad",
        },
index 773e55eed88b18353742107689d5c93e2aae4c16..d3f8688fdd9c3ebe03a0c97fb32283f4cd4190ac 100644 (file)
@@ -461,11 +461,9 @@ static int omap4_keypad_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int omap4_keypad_remove(struct platform_device *pdev)
+static void omap4_keypad_remove(struct platform_device *pdev)
 {
        dev_pm_clear_wake_irq(&pdev->dev);
-
-       return 0;
 }
 
 static const struct of_device_id omap_keypad_dt_match[] = {
@@ -476,7 +474,7 @@ MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
 
 static struct platform_driver omap4_keypad_driver = {
        .probe          = omap4_keypad_probe,
-       .remove         = omap4_keypad_remove,
+       .remove_new     = omap4_keypad_remove,
        .driver         = {
                .name   = "omap4-keypad",
                .of_match_table = omap_keypad_dt_match,
index d85dd2489293463cfeabf00b1414834806b563ca..e212eff7687c010ca3e19b9627d5a46b3a8a7e51 100644 (file)
@@ -444,7 +444,7 @@ err_unprepare_clk:
        return error;
 }
 
-static int samsung_keypad_remove(struct platform_device *pdev)
+static void samsung_keypad_remove(struct platform_device *pdev)
 {
        struct samsung_keypad *keypad = platform_get_drvdata(pdev);
 
@@ -453,8 +453,6 @@ static int samsung_keypad_remove(struct platform_device *pdev)
        input_unregister_device(keypad->input_dev);
 
        clk_unprepare(keypad->clk);
-
-       return 0;
 }
 
 static int samsung_keypad_runtime_suspend(struct device *dev)
@@ -589,7 +587,7 @@ MODULE_DEVICE_TABLE(platform, samsung_keypad_driver_ids);
 
 static struct platform_driver samsung_keypad_driver = {
        .probe          = samsung_keypad_probe,
-       .remove         = samsung_keypad_remove,
+       .remove_new     = samsung_keypad_remove,
        .driver         = {
                .name   = "samsung-keypad",
                .of_match_table = of_match_ptr(samsung_keypad_dt_match),
index 2c00320f739fc1e7e60e0fab6c11c7efca9608e0..4ea4fd25c5d20ed2fed750034f9db1426fe2bf37 100644 (file)
@@ -265,7 +265,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
        return error;
 }
 
-static int sh_keysc_remove(struct platform_device *pdev)
+static void sh_keysc_remove(struct platform_device *pdev)
 {
        struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
 
@@ -279,8 +279,6 @@ static int sh_keysc_remove(struct platform_device *pdev)
        pm_runtime_disable(&pdev->dev);
 
        kfree(priv);
-
-       return 0;
 }
 
 static int sh_keysc_suspend(struct device *dev)
@@ -321,7 +319,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(sh_keysc_dev_pm_ops,
 
 static struct platform_driver sh_keysc_device_driver = {
        .probe          = sh_keysc_probe,
-       .remove         = sh_keysc_remove,
+       .remove_new     = sh_keysc_remove,
        .driver         = {
                .name   = "sh_keysc",
                .pm     = pm_sleep_ptr(&sh_keysc_dev_pm_ops),
index a50fa9915381f1a71b8ad1da4ca2a9a1d7e4626b..557d00a667cea523a6b3a7dd635573defb0c10a3 100644 (file)
@@ -272,14 +272,12 @@ static int spear_kbd_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int spear_kbd_remove(struct platform_device *pdev)
+static void spear_kbd_remove(struct platform_device *pdev)
 {
        struct spear_kbd *kbd = platform_get_drvdata(pdev);
 
        input_unregister_device(kbd->input);
        clk_unprepare(kbd->clk);
-
-       return 0;
 }
 
 static int spear_kbd_suspend(struct device *dev)
@@ -375,7 +373,7 @@ MODULE_DEVICE_TABLE(of, spear_kbd_id_table);
 
 static struct platform_driver spear_kbd_driver = {
        .probe          = spear_kbd_probe,
-       .remove         = spear_kbd_remove,
+       .remove_new     = spear_kbd_remove,
        .driver         = {
                .name   = "keyboard",
                .pm     = pm_sleep_ptr(&spear_kbd_pm_ops),
index 2c6c53290cc0f57977eb081d3559ae35391e3d3d..2013c0afd0c3a6b987a9218563dfbe82cebee431 100644 (file)
@@ -404,20 +404,18 @@ static int stmpe_keypad_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int stmpe_keypad_remove(struct platform_device *pdev)
+static void stmpe_keypad_remove(struct platform_device *pdev)
 {
        struct stmpe_keypad *keypad = platform_get_drvdata(pdev);
 
        stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD);
-
-       return 0;
 }
 
 static struct platform_driver stmpe_keypad_driver = {
        .driver.name    = "stmpe-keypad",
        .driver.owner   = THIS_MODULE,
        .probe          = stmpe_keypad_probe,
-       .remove         = stmpe_keypad_remove,
+       .remove_new     = stmpe_keypad_remove,
 };
 module_platform_driver(stmpe_keypad_driver);
 
index c9a823ea45d02965275f44318a7e8c5af3790887..a1765ed8c825c16298d5ca7e523c049504fcf3fa 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/io.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/property.h>
 #include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/input/matrix_keypad.h>
@@ -602,9 +602,6 @@ static int tegra_kbc_probe(struct platform_device *pdev)
        unsigned int debounce_cnt;
        unsigned int scan_time_rows;
        unsigned int keymap_rows;
-       const struct of_device_id *match;
-
-       match = of_match_device(tegra_kbc_of_match, &pdev->dev);
 
        kbc = devm_kzalloc(&pdev->dev, sizeof(*kbc), GFP_KERNEL);
        if (!kbc) {
@@ -613,7 +610,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
        }
 
        kbc->dev = &pdev->dev;
-       kbc->hw_support = match->data;
+       kbc->hw_support = device_get_match_data(&pdev->dev);
        kbc->max_keys = kbc->hw_support->max_rows *
                                kbc->hw_support->max_columns;
        kbc->num_rows_and_columns = kbc->hw_support->max_rows +
index 51c8a326fd0686571df301ffa939ce7cfd52cdbe..31f0702c3d01e54f74ad3b28b8d9469745145600 100644 (file)
@@ -138,14 +138,13 @@ out:
        return err;
 }
 
-static int pm80x_onkey_remove(struct platform_device *pdev)
+static void pm80x_onkey_remove(struct platform_device *pdev)
 {
        struct pm80x_onkey_info *info = platform_get_drvdata(pdev);
 
        pm80x_free_irq(info->pm80x, info->irq, info);
        input_unregister_device(info->idev);
        kfree(info);
-       return 0;
 }
 
 static struct platform_driver pm80x_onkey_driver = {
@@ -154,7 +153,7 @@ static struct platform_driver pm80x_onkey_driver = {
                   .pm = &pm80x_onkey_pm_ops,
                   },
        .probe = pm80x_onkey_probe,
-       .remove = pm80x_onkey_remove,
+       .remove_new = pm80x_onkey_remove,
 };
 
 module_platform_driver(pm80x_onkey_driver);
index 4581606a28d63011c28c37f776001b3ee0ef871e..24f9e9d893de3a2fe24f4271c0281f421ef5abc1 100644 (file)
@@ -133,20 +133,11 @@ static ssize_t axp20x_store_attr(struct device *dev,
                                 size_t count)
 {
        struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
-       char val_str[20];
-       size_t len;
        int ret, i;
        unsigned int val, idx = 0;
        unsigned int best_err = UINT_MAX;
 
-       val_str[sizeof(val_str) - 1] = '\0';
-       strncpy(val_str, buf, sizeof(val_str) - 1);
-       len = strlen(val_str);
-
-       if (len && val_str[len - 1] == '\n')
-               val_str[len - 1] = '\0';
-
-       ret = kstrtouint(val_str, 10, &val);
+       ret = kstrtouint(buf, 10, &val);
        if (ret)
                return ret;
 
index 6d1152850a6d8f6df68101b9692763f143f87ab1..7a1122e1efb9cc2711e02122d4d9655644e3d7e5 100644 (file)
@@ -127,7 +127,7 @@ err_free_mem:
        return error;
 }
 
-static int da9052_onkey_remove(struct platform_device *pdev)
+static void da9052_onkey_remove(struct platform_device *pdev)
 {
        struct da9052_onkey *onkey = platform_get_drvdata(pdev);
 
@@ -136,13 +136,11 @@ static int da9052_onkey_remove(struct platform_device *pdev)
 
        input_unregister_device(onkey->input);
        kfree(onkey);
-
-       return 0;
 }
 
 static struct platform_driver da9052_onkey_driver = {
        .probe  = da9052_onkey_probe,
-       .remove = da9052_onkey_remove,
+       .remove_new = da9052_onkey_remove,
        .driver = {
                .name   = "da9052-onkey",
        },
index 7a0d3a1d503cf3b94aea3ff38560fc4bfbc72679..871812f1b398e8150bddb56e78987c348e0dc735 100644 (file)
@@ -132,7 +132,7 @@ err_free_input:
        return err;
 }
 
-static int da9055_onkey_remove(struct platform_device *pdev)
+static void da9055_onkey_remove(struct platform_device *pdev)
 {
        struct da9055_onkey *onkey = platform_get_drvdata(pdev);
        int irq = platform_get_irq_byname(pdev, "ONKEY");
@@ -141,13 +141,11 @@ static int da9055_onkey_remove(struct platform_device *pdev)
        free_irq(irq, onkey);
        cancel_delayed_work_sync(&onkey->work);
        input_unregister_device(onkey->input);
-
-       return 0;
 }
 
 static struct platform_driver da9055_onkey_driver = {
        .probe  = da9055_onkey_probe,
-       .remove = da9055_onkey_remove,
+       .remove_new = da9055_onkey_remove,
        .driver = {
                .name   = "da9055-onkey",
        },
index 68f1c584da05697f11ddddf9bbffe84433a7e509..fa4e7f67d71367b09a0cc5dd42661f94da3a29f8 100644 (file)
@@ -256,20 +256,18 @@ err_release_ports:
        return err;
 }
 
-static int ideapad_remove(struct platform_device *pdev)
+static void ideapad_remove(struct platform_device *pdev)
 {
        i8042_remove_filter(slidebar_i8042_filter);
        input_unregister_device(slidebar_input_dev);
        release_region(IDEAPAD_BASE, 3);
-
-       return 0;
 }
 
 static struct platform_driver slidebar_drv = {
        .driver = {
                .name = "ideapad_slidebar",
        },
-       .remove = ideapad_remove,
+       .remove_new = ideapad_remove,
 };
 
 static int __init ideapad_dmi_check(const struct dmi_system_id *id)
index c0a08563987053effad40b29e51d75a8839320d0..3c636c75e8a1f1520ab2c5c3bec4004e023080c8 100644 (file)
@@ -1586,10 +1586,7 @@ static struct attribute *iqs269_attrs[] = {
        &dev_attr_ati_trigger.attr,
        NULL,
 };
-
-static const struct attribute_group iqs269_attr_group = {
-       .attrs = iqs269_attrs,
-};
+ATTRIBUTE_GROUPS(iqs269);
 
 static const struct regmap_config iqs269_regmap_config = {
        .reg_bits = 8,
@@ -1671,10 +1668,6 @@ static int iqs269_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &iqs269_attr_group);
-       if (error)
-               dev_err(&client->dev, "Failed to add attributes: %d\n", error);
-
        return error;
 }
 
@@ -1743,6 +1736,7 @@ MODULE_DEVICE_TABLE(of, iqs269_of_match);
 static struct i2c_driver iqs269_i2c_driver = {
        .driver = {
                .name = "iqs269a",
+               .dev_groups = iqs269_groups,
                .of_match_table = iqs269_of_match,
                .pm = pm_sleep_ptr(&iqs269_pm),
        },
index 912e614d039d71d53f83c4499ddf6a90ed24e230..d47269b10e9ab387c39c766d23ac7478994dc741 100644 (file)
@@ -334,14 +334,25 @@ static ssize_t kxtj9_set_poll(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR(poll, S_IRUGO|S_IWUSR, kxtj9_get_poll, kxtj9_set_poll);
 
-static struct attribute *kxtj9_attributes[] = {
+static struct attribute *kxtj9_attrs[] = {
        &dev_attr_poll.attr,
        NULL
 };
 
-static struct attribute_group kxtj9_attribute_group = {
-       .attrs = kxtj9_attributes
+static umode_t kxtj9_attr_is_visible(struct kobject *kobj,
+                                    struct attribute *attr, int n)
+{
+       struct device *dev = kobj_to_dev(kobj);
+       struct i2c_client *client = to_i2c_client(dev);
+
+       return client->irq ? attr->mode : 0;
+}
+
+static struct attribute_group kxtj9_group = {
+       .attrs = kxtj9_attrs,
+       .is_visible = kxtj9_attr_is_visible,
 };
+__ATTRIBUTE_GROUPS(kxtj9);
 
 static void kxtj9_poll(struct input_dev *input)
 {
@@ -482,13 +493,6 @@ static int kxtj9_probe(struct i2c_client *client)
                        dev_err(&client->dev, "request irq failed: %d\n", err);
                        return err;
                }
-
-               err = devm_device_add_group(&client->dev,
-                                           &kxtj9_attribute_group);
-               if (err) {
-                       dev_err(&client->dev, "sysfs create failed: %d\n", err);
-                       return err;
-               }
        }
 
        return 0;
@@ -535,8 +539,9 @@ MODULE_DEVICE_TABLE(i2c, kxtj9_id);
 
 static struct i2c_driver kxtj9_driver = {
        .driver = {
-               .name   = NAME,
-               .pm     = pm_sleep_ptr(&kxtj9_pm_ops),
+               .name           = NAME,
+               .dev_groups     = kxtj9_groups,
+               .pm             = pm_sleep_ptr(&kxtj9_pm_ops),
        },
        .probe          = kxtj9_probe,
        .id_table       = kxtj9_id,
index 25fcf1467151b1fd8643353ef8dbb64082e2d9a5..3fe0a85c45e00a5cf50effc415b6b3587e99dee2 100644 (file)
@@ -75,15 +75,13 @@ static int m68kspkr_probe(struct platform_device *dev)
        return 0;
 }
 
-static int m68kspkr_remove(struct platform_device *dev)
+static void m68kspkr_remove(struct platform_device *dev)
 {
        struct input_dev *input_dev = platform_get_drvdata(dev);
 
        input_unregister_device(input_dev);
        /* turn off the speaker */
        m68kspkr_event(NULL, EV_SND, SND_BELL, 0);
-
-       return 0;
 }
 
 static void m68kspkr_shutdown(struct platform_device *dev)
@@ -97,7 +95,7 @@ static struct platform_driver m68kspkr_platform_driver = {
                .name   = "m68kspkr",
        },
        .probe          = m68kspkr_probe,
-       .remove         = m68kspkr_remove,
+       .remove_new     = m68kspkr_remove,
        .shutdown       = m68kspkr_shutdown,
 };
 
index c4dff476d47968d54260deb93146e32d451d9999..8861a67be5754a067372813600d271363ca27698 100644 (file)
@@ -351,7 +351,7 @@ err_free_mem:
        return error;
 }
 
-static int max8997_haptic_remove(struct platform_device *pdev)
+static void max8997_haptic_remove(struct platform_device *pdev)
 {
        struct max8997_haptic *chip = platform_get_drvdata(pdev);
 
@@ -362,8 +362,6 @@ static int max8997_haptic_remove(struct platform_device *pdev)
                pwm_put(chip->pwm);
 
        kfree(chip);
-
-       return 0;
 }
 
 static int max8997_haptic_suspend(struct device *dev)
@@ -391,7 +389,7 @@ static struct platform_driver max8997_haptic_driver = {
                .pm     = pm_sleep_ptr(&max8997_haptic_pm_ops),
        },
        .probe          = max8997_haptic_probe,
-       .remove         = max8997_haptic_remove,
+       .remove_new     = max8997_haptic_remove,
        .id_table       = max8997_haptic_id,
 };
 module_platform_driver(max8997_haptic_driver);
index 0636eee4bb6ceee2eede21475dac61ec5c6a678c..1c8c939638f6cda327a995f7c209a5c531060ea1 100644 (file)
@@ -229,7 +229,7 @@ free_input_dev:
        return err;
 }
 
-static int mc13783_pwrbutton_remove(struct platform_device *pdev)
+static void mc13783_pwrbutton_remove(struct platform_device *pdev)
 {
        struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
        const struct mc13xxx_buttons_platform_data *pdata;
@@ -249,13 +249,11 @@ static int mc13783_pwrbutton_remove(struct platform_device *pdev)
 
        input_unregister_device(priv->pwr);
        kfree(priv);
-
-       return 0;
 }
 
 static struct platform_driver mc13783_pwrbutton_driver = {
        .probe          = mc13783_pwrbutton_probe,
-       .remove         = mc13783_pwrbutton_remove,
+       .remove_new     = mc13783_pwrbutton_remove,
        .driver         = {
                .name   = "mc13783-pwrbutton",
        },
index 7e361727b0d980458afad0022ad8c16df10aca55..06d5972e8e84dc594b4b27d0fb40dfb7d670ce7e 100644 (file)
@@ -245,7 +245,7 @@ err_free_mem:
  *
  * Return: 0
  */
-static int palmas_pwron_remove(struct platform_device *pdev)
+static void palmas_pwron_remove(struct platform_device *pdev)
 {
        struct palmas_pwron *pwron = platform_get_drvdata(pdev);
 
@@ -254,8 +254,6 @@ static int palmas_pwron_remove(struct platform_device *pdev)
 
        input_unregister_device(pwron->input_dev);
        kfree(pwron);
-
-       return 0;
 }
 
 /**
@@ -312,7 +310,7 @@ MODULE_DEVICE_TABLE(of, of_palmas_pwr_match);
 
 static struct platform_driver palmas_pwron_driver = {
        .probe  = palmas_pwron_probe,
-       .remove = palmas_pwron_remove,
+       .remove_new = palmas_pwron_remove,
        .driver = {
                .name   = "palmas_pwrbutton",
                .of_match_table = of_match_ptr(of_palmas_pwr_match),
index b5a53636d7e2e9aafe112aa78152aec47776da47..8a7e9ada59526a64842082254661094cb86d4981 100644 (file)
@@ -99,7 +99,7 @@ fail:
        return err;
 }
 
-static int pcap_keys_remove(struct platform_device *pdev)
+static void pcap_keys_remove(struct platform_device *pdev)
 {
        struct pcap_keys *pcap_keys = platform_get_drvdata(pdev);
 
@@ -108,13 +108,11 @@ static int pcap_keys_remove(struct platform_device *pdev)
 
        input_unregister_device(pcap_keys->input);
        kfree(pcap_keys);
-
-       return 0;
 }
 
 static struct platform_driver pcap_keys_device_driver = {
        .probe          = pcap_keys_probe,
-       .remove         = pcap_keys_remove,
+       .remove_new     = pcap_keys_remove,
        .driver         = {
                .name   = "pcap-keys",
        }
index 4c60c70c4c102dd4564ff3f8a5350db4f9483c92..c5c5fe236c182c95bce78b95a3fceaf353df771c 100644 (file)
@@ -87,7 +87,7 @@ static int pcf50633_input_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int pcf50633_input_remove(struct platform_device *pdev)
+static void pcf50633_input_remove(struct platform_device *pdev)
 {
        struct pcf50633_input *input  = platform_get_drvdata(pdev);
 
@@ -96,8 +96,6 @@ static int pcf50633_input_remove(struct platform_device *pdev)
 
        input_unregister_device(input->input_dev);
        kfree(input);
-
-       return 0;
 }
 
 static struct platform_driver pcf50633_input_driver = {
@@ -105,7 +103,7 @@ static struct platform_driver pcf50633_input_driver = {
                .name = "pcf50633-input",
        },
        .probe = pcf50633_input_probe,
-       .remove = pcf50633_input_remove,
+       .remove_new = pcf50633_input_remove,
 };
 module_platform_driver(pcf50633_input_driver);
 
index 9c666b2f14fef0f28572540eb2a0b85ea486080f..897854fd245f18d362b61d3d631f6dd2570cd776 100644 (file)
@@ -95,15 +95,13 @@ static int pcspkr_probe(struct platform_device *dev)
        return 0;
 }
 
-static int pcspkr_remove(struct platform_device *dev)
+static void pcspkr_remove(struct platform_device *dev)
 {
        struct input_dev *pcspkr_dev = platform_get_drvdata(dev);
 
        input_unregister_device(pcspkr_dev);
        /* turn off the speaker */
        pcspkr_event(NULL, EV_SND, SND_BELL, 0);
-
-       return 0;
 }
 
 static int pcspkr_suspend(struct device *dev)
@@ -129,7 +127,7 @@ static struct platform_driver pcspkr_platform_driver = {
                .pm     = &pcspkr_pm_ops,
        },
        .probe          = pcspkr_probe,
-       .remove         = pcspkr_remove,
+       .remove_new     = pcspkr_remove,
        .shutdown       = pcspkr_shutdown,
 };
 module_platform_driver(pcspkr_platform_driver);
index ba747c5b2b5fc7620fbd8b2acf2bac46cf92fd47..bab710023d8f1c2bbd04ca02d1571fddafc89006 100644 (file)
@@ -408,14 +408,12 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int pm8941_pwrkey_remove(struct platform_device *pdev)
+static void pm8941_pwrkey_remove(struct platform_device *pdev)
 {
        struct pm8941_pwrkey *pwrkey = platform_get_drvdata(pdev);
 
        if (pwrkey->data->supports_ps_hold_poff_config)
                unregister_reboot_notifier(&pwrkey->reboot_notifier);
-
-       return 0;
 }
 
 static const struct pm8941_data pwrkey_data = {
@@ -467,7 +465,7 @@ MODULE_DEVICE_TABLE(of, pm8941_pwr_key_id_table);
 
 static struct platform_driver pm8941_pwrkey_driver = {
        .probe = pm8941_pwrkey_probe,
-       .remove = pm8941_pwrkey_remove,
+       .remove_new = pm8941_pwrkey_remove,
        .driver = {
                .name = "pm8941-pwrkey",
                .pm = pm_sleep_ptr(&pm8941_pwr_key_pm_ops),
index e79f5497948b8c047039c29c504317d009b5ef4c..08bcee3d6bccac2f03625c32a588c664ea789af8 100644 (file)
@@ -411,7 +411,7 @@ out:
        return button_info;
 }
 
-static int soc_button_remove(struct platform_device *pdev)
+static void soc_button_remove(struct platform_device *pdev)
 {
        struct soc_button_data *priv = platform_get_drvdata(pdev);
 
@@ -420,8 +420,6 @@ static int soc_button_remove(struct platform_device *pdev)
        for (i = 0; i < BUTTON_TYPES; i++)
                if (priv->children[i])
                        platform_device_unregister(priv->children[i]);
-
-       return 0;
 }
 
 static int soc_button_probe(struct platform_device *pdev)
@@ -609,7 +607,7 @@ MODULE_DEVICE_TABLE(acpi, soc_button_acpi_match);
 
 static struct platform_driver soc_button_driver = {
        .probe          = soc_button_probe,
-       .remove         = soc_button_remove,
+       .remove_new     = soc_button_remove,
        .driver         = {
                .name = KBUILD_MODNAME,
                .acpi_match_table = ACPI_PTR(soc_button_acpi_match),
index e5dd84725c6e74737ca4a080d6ac4b1129330623..20020cbc0752be1434c62fe52320bfc961d77b1e 100644 (file)
@@ -231,7 +231,7 @@ out_err:
        return err;
 }
 
-static int bbc_remove(struct platform_device *op)
+static void bbc_remove(struct platform_device *op)
 {
        struct sparcspkr_state *state = platform_get_drvdata(op);
        struct input_dev *input_dev = state->input_dev;
@@ -245,8 +245,6 @@ static int bbc_remove(struct platform_device *op)
        of_iounmap(&op->resource[0], info->regs, 6);
 
        kfree(state);
-
-       return 0;
 }
 
 static const struct of_device_id bbc_beep_match[] = {
@@ -264,7 +262,7 @@ static struct platform_driver bbc_beep_driver = {
                .of_match_table = bbc_beep_match,
        },
        .probe          = bbc_beep_probe,
-       .remove         = bbc_remove,
+       .remove_new     = bbc_remove,
        .shutdown       = sparcspkr_shutdown,
 };
 
@@ -310,7 +308,7 @@ out_err:
        return err;
 }
 
-static int grover_remove(struct platform_device *op)
+static void grover_remove(struct platform_device *op)
 {
        struct sparcspkr_state *state = platform_get_drvdata(op);
        struct grover_beep_info *info = &state->u.grover;
@@ -325,8 +323,6 @@ static int grover_remove(struct platform_device *op)
        of_iounmap(&op->resource[2], info->freq_regs, 2);
 
        kfree(state);
-
-       return 0;
 }
 
 static const struct of_device_id grover_beep_match[] = {
@@ -344,7 +340,7 @@ static struct platform_driver grover_beep_driver = {
                .of_match_table = grover_beep_match,
        },
        .probe          = grover_beep_probe,
-       .remove         = grover_remove,
+       .remove_new     = grover_remove,
        .shutdown       = sparcspkr_shutdown,
 };
 
index 111cb70cde46527cd39eec0e6a616ad625676c9d..5c4956678cd0aeed39a5bb756940939850ac271d 100644 (file)
@@ -1286,13 +1286,11 @@ static int wistron_probe(struct platform_device *dev)
        return 0;
 }
 
-static int wistron_remove(struct platform_device *dev)
+static void wistron_remove(struct platform_device *dev)
 {
        wistron_led_remove();
        input_unregister_device(wistron_idev);
        bios_detach();
-
-       return 0;
 }
 
 static int wistron_suspend(struct device *dev)
@@ -1336,7 +1334,7 @@ static struct platform_driver wistron_driver = {
                .pm     = pm_sleep_ptr(&wistron_pm_ops),
        },
        .probe          = wistron_probe,
-       .remove         = wistron_remove,
+       .remove_new     = wistron_remove,
 };
 
 static int __init wb_module_init(void)
index a42fe041b73c67da266b786eb88f89540af05b46..e4a06c73b72d9dd07ac7dc938bb11f5cffed58f3 100644 (file)
@@ -123,20 +123,18 @@ err:
        return ret;
 }
 
-static int wm831x_on_remove(struct platform_device *pdev)
+static void wm831x_on_remove(struct platform_device *pdev)
 {
        struct wm831x_on *wm831x_on = platform_get_drvdata(pdev);
        int irq = platform_get_irq(pdev, 0);
 
        free_irq(irq, wm831x_on);
        cancel_delayed_work_sync(&wm831x_on->work);
-
-       return 0;
 }
 
 static struct platform_driver wm831x_on_driver = {
        .probe          = wm831x_on_probe,
-       .remove         = wm831x_on_remove,
+       .remove_new     = wm831x_on_remove,
        .driver         = {
                .name   = "wm831x-on",
        },
index 05851bc32541f7c6917ed1ae9e434234baf9e5f0..a84098448f5b94d607dc5b86ceb5f04618783179 100644 (file)
@@ -1223,7 +1223,7 @@ static DEVICE_ATTR(baseline, S_IRUGO, cyapa_show_baseline, NULL);
 static DEVICE_ATTR(calibrate, S_IWUSR, NULL, cyapa_calibrate_store);
 static DEVICE_ATTR(mode, S_IRUGO, cyapa_show_mode, NULL);
 
-static struct attribute *cyapa_sysfs_entries[] = {
+static struct attribute *cyapa_attrs[] = {
        &dev_attr_firmware_version.attr,
        &dev_attr_product_id.attr,
        &dev_attr_update_fw.attr,
@@ -1232,10 +1232,7 @@ static struct attribute *cyapa_sysfs_entries[] = {
        &dev_attr_mode.attr,
        NULL,
 };
-
-static const struct attribute_group cyapa_sysfs_group = {
-       .attrs = cyapa_sysfs_entries,
-};
+ATTRIBUTE_GROUPS(cyapa);
 
 static void cyapa_disable_regulator(void *data)
 {
@@ -1302,12 +1299,6 @@ static int cyapa_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(dev, &cyapa_sysfs_group);
-       if (error) {
-               dev_err(dev, "failed to create sysfs entries: %d\n", error);
-               return error;
-       }
-
        error = cyapa_prepare_wakeup_controls(cyapa);
        if (error) {
                dev_err(dev, "failed to prepare wakeup controls: %d\n", error);
@@ -1484,6 +1475,7 @@ MODULE_DEVICE_TABLE(of, cyapa_of_match);
 static struct i2c_driver cyapa_driver = {
        .driver = {
                .name = "cyapa",
+               .dev_groups = cyapa_groups,
                .pm = pm_ptr(&cyapa_pm_ops),
                .acpi_match_table = ACPI_PTR(cyapa_acpi_id),
                .of_match_table = of_match_ptr(cyapa_of_match),
index 2b7b86eef280e73ead3b12e5bd68a6fefd9d6b74..c00dc1275da23daebb21110749f3c3f75431d075 100644 (file)
@@ -295,7 +295,7 @@ err_free_gpio:
        return error;
 }
 
-static int navpoint_remove(struct platform_device *pdev)
+static void navpoint_remove(struct platform_device *pdev)
 {
        const struct navpoint_platform_data *pdata =
                                        dev_get_platdata(&pdev->dev);
@@ -311,8 +311,6 @@ static int navpoint_remove(struct platform_device *pdev)
 
        if (gpio_is_valid(pdata->gpio))
                gpio_free(pdata->gpio);
-
-       return 0;
 }
 
 static int navpoint_suspend(struct device *dev)
@@ -348,7 +346,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(navpoint_pm_ops,
 
 static struct platform_driver navpoint_driver = {
        .probe          = navpoint_probe,
-       .remove         = navpoint_remove,
+       .remove_new     = navpoint_remove,
        .driver = {
                .name   = "navpoint",
                .pm     = pm_sleep_ptr(&navpoint_pm_ops),
index f2e093b0b9982d238cca68454c0fbdbef174a81d..1b45b1d3077de72d6f78c608287c52f0d09773f3 100644 (file)
@@ -277,11 +277,11 @@ void rmi_unregister_function(struct rmi_function *fn)
 
        device_del(&fn->dev);
        of_node_put(fn->dev.of_node);
-       put_device(&fn->dev);
 
        for (i = 0; i < fn->num_of_irqs; i++)
                irq_dispose_mapping(fn->irq[i]);
 
+       put_device(&fn->dev);
 }
 
 /**
index 0d9a5756e3f5934ba8df6e4b0518687c74bc3a16..3b3ac71e53dc589e5c547ff4eec7cccd54564b8a 100644 (file)
@@ -471,7 +471,7 @@ static ssize_t rmi_driver_update_fw_store(struct device *dev,
        if (buf[count - 1] == '\0' || buf[count - 1] == '\n')
                copy_count -= 1;
 
-       strncpy(fw_name, buf, copy_count);
+       memcpy(fw_name, buf, copy_count);
        fw_name[copy_count] = '\0';
 
        ret = request_firmware(&fw, fw_name, dev);
index 9f8d7b332d1b0a8643851617c401f2ac82dc7bd6..c5b634940cfcff91c63af13df6a0f8d9cad1c4cb 100644 (file)
@@ -125,13 +125,11 @@ static int altera_ps2_probe(struct platform_device *pdev)
 /*
  * Remove one device from this driver.
  */
-static int altera_ps2_remove(struct platform_device *pdev)
+static void altera_ps2_remove(struct platform_device *pdev)
 {
        struct ps2if *ps2if = platform_get_drvdata(pdev);
 
        serio_unregister_port(ps2if->io);
-
-       return 0;
 }
 
 #ifdef CONFIG_OF
@@ -148,7 +146,7 @@ MODULE_DEVICE_TABLE(of, altera_ps2_match);
  */
 static struct platform_driver altera_ps2_driver = {
        .probe          = altera_ps2_probe,
-       .remove         = altera_ps2_remove,
+       .remove_new     = altera_ps2_remove,
        .driver = {
                .name   = DRV_NAME,
                .of_match_table = of_match_ptr(altera_ps2_match),
index ec93cb4573c3e1a88ba95bdfe81b5c95ea6845c6..0bd6ae1068099aa8daaf9c61998cb85e285e1a83 100644 (file)
@@ -173,18 +173,16 @@ static int ams_delta_serio_init(struct platform_device *pdev)
        return 0;
 }
 
-static int ams_delta_serio_exit(struct platform_device *pdev)
+static void ams_delta_serio_exit(struct platform_device *pdev)
 {
        struct ams_delta_serio *priv = platform_get_drvdata(pdev);
 
        serio_unregister_port(priv->serio);
-
-       return 0;
 }
 
 static struct platform_driver ams_delta_serio_driver = {
        .probe  = ams_delta_serio_init,
-       .remove = ams_delta_serio_exit,
+       .remove_new = ams_delta_serio_exit,
        .driver = {
                .name   = DRIVER_NAME
        },
index 3f6866d39b862454fa903981016c3df03b252c8f..dbbb1025152098d2ff1cf2fae0834e485076b2e7 100644 (file)
@@ -187,13 +187,11 @@ static int apbps2_of_probe(struct platform_device *ofdev)
        return 0;
 }
 
-static int apbps2_of_remove(struct platform_device *of_dev)
+static void apbps2_of_remove(struct platform_device *of_dev)
 {
        struct apbps2_priv *priv = platform_get_drvdata(of_dev);
 
        serio_unregister_port(priv->io);
-
-       return 0;
 }
 
 static const struct of_device_id apbps2_of_match[] = {
@@ -210,7 +208,7 @@ static struct platform_driver apbps2_of_driver = {
                .of_match_table = apbps2_of_match,
        },
        .probe = apbps2_of_probe,
-       .remove = apbps2_of_remove,
+       .remove_new = apbps2_of_remove,
 };
 
 module_platform_driver(apbps2_of_driver);
index a6debb13d5278f96ef40a73847ea8c6ade4f5ada..9d8726830140110ae92ad2f7df93c1cedd75a438 100644 (file)
@@ -232,7 +232,7 @@ static int arc_ps2_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int arc_ps2_remove(struct platform_device *pdev)
+static void arc_ps2_remove(struct platform_device *pdev)
 {
        struct arc_ps2_data *arc_ps2 = platform_get_drvdata(pdev);
        int i;
@@ -244,8 +244,6 @@ static int arc_ps2_remove(struct platform_device *pdev)
        dev_dbg(&pdev->dev, "frame error count = %i\n", arc_ps2->frame_error);
        dev_dbg(&pdev->dev, "buffer overflow count = %i\n",
                arc_ps2->buf_overflow);
-
-       return 0;
 }
 
 #ifdef CONFIG_OF
@@ -262,7 +260,7 @@ static struct platform_driver arc_ps2_driver = {
                .of_match_table = of_match_ptr(arc_ps2_match),
        },
        .probe  = arc_ps2_probe,
-       .remove = arc_ps2_remove,
+       .remove_new = arc_ps2_remove,
 };
 
 module_platform_driver(arc_ps2_driver);
index 3da751f4a6bf675ee286554a35edcbe730c2ec91..d5c9bb3d010382a5311f711d18b5157a4e4055fd 100644 (file)
@@ -180,11 +180,9 @@ static int ct82c710_probe(struct platform_device *dev)
        return 0;
 }
 
-static int ct82c710_remove(struct platform_device *dev)
+static void ct82c710_remove(struct platform_device *dev)
 {
        serio_unregister_port(ct82c710_port);
-
-       return 0;
 }
 
 static struct platform_driver ct82c710_driver = {
@@ -192,7 +190,7 @@ static struct platform_driver ct82c710_driver = {
                .name   = "ct82c710",
        },
        .probe          = ct82c710_probe,
-       .remove         = ct82c710_remove,
+       .remove_new     = ct82c710_remove,
 };
 
 
index b68793bf05c8cefb9f7bb59da7748147d611da7f..c2fda54dc384fe742f0cdec836ac85dce7b7b2b2 100644 (file)
@@ -82,11 +82,9 @@ static int sparc_i8042_probe(struct platform_device *op)
        return 0;
 }
 
-static int sparc_i8042_remove(struct platform_device *op)
+static void sparc_i8042_remove(struct platform_device *op)
 {
        of_iounmap(kbd_res, kbd_iobase, 8);
-
-       return 0;
 }
 
 static const struct of_device_id sparc_i8042_match[] = {
@@ -103,7 +101,7 @@ static struct platform_driver sparc_i8042_driver = {
                .of_match_table = sparc_i8042_match,
        },
        .probe          = sparc_i8042_probe,
-       .remove         = sparc_i8042_remove,
+       .remove_new     = sparc_i8042_remove,
 };
 
 static bool i8042_is_mr_coffee(void)
index 6dac7c1853a54189f50784b85b5ae3eaf9b6b93e..9fbb8d31575ae1486afcb1e7f70e51ff8d6f5a76 100644 (file)
@@ -1584,13 +1584,11 @@ static int i8042_probe(struct platform_device *dev)
        return error;
 }
 
-static int i8042_remove(struct platform_device *dev)
+static void i8042_remove(struct platform_device *dev)
 {
        i8042_unregister_ports();
        i8042_free_irqs();
        i8042_controller_reset(false);
-
-       return 0;
 }
 
 static struct platform_driver i8042_driver = {
@@ -1601,7 +1599,7 @@ static struct platform_driver i8042_driver = {
 #endif
        },
        .probe          = i8042_probe,
-       .remove         = i8042_remove,
+       .remove_new     = i8042_remove,
        .shutdown       = i8042_shutdown,
 };
 
index d51bfe912db5b64b26a24662787269bef23d5b22..50552dc7b4f5e689b7f1e9e63f9104e80efc57c2 100644 (file)
@@ -190,7 +190,7 @@ static int ioc3kbd_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ioc3kbd_remove(struct platform_device *pdev)
+static void ioc3kbd_remove(struct platform_device *pdev)
 {
        struct ioc3kbd_data *d = platform_get_drvdata(pdev);
 
@@ -198,13 +198,11 @@ static int ioc3kbd_remove(struct platform_device *pdev)
 
        serio_unregister_port(d->kbd);
        serio_unregister_port(d->aux);
-
-       return 0;
 }
 
 static struct platform_driver ioc3kbd_driver = {
        .probe          = ioc3kbd_probe,
-       .remove         = ioc3kbd_remove,
+       .remove_new     = ioc3kbd_remove,
        .driver = {
                .name = "ioc3-kbd",
        },
index 629e15089c219e28c1b0746f401461951057ed4e..5ccfb82759b35613eba024608b088132adddf68b 100644 (file)
@@ -148,12 +148,10 @@ static int maceps2_probe(struct platform_device *dev)
        return 0;
 }
 
-static int maceps2_remove(struct platform_device *dev)
+static void maceps2_remove(struct platform_device *dev)
 {
        serio_unregister_port(maceps2_port[0]);
        serio_unregister_port(maceps2_port[1]);
-
-       return 0;
 }
 
 static struct platform_driver maceps2_driver = {
@@ -161,7 +159,7 @@ static struct platform_driver maceps2_driver = {
                .name   = "maceps2",
        },
        .probe          = maceps2_probe,
-       .remove         = maceps2_remove,
+       .remove_new     = maceps2_remove,
 };
 
 static int __init maceps2_init(void)
index 33a8e5889bd8b8fa0747c8e97a951bb5650c0c9c..240a714f708185335fe507804fdeae6cbb5d8c01 100644 (file)
@@ -238,7 +238,7 @@ err_pad:
        return error;
 }
 
-static int olpc_apsp_remove(struct platform_device *pdev)
+static void olpc_apsp_remove(struct platform_device *pdev)
 {
        struct olpc_apsp *priv = platform_get_drvdata(pdev);
 
@@ -246,8 +246,6 @@ static int olpc_apsp_remove(struct platform_device *pdev)
 
        serio_unregister_port(priv->kbio);
        serio_unregister_port(priv->padio);
-
-       return 0;
 }
 
 static const struct of_device_id olpc_apsp_dt_ids[] = {
@@ -258,7 +256,7 @@ MODULE_DEVICE_TABLE(of, olpc_apsp_dt_ids);
 
 static struct platform_driver olpc_apsp_driver = {
        .probe          = olpc_apsp_probe,
-       .remove         = olpc_apsp_remove,
+       .remove_new     = olpc_apsp_remove,
        .driver         = {
                .name   = "olpc-apsp",
                .of_match_table = olpc_apsp_dt_ids,
index bc1dc484389b40871476964d409652f660be4888..c3ff60859a035b90d20982f9b3fa8047dfb23287 100644 (file)
@@ -476,12 +476,11 @@ err_free_serio:
        return error;
 }
 
-static int ps2_gpio_remove(struct platform_device *pdev)
+static void ps2_gpio_remove(struct platform_device *pdev)
 {
        struct ps2_gpio_data *drvdata = platform_get_drvdata(pdev);
 
        serio_unregister_port(drvdata->serio);
-       return 0;
 }
 
 #if defined(CONFIG_OF)
@@ -494,7 +493,7 @@ MODULE_DEVICE_TABLE(of, ps2_gpio_match);
 
 static struct platform_driver ps2_gpio_driver = {
        .probe          = ps2_gpio_probe,
-       .remove         = ps2_gpio_remove,
+       .remove_new     = ps2_gpio_remove,
        .driver = {
                .name = DRIVER_NAME,
                .of_match_table = of_match_ptr(ps2_gpio_match),
index ba04058fc3cbde89260357a6ede06323f9af0ad7..3f81f8749cd56cbfd6b3ddcf5978bae491a4e5a1 100644 (file)
@@ -148,7 +148,7 @@ err_free_mem:
        return error;
 }
 
-static int q40kbd_remove(struct platform_device *pdev)
+static void q40kbd_remove(struct platform_device *pdev)
 {
        struct q40kbd *q40kbd = platform_get_drvdata(pdev);
 
@@ -160,15 +160,13 @@ static int q40kbd_remove(struct platform_device *pdev)
        serio_unregister_port(q40kbd->port);
        free_irq(Q40_IRQ_KEYBOARD, q40kbd);
        kfree(q40kbd);
-
-       return 0;
 }
 
 static struct platform_driver q40kbd_driver = {
        .driver         = {
                .name   = "q40kbd",
        },
-       .remove         = q40kbd_remove,
+       .remove_new     = q40kbd_remove,
 };
 
 module_platform_driver_probe(q40kbd_driver, q40kbd_probe);
index e8a9709f32ebbb68ab1d09f8bc56860f1751b63c..9bbfefd092c0852c558baef07e71baaecf1f62bd 100644 (file)
@@ -133,20 +133,18 @@ static int rpckbd_probe(struct platform_device *dev)
        return 0;
 }
 
-static int rpckbd_remove(struct platform_device *dev)
+static void rpckbd_remove(struct platform_device *dev)
 {
        struct serio *serio = platform_get_drvdata(dev);
        struct rpckbd_data *rpckbd = serio->port_data;
 
        serio_unregister_port(serio);
        kfree(rpckbd);
-
-       return 0;
 }
 
 static struct platform_driver rpckbd_driver = {
        .probe          = rpckbd_probe,
-       .remove         = rpckbd_remove,
+       .remove_new     = rpckbd_remove,
        .driver         = {
                .name   = "kart",
        },
index eb262640192e989e5d1966dc7f155443cfe62248..aec66d9f517615bf7a8b21432bab07f485f1386c 100644 (file)
@@ -297,7 +297,7 @@ err_free_mem:
        return error;
 }
 
-static int sun4i_ps2_remove(struct platform_device *pdev)
+static void sun4i_ps2_remove(struct platform_device *pdev)
 {
        struct sun4i_ps2data *drvdata = platform_get_drvdata(pdev);
 
@@ -311,8 +311,6 @@ static int sun4i_ps2_remove(struct platform_device *pdev)
        iounmap(drvdata->reg_base);
 
        kfree(drvdata);
-
-       return 0;
 }
 
 static const struct of_device_id sun4i_ps2_match[] = {
@@ -324,7 +322,7 @@ MODULE_DEVICE_TABLE(of, sun4i_ps2_match);
 
 static struct platform_driver sun4i_ps2_driver = {
        .probe          = sun4i_ps2_probe,
-       .remove         = sun4i_ps2_remove,
+       .remove_new     = sun4i_ps2_remove,
        .driver = {
                .name = DRIVER_NAME,
                .of_match_table = sun4i_ps2_match,
index f3d28da70b75c4478becad35f757e972fc7a054d..d8f9faf2b52902a76527abd0a844b386cfb0a677 100644 (file)
@@ -329,7 +329,7 @@ failed1:
  * if the driver module is being unloaded. It frees any resources allocated to
  * the device.
  */
-static int xps2_of_remove(struct platform_device *of_dev)
+static void xps2_of_remove(struct platform_device *of_dev)
 {
        struct xps2data *drvdata = platform_get_drvdata(of_dev);
        struct resource r_mem; /* IO mem resources */
@@ -344,8 +344,6 @@ static int xps2_of_remove(struct platform_device *of_dev)
                release_mem_region(r_mem.start, resource_size(&r_mem));
 
        kfree(drvdata);
-
-       return 0;
 }
 
 /* Match table for of_platform binding */
@@ -361,7 +359,7 @@ static struct platform_driver xps2_of_driver = {
                .of_match_table = xps2_of_match,
        },
        .probe          = xps2_of_probe,
-       .remove         = xps2_of_remove,
+       .remove_new     = xps2_of_remove,
 };
 module_platform_driver(xps2_of_driver);
 
index edb36d663f22f16aa3f7e8895b47a9fe02a1b4c0..a0598e9c7affcc1689a56d1a5674011769d806e9 100644 (file)
@@ -612,10 +612,11 @@ static umode_t ad7877_attr_is_visible(struct kobject *kobj,
        return mode;
 }
 
-static const struct attribute_group ad7877_attr_group = {
+static const struct attribute_group ad7877_group = {
        .is_visible     = ad7877_attr_is_visible,
        .attrs          = ad7877_attributes,
 };
+__ATTRIBUTE_GROUPS(ad7877);
 
 static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 {
@@ -777,10 +778,6 @@ static int ad7877_probe(struct spi_device *spi)
                return err;
        }
 
-       err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
-       if (err)
-               return err;
-
        err = input_register_device(input_dev);
        if (err)
                return err;
@@ -810,8 +807,9 @@ static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
 
 static struct spi_driver ad7877_driver = {
        .driver = {
-               .name   = "ad7877",
-               .pm     = pm_sleep_ptr(&ad7877_pm),
+               .name           = "ad7877",
+               .dev_groups     = ad7877_groups,
+               .pm             = pm_sleep_ptr(&ad7877_pm),
        },
        .probe          = ad7877_probe,
 };
index feaa6f8b01ed67baea5de8c8a9dc853b21e8da1e..5c094ab746989678df08d30170504b6d6aec7cc2 100644 (file)
@@ -58,9 +58,10 @@ MODULE_DEVICE_TABLE(of, ad7879_i2c_dt_ids);
 
 static struct i2c_driver ad7879_i2c_driver = {
        .driver = {
-               .name   = "ad7879",
-               .pm     = &ad7879_pm_ops,
-               .of_match_table = of_match_ptr(ad7879_i2c_dt_ids),
+               .name           = "ad7879",
+               .dev_groups     = ad7879_groups,
+               .pm             = &ad7879_pm_ops,
+               .of_match_table = of_match_ptr(ad7879_i2c_dt_ids),
        },
        .probe          = ad7879_i2c_probe,
        .id_table       = ad7879_id,
index 50e88984680032ab89ff6811ed65dabd325da7f0..064968fe57cfd54ff80ac3d927572ef4b7acc6a1 100644 (file)
@@ -56,9 +56,10 @@ MODULE_DEVICE_TABLE(of, ad7879_spi_dt_ids);
 
 static struct spi_driver ad7879_spi_driver = {
        .driver = {
-               .name   = "ad7879",
-               .pm     = &ad7879_pm_ops,
-               .of_match_table = of_match_ptr(ad7879_spi_dt_ids),
+               .name           = "ad7879",
+               .dev_groups     = ad7879_groups,
+               .pm             = &ad7879_pm_ops,
+               .of_match_table = of_match_ptr(ad7879_spi_dt_ids),
        },
        .probe          = ad7879_spi_probe,
 };
index e850853328f1b3bd9f13f46ab8644cfda1f45516..e5d69bf2276e0f9fb5424e7cda1983325c00c56a 100644 (file)
@@ -391,6 +391,12 @@ static const struct attribute_group ad7879_attr_group = {
        .attrs = ad7879_attributes,
 };
 
+const struct attribute_group *ad7879_groups[] = {
+       &ad7879_attr_group,
+       NULL
+};
+EXPORT_SYMBOL_GPL(ad7879_groups);
+
 #ifdef CONFIG_GPIOLIB
 static int ad7879_gpio_direction_input(struct gpio_chip *chip,
                                        unsigned gpio)
@@ -612,10 +618,6 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
 
        __ad7879_disable(ts);
 
-       err = devm_device_add_group(dev, &ad7879_attr_group);
-       if (err)
-               return err;
-
        err = ad7879_gpio_add(ts);
        if (err)
                return err;
index ae8aa1428e56b7de7ca2af89956ed7b677dd6ba0..d71a8e787290002037833732a3a410f71511a1a1 100644 (file)
@@ -8,11 +8,14 @@
 #ifndef _AD7879_H_
 #define _AD7879_H_
 
+#include <linux/pm.h>
 #include <linux/types.h>
 
+struct attribute_group;
 struct device;
 struct regmap;
 
+extern const struct attribute_group *ad7879_groups[];
 extern const struct dev_pm_ops ad7879_pm_ops;
 
 int ad7879_probe(struct device *dev, struct regmap *regmap,
index faea40dd66d01862f22e6fc50a95e4c044abfbb1..d2bbb436a77df927b95c1d9494beaf3d2bf6abf6 100644 (file)
@@ -625,15 +625,12 @@ static ssize_t ads7846_disable_store(struct device *dev,
 
 static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
 
-static struct attribute *ads784x_attributes[] = {
+static struct attribute *ads784x_attrs[] = {
        &dev_attr_pen_down.attr,
        &dev_attr_disable.attr,
        NULL,
 };
-
-static const struct attribute_group ads784x_attr_group = {
-       .attrs = ads784x_attributes,
-};
+ATTRIBUTE_GROUPS(ads784x);
 
 /*--------------------------------------------------------------------------*/
 
@@ -1357,10 +1354,6 @@ static int ads7846_probe(struct spi_device *spi)
        else
                (void) ads7846_read12_ser(dev, READ_12BIT_SER(vaux));
 
-       err = devm_device_add_group(dev, &ads784x_attr_group);
-       if (err)
-               return err;
-
        err = input_register_device(input_dev);
        if (err)
                return err;
@@ -1386,9 +1379,10 @@ static void ads7846_remove(struct spi_device *spi)
 
 static struct spi_driver ads7846_driver = {
        .driver = {
-               .name   = "ads7846",
-               .pm     = pm_sleep_ptr(&ads7846_pm),
-               .of_match_table = ads7846_dt_ids,
+               .name           = "ads7846",
+               .dev_groups     = ads784x_groups,
+               .pm             = pm_sleep_ptr(&ads7846_pm),
+               .of_match_table = ads7846_dt_ids,
        },
        .probe          = ads7846_probe,
        .remove         = ads7846_remove,
index db5a885ecd728573edc566eb2d57f10d26e7e33a..68527ede5c0eae1393fdec5ce76150fb92ac7675 100644 (file)
@@ -207,7 +207,7 @@ struct cyttsp5 {
        int num_prv_rec;
        struct regmap *regmap;
        struct touchscreen_properties prop;
-       struct regulator *vdd;
+       struct regulator_bulk_data supplies[2];
 };
 
 /*
@@ -817,7 +817,7 @@ static void cyttsp5_cleanup(void *data)
 {
        struct cyttsp5 *ts = data;
 
-       regulator_disable(ts->vdd);
+       regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies);
 }
 
 static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
@@ -840,9 +840,12 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
        init_completion(&ts->cmd_done);
 
        /* Power up the device */
-       ts->vdd = devm_regulator_get(dev, "vdd");
-       if (IS_ERR(ts->vdd)) {
-               error = PTR_ERR(ts->vdd);
+       ts->supplies[0].supply = "vdd";
+       ts->supplies[1].supply = "vddio";
+       error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies),
+                                       ts->supplies);
+       if (error) {
+               dev_err(ts->dev, "Failed to get regulators, error %d\n", error);
                return error;
        }
 
@@ -850,9 +853,11 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
        if (error)
                return error;
 
-       error = regulator_enable(ts->vdd);
-       if (error)
+       error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies);
+       if (error) {
+               dev_err(ts->dev, "Failed to enable regulators, error %d\n", error);
                return error;
+       }
 
        ts->input = devm_input_allocate_device(dev);
        if (!ts->input) {
index f91d0e02ddaee1ddc01eecdad1d61372cbd6fd07..d71690ce64633ff90f83cd2875439e3911718aec 100644 (file)
@@ -311,7 +311,7 @@ err_free_mem:
        return error;
 }
 
-static int  da9052_ts_remove(struct platform_device *pdev)
+static void da9052_ts_remove(struct platform_device *pdev)
 {
        struct da9052_tsi *tsi = platform_get_drvdata(pdev);
 
@@ -322,13 +322,11 @@ static int  da9052_ts_remove(struct platform_device *pdev)
 
        input_unregister_device(tsi->dev);
        kfree(tsi);
-
-       return 0;
 }
 
 static struct platform_driver da9052_tsi_driver = {
        .probe  = da9052_ts_probe,
-       .remove = da9052_ts_remove,
+       .remove_new = da9052_ts_remove,
        .driver = {
                .name   = "da9052-tsi",
        },
index 457d53337fbb399191efd37f7f822a53e204b981..3e102bcc4a1c7120428ca4c8a40d396797ae9980 100644 (file)
@@ -580,10 +580,7 @@ static struct attribute *edt_ft5x06_attrs[] = {
        &dev_attr_crc_errors.attr,
        NULL
 };
-
-static const struct attribute_group edt_ft5x06_attr_group = {
-       .attrs = edt_ft5x06_attrs,
-};
+ATTRIBUTE_GROUPS(edt_ft5x06);
 
 static void edt_ft5x06_restore_reg_parameters(struct edt_ft5x06_ts_data *tsdata)
 {
@@ -1330,10 +1327,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &edt_ft5x06_attr_group);
-       if (error)
-               return error;
-
        error = input_register_device(input);
        if (error)
                return error;
@@ -1502,6 +1495,7 @@ MODULE_DEVICE_TABLE(of, edt_ft5x06_of_match);
 static struct i2c_driver edt_ft5x06_ts_driver = {
        .driver = {
                .name = "edt_ft5x06",
+               .dev_groups = edt_ft5x06_groups,
                .of_match_table = edt_ft5x06_of_match,
                .pm = pm_sleep_ptr(&edt_ft5x06_ts_pm_ops),
                .probe_type = PROBE_PREFER_ASYNCHRONOUS,
index a1af3de9f3109ed6c6887d6b6575a33facf44669..365765d40e627880df9753cc27771345ff31a790 100644 (file)
@@ -1299,7 +1299,7 @@ static ELANTS_VERSION_ATTR(solution_version);
 static ELANTS_VERSION_ATTR(bc_version);
 static ELANTS_VERSION_ATTR(iap_version);
 
-static struct attribute *elants_attributes[] = {
+static struct attribute *elants_i2c_attrs[] = {
        &dev_attr_calibrate.attr,
        &dev_attr_update_fw.attr,
        &dev_attr_iap_mode.attr,
@@ -1313,10 +1313,7 @@ static struct attribute *elants_attributes[] = {
        &elants_ver_attr_iap_version.dattr.attr,
        NULL
 };
-
-static const struct attribute_group elants_attribute_group = {
-       .attrs = elants_attributes,
-};
+ATTRIBUTE_GROUPS(elants_i2c);
 
 static int elants_i2c_power_on(struct elants_data *ts)
 {
@@ -1552,13 +1549,6 @@ static int elants_i2c_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &elants_attribute_group);
-       if (error) {
-               dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
-                       error);
-               return error;
-       }
-
        return 0;
 }
 
@@ -1667,6 +1657,7 @@ static struct i2c_driver elants_i2c_driver = {
        .id_table = elants_i2c_id,
        .driver = {
                .name = DEVICE_NAME,
+               .dev_groups = elants_i2c_groups,
                .pm = pm_sleep_ptr(&elants_i2c_pm_ops),
                .acpi_match_table = ACPI_PTR(elants_acpi_id),
                .of_match_table = of_match_ptr(elants_of_match),
index 4c0d99aae9e0346be665ac679c17925e2291e332..a4030cc9ff60d7031e4f988f7446491dafcfc0ea 100644 (file)
@@ -325,16 +325,13 @@ static ssize_t type_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(type);
 
-static struct attribute *sysfs_attrs[] = {
+static struct attribute *exc3000_attrs[] = {
        &dev_attr_fw_version.attr,
        &dev_attr_model.attr,
        &dev_attr_type.attr,
        NULL
 };
-
-static struct attribute_group exc3000_attribute_group = {
-       .attrs = sysfs_attrs
-};
+ATTRIBUTE_GROUPS(exc3000);
 
 static int exc3000_probe(struct i2c_client *client)
 {
@@ -437,10 +434,6 @@ static int exc3000_probe(struct i2c_client *client)
 
        i2c_set_clientdata(client, data);
 
-       error = devm_device_add_group(&client->dev, &exc3000_attribute_group);
-       if (error)
-               return error;
-
        return 0;
 }
 
@@ -473,6 +466,7 @@ MODULE_DEVICE_TABLE(acpi, exc3000_acpi_match);
 static struct i2c_driver exc3000_driver = {
        .driver = {
                .name   = "exc3000",
+               .dev_groups = exc3000_groups,
                .of_match_table = of_match_ptr(exc3000_of_match),
                .acpi_match_table = ACPI_PTR(exc3000_acpi_match),
        },
index 404153338df718d2d62874bc02c9b8948396cd2a..0f58258306bfc594e84625f51e56cf7cd963615d 100644 (file)
@@ -954,16 +954,13 @@ static DEVICE_ATTR(version, 0664, hideep_fw_version_show, NULL);
 static DEVICE_ATTR(product_id, 0664, hideep_product_id_show, NULL);
 static DEVICE_ATTR(update_fw, 0664, NULL, hideep_update_fw);
 
-static struct attribute *hideep_ts_sysfs_entries[] = {
+static struct attribute *hideep_ts_attrs[] = {
        &dev_attr_version.attr,
        &dev_attr_product_id.attr,
        &dev_attr_update_fw.attr,
        NULL,
 };
-
-static const struct attribute_group hideep_ts_attr_group = {
-       .attrs = hideep_ts_sysfs_entries,
-};
+ATTRIBUTE_GROUPS(hideep_ts);
 
 static void hideep_set_work_mode(struct hideep_ts *ts)
 {
@@ -1096,13 +1093,6 @@ static int hideep_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &hideep_ts_attr_group);
-       if (error) {
-               dev_err(&client->dev,
-                       "failed to add sysfs attributes: %d\n", error);
-               return error;
-       }
-
        return 0;
 }
 
@@ -1131,6 +1121,7 @@ MODULE_DEVICE_TABLE(of, hideep_match_table);
 static struct i2c_driver hideep_driver = {
        .driver = {
                .name                   = HIDEEP_I2C_NAME,
+               .dev_groups             = hideep_ts_groups,
                .of_match_table         = of_match_ptr(hideep_match_table),
                .acpi_match_table       = ACPI_PTR(hideep_acpi_id),
                .pm                     = pm_sleep_ptr(&hideep_pm_ops),
index 2450cfa14de9dfe67657657399588241d4dfc636..d0f257989fd6b728091ff3ee1add1d00777507de 100644 (file)
@@ -274,10 +274,7 @@ static struct attribute *hycon_hy46xx_attrs[] = {
        &hycon_hy46xx_attr_bootloader_version.dattr.attr,
        NULL
 };
-
-static const struct attribute_group hycon_hy46xx_attr_group = {
-       .attrs = hycon_hy46xx_attrs,
-};
+ATTRIBUTE_GROUPS(hycon_hy46xx);
 
 static void hycon_hy46xx_get_defaults(struct device *dev, struct hycon_hy46xx_data *tsdata)
 {
@@ -535,10 +532,6 @@ static int hycon_hy46xx_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &hycon_hy46xx_attr_group);
-       if (error)
-               return error;
-
        error = input_register_device(input);
        if (error)
                return error;
@@ -576,6 +569,7 @@ MODULE_DEVICE_TABLE(of, hycon_hy46xx_of_match);
 static struct i2c_driver hycon_hy46xx_driver = {
        .driver = {
                .name = "hycon_hy46xx",
+               .dev_groups = hycon_hy46xx_groups,
                .of_match_table = hycon_hy46xx_of_match,
                .probe_type = PROBE_PREFER_ASYNCHRONOUS,
        },
index ad6828e4f2e2df579b3f084c17405324eee662d4..31ffdc2a93f35aaf72bb67a3931f5cc0441ab3f7 100644 (file)
@@ -876,7 +876,7 @@ exit:
 
 static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store);
 
-static struct attribute *ili210x_attributes[] = {
+static struct attribute *ili210x_attrs[] = {
        &dev_attr_calibrate.attr,
        &dev_attr_firmware_update.attr,
        &dev_attr_firmware_version.attr,
@@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj,
        return attr->mode;
 }
 
-static const struct attribute_group ili210x_attr_group = {
-       .attrs = ili210x_attributes,
+static const struct attribute_group ili210x_group = {
+       .attrs = ili210x_attrs,
        .is_visible = ili210x_attributes_visible,
 };
+__ATTRIBUTE_GROUPS(ili210x);
 
 static void ili210x_power_down(void *data)
 {
@@ -1013,13 +1014,6 @@ static int ili210x_i2c_probe(struct i2c_client *client)
        if (error)
                return error;
 
-       error = devm_device_add_group(dev, &ili210x_attr_group);
-       if (error) {
-               dev_err(dev, "Unable to create sysfs attributes, err: %d\n",
-                       error);
-               return error;
-       }
-
        error = input_register_device(priv->input);
        if (error) {
                dev_err(dev, "Cannot register input device, err: %d\n", error);
@@ -1050,6 +1044,7 @@ MODULE_DEVICE_TABLE(of, ili210x_dt_ids);
 static struct i2c_driver ili210x_ts_driver = {
        .driver = {
                .name = "ili210x_i2c",
+               .dev_groups = ili210x_groups,
                .of_match_table = ili210x_dt_ids,
        },
        .id_table = ili210x_i2c_id,
index 2f872e95fbbadee2df4304c30120a04613bfada3..90c4934e750a3a3dda59e0688388f8d1f0dcf4b4 100644 (file)
@@ -537,10 +537,7 @@ static struct attribute *ilitek_sysfs_attrs[] = {
        &dev_attr_product_id.attr,
        NULL
 };
-
-static struct attribute_group ilitek_attrs_group = {
-       .attrs = ilitek_sysfs_attrs,
-};
+ATTRIBUTE_GROUPS(ilitek_sysfs);
 
 static int ilitek_ts_i2c_probe(struct i2c_client *client)
 {
@@ -595,12 +592,6 @@ static int ilitek_ts_i2c_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(dev, &ilitek_attrs_group);
-       if (error) {
-               dev_err(dev, "sysfs create group failed: %d\n", error);
-               return error;
-       }
-
        return 0;
 }
 
@@ -675,6 +666,7 @@ MODULE_DEVICE_TABLE(of, ilitek_ts_i2c_match);
 static struct i2c_driver ilitek_ts_i2c_driver = {
        .driver = {
                .name = ILITEK_TS_NAME,
+               .dev_groups = ilitek_sysfs_groups,
                .pm = pm_sleep_ptr(&ilitek_pm_ops),
                .of_match_table = of_match_ptr(ilitek_ts_i2c_match),
                .acpi_match_table = ACPI_PTR(ilitekts_acpi_id),
index b4768b66eb1012d6c669d7eaeb8848e1f91fc969..a3f4fb85bee58bf1e5f73861bd59637eed4e565f 100644 (file)
@@ -974,10 +974,11 @@ static umode_t iqs5xx_attr_is_visible(struct kobject *kobj,
        return attr->mode;
 }
 
-static const struct attribute_group iqs5xx_attr_group = {
+static const struct attribute_group iqs5xx_group = {
        .is_visible = iqs5xx_attr_is_visible,
        .attrs = iqs5xx_attrs,
 };
+__ATTRIBUTE_GROUPS(iqs5xx);
 
 static int iqs5xx_suspend(struct device *dev)
 {
@@ -1053,12 +1054,6 @@ static int iqs5xx_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &iqs5xx_attr_group);
-       if (error) {
-               dev_err(&client->dev, "Failed to add attributes: %d\n", error);
-               return error;
-       }
-
        if (iqs5xx->input) {
                error = input_register_device(iqs5xx->input);
                if (error)
@@ -1089,6 +1084,7 @@ MODULE_DEVICE_TABLE(of, iqs5xx_of_match);
 static struct i2c_driver iqs5xx_i2c_driver = {
        .driver = {
                .name           = "iqs5xx",
+               .dev_groups     = iqs5xx_groups,
                .of_match_table = iqs5xx_of_match,
                .pm             = pm_sleep_ptr(&iqs5xx_pm),
        },
index 85b95ed461e7d0c21cee81f069b86d2865d6b9c4..bfbebe245040c1d370c6a393161af1320ae8273f 100644 (file)
@@ -252,18 +252,16 @@ static int mainstone_wm97xx_probe(struct platform_device *pdev)
        return wm97xx_register_mach_ops(wm, &mainstone_mach_ops);
 }
 
-static int mainstone_wm97xx_remove(struct platform_device *pdev)
+static void mainstone_wm97xx_remove(struct platform_device *pdev)
 {
        struct wm97xx *wm = platform_get_drvdata(pdev);
 
        wm97xx_unregister_mach_ops(wm);
-
-       return 0;
 }
 
 static struct platform_driver mainstone_wm97xx_driver = {
        .probe  = mainstone_wm97xx_probe,
-       .remove = mainstone_wm97xx_remove,
+       .remove_new = mainstone_wm97xx_remove,
        .driver = {
                .name   = "wm97xx-touch",
        },
index ae0d978c83bfa4754eb5b6e9901da6f9622ca578..cbcd6e34efb7d14eb30d7b4e9de0f42116d3ce59 100644 (file)
@@ -217,18 +217,16 @@ err_free_mem:
        return ret;
 }
 
-static int mc13783_ts_remove(struct platform_device *pdev)
+static void mc13783_ts_remove(struct platform_device *pdev)
 {
        struct mc13783_ts_priv *priv = platform_get_drvdata(pdev);
 
        input_unregister_device(priv->idev);
        kfree(priv);
-
-       return 0;
 }
 
 static struct platform_driver mc13783_ts_driver = {
-       .remove         = mc13783_ts_remove,
+       .remove_new     = mc13783_ts_remove,
        .driver         = {
                .name   = MC13783_TS_NAME,
        },
index 2ac4483fbc2588b552ef9c76f40caa7f51978036..aa325486f61825e2e30d36a432fffafd8ddb2cbb 100644 (file)
@@ -1419,10 +1419,7 @@ static struct attribute *mip4_attrs[] = {
        &dev_attr_update_fw.attr,
        NULL,
 };
-
-static const struct attribute_group mip4_attr_group = {
-       .attrs = mip4_attrs,
-};
+ATTRIBUTE_GROUPS(mip4);
 
 static int mip4_probe(struct i2c_client *client)
 {
@@ -1514,13 +1511,6 @@ static int mip4_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &mip4_attr_group);
-       if (error) {
-               dev_err(&client->dev,
-                       "Failed to create sysfs attribute group: %d\n", error);
-               return error;
-       }
-
        return 0;
 }
 
@@ -1589,6 +1579,7 @@ static struct i2c_driver mip4_driver = {
        .probe = mip4_probe,
        .driver = {
                .name = MIP4_DEVICE_NAME,
+               .dev_groups = mip4_groups,
                .of_match_table = of_match_ptr(mip4_of_match),
                .acpi_match_table = ACPI_PTR(mip4_acpi_match),
                .pm = pm_sleep_ptr(&mip4_pm_ops),
index b2da0194e02ab1e845a1aae978cdbae277daebca..821245019feaae9b81ffdbddb04f889dfa9b1d55 100644 (file)
@@ -197,7 +197,7 @@ fail:
        return err;
 }
 
-static int pcap_ts_remove(struct platform_device *pdev)
+static void pcap_ts_remove(struct platform_device *pdev)
 {
        struct pcap_ts *pcap_ts = platform_get_drvdata(pdev);
 
@@ -207,8 +207,6 @@ static int pcap_ts_remove(struct platform_device *pdev)
        input_unregister_device(pcap_ts->input);
 
        kfree(pcap_ts);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM
@@ -240,7 +238,7 @@ static const struct dev_pm_ops pcap_ts_pm_ops = {
 
 static struct platform_driver pcap_ts_driver = {
        .probe          = pcap_ts_probe,
-       .remove         = pcap_ts_remove,
+       .remove_new     = pcap_ts_remove,
        .driver         = {
                .name   = "pcap-ts",
                .pm     = PCAP_TS_PM_OPS,
index 78dd3059d585ac21ecfd5d1fe502466b111ed984..13c500e776f6d2c20d307b1ca2e46cfb17abb3a6 100644 (file)
@@ -1004,7 +1004,7 @@ static DEVICE_ATTR(boot_mode, S_IRUGO, raydium_i2c_boot_mode_show, NULL);
 static DEVICE_ATTR(update_fw, S_IWUSR, NULL, raydium_i2c_update_fw_store);
 static DEVICE_ATTR(calibrate, S_IWUSR, NULL, raydium_i2c_calibrate_store);
 
-static struct attribute *raydium_i2c_attributes[] = {
+static struct attribute *raydium_i2c_attrs[] = {
        &dev_attr_update_fw.attr,
        &dev_attr_boot_mode.attr,
        &dev_attr_fw_version.attr,
@@ -1012,10 +1012,7 @@ static struct attribute *raydium_i2c_attributes[] = {
        &dev_attr_calibrate.attr,
        NULL
 };
-
-static const struct attribute_group raydium_i2c_attribute_group = {
-       .attrs = raydium_i2c_attributes,
-};
+ATTRIBUTE_GROUPS(raydium_i2c);
 
 static int raydium_i2c_power_on(struct raydium_data *ts)
 {
@@ -1174,14 +1171,6 @@ static int raydium_i2c_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev,
-                                  &raydium_i2c_attribute_group);
-       if (error) {
-               dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
-                       error);
-               return error;
-       }
-
        return 0;
 }
 
@@ -1265,6 +1254,7 @@ static struct i2c_driver raydium_i2c_driver = {
        .id_table = raydium_i2c_id,
        .driver = {
                .name = "raydium_ts",
+               .dev_groups = raydium_i2c_groups,
                .pm = pm_sleep_ptr(&raydium_i2c_pm_ops),
                .acpi_match_table = ACPI_PTR(raydium_acpi_id),
                .of_match_table = of_match_ptr(raydium_of_match),
index 240424f06b98fccea7fa18161d9524d644e042c5..4493ad0c93221081a3050e75c35fbc265468082c 100644 (file)
@@ -854,10 +854,7 @@ static struct attribute *rohm_ts_attrs[] = {
        &dev_attr_inv_y.attr,
        NULL,
 };
-
-static const struct attribute_group rohm_ts_attr_group = {
-       .attrs = rohm_ts_attrs,
-};
+ATTRIBUTE_GROUPS(rohm_ts);
 
 static int rohm_ts_device_init(struct i2c_client *client, u8 setup2)
 {
@@ -1164,12 +1161,6 @@ static int rohm_bu21023_i2c_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(dev, &rohm_ts_attr_group);
-       if (error) {
-               dev_err(dev, "failed to create sysfs group: %d\n", error);
-               return error;
-       }
-
        return error;
 }
 
@@ -1182,6 +1173,7 @@ MODULE_DEVICE_TABLE(i2c, rohm_bu21023_i2c_id);
 static struct i2c_driver rohm_bu21023_i2c_driver = {
        .driver = {
                .name = BU21023_NAME,
+               .dev_groups = rohm_ts_groups,
        },
        .probe = rohm_bu21023_i2c_probe,
        .id_table = rohm_bu21023_i2c_id,
index 998d99d189111f8e1671a28167b517e8b5157575..149cc2c4925e91f3eb964c1ce193733e69828abd 100644 (file)
@@ -286,10 +286,7 @@ static struct attribute *s6sy761_sysfs_attrs[] = {
        &dev_attr_devid.attr,
        NULL
 };
-
-static struct attribute_group s6sy761_attribute_group = {
-       .attrs = s6sy761_sysfs_attrs
-};
+ATTRIBUTE_GROUPS(s6sy761_sysfs);
 
 static int s6sy761_power_on(struct s6sy761_data *sdata)
 {
@@ -465,10 +462,6 @@ static int s6sy761_probe(struct i2c_client *client)
        if (err)
                return err;
 
-       err = devm_device_add_group(&client->dev, &s6sy761_attribute_group);
-       if (err)
-               return err;
-
        pm_runtime_enable(&client->dev);
 
        return 0;
@@ -535,6 +528,7 @@ MODULE_DEVICE_TABLE(i2c, s6sy761_id);
 static struct i2c_driver s6sy761_driver = {
        .driver = {
                .name = S6SY761_DEV_NAME,
+               .dev_groups = s6sy761_sysfs_groups,
                .of_match_table = of_match_ptr(s6sy761_of_match),
                .pm = pm_ptr(&s6sy761_pm_ops),
        },
index 56e371fd88fa1082029cb7432def580dd6a3379b..85010fa079082f4085637065b9d0ef2682af567b 100644 (file)
@@ -517,10 +517,7 @@ static struct attribute *stmfts_sysfs_attrs[] = {
        &dev_attr_hover_enable.attr,
        NULL
 };
-
-static struct attribute_group stmfts_attribute_group = {
-       .attrs = stmfts_sysfs_attrs
-};
+ATTRIBUTE_GROUPS(stmfts_sysfs);
 
 static int stmfts_power_on(struct stmfts_data *sdata)
 {
@@ -727,10 +724,6 @@ static int stmfts_probe(struct i2c_client *client)
                }
        }
 
-       err = devm_device_add_group(&client->dev, &stmfts_attribute_group);
-       if (err)
-               return err;
-
        pm_runtime_enable(&client->dev);
        device_enable_async_suspend(&client->dev);
 
@@ -804,6 +797,7 @@ MODULE_DEVICE_TABLE(i2c, stmfts_id);
 static struct i2c_driver stmfts_driver = {
        .driver = {
                .name = STMFTS_DEV_NAME,
+               .dev_groups = stmfts_sysfs_groups,
                .of_match_table = of_match_ptr(stmfts_of_match),
                .pm = pm_ptr(&stmfts_pm_ops),
                .probe_type = PROBE_PREFER_ASYNCHRONOUS,
index 25c45c3a35615c76eb7b1bc1d02483248fbf0bf1..b204fdb2d22c61131155c451962dc10e058eab05 100644 (file)
@@ -350,13 +350,11 @@ static int stmpe_input_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int stmpe_ts_remove(struct platform_device *pdev)
+static void stmpe_ts_remove(struct platform_device *pdev)
 {
        struct stmpe_touch *ts = platform_get_drvdata(pdev);
 
        stmpe_disable(ts->stmpe, STMPE_BLOCK_TOUCHSCREEN);
-
-       return 0;
 }
 
 static struct platform_driver stmpe_ts_driver = {
@@ -364,7 +362,7 @@ static struct platform_driver stmpe_ts_driver = {
                .name = STMPE_TS_NAME,
        },
        .probe = stmpe_input_probe,
-       .remove = stmpe_ts_remove,
+       .remove_new = stmpe_ts_remove,
 };
 module_platform_driver(stmpe_ts_driver);
 
index bb3c6072fc82797536da2f5e346f88aed525228b..92b2b840b4b7b7b6a281041b652f3211cc139327 100644 (file)
@@ -375,7 +375,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int sun4i_ts_remove(struct platform_device *pdev)
+static void sun4i_ts_remove(struct platform_device *pdev)
 {
        struct sun4i_ts_data *ts = platform_get_drvdata(pdev);
 
@@ -385,8 +385,6 @@ static int sun4i_ts_remove(struct platform_device *pdev)
 
        /* Deactivate all IRQs */
        writel(0, ts->base + TP_INT_FIFOC);
-
-       return 0;
 }
 
 static const struct of_device_id sun4i_ts_of_match[] = {
@@ -403,7 +401,7 @@ static struct platform_driver sun4i_ts_driver = {
                .of_match_table = sun4i_ts_of_match,
        },
        .probe  = sun4i_ts_probe,
-       .remove = sun4i_ts_remove,
+       .remove_new = sun4i_ts_remove,
 };
 
 module_platform_driver(sun4i_ts_driver);
index 9aa4e35fb4f5aaf083341f93703457ead0d1deb2..34324f8512ac2d40d15321551ef2dee0cca00d74 100644 (file)
@@ -491,7 +491,7 @@ err_free_mem:
        return err;
 }
 
-static int titsc_remove(struct platform_device *pdev)
+static void titsc_remove(struct platform_device *pdev)
 {
        struct titsc *ts_dev = platform_get_drvdata(pdev);
        u32 steps;
@@ -508,7 +508,6 @@ static int titsc_remove(struct platform_device *pdev)
        input_unregister_device(ts_dev->input);
 
        kfree(ts_dev);
-       return 0;
 }
 
 static int titsc_suspend(struct device *dev)
@@ -552,7 +551,7 @@ MODULE_DEVICE_TABLE(of, ti_tsc_dt_ids);
 
 static struct platform_driver ti_tsc_driver = {
        .probe  = titsc_probe,
-       .remove = titsc_remove,
+       .remove_new = titsc_remove,
        .driver = {
                .name   = "TI-am335x-tsc",
                .pm     = pm_sleep_ptr(&titsc_pm_ops),
index b5e904c5b7c49e8d7e8d2a8ada90950aae58ef39..89c5248f66f6fcbcd6e410f009340f7cd94898e4 100644 (file)
@@ -63,9 +63,10 @@ MODULE_DEVICE_TABLE(of, tsc2004_of_match);
 
 static struct i2c_driver tsc2004_driver = {
        .driver = {
-               .name   = "tsc2004",
-               .of_match_table = of_match_ptr(tsc2004_of_match),
-               .pm     = pm_sleep_ptr(&tsc200x_pm_ops),
+               .name           = "tsc2004",
+               .dev_groups     = tsc200x_groups,
+               .of_match_table = of_match_ptr(tsc2004_of_match),
+               .pm             = pm_sleep_ptr(&tsc200x_pm_ops),
        },
        .id_table       = tsc2004_idtable,
        .probe          = tsc2004_probe,
index b6dfbcfc8c19b21ef59fb5d0fed0256105171db5..1b40ce0ca1b9910c60a38cd207f8d9de5d16fc57 100644 (file)
@@ -79,9 +79,10 @@ MODULE_DEVICE_TABLE(of, tsc2005_of_match);
 
 static struct spi_driver tsc2005_driver = {
        .driver = {
-               .name   = "tsc2005",
-               .of_match_table = of_match_ptr(tsc2005_of_match),
-               .pm     = pm_sleep_ptr(&tsc200x_pm_ops),
+               .name           = "tsc2005",
+               .dev_groups     = tsc200x_groups,
+               .of_match_table = of_match_ptr(tsc2005_of_match),
+               .pm             = pm_sleep_ptr(&tsc200x_pm_ops),
        },
        .probe  = tsc2005_probe,
        .remove = tsc2005_remove,
index b799f26fcf8facbb090105a7a57cf5949ab60d1c..a4c0e9db9bb94d0abb47aadc793d11838033e3c7 100644 (file)
@@ -356,6 +356,12 @@ static const struct attribute_group tsc200x_attr_group = {
        .attrs          = tsc200x_attrs,
 };
 
+const struct attribute_group *tsc200x_groups[] = {
+       &tsc200x_attr_group,
+       NULL
+};
+EXPORT_SYMBOL_GPL(tsc200x_groups);
+
 static void tsc200x_esd_work(struct work_struct *work)
 {
        struct tsc200x *ts = container_of(work, struct tsc200x, esd_work.work);
@@ -553,25 +559,17 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
                return error;
 
        dev_set_drvdata(dev, ts);
-       error = sysfs_create_group(&dev->kobj, &tsc200x_attr_group);
-       if (error) {
-               dev_err(dev,
-                       "Failed to create sysfs attributes, err: %d\n", error);
-               goto disable_regulator;
-       }
 
        error = input_register_device(ts->idev);
        if (error) {
                dev_err(dev,
                        "Failed to register input device, err: %d\n", error);
-               goto err_remove_sysfs;
+               goto disable_regulator;
        }
 
        irq_set_irq_wake(irq, 1);
        return 0;
 
-err_remove_sysfs:
-       sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
 disable_regulator:
        regulator_disable(ts->vio);
        return error;
@@ -582,8 +580,6 @@ void tsc200x_remove(struct device *dev)
 {
        struct tsc200x *ts = dev_get_drvdata(dev);
 
-       sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
-
        regulator_disable(ts->vio);
 }
 EXPORT_SYMBOL_GPL(tsc200x_remove);
index 4ded34425b21eef7bbbb8270eb22c1a2e7e823e6..37de91efd78ea3cae52bb785d52c8517e5a9b653 100644 (file)
@@ -70,6 +70,7 @@
 
 extern const struct regmap_config tsc200x_regmap_config;
 extern const struct dev_pm_ops tsc200x_pm_ops;
+extern const struct attribute_group *tsc200x_groups[];
 
 int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
                  struct regmap *regmap,
index cbc4750c53f9a9bdab1a3abd4b6f706d2de94eb2..128341a6696bc01943c1b7eb7eb42ecf93417183 100644 (file)
@@ -944,10 +944,7 @@ static struct attribute *wdt87xx_attrs[] = {
        &dev_attr_update_fw.attr,
        NULL
 };
-
-static const struct attribute_group wdt87xx_attr_group = {
-       .attrs = wdt87xx_attrs,
-};
+ATTRIBUTE_GROUPS(wdt87xx);
 
 static void wdt87xx_report_contact(struct input_dev *input,
                                   struct wdt87xx_sys_param *param,
@@ -1104,12 +1101,6 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &wdt87xx_attr_group);
-       if (error) {
-               dev_err(&client->dev, "create sysfs failed: %d\n", error);
-               return error;
-       }
-
        return 0;
 }
 
@@ -1172,8 +1163,9 @@ static struct i2c_driver wdt87xx_driver = {
        .probe          = wdt87xx_ts_probe,
        .id_table       = wdt87xx_dev_id,
        .driver = {
-               .name   = WDT87XX_NAME,
-               .pm     = pm_sleep_ptr(&wdt87xx_pm_ops),
+               .name = WDT87XX_NAME,
+               .dev_groups = wdt87xx_groups,
+               .pm = pm_sleep_ptr(&wdt87xx_pm_ops),
                .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id),
        },
 };
index 319f57fb9af52805bd143ba25f55e1650cd05c7a..9cee26b63341df1403f5a966c898cccab4e75ff5 100644 (file)
@@ -374,14 +374,12 @@ err_alloc:
        return error;
 }
 
-static int wm831x_ts_remove(struct platform_device *pdev)
+static void wm831x_ts_remove(struct platform_device *pdev)
 {
        struct wm831x_ts *wm831x_ts = platform_get_drvdata(pdev);
 
        free_irq(wm831x_ts->pd_irq, wm831x_ts);
        free_irq(wm831x_ts->data_irq, wm831x_ts);
-
-       return 0;
 }
 
 static struct platform_driver wm831x_ts_driver = {
@@ -389,7 +387,7 @@ static struct platform_driver wm831x_ts_driver = {
                .name = "wm831x-touch",
        },
        .probe = wm831x_ts_probe,
-       .remove = wm831x_ts_remove,
+       .remove_new = wm831x_ts_remove,
 };
 module_platform_driver(wm831x_ts_driver);
 
index ac3b3dd59488ad72b93ffcc6b96123d352f06e37..f01f6cc9b59fa8a98dc389c8a6fc6d7ec8b9513e 100644 (file)
@@ -756,11 +756,9 @@ batt_err:
        return ret;
 }
 
-static int wm97xx_mfd_remove(struct platform_device *pdev)
+static void wm97xx_mfd_remove(struct platform_device *pdev)
 {
        wm97xx_remove(&pdev->dev);
-
-       return 0;
 }
 
 static int wm97xx_suspend(struct device *dev)
@@ -878,7 +876,7 @@ static struct platform_driver wm97xx_mfd_driver = {
                .pm =           pm_sleep_ptr(&wm97xx_pm_ops),
        },
        .probe =        wm97xx_mfd_probe,
-       .remove =       wm97xx_mfd_remove,
+       .remove_new =   wm97xx_mfd_remove,
 };
 
 static int __init wm97xx_init(void)
index 49790c1bd2c43e21615fda95cbf3febb22ba6da0..de6503c0edb8efcf86e0565a52b81e7a4e378014 100644 (file)
@@ -562,7 +562,7 @@ struct ff_device {
 
        int max_effects;
        struct ff_effect *effects;
-       struct file *effect_owners[];
+       struct file *effect_owners[] __counted_by(max_effects);
 };
 
 int input_ff_create(struct input_dev *dev, unsigned int max_effects);
index 3b8580bd33c146badadfd0bde7101cba99d17c96..2cf89a538b18bbc7c99c8705c2d22bdc95065238 100644 (file)
@@ -47,7 +47,7 @@ struct input_mt {
        unsigned int flags;
        unsigned int frame;
        int *red;
-       struct input_mt_slot slots[];
+       struct input_mt_slot slots[] __counted_by(num_slots);
 };
 
 static inline void input_mt_set_value(struct input_mt_slot *slot,