* [PATCH v2] Input: add regulator haptic driver
From: hyunhee.kim @ 2013-10-24 6:35 UTC (permalink / raw)
To: 'Dmitry Torokhov'
Cc: broonie, peter.ujfalusi, wfp5p, linux-input, linux-kernel, akpm,
kyungmin.park, 'Aristeu Sergio Rozanski Filho'
In-Reply-To: <20131021155558.GA4255@core.coreip.homeip.net>
From: Hyunhee Kim <hyunhee.kim@samsung.com>
Date: Wed, 9 Oct 2013 16:21:36 +0900
Subject: [PATCH] tizenw: add regulator haptic driver
Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Aristeu Rozanski <aris@ruivo.org>
---
drivers/input/misc/Kconfig | 10 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/regulator-haptic.c | 183
+++++++++++++++++++++++++++++++++
3 files changed, 194 insertions(+)
create mode 100644 drivers/input/misc/regulator-haptic.c
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index bb698e1..21b4d5b 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -82,6 +82,16 @@ config INPUT_ARIZONA_HAPTICS
To compile this driver as a module, choose M here: the
module will be called arizona-haptics.
+config INPUT_REGULATOR_HAPTIC
+ tristate "support haptics on/off using regulator"
+ select INPUT_FF_MEMLESS
+ help
+ Say Y to enable support for the haptic module. Haptic can be
+ enabled/disabled by regulator.
+
+ To compile this driver as a module, choose M here: the
+ module will be called regulator-haptic.
+
config INPUT_BMA150
tristate "BMA150/SMB380 acceleration sensor support"
depends on I2C
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index d7fc17f..106f0bc 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_INPUT_ADXL34X_I2C) +=
adxl34x-i2c.o
obj-$(CONFIG_INPUT_ADXL34X_SPI) += adxl34x-spi.o
obj-$(CONFIG_INPUT_APANEL) += apanel.o
obj-$(CONFIG_INPUT_ARIZONA_HAPTICS) += arizona-haptics.o
+obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o
obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
obj-$(CONFIG_INPUT_BFIN_ROTARY) += bfin_rotary.o
diff --git a/drivers/input/misc/regulator-haptic.c
b/drivers/input/misc/regulator-haptic.c
new file mode 100644
index 0000000..c9588d5
--- /dev/null
+++ b/drivers/input/misc/regulator-haptic.c
@@ -0,0 +1,183 @@
+/*
+ * Regulator haptic driver
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Author: Hyunhee Kim <hyunhee.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/regulator/driver.h>
+
+struct regulator_haptic {
+ struct device *dev;
+ struct input_dev *input_dev;
+ struct work_struct work;
+ bool enabled;
+ struct regulator *regulator;
+ struct mutex mutex;
+ int level;
+};
+
+static void regulator_haptic_toggle(struct regulator_haptic *haptic, bool
enable)
+{
+ int ret;
+
+ mutex_lock(&haptic->mutex);
+ if (enable && !haptic->enabled) {
+ haptic->enabled = true;
+ ret = regulator_enable(haptic->regulator);
+ if (ret)
+ dev_err(haptic->dev, "failed to enable
regulator\n");
+ } else if (!enable && haptic->enabled) {
+ haptic->enabled = false;
+ ret = regulator_disable(haptic->regulator);
+ if (ret)
+ dev_err(haptic->dev, "failed to disable
regulator\n");
+ }
+ mutex_unlock(&haptic->mutex);
+}
+
+static void regulator_haptic_work(struct work_struct *work)
+{
+ struct regulator_haptic *haptic = container_of(work,
+ struct
regulator_haptic,
+ work);
+ if (haptic->level)
+ regulator_haptic_toggle(haptic, true);
+ else
+ regulator_haptic_toggle(haptic, false);
+
+}
+
+static int regulator_haptic_play(struct input_dev *input, void *data,
+ struct ff_effect *effect)
+{
+ struct regulator_haptic *haptic = input_get_drvdata(input);
+
+ haptic->level = effect->u.rumble.strong_magnitude;
+ if (!haptic->level)
+ haptic->level = effect->u.rumble.weak_magnitude;
+ schedule_work(&haptic->work);
+
+ return 0;
+}
+
+static void regulator_haptic_close(struct input_dev *input)
+{
+ struct regulator_haptic *haptic = input_get_drvdata(input);
+
+ cancel_work_sync(&haptic->work);
+ regulator_haptic_toggle(haptic, false);
+}
+
+static int regulator_haptic_probe(struct platform_device *pdev)
+{
+ struct regulator_haptic *haptic;
+ struct input_dev *input_dev;
+ int error;
+
+ haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL);
+ if (!haptic) {
+ dev_err(&pdev->dev, "unable to allocate memory for
haptic\n");
+ return -ENOMEM;
+ }
+
+ input_dev = input_allocate_device();
+
+ if (!input_dev) {
+ dev_err(&pdev->dev, "unable to allocate memory\n");
+ error = -ENOMEM;
+ goto err_kfree_mem;
+ }
+
+ INIT_WORK(&haptic->work, regulator_haptic_work);
+ mutex_init(&haptic->mutex);
+ haptic->input_dev = input_dev;
+ haptic->dev = &pdev->dev;
+ haptic->regulator = regulator_get(&pdev->dev, "haptic");
+
+ if (IS_ERR(haptic->regulator)) {
+ error = PTR_ERR(haptic->regulator);
+ dev_err(&pdev->dev, "unable to get regulator, err: %d\n",
+ error);
+ goto err_ifree_mem;
+ }
+
+ haptic->input_dev->name = "regulator:haptic";
+ haptic->input_dev->dev.parent = &pdev->dev;
+ haptic->input_dev->close = regulator_haptic_close;
+ haptic->enabled = false;
+ input_set_drvdata(haptic->input_dev, haptic);
+ input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE);
+
+ error = input_ff_create_memless(input_dev, NULL,
+ regulator_haptic_play);
+ if (error) {
+ dev_err(&pdev->dev,
+ "input_ff_create_memless() failed: %d\n",
+ error);
+ goto err_put_regulator;
+ }
+
+ error = input_register_device(haptic->input_dev);
+ if (error) {
+ dev_err(&pdev->dev,
+ "couldn't register input device: %d\n",
+ error);
+ goto err_destroy_ff;
+ }
+
+ platform_set_drvdata(pdev, haptic);
+
+ return 0;
+
+err_destroy_ff:
+ input_ff_destroy(haptic->input_dev);
+err_put_regulator:
+ regulator_put(haptic->regulator);
+err_ifree_mem:
+ input_free_device(haptic->input_dev);
+err_kfree_mem:
+ kfree(haptic);
+
+ return error;
+}
+
+static int regulator_haptic_remove(struct platform_device *pdev)
+{
+ struct regulator_haptic *haptic = platform_get_drvdata(pdev);
+
+ input_unregister_device(haptic->input_dev);
+
+ return 0;
+}
+
+static struct of_device_id regulator_haptic_dt_match[] = {
+ { .compatible = "linux,regulator-haptic" },
+ {},
+};
+
+static struct platform_driver regulator_haptic_driver = {
+ .driver = {
+ .name = "regulator-haptic",
+ .owner = THIS_MODULE,
+ .of_match_table = regulator_haptic_dt_match,
+ },
+
+ .probe = regulator_haptic_probe,
+ .remove = regulator_haptic_remove,
+};
+module_platform_driver(regulator_haptic_driver);
+
+MODULE_ALIAS("platform:regulator-haptic");
+MODULE_DESCRIPTION("Regulator haptic driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Hyunhee Kim <hyunhee.kim@samsung.com>");
--
1.7.9.5
-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
Sent: Tuesday, October 22, 2013 12:56 AM
To: hyunhee.kim
Cc: broonie@opensource.wolfsonmicro.com; peter.ujfalusi@ti.com;
wfp5p@virginia.edu; linux-input@vger.kernel.org;
linux-kernel@vger.kernel.org; akpm@linux-foundation.org;
kyungmin.park@samsung.com; Aristeu Sergio Rozanski Filho
Subject: Re: [PATCH] Input: add regulator haptic driver
Hi Hyunhee,
On Fri, Oct 11, 2013 at 11:26:05AM +0900, hyunhee.kim wrote:
> From: Hyunhee Kim <hyunhee.kim@samsung.com>
> Date: Wed, 9 Oct 2013 16:21:36 +0900
> Subject: [PATCH] Input: add regulator haptic driver
>
> The regulator haptic driver function can be used to control motor by
on/off
> regulator.
> User can control the haptic driver by using force feedback framework.
>
> Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/input/misc/Kconfig | 6 ++
> drivers/input/misc/Makefile | 1 +
> drivers/input/misc/regulator-haptic.c | 185
> +++++++++++++++++++++++++++++++++
> 3 files changed, 192 insertions(+)
> create mode 100644 drivers/input/misc/regulator-haptic.c
>
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index bb698e1..f391cd7 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -82,6 +82,12 @@ config INPUT_ARIZONA_HAPTICS
> To compile this driver as a module, choose M here: the
> module will be called arizona-haptics.
>
> +config INPUT_REGULATOR_HAPTIC
> + tristate "regulator haptics support"
This option should be worded better I think.
> + select INPUT_FF_MEMLESS
> + help
> + Say Y to enable support for the haptics module for regulator.
And explained better to. Also please add "To compile this driver as a
module..."
> +
> config INPUT_BMA150
> tristate "BMA150/SMB380 acceleration sensor support"
> depends on I2C
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index d7fc17f..106f0bc 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_INPUT_ADXL34X_I2C) +=
> adxl34x-i2c.o
> obj-$(CONFIG_INPUT_ADXL34X_SPI) += adxl34x-spi.o
> obj-$(CONFIG_INPUT_APANEL) += apanel.o
> obj-$(CONFIG_INPUT_ARIZONA_HAPTICS) += arizona-haptics.o
> +obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o
> obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
> obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
> obj-$(CONFIG_INPUT_BFIN_ROTARY) += bfin_rotary.o
> diff --git a/drivers/input/misc/regulator-haptic.c
> b/drivers/input/misc/regulator-haptic.c
> new file mode 100644
> index 0000000..29f57ea
> --- /dev/null
> +++ b/drivers/input/misc/regulator-haptic.c
> @@ -0,0 +1,185 @@
> +/*
> + * Regulator haptic driver
> + *
> + * Copyright (c) 2013 Samsung Electronics Co., Ltd.
> + *
> + * Author: Hyunhee Kim <hyunhee.kim@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/input.h>
> +#include <linux/slab.h>
> +#include <linux/regulator/driver.h>
> +
> +struct regulator_haptic {
> + struct device *dev;
> + struct input_dev *input_dev;
> + struct work_struct work;
> + bool enabled;
> + struct regulator *regulator;
> + struct mutex mutex;
> + int level;
> +};
> +
> +static void regulator_haptic_enable(struct regulator_haptic *haptic, bool
> enable)
> +{
> + int ret;
> +
> + mutex_lock(&haptic->mutex);
> + if (enable && !haptic->enabled) {
> + haptic->enabled = true;
> + ret = regulator_enable(haptic->regulator);
> + if (ret)
> + pr_err("haptic: %s failed to enable regulator\n",
> + __func__);
Please use dev_err() here and also stick error code into the message.
> + } else if (!enable && haptic->enabled) {
> + haptic->enabled = false;
> + ret = regulator_disable(haptic->regulator);
> + if (ret)
> + pr_err("haptic: %s failed to disable regulator\n",
> + __func__);
> + }
> + mutex_unlock(&haptic->mutex);
I wonder if you want separate functions for regulator_haptic_enable and
regulator_haptic_disable seeing how you are using it later in the code.
If not then ...
> +}
> +
> +static void regulator_haptic_work(struct work_struct *work)
> +{
> + struct regulator_haptic *haptic = container_of(work,
> + struct
> regulator_haptic,
> + work);
> + if (haptic->level)
> + regulator_haptic_enable(haptic, true);
> + else
> + regulator_haptic_enable(haptic, false);
... just say:
regulator_haptic_toggle(haptic, haptic->level != 0);
> +
> +}
> +
> +static int regulator_haptic_play(struct input_dev *input, void *data,
> + struct ff_effect *effect)
> +{
> + struct regulator_haptic *haptic = input_get_drvdata(input);
> +
> + haptic->level = effect->u.rumble.strong_magnitude;
> + if (!haptic->level)
> + haptic->level = effect->u.rumble.weak_magnitude;
> + schedule_work(&haptic->work);
> +
> + return 0;
> +}
> +
> +static void regulator_haptic_close(struct input_dev *input)
> +{
> + struct regulator_haptic *haptic = input_get_drvdata(input);
> +
> + cancel_work_sync(&haptic->work);
> + regulator_haptic_enable(haptic, false);
> +}
> +
> +static int regulator_haptic_probe(struct platform_device *pdev)
> +{
> + struct regulator_haptic *haptic;
> + struct input_dev *input_dev;
> + int error;
> +
> + haptic = kzalloc(sizeof(*haptic), GFP_KERNEL);
> + if (!haptic) {
> + dev_err(&pdev->dev, "unable to allocate memory for
> haptic\n");
> + return -ENOMEM;
> + }
> +
> + input_dev = input_allocate_device();
> +
> + if (!input_dev) {
> + dev_err(&pdev->dev, "unable to allocate memory\n");
> + error = -ENOMEM;
> + goto err_kfree_mem;
> + }
> +
> + INIT_WORK(&haptic->work, regulator_haptic_work);
> + mutex_init(&haptic->mutex);
> + haptic->input_dev = input_dev;
> + haptic->dev = &pdev->dev;
> + haptic->regulator = regulator_get(&pdev->dev, "haptic");
> +
> + if (IS_ERR(haptic->regulator)) {
> + error = PTR_ERR(haptic->regulator);
> + dev_err(&pdev->dev, "unable to get regulator, err: %d\n",
> + error);
> + goto err_ifree_mem;
> + }
> +
> + haptic->input_dev->name = "regulator:haptic";
> + haptic->input_dev->dev.parent = &pdev->dev;
> + haptic->input_dev->close = regulator_haptic_close;
> + haptic->enabled = false;
> + input_set_drvdata(haptic->input_dev, haptic);
> + input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE);
> +
> + error = input_ff_create_memless(input_dev, NULL,
> + regulator_haptic_play);
> + if (error) {
> + dev_err(&pdev->dev,
> + "input_ff_create_memless() failed: %d\n",
> + error);
> + goto err_put_regulator;
> + }
> +
> + error = input_register_device(haptic->input_dev);
> + if (error) {
> + dev_err(&pdev->dev,
> + "couldn't register input device: %d\n",
> + error);
> + goto err_destroy_ff;
> + }
> +
> + platform_set_drvdata(pdev, haptic);
> +
> + return 0;
> +
> +err_destroy_ff:
> + input_ff_destroy(haptic->input_dev);
> +err_put_regulator:
> + regulator_put(haptic->regulator);
> +err_ifree_mem:
> + input_free_device(haptic->input_dev);
> +err_kfree_mem:
> + kfree(haptic);
> +
> + return error;
> +}
> +
> +static int regulator_haptic_remove(struct platform_device *pdev)
> +{
> + struct regulator_haptic *haptic = platform_get_drvdata(pdev);
> +
> + input_unregister_device(haptic->input_dev);
I think you are leaking reference to regulator and memory allocated for
the haptic structure here. Maybe it should all be converted to devm.
> +
> + return 0;
> +}
> +
> +static struct of_device_id regulator_haptic_dt_match[] = {
> + { .compatible = "linux,regulator-haptic" },
> + {},
> +};
> +
> +static struct platform_driver regulator_haptic_driver = {
> + .driver = {
> + .name = "regulator-haptic",
> + .owner = THIS_MODULE,
> + .of_match_table = regulator_haptic_dt_match,
> + },
> +
> + .probe = regulator_haptic_probe,
> + .remove = regulator_haptic_remove,
> +};
> +module_platform_driver(regulator_haptic_driver);
> +
> +MODULE_ALIAS("platform:regulator-haptic");
> +MODULE_DESCRIPTION("Regulator haptic driver");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Hyunhee Kim <hyunhee.kim@samsung.com>");
> --
> 1.7.9.5
>
>
Thanks.
--
Dmitry
^ permalink raw reply related
* Re: [PATCHv5 1/3] Input: twl4030-pwrbutton - add device tree support
From: Sebastian Reichel @ 2013-10-23 22:49 UTC (permalink / raw)
To: Rob Herring
Cc: Dmitry Torokhov, Grant Likely, Rob Herring, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <52684C8E.6080802@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]
On Wed, Oct 23, 2013 at 05:24:14PM -0500, Rob Herring wrote:
> So a twl4030 device is only a power button? DT should describe the h/w
> not a node for a sub-function of a device.
No. TWL4030 is a companion chip for the OMAP3 processor. It provides
miscellaneous functionality, e.g.:
* RTC
* Watchdog
* Regulators
* Keypad Matrix
* USB
* Audio
* Vibrator
* GPIO
* ...
One part of the functionality is the power button. The patch
assumes, that the twl4030-pwrbutton node is used as follows:
twl {
/* ... common stuff ... */
pwrbutton {
compatible = "ti,twl4030-pwrbutton";
interrupts = <8>;
};
};
See also:
* Documentation/devicetree/bindings/mfd/twl-familly.txt
* Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
* Documentation/devicetree/bindings/sound/omap-twl4030.txt
* Documentation/devicetree/bindings/mfd/twl4030-power.txt
* Documentation/devicetree/bindings/mfd/twl4030-audio.txt
* Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCHv5 1/3] Input: twl4030-pwrbutton - add device tree support
From: Rob Herring @ 2013-10-23 22:24 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Peter Ujfalusi, Sachin Kamat,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1382560002-6299-2-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
On 10/23/2013 03:26 PM, Sebastian Reichel wrote:
> Add device tree support for twl4030 power button driver.
>
> Signed-off-by: Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
> ---
> .../devicetree/bindings/input/twl4030-pwrbutton.txt | 13 +++++++++++++
> drivers/input/misc/twl4030-pwrbutton.c | 16 ++++++++++++----
> 2 files changed, 25 insertions(+), 4 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
>
> diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> new file mode 100644
> index 0000000..945ec74
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> @@ -0,0 +1,13 @@
> +* TWL4030's pwrbutton device tree bindings
> +
> +Required SoC Specific Properties:
> +- compatible: should be one of the following
> + - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
> +- interrupt: should be one of the following
> + - <8>: For controllers compatible with twl4030
> +
> +Example:
> + twl_pwrbutton: pwrbutton {
> + compatible = "ti,twl4030-pwrbutton";
> + interrupts = <8>;
> + };
So a twl4030 device is only a power button? DT should describe the h/w
not a node for a sub-function of a device.
Rob
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> index b9a05fd..a3a0fe3 100644
> --- a/drivers/input/misc/twl4030-pwrbutton.c
> +++ b/drivers/input/misc/twl4030-pwrbutton.c
> @@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
> return IRQ_HANDLED;
> }
>
> -static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
> +static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> {
> struct input_dev *pwr;
> int irq = platform_get_irq(pdev, 0);
> @@ -106,16 +106,24 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
> return 0;
> }
>
> +#if IS_ENABLED(CONFIG_OF)
> +static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
> + { .compatible = "ti,twl4030-pwrbutton" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
> +#endif
> +
> static struct platform_driver twl4030_pwrbutton_driver = {
> + .probe = twl4030_pwrbutton_probe,
> .remove = __exit_p(twl4030_pwrbutton_remove),
> .driver = {
> .name = "twl4030_pwrbutton",
> .owner = THIS_MODULE,
> + .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
> },
> };
> -
> -module_platform_driver_probe(twl4030_pwrbutton_driver,
> - twl4030_pwrbutton_probe);
> +module_platform_driver(twl4030_pwrbutton_driver);
>
> MODULE_ALIAS("platform:twl4030_pwrbutton");
> MODULE_DESCRIPTION("Triton2 Power Button");
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCHv5][ 1/4] Input: tsc2007: Add device tree support.
From: Rob Herring @ 2013-10-23 22:18 UTC (permalink / raw)
To: Denis Carikli, Sascha Hauer
Cc: Mark Rutland, devicetree, Dmitry Torokhov, Pawel Moll,
Stephen Warren, Ian Campbell, Rob Herring, Thierry Reding,
Eric Bénard, linux-input, Shawn Guo, linux-arm-kernel,
Lothar Waßmann
In-Reply-To: <1382530220-27881-1-git-send-email-denis@eukrea.com>
On 10/23/2013 07:10 AM, Denis Carikli wrote:
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: devicetree@vger.kernel.org
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Lothar Waßmann <LW@KARO-electronics.de>
> Cc: Eric Bénard <eric@eukrea.com>
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> ChangeLog v4->v5:
> - Most of the "if (ts->of)" were replaced by wrapping them in the
> tsc2007_is_pen_down_valid and tsc2007_is_pen_down functions.
> - Some whitespace cleanups.
> - The devm_kzalloc call was fixed to make it compile.
> ---
> .../bindings/input/touchscreen/tsc2007.txt | 44 +++++
> drivers/input/touchscreen/tsc2007.c | 194 +++++++++++++++-----
> 2 files changed, 197 insertions(+), 41 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
> new file mode 100644
> index 0000000..fadd3f6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
> @@ -0,0 +1,44 @@
> +* Texas Instruments tsc2007 touchscreen controller
> +
> +Required properties:
> +- compatible: must be "ti,tsc2007".
> +- reg: I2C address of the chip.
> +- pinctrl-0: Should specify pin control groups used for this controller
> + (see pinctrl bindings[0]).
> +- pinctrl-names: Should contain only one value - "default"
> + (see pinctrl bindings[0]).
I'm confused why an i2c slave needs pinctl binding?
> +- interrupt-parent: the phandle for the interrupt controller
> + (see interrupt binding[1]).
> +- interrupts: interrupt to which the chip is connected
> + (see interrupt binding[1]).
> +- ti,x-plate-ohms: X-plate resistance in ohms.
> +
> +Optional properties:
> +- gpios: the interrupt gpio the chip is connected to (trough the penirq pin)
> + (see GPIO binding[2] for more details).
> +- max-rt: maximum pressure.
> +- fuzzy: specifies the fuzz value that is used to filter noise from the event
> + stream.
> +- poll-period: how much time to wait(in millisecond) before reading again the
> + values from the tsc2007.
> +
> +[0]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
> +[1]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> +[2]: Documentation/devicetree/bindings/gpio/gpio.txt
> +
> +Example:
> + &i2c1 {
> + /* ... */
> + tsc2007@49 {
> + compatible = "ti,tsc2007";
> + reg = <0x49>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_tsc2007_1>;
> + interrupt-parent = <&gpio4>;
> + interrupts = <0x0 0x8>;
> + gpios = <&gpio4 0 0>;
> + ti,x-plate-ohms = <180>;
> + };
> +
> + /* ... */
> + };
> diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
> index 0b67ba4..0625fe1 100644
> --- a/drivers/input/touchscreen/tsc2007.c
> +++ b/drivers/input/touchscreen/tsc2007.c
> @@ -26,6 +26,9 @@
> #include <linux/interrupt.h>
> #include <linux/i2c.h>
> #include <linux/i2c/tsc2007.h>
> +#include <linux/of_device.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
>
> #define TSC2007_MEASURE_TEMP0 (0x0 << 4)
> #define TSC2007_MEASURE_AUX (0x2 << 4)
> @@ -74,7 +77,10 @@ struct tsc2007 {
> u16 max_rt;
> unsigned long poll_delay;
> unsigned long poll_period;
> + int fuzzy;
> + char of;
>
> + unsigned gpio;
> int irq;
>
> wait_queue_head_t wait;
> @@ -84,6 +90,11 @@ struct tsc2007 {
> void (*clear_penirq)(void);
> };
>
> +static int tsc2007_get_pendown_state_dt(struct tsc2007 *ts)
> +{
> + return !gpio_get_value(ts->gpio);
> +}
> +
> static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd)
> {
> s32 data;
> @@ -142,6 +153,14 @@ static u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
> return rt;
> }
>
> +static bool tsc2007_is_pen_down_valid(struct tsc2007 *ts)
> +{
> + if (ts->of)
> + return gpio_is_valid(ts->gpio);
> + else
> + return ts->get_pendown_state ? true : false;
> +}
> +
> static bool tsc2007_is_pen_down(struct tsc2007 *ts)
> {
> /*
> @@ -158,10 +177,13 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts)
> * to fall back on the pressure reading.
> */
>
> - if (!ts->get_pendown_state)
> + if (!tsc2007_is_pen_down_valid(ts))
> return true;
>
> - return ts->get_pendown_state();
> + if (ts->of)
> + return tsc2007_get_pendown_state_dt(ts);
> + else
> + return ts->get_pendown_state();
> }
>
> static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
> @@ -178,7 +200,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
>
> rt = tsc2007_calculate_pressure(ts, &tc);
>
> - if (rt == 0 && !ts->get_pendown_state) {
> + if(!rt && !tsc2007_is_pen_down_valid(ts)) {
> /*
> * If pressure reported is 0 and we don't have
> * callback to check pendown state, we have to
> @@ -228,7 +250,7 @@ static irqreturn_t tsc2007_hard_irq(int irq, void *handle)
> {
> struct tsc2007 *ts = handle;
>
> - if (!ts->get_pendown_state || likely(ts->get_pendown_state()))
> + if (tsc2007_is_pen_down(ts))
> return IRQ_WAKE_THREAD;
>
> if (ts->clear_penirq)
> @@ -273,34 +295,65 @@ static void tsc2007_close(struct input_dev *input_dev)
> tsc2007_stop(ts);
> }
>
> -static int tsc2007_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +#ifdef CONFIG_OF
> +static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts,
> + struct device_node *np)
> {
> - struct tsc2007 *ts;
> - struct tsc2007_platform_data *pdata = client->dev.platform_data;
> - struct input_dev *input_dev;
> - int err;
> -
> - if (!pdata) {
> - dev_err(&client->dev, "platform data is required!\n");
> + int err = 0;
> + u32 val32;
> + u64 val64;
> +
> + if (!of_property_read_u32(np, "max-rt", &val32))
> + ts->max_rt = val32;
> + else
> + ts->max_rt = MAX_12BIT;
These functions don't overwrite the value if the property isn't present.
So you can set the values to the defaults and just pass the variable
(i.e. ts->max_rt) to of_property_read_u32 directly.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCHv5 1/3] Input: twl4030-pwrbutton - add device tree support
From: Sebastian Reichel @ 2013-10-23 20:26 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382560002-6299-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 power button driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/input/twl4030-pwrbutton.txt | 13 +++++++++++++
drivers/input/misc/twl4030-pwrbutton.c | 16 ++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
new file mode 100644
index 0000000..945ec74
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
@@ -0,0 +1,13 @@
+* TWL4030's pwrbutton device tree bindings
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+ - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+- interrupt: should be one of the following
+ - <8>: For controllers compatible with twl4030
+
+Example:
+ twl_pwrbutton: pwrbutton {
+ compatible = "ti,twl4030-pwrbutton";
+ interrupts = <8>;
+ };
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b9a05fd..a3a0fe3 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
return IRQ_HANDLED;
}
-static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
@@ -106,16 +106,24 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
return 0;
}
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
+ { .compatible = "ti,twl4030-pwrbutton" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+#endif
+
static struct platform_driver twl4030_pwrbutton_driver = {
+ .probe = twl4030_pwrbutton_probe,
.remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
},
};
-
-module_platform_driver_probe(twl4030_pwrbutton_driver,
- twl4030_pwrbutton_probe);
+module_platform_driver(twl4030_pwrbutton_driver);
MODULE_ALIAS("platform:twl4030_pwrbutton");
MODULE_DESCRIPTION("Triton2 Power Button");
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv5 2/3] Input: twl4030-pwrbutton: use dev_err for errors
From: Sebastian Reichel @ 2013-10-23 20:26 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382560002-6299-1-git-send-email-sre@debian.org>
Use dev_err() to output errors instead of dev_dbg().
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index a3a0fe3..48639ff 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -74,13 +74,13 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
- dev_dbg(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+ dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
goto free_input_dev;
}
err = input_register_device(pwr);
if (err) {
- dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
+ dev_err(&pdev->dev, "Can't register power button: %d\n", err);
goto free_irq;
}
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv5 3/3] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Sebastian Reichel @ 2013-10-23 20:26 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382560002-6299-1-git-send-email-sre@debian.org>
Use managed irq resource to simplify the driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index 48639ff..be1759c 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -58,7 +58,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
int irq = platform_get_irq(pdev, 0);
int err;
- pwr = input_allocate_device();
+ pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_dbg(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
@@ -70,40 +70,23 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr->phys = "twl4030_pwrbutton/input0";
pwr->dev.parent = &pdev->dev;
- err = request_threaded_irq(irq, NULL, powerbutton_irq,
+ err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
- goto free_input_dev;
+ return err;
}
err = input_register_device(pwr);
if (err) {
dev_err(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
+ return err;
}
platform_set_drvdata(pdev, pwr);
return 0;
-
-free_irq:
- free_irq(irq, pwr);
-free_input_dev:
- input_free_device(pwr);
- return err;
-}
-
-static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
-{
- struct input_dev *pwr = platform_get_drvdata(pdev);
- int irq = platform_get_irq(pdev, 0);
-
- free_irq(irq, pwr);
- input_unregister_device(pwr);
-
- return 0;
}
#if IS_ENABLED(CONFIG_OF)
@@ -116,7 +99,6 @@ MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
static struct platform_driver twl4030_pwrbutton_driver = {
.probe = twl4030_pwrbutton_probe,
- .remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv5 0/3] DT Support for TWL4030 power button
From: Sebastian Reichel @ 2013-10-23 20:26 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
Hi,
This is the fifth iteration of DT support for the TWL4030
power button.
Changes since v4 [0]:
* do not change dev_dbg to dev_err for input_allocate_device,
since it prints its own message. Call will be removed completly
by another patchset [1].
[0] https://lkml.org/lkml/2013/10/23/372
[1] https://lkml.org/lkml/2013/10/23/390
-- Sebastian
Sebastian Reichel (3):
Input: twl4030-pwrbutton - add device tree support
Input: twl4030-pwrbutton: use dev_err for errors
Input: twl4030-pwrbutton: simplify driver using devm_*
.../bindings/input/twl4030-pwrbutton.txt | 13 +++++++
drivers/input/misc/twl4030-pwrbutton.c | 44 +++++++++-------------
2 files changed, 30 insertions(+), 27 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
--
1.8.4.rc3
^ permalink raw reply
* Re: [PATCHv4 2/3] Input: twl4030-pwrbutton: use dev_err for errors
From: Joe Perches @ 2013-10-23 19:38 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Dmitry Torokhov, Grant Likely, Rob Herring, Peter Ujfalusi,
Sachin Kamat, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20131023193112.GB30437-SfvFxonMDyemK9LvCR3Hrw@public.gmane.org>
On Wed, 2013-10-23 at 21:31 +0200, Sebastian Reichel wrote:
> On Wed, Oct 23, 2013 at 11:17:46AM -0700, Joe Perches wrote:
> > On Wed, 2013-10-23 at 19:54 +0200, Sebastian Reichel wrote:
> > > Use dev_err() to output errors instead of dev_dbg().
> > []
> > > diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> > []
> > > @@ -60,7 +60,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> > >
> > > pwr = input_allocate_device();
> > > if (!pwr) {
> > > - dev_dbg(&pdev->dev, "Can't allocate power button\n");
> > > + dev_err(&pdev->dev, "Can't allocate power button\n");
> > > return -ENOMEM;
> > > }
> >
> > input_allocate_device uses kzalloc and it will emit a
> > standardized OOM message along with a dump_stack()
> > so this dev_err/dev_dbg is redundant and not necessary.
>
> I saw you sent a big patchset changing this for all drivers.
> Should I drop this patch?
I think the 2 other bits of this patch are fine.
Maybe resend with this section dropped?
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCHv4 2/3] Input: twl4030-pwrbutton: use dev_err for errors
From: Sebastian Reichel @ 2013-10-23 19:31 UTC (permalink / raw)
To: Joe Perches
Cc: Dmitry Torokhov, Grant Likely, Rob Herring, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382552266.22433.36.camel@joe-AO722>
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
On Wed, Oct 23, 2013 at 11:17:46AM -0700, Joe Perches wrote:
> On Wed, 2013-10-23 at 19:54 +0200, Sebastian Reichel wrote:
> > Use dev_err() to output errors instead of dev_dbg().
> []
> > diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> []
> > @@ -60,7 +60,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> >
> > pwr = input_allocate_device();
> > if (!pwr) {
> > - dev_dbg(&pdev->dev, "Can't allocate power button\n");
> > + dev_err(&pdev->dev, "Can't allocate power button\n");
> > return -ENOMEM;
> > }
>
> input_allocate_device uses kzalloc and it will emit a
> standardized OOM message along with a dump_stack()
> so this dev_err/dev_dbg is redundant and not necessary.
I saw you sent a big patchset changing this for all drivers.
Should I drop this patch?
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH 4/8] input: Remove OOM message after input_allocate_device
From: Joe Perches @ 2013-10-23 19:14 UTC (permalink / raw)
To: linux-kernel
Cc: Dmitry Torokhov, Wan ZongShun, Andrey Moiseev, Henrik Rydberg,
Josh Wu, Ferruh Yigit, Pau Oliva Fora, Ben Dooks, Kukjin Kim,
linux-input, linux-arm-kernel, linux-samsung-soc
In-Reply-To: <cover.1382555436.git.joe@perches.com>
Emitting an OOM message isn't necessary after input_allocate_device
as there's a generic OOM and a dump_stack already done.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/input/joystick/as5011.c | 2 --
drivers/input/joystick/db9.c | 1 -
drivers/input/joystick/gamecon.c | 4 +---
drivers/input/joystick/turbografx.c | 1 -
drivers/input/joystick/walkera0701.c | 1 -
drivers/input/keyboard/amikbd.c | 4 +---
drivers/input/keyboard/davinci_keyscan.c | 1 -
drivers/input/keyboard/gpio_keys.c | 1 -
drivers/input/keyboard/lpc32xx-keys.c | 1 -
drivers/input/keyboard/max7359_keypad.c | 1 -
drivers/input/keyboard/mcs_touchkey.c | 1 -
drivers/input/keyboard/mpr121_touchkey.c | 1 -
drivers/input/keyboard/nomadik-ske-keypad.c | 1 -
drivers/input/keyboard/opencores-kbd.c | 1 -
drivers/input/keyboard/pmic8xxx-keypad.c | 1 -
drivers/input/keyboard/pxa27x_keypad.c | 1 -
drivers/input/keyboard/pxa930_rotary.c | 1 -
drivers/input/keyboard/qt1070.c | 1 -
drivers/input/keyboard/qt2160.c | 1 -
drivers/input/keyboard/sh_keysc.c | 1 -
drivers/input/keyboard/tc3589x-keypad.c | 1 -
drivers/input/keyboard/tnetv107x-keypad.c | 1 -
drivers/input/keyboard/w90p910_keypad.c | 1 -
drivers/input/misc/88pm80x_onkey.c | 1 -
drivers/input/misc/88pm860x_onkey.c | 1 -
drivers/input/misc/arizona-haptics.c | 4 +---
drivers/input/misc/atlas_btns.c | 4 +---
drivers/input/misc/da9052_onkey.c | 1 -
drivers/input/misc/da9055_onkey.c | 4 +---
drivers/input/misc/ideapad_slidebar.c | 1 -
drivers/input/misc/ims-pcu.c | 7 +------
drivers/input/misc/kxtj9.c | 4 +---
drivers/input/misc/max8997_haptic.c | 1 -
drivers/input/misc/mc13783-pwrbutton.c | 4 +---
drivers/input/misc/mpu3050.c | 1 -
drivers/input/misc/pcf8574_keypad.c | 1 -
drivers/input/misc/pm8xxx-vibrator.c | 1 -
drivers/input/misc/pmic8xxx-pwrkey.c | 1 -
drivers/input/misc/pwm-beeper.c | 1 -
drivers/input/misc/twl4030-pwrbutton.c | 4 +---
drivers/input/misc/twl6040-vibra.c | 1 -
drivers/input/mouse/appletouch.c | 4 +---
drivers/input/mouse/bcm5974.c | 4 +---
drivers/input/mouse/cyapa.c | 4 +---
drivers/input/mouse/inport.c | 1 -
drivers/input/mouse/logibm.c | 1 -
drivers/input/mouse/pc110pad.c | 1 -
drivers/input/mouse/pxa930_trkball.c | 1 -
drivers/input/tablet/aiptek.c | 5 +----
drivers/input/tablet/gtco.c | 1 -
drivers/input/touchscreen/88pm860x-ts.c | 1 -
drivers/input/touchscreen/atmel_mxt_ts.c | 1 -
drivers/input/touchscreen/atmel_tsadcc.c | 1 -
drivers/input/touchscreen/bu21013_ts.c | 1 -
drivers/input/touchscreen/cyttsp4_core.c | 2 --
drivers/input/touchscreen/da9034-ts.c | 1 -
drivers/input/touchscreen/edt-ft5x06.c | 1 -
drivers/input/touchscreen/eeti_ts.c | 5 +----
drivers/input/touchscreen/htcpen.c | 1 -
drivers/input/touchscreen/intel-mid-touch.c | 1 -
drivers/input/touchscreen/lpc32xx_ts.c | 1 -
drivers/input/touchscreen/mcs5000_ts.c | 1 -
drivers/input/touchscreen/migor_ts.c | 1 -
drivers/input/touchscreen/mk712.c | 1 -
drivers/input/touchscreen/pixcir_i2c_ts.c | 1 -
drivers/input/touchscreen/s3c2410_ts.c | 1 -
drivers/input/touchscreen/ti_am335x_tsc.c | 1 -
drivers/input/touchscreen/tnetv107x-ts.c | 1 -
68 files changed, 14 insertions(+), 103 deletions(-)
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c
index 005d852..3b9c709 100644
--- a/drivers/input/joystick/as5011.c
+++ b/drivers/input/joystick/as5011.c
@@ -254,8 +254,6 @@ static int as5011_probe(struct i2c_client *client,
as5011 = kmalloc(sizeof(struct as5011_device), GFP_KERNEL);
input_dev = input_allocate_device();
if (!as5011 || !input_dev) {
- dev_err(&client->dev,
- "Can't allocate memory for device structure\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 8e7de5c..b0f18f2 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -609,7 +609,6 @@ static struct db9 __init *db9_probe(int parport, int mode)
db9->dev[i] = input_dev = input_allocate_device();
if (!input_dev) {
- printk(KERN_ERR "db9.c: Not enough memory for input device\n");
err = -ENOMEM;
goto err_unreg_devs;
}
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index e68e497..ded4f23 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -824,10 +824,8 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
}
pad->dev = input_dev = input_allocate_device();
- if (!input_dev) {
- pr_err("Not enough memory for input device\n");
+ if (!input_dev)
return -ENOMEM;
- }
pad->type = pad_type;
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index 27b6a3c..932d1b3 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -204,7 +204,6 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
tgfx->dev[i] = input_dev = input_allocate_device();
if (!input_dev) {
- printk(KERN_ERR "turbografx.c: Not enough memory for input device\n");
err = -ENOMEM;
goto err_unreg_devs;
}
diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c
index b76ac58..5000959 100644
--- a/drivers/input/joystick/walkera0701.c
+++ b/drivers/input/joystick/walkera0701.c
@@ -237,7 +237,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport)
w->input_dev = input_allocate_device();
if (!w->input_dev) {
- pr_err("failed to allocate input device\n");
error = -ENOMEM;
goto err_unregister_device;
}
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
index 096d606..e3c0455 100644
--- a/drivers/input/keyboard/amikbd.c
+++ b/drivers/input/keyboard/amikbd.c
@@ -189,10 +189,8 @@ static int __init amikbd_probe(struct platform_device *pdev)
int i, j, err;
dev = input_allocate_device();
- if (!dev) {
- dev_err(&pdev->dev, "Not enough memory for input device\n");
+ if (!dev)
return -ENOMEM;
- }
dev->name = pdev->name;
dev->phys = "amikbd/input0";
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
index d15977a..9455d7a 100644
--- a/drivers/input/keyboard/davinci_keyscan.c
+++ b/drivers/input/keyboard/davinci_keyscan.c
@@ -200,7 +200,6 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
key_dev = input_allocate_device();
if (!key_dev) {
- dev_dbg(dev, "could not allocate input device\n");
error = -ENOMEM;
goto fail1;
}
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 440ce32..9302aaf 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -704,7 +704,6 @@ static int gpio_keys_probe(struct platform_device *pdev)
GFP_KERNEL);
input = input_allocate_device();
if (!ddata || !input) {
- dev_err(dev, "failed to allocate state\n");
error = -ENOMEM;
goto fail1;
}
diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c
index 4218143..cb1792e 100644
--- a/drivers/input/keyboard/lpc32xx-keys.c
+++ b/drivers/input/keyboard/lpc32xx-keys.c
@@ -211,7 +211,6 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev)
kscandat->input = input = input_allocate_device();
if (!input) {
- dev_err(&pdev->dev, "failed to allocate input device\n");
error = -ENOMEM;
goto err_free_keymap;
}
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c
index bc2cdaf..8421f8c 100644
--- a/drivers/input/keyboard/max7359_keypad.c
+++ b/drivers/input/keyboard/max7359_keypad.c
@@ -205,7 +205,6 @@ static int max7359_probe(struct i2c_client *client,
keypad = kzalloc(sizeof(struct max7359_keypad), GFP_KERNEL);
input_dev = input_allocate_device();
if (!keypad || !input_dev) {
- dev_err(&client->dev, "failed to allocate memory\n");
error = -ENOMEM;
goto failed_free_mem;
}
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c
index 7c236f9..6743644 100644
--- a/drivers/input/keyboard/mcs_touchkey.c
+++ b/drivers/input/keyboard/mcs_touchkey.c
@@ -119,7 +119,6 @@ static int mcs_touchkey_probe(struct i2c_client *client,
GFP_KERNEL);
input_dev = input_allocate_device();
if (!data || !input_dev) {
- dev_err(&client->dev, "Failed to allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index f7f3e9a..570275d 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -217,7 +217,6 @@ static int mpr_touchkey_probe(struct i2c_client *client,
mpr121 = kzalloc(sizeof(struct mpr121_touchkey), GFP_KERNEL);
input_dev = input_allocate_device();
if (!mpr121 || !input_dev) {
- dev_err(&client->dev, "Failed to allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c
index c7d505c..01c971f 100644
--- a/drivers/input/keyboard/nomadik-ske-keypad.c
+++ b/drivers/input/keyboard/nomadik-ske-keypad.c
@@ -249,7 +249,6 @@ static int __init ske_keypad_probe(struct platform_device *pdev)
keypad = kzalloc(sizeof(struct ske_keypad), GFP_KERNEL);
input = input_allocate_device();
if (!keypad || !input) {
- dev_err(&pdev->dev, "failed to allocate keypad memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c
index 7b9b441..72a6855 100644
--- a/drivers/input/keyboard/opencores-kbd.c
+++ b/drivers/input/keyboard/opencores-kbd.c
@@ -59,7 +59,6 @@ static int opencores_kbd_probe(struct platform_device *pdev)
opencores_kbd = kzalloc(sizeof(*opencores_kbd), GFP_KERNEL);
input = input_allocate_device();
if (!opencores_kbd || !input) {
- dev_err(&pdev->dev, "failed to allocate device structures\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index 2c9f19a..8bdea7e 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -597,7 +597,6 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
kp->input = input_allocate_device();
if (!kp->input) {
- dev_err(&pdev->dev, "unable to allocate input device\n");
rc = -ENOMEM;
goto err_alloc_device;
}
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index a2e758d..52001f1 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -741,7 +741,6 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
keypad = kzalloc(sizeof(struct pxa27x_keypad), GFP_KERNEL);
input_dev = input_allocate_device();
if (!keypad || !input_dev) {
- dev_err(&pdev->dev, "failed to allocate memory\n");
error = -ENOMEM;
goto failed_free;
}
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c
index 248cdcf..fbe0f2e 100644
--- a/drivers/input/keyboard/pxa930_rotary.c
+++ b/drivers/input/keyboard/pxa930_rotary.c
@@ -125,7 +125,6 @@ static int pxa930_rotary_probe(struct platform_device *pdev)
/* allocate and register the input device */
input_dev = input_allocate_device();
if (!input_dev) {
- dev_err(&pdev->dev, "failed to allocate input device\n");
err = -ENOMEM;
goto failed_free_io;
}
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c
index 6c561ec..8081f89 100644
--- a/drivers/input/keyboard/qt1070.c
+++ b/drivers/input/keyboard/qt1070.c
@@ -167,7 +167,6 @@ static int qt1070_probe(struct i2c_client *client,
data = kzalloc(sizeof(struct qt1070_data), GFP_KERNEL);
input = input_allocate_device();
if (!data || !input) {
- dev_err(&client->dev, "insufficient memory\n");
err = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c
index 1c0ddad..4e078fe 100644
--- a/drivers/input/keyboard/qt2160.c
+++ b/drivers/input/keyboard/qt2160.c
@@ -399,7 +399,6 @@ static int qt2160_probe(struct i2c_client *client,
qt2160 = kzalloc(sizeof(struct qt2160_data), GFP_KERNEL);
input = input_allocate_device();
if (!qt2160 || !input) {
- dev_err(&client->dev, "insufficient memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
index fe0e498..b739f11 100644
--- a/drivers/input/keyboard/sh_keysc.c
+++ b/drivers/input/keyboard/sh_keysc.c
@@ -210,7 +210,6 @@ static int sh_keysc_probe(struct platform_device *pdev)
priv->input = input_allocate_device();
if (!priv->input) {
- dev_err(&pdev->dev, "failed to allocate input device\n");
error = -ENOMEM;
goto err2;
}
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 208de7c..5f4af0f 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -318,7 +318,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
input = input_allocate_device();
if (!keypad || !input) {
- dev_err(&pdev->dev, "failed to allocate keypad memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c
index 5f7b427..82dfca2 100644
--- a/drivers/input/keyboard/tnetv107x-keypad.c
+++ b/drivers/input/keyboard/tnetv107x-keypad.c
@@ -243,7 +243,6 @@ static int keypad_probe(struct platform_device *pdev)
kp->input_dev = input_allocate_device();
if (!kp->input_dev) {
- dev_err(dev, "cannot allocate input device\n");
error = -ENOMEM;
goto error_input;
}
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c
index 7b03916..4feca23 100644
--- a/drivers/input/keyboard/w90p910_keypad.c
+++ b/drivers/input/keyboard/w90p910_keypad.c
@@ -145,7 +145,6 @@ static int w90p910_keypad_probe(struct platform_device *pdev)
keypad = kzalloc(sizeof(struct w90p910_keypad), GFP_KERNEL);
input_dev = input_allocate_device();
if (!keypad || !input_dev) {
- dev_err(&pdev->dev, "failed to allocate driver data\n");
error = -ENOMEM;
goto failed_free;
}
diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c
index ee43e5b..f8d9b73 100644
--- a/drivers/input/misc/88pm80x_onkey.c
+++ b/drivers/input/misc/88pm80x_onkey.c
@@ -91,7 +91,6 @@ static int pm80x_onkey_probe(struct platform_device *pdev)
info->idev = input_allocate_device();
if (!info->idev) {
- dev_err(&pdev->dev, "Failed to allocate input dev\n");
err = -ENOMEM;
goto out;
}
diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c
index abd8453..c05f0a1 100644
--- a/drivers/input/misc/88pm860x_onkey.c
+++ b/drivers/input/misc/88pm860x_onkey.c
@@ -78,7 +78,6 @@ static int pm860x_onkey_probe(struct platform_device *pdev)
info->idev = input_allocate_device();
if (!info->idev) {
- dev_err(chip->dev, "Failed to allocate input dev\n");
ret = -ENOMEM;
goto out;
}
diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c
index 7a04f54..a687bf9 100644
--- a/drivers/input/misc/arizona-haptics.c
+++ b/drivers/input/misc/arizona-haptics.c
@@ -190,10 +190,8 @@ static int arizona_haptics_probe(struct platform_device *pdev)
INIT_WORK(&haptics->work, arizona_haptics_work);
haptics->input_dev = input_allocate_device();
- if (haptics->input_dev == NULL) {
- dev_err(arizona->dev, "Failed to allocate input device\n");
+ if (haptics->input_dev == NULL)
return -ENOMEM;
- }
input_set_drvdata(haptics->input_dev, haptics);
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c
index 5d44023..c765465 100644
--- a/drivers/input/misc/atlas_btns.c
+++ b/drivers/input/misc/atlas_btns.c
@@ -79,10 +79,8 @@ static int atlas_acpi_button_add(struct acpi_device *device)
int err;
input_dev = input_allocate_device();
- if (!input_dev) {
- pr_err("unable to allocate input device\n");
+ if (!input_dev)
return -ENOMEM;
- }
input_dev->name = "Atlas ACPI button driver";
input_dev->phys = "ASIM0000/atlas/input0";
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c
index 020569a..53591e8 100644
--- a/drivers/input/misc/da9052_onkey.c
+++ b/drivers/input/misc/da9052_onkey.c
@@ -85,7 +85,6 @@ static int da9052_onkey_probe(struct platform_device *pdev)
onkey = kzalloc(sizeof(*onkey), GFP_KERNEL);
input_dev = input_allocate_device();
if (!onkey || !input_dev) {
- dev_err(&pdev->dev, "Failed to allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c
index a0af8b2..76bc187 100644
--- a/drivers/input/misc/da9055_onkey.c
+++ b/drivers/input/misc/da9055_onkey.c
@@ -94,10 +94,8 @@ static int da9055_onkey_probe(struct platform_device *pdev)
}
input_dev = input_allocate_device();
- if (!input_dev) {
- dev_err(&pdev->dev, "Failed to allocate memory\n");
+ if (!input_dev)
return -ENOMEM;
- }
onkey->input = input_dev;
onkey->da9055 = da9055;
diff --git a/drivers/input/misc/ideapad_slidebar.c b/drivers/input/misc/ideapad_slidebar.c
index edfd623..2cd57b43 100644
--- a/drivers/input/misc/ideapad_slidebar.c
+++ b/drivers/input/misc/ideapad_slidebar.c
@@ -223,7 +223,6 @@ static int __init ideapad_probe(struct platform_device* pdev)
slidebar_input_dev = input_allocate_device();
if (!slidebar_input_dev) {
- dev_err(&pdev->dev, "Failed to allocate input device\n");
err = -ENOMEM;
goto err_release_ports;
}
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index e204f26..444dd85 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -206,11 +206,8 @@ static int ims_pcu_setup_buttons(struct ims_pcu *pcu,
int error;
input = input_allocate_device();
- if (!input) {
- dev_err(pcu->dev,
- "Not enough memory for input input device\n");
+ if (!input)
return -ENOMEM;
- }
snprintf(buttons->name, sizeof(buttons->name),
"IMS PCU#%d Button Interface", pcu->device_no);
@@ -290,8 +287,6 @@ static int ims_pcu_setup_gamepad(struct ims_pcu *pcu)
gamepad = kzalloc(sizeof(struct ims_pcu_gamepad), GFP_KERNEL);
input = input_allocate_device();
if (!gamepad || !input) {
- dev_err(pcu->dev,
- "Not enough memory for gamepad device\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c
index a993b67..7734eed 100644
--- a/drivers/input/misc/kxtj9.c
+++ b/drivers/input/misc/kxtj9.c
@@ -314,10 +314,8 @@ static int kxtj9_setup_input_device(struct kxtj9_data *tj9)
int err;
input_dev = input_allocate_device();
- if (!input_dev) {
- dev_err(&tj9->client->dev, "input device allocate failed\n");
+ if (!input_dev)
return -ENOMEM;
- }
tj9->input_dev = input_dev;
diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c
index e973133..b2f9615 100644
--- a/drivers/input/misc/max8997_haptic.c
+++ b/drivers/input/misc/max8997_haptic.c
@@ -260,7 +260,6 @@ static int max8997_haptic_probe(struct platform_device *pdev)
chip = kzalloc(sizeof(struct max8997_haptic), GFP_KERNEL);
input_dev = input_allocate_device();
if (!chip || !input_dev) {
- dev_err(&pdev->dev, "unable to allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index d0277a7..87538be 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -105,10 +105,8 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
}
pwr = input_allocate_device();
- if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ if (!pwr)
return -ENOMEM;
- }
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c
index dce0d95..d21521d 100644
--- a/drivers/input/misc/mpu3050.c
+++ b/drivers/input/misc/mpu3050.c
@@ -317,7 +317,6 @@ static int mpu3050_probe(struct i2c_client *client,
sensor = kzalloc(sizeof(struct mpu3050_sensor), GFP_KERNEL);
idev = input_allocate_device();
if (!sensor || !idev) {
- dev_err(&client->dev, "failed to allocate driver data\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
index e373929..729de73 100644
--- a/drivers/input/misc/pcf8574_keypad.c
+++ b/drivers/input/misc/pcf8574_keypad.c
@@ -99,7 +99,6 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i
idev = input_allocate_device();
if (!idev) {
- dev_err(&client->dev, "Can't allocate input device\n");
ret = -ENOMEM;
goto fail_allocate;
}
diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
index ec086f6..9e5f13a 100644
--- a/drivers/input/misc/pm8xxx-vibrator.c
+++ b/drivers/input/misc/pm8xxx-vibrator.c
@@ -189,7 +189,6 @@ static int pm8xxx_vib_probe(struct platform_device *pdev)
vib = kzalloc(sizeof(*vib), GFP_KERNEL);
input_dev = input_allocate_device();
if (!vib || !input_dev) {
- dev_err(&pdev->dev, "couldn't allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c
index b49b738..a411b28 100644
--- a/drivers/input/misc/pmic8xxx-pwrkey.c
+++ b/drivers/input/misc/pmic8xxx-pwrkey.c
@@ -109,7 +109,6 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev)
pwr = input_allocate_device();
if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
err = -ENOMEM;
goto free_pwrkey;
}
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index 2ff4d1c..41c5535 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -89,7 +89,6 @@ static int pwm_beeper_probe(struct platform_device *pdev)
beeper->input = input_allocate_device();
if (!beeper->input) {
- dev_err(&pdev->dev, "Failed to allocate input device\n");
error = -ENOMEM;
goto err_pwm_free;
}
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b9a05fd..4405548 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -59,10 +59,8 @@ static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
int err;
pwr = input_allocate_device();
- if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ if (!pwr)
return -ENOMEM;
- }
pwr->evbit[0] = BIT_MASK(EV_KEY);
pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 7864b0c..1272a65 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -354,7 +354,6 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
info->input_dev = input_allocate_device();
if (info->input_dev == NULL) {
- dev_err(info->dev, "couldn't allocate input device\n");
ret = -ENOMEM;
goto err_regulator;
}
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index e42f1fa..20dcbf9 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -798,10 +798,8 @@ static int atp_probe(struct usb_interface *iface,
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(struct atp), GFP_KERNEL);
input_dev = input_allocate_device();
- if (!dev || !input_dev) {
- dev_err(&iface->dev, "Out of memory\n");
+ if (!dev || !input_dev)
goto err_free_devs;
- }
dev->udev = udev;
dev->intf = iface;
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index a73f961..2ca2861 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -862,10 +862,8 @@ static int bcm5974_probe(struct usb_interface *iface,
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL);
input_dev = input_allocate_device();
- if (!dev || !input_dev) {
- dev_err(&iface->dev, "out of memory\n");
+ if (!dev || !input_dev)
goto err_free_devs;
- }
dev->udev = udev;
dev->intf = iface;
diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index b409c3d7..736e156 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -763,10 +763,8 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)
return -EINVAL;
input = cyapa->input = input_allocate_device();
- if (!input) {
- dev_err(dev, "allocate memory for input device failed\n");
+ if (!input)
return -ENOMEM;
- }
input->name = CYAPA_NAME;
input->phys = cyapa->phys;
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index 3827a22..7b66f11 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -148,7 +148,6 @@ static int __init inport_init(void)
inport_dev = input_allocate_device();
if (!inport_dev) {
- printk(KERN_ERR "inport.c: Not enough memory for input device\n");
err = -ENOMEM;
goto err_release_region;
}
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c
index e241311..2af1235 100644
--- a/drivers/input/mouse/logibm.c
+++ b/drivers/input/mouse/logibm.c
@@ -141,7 +141,6 @@ static int __init logibm_init(void)
logibm_dev = input_allocate_device();
if (!logibm_dev) {
- printk(KERN_ERR "logibm.c: Not enough memory for input device\n");
err = -ENOMEM;
goto err_release_region;
}
diff --git a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c
index 7b02b65..d08965b 100644
--- a/drivers/input/mouse/pc110pad.c
+++ b/drivers/input/mouse/pc110pad.c
@@ -129,7 +129,6 @@ static int __init pc110pad_init(void)
pc110pad_dev = input_allocate_device();
if (!pc110pad_dev) {
- printk(KERN_ERR "pc110pad: Not enough memory.\n");
err = -ENOMEM;
goto err_free_irq;
}
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c
index 0ecb9e7..0ab27cc 100644
--- a/drivers/input/mouse/pxa930_trkball.c
+++ b/drivers/input/mouse/pxa930_trkball.c
@@ -194,7 +194,6 @@ static int pxa930_trkball_probe(struct platform_device *pdev)
input = input_allocate_device();
if (!input) {
- dev_err(&pdev->dev, "failed to allocate input device\n");
error = -ENOMEM;
goto failed_free_irq;
}
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index ee83c39..fa309d9 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1710,11 +1710,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL);
inputdev = input_allocate_device();
- if (!aiptek || !inputdev) {
- dev_warn(&intf->dev,
- "cannot allocate memory or input device\n");
+ if (!aiptek || !inputdev)
goto fail1;
- }
aiptek->data = usb_alloc_coherent(usbdev, AIPTEK_PACKET_LENGTH,
GFP_ATOMIC, &aiptek->data_dma);
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index 29e01ab..fddff41 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -840,7 +840,6 @@ static int gtco_probe(struct usb_interface *usbinterface,
gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL);
input_dev = input_allocate_device();
if (!gtco || !input_dev) {
- dev_err(&usbinterface->dev, "No more memory\n");
error = -ENOMEM;
goto err_free_devs;
}
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index f7de14a..53373b2 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -241,7 +241,6 @@ static int pm860x_touch_probe(struct platform_device *pdev)
touch->idev = input_allocate_device();
if (touch->idev == NULL) {
- dev_err(&pdev->dev, "Failed to allocate input device!\n");
ret = -ENOMEM;
goto out;
}
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 59aa240..aa1fbc0 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1142,7 +1142,6 @@ static int mxt_probe(struct i2c_client *client,
data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL);
input_dev = input_allocate_device();
if (!data || !input_dev) {
- dev_err(&client->dev, "Failed to allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
index bddabc5..8da3902 100644
--- a/drivers/input/touchscreen/atmel_tsadcc.c
+++ b/drivers/input/touchscreen/atmel_tsadcc.c
@@ -206,7 +206,6 @@ static int atmel_tsadcc_probe(struct platform_device *pdev)
input_dev = input_allocate_device();
if (!input_dev) {
- dev_err(&pdev->dev, "failed to allocate input device.\n");
err = -EBUSY;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index b9b5dda..29a09e5 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -524,7 +524,6 @@ static int bu21013_probe(struct i2c_client *client,
bu21013_data = kzalloc(sizeof(struct bu21013_ts_data), GFP_KERNEL);
in_dev = input_allocate_device();
if (!bu21013_data || !in_dev) {
- dev_err(&client->dev, "device memory alloc failed\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index a035a39..9b86453 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -1958,8 +1958,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
__func__);
md->input = input_allocate_device();
if (md->input == NULL) {
- dev_err(dev, "%s: Error, failed to allocate input device\n",
- __func__);
rc = -ENOSYS;
goto error_alloc_failed;
}
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c
index 34ad841..0ec0761 100644
--- a/drivers/input/touchscreen/da9034-ts.c
+++ b/drivers/input/touchscreen/da9034-ts.c
@@ -325,7 +325,6 @@ static int da9034_touch_probe(struct platform_device *pdev)
input_dev = input_allocate_device();
if (!input_dev) {
- dev_err(&pdev->dev, "failed to allocate input device\n");
ret = -ENOMEM;
goto err_free_touch;
}
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 83fa1b1..675184a 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -736,7 +736,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL);
input = input_allocate_device();
if (!tsdata || !input) {
- dev_err(&client->dev, "failed to allocate driver data.\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 1ce3d29..d2e509e 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -178,11 +178,8 @@ static int eeti_ts_probe(struct i2c_client *client,
mutex_init(&priv->mutex);
input = input_allocate_device();
-
- if (!input) {
- dev_err(&client->dev, "Failed to allocate input device.\n");
+ if (!input)
goto err1;
- }
input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c
index 92e2243..ddd2d14 100644
--- a/drivers/input/touchscreen/htcpen.c
+++ b/drivers/input/touchscreen/htcpen.c
@@ -127,7 +127,6 @@ static int htcpen_isa_probe(struct device *dev, unsigned int id)
htcpen_dev = input_allocate_device();
if (!htcpen_dev) {
- printk(KERN_ERR "htcpen: can't allocate device\n");
err = -ENOMEM;
goto input_alloc_failed;
}
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c
index e30d837..95bf513 100644
--- a/drivers/input/touchscreen/intel-mid-touch.c
+++ b/drivers/input/touchscreen/intel-mid-touch.c
@@ -584,7 +584,6 @@ static int mrstouch_probe(struct platform_device *pdev)
tsdev = kzalloc(sizeof(struct mrstouch_dev), GFP_KERNEL);
input = input_allocate_device();
if (!tsdev || !input) {
- dev_err(&pdev->dev, "unable to allocate memory\n");
err = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c
index 9101ee5..5b24d4c 100644
--- a/drivers/input/touchscreen/lpc32xx_ts.c
+++ b/drivers/input/touchscreen/lpc32xx_ts.c
@@ -227,7 +227,6 @@ static int lpc32xx_ts_probe(struct platform_device *pdev)
tsc = kzalloc(sizeof(*tsc), GFP_KERNEL);
input = input_allocate_device();
if (!tsc || !input) {
- dev_err(&pdev->dev, "failed allocating memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c
index f9f4e0c..85101e7 100644
--- a/drivers/input/touchscreen/mcs5000_ts.c
+++ b/drivers/input/touchscreen/mcs5000_ts.c
@@ -200,7 +200,6 @@ static int mcs5000_ts_probe(struct i2c_client *client,
data = kzalloc(sizeof(struct mcs5000_ts_data), GFP_KERNEL);
input_dev = input_allocate_device();
if (!data || !input_dev) {
- dev_err(&client->dev, "Failed to allocate memory\n");
ret = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c
index c038db9..23a2fd5 100644
--- a/drivers/input/touchscreen/migor_ts.c
+++ b/drivers/input/touchscreen/migor_ts.c
@@ -139,7 +139,6 @@ static int migor_ts_probe(struct i2c_client *client,
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
input = input_allocate_device();
if (!priv || !input) {
- dev_err(&client->dev, "failed to allocate memory\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/mk712.c b/drivers/input/touchscreen/mk712.c
index 36e57de..0ba4e47 100644
--- a/drivers/input/touchscreen/mk712.c
+++ b/drivers/input/touchscreen/mk712.c
@@ -170,7 +170,6 @@ static int __init mk712_init(void)
mk712_dev = input_allocate_device();
if (!mk712_dev) {
- printk(KERN_ERR "mk712: not enough memory\n");
err = -ENOMEM;
goto fail1;
}
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 6cc6b36..70580b6 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -141,7 +141,6 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL);
input = input_allocate_device();
if (!tsdata || !input) {
- dev_err(&client->dev, "Failed to allocate driver data!\n");
error = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index b061af2..40461f8 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -308,7 +308,6 @@ static int s3c2410ts_probe(struct platform_device *pdev)
input_dev = input_allocate_device();
if (!input_dev) {
- dev_err(dev, "Unable to allocate the input device !!\n");
ret = -ENOMEM;
goto err_iomap;
}
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 24e625c..698b70c 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -378,7 +378,6 @@ static int titsc_probe(struct platform_device *pdev)
ts_dev = kzalloc(sizeof(struct titsc), GFP_KERNEL);
input_dev = input_allocate_device();
if (!ts_dev || !input_dev) {
- dev_err(&pdev->dev, "failed to allocate memory.\n");
err = -ENOMEM;
goto err_free_mem;
}
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c
index c47827a..e3bff77 100644
--- a/drivers/input/touchscreen/tnetv107x-ts.c
+++ b/drivers/input/touchscreen/tnetv107x-ts.c
@@ -306,7 +306,6 @@ static int tsc_probe(struct platform_device *pdev)
ts->input_dev = input_allocate_device();
if (!ts->input_dev) {
- dev_err(dev, "cannot allocate input device\n");
error = -ENOMEM;
goto error_input;
}
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related
* [PATCH 3/8] hid: Remove OOM message after input_allocate_device
From: Joe Perches @ 2013-10-23 19:14 UTC (permalink / raw)
To: linux-kernel; +Cc: Bruno Prémont, linux-input
In-Reply-To: <cover.1382555436.git.joe@perches.com>
Emitting an OOM message isn't necessary after input_allocate_device
as there's a generic OOM and a dump_stack already done.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/hid/hid-input.c | 1 -
drivers/hid/hid-picolcd_core.c | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 8741d95..aed8238 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1263,7 +1263,6 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid)
if (!hidinput || !input_dev) {
kfree(hidinput);
input_free_device(input_dev);
- hid_err(hid, "Out of memory during hid input probe\n");
return NULL;
}
diff --git a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c
index acbb0210..f34ba0f 100644
--- a/drivers/hid/hid-picolcd_core.c
+++ b/drivers/hid/hid-picolcd_core.c
@@ -431,10 +431,9 @@ static int picolcd_init_keys(struct picolcd_data *data,
}
idev = input_allocate_device();
- if (idev == NULL) {
- hid_err(hdev, "failed to allocate input device\n");
+ if (idev == NULL)
return -ENOMEM;
- }
+
input_set_drvdata(idev, hdev);
memcpy(data->keycode, def_keymap, sizeof(def_keymap));
idev->name = hdev->name;
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related
* [PATCH 0/8] treewide: Remove OOM message after input_alloc_device
From: Joe Perches @ 2013-10-23 19:14 UTC (permalink / raw)
To: linux-kernel
Cc: linux-doc, linuxppc-dev, cbe-oss-dev, linux-input,
linux-arm-kernel, linux-samsung-soc, linux-media, acpi4asus-user,
platform-driver-x86, ibm-acpi-devel, devel, linux-iio, alsa-devel
Joe Perches (8):
Documentation: Remove OOM message after input_allocate_device
cell: Remove OOM message after input_allocate_device
hid: Remove OOM message after input_allocate_device
input: Remove OOM message after input_allocate_device
media: Remove OOM message after input_allocate_device
platform:x86: Remove OOM message after input_allocate_device
staging: Remove OOM message after input_allocate_device
sound: Remove OOM message after input_allocate_device
Documentation/input/input-programming.txt | 1 -
arch/powerpc/platforms/cell/cbe_powerbutton.c | 1 -
drivers/hid/hid-input.c | 1 -
drivers/hid/hid-picolcd_core.c | 5 ++---
drivers/input/joystick/as5011.c | 2 --
drivers/input/joystick/db9.c | 1 -
drivers/input/joystick/gamecon.c | 4 +---
drivers/input/joystick/turbografx.c | 1 -
drivers/input/joystick/walkera0701.c | 1 -
drivers/input/keyboard/amikbd.c | 4 +---
drivers/input/keyboard/davinci_keyscan.c | 1 -
drivers/input/keyboard/gpio_keys.c | 1 -
drivers/input/keyboard/lpc32xx-keys.c | 1 -
drivers/input/keyboard/max7359_keypad.c | 1 -
drivers/input/keyboard/mcs_touchkey.c | 1 -
drivers/input/keyboard/mpr121_touchkey.c | 1 -
drivers/input/keyboard/nomadik-ske-keypad.c | 1 -
drivers/input/keyboard/opencores-kbd.c | 1 -
drivers/input/keyboard/pmic8xxx-keypad.c | 1 -
drivers/input/keyboard/pxa27x_keypad.c | 1 -
drivers/input/keyboard/pxa930_rotary.c | 1 -
drivers/input/keyboard/qt1070.c | 1 -
drivers/input/keyboard/qt2160.c | 1 -
drivers/input/keyboard/sh_keysc.c | 1 -
drivers/input/keyboard/tc3589x-keypad.c | 1 -
drivers/input/keyboard/tnetv107x-keypad.c | 1 -
drivers/input/keyboard/w90p910_keypad.c | 1 -
drivers/input/misc/88pm80x_onkey.c | 1 -
drivers/input/misc/88pm860x_onkey.c | 1 -
drivers/input/misc/arizona-haptics.c | 4 +---
drivers/input/misc/atlas_btns.c | 4 +---
drivers/input/misc/da9052_onkey.c | 1 -
drivers/input/misc/da9055_onkey.c | 4 +---
drivers/input/misc/ideapad_slidebar.c | 1 -
drivers/input/misc/ims-pcu.c | 7 +------
drivers/input/misc/kxtj9.c | 4 +---
drivers/input/misc/max8997_haptic.c | 1 -
drivers/input/misc/mc13783-pwrbutton.c | 4 +---
drivers/input/misc/mpu3050.c | 1 -
drivers/input/misc/pcf8574_keypad.c | 1 -
drivers/input/misc/pm8xxx-vibrator.c | 1 -
drivers/input/misc/pmic8xxx-pwrkey.c | 1 -
drivers/input/misc/pwm-beeper.c | 1 -
drivers/input/misc/twl4030-pwrbutton.c | 4 +---
drivers/input/misc/twl6040-vibra.c | 1 -
drivers/input/mouse/appletouch.c | 4 +---
drivers/input/mouse/bcm5974.c | 4 +---
drivers/input/mouse/cyapa.c | 4 +---
drivers/input/mouse/inport.c | 1 -
drivers/input/mouse/logibm.c | 1 -
drivers/input/mouse/pc110pad.c | 1 -
drivers/input/mouse/pxa930_trkball.c | 1 -
drivers/input/tablet/aiptek.c | 5 +----
drivers/input/tablet/gtco.c | 1 -
drivers/input/touchscreen/88pm860x-ts.c | 1 -
drivers/input/touchscreen/atmel_mxt_ts.c | 1 -
drivers/input/touchscreen/atmel_tsadcc.c | 1 -
drivers/input/touchscreen/bu21013_ts.c | 1 -
drivers/input/touchscreen/cyttsp4_core.c | 2 --
drivers/input/touchscreen/da9034-ts.c | 1 -
drivers/input/touchscreen/edt-ft5x06.c | 1 -
drivers/input/touchscreen/eeti_ts.c | 5 +----
drivers/input/touchscreen/htcpen.c | 1 -
drivers/input/touchscreen/intel-mid-touch.c | 1 -
drivers/input/touchscreen/lpc32xx_ts.c | 1 -
drivers/input/touchscreen/mcs5000_ts.c | 1 -
drivers/input/touchscreen/migor_ts.c | 1 -
drivers/input/touchscreen/mk712.c | 1 -
drivers/input/touchscreen/pixcir_i2c_ts.c | 1 -
drivers/input/touchscreen/s3c2410_ts.c | 1 -
drivers/input/touchscreen/ti_am335x_tsc.c | 1 -
drivers/input/touchscreen/tnetv107x-ts.c | 1 -
drivers/media/rc/imon.c | 8 ++------
drivers/media/usb/em28xx/em28xx-input.c | 4 +---
drivers/media/usb/pwc/pwc-if.c | 1 -
drivers/platform/x86/asus-laptop.c | 5 ++---
drivers/platform/x86/eeepc-laptop.c | 4 +---
drivers/platform/x86/ideapad-laptop.c | 4 +---
drivers/platform/x86/intel_mid_powerbtn.c | 4 +---
drivers/platform/x86/panasonic-laptop.c | 5 +----
drivers/platform/x86/thinkpad_acpi.c | 1 -
drivers/platform/x86/topstar-laptop.c | 4 +---
drivers/platform/x86/toshiba_acpi.c | 4 +---
drivers/staging/cptm1217/clearpad_tm1217.c | 2 --
drivers/staging/iio/adc/mxs-lradc.c | 4 +---
drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 2 --
sound/pci/hda/hda_beep.c | 4 +---
87 files changed, 29 insertions(+), 152 deletions(-)
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply
* Re: [PATCHv4 2/3] Input: twl4030-pwrbutton: use dev_err for errors
From: Joe Perches @ 2013-10-23 18:17 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Sebastian Reichel, Dmitry Torokhov, Grant Likely, Rob Herring,
Peter Ujfalusi, Sachin Kamat, linux-input, linux-kernel,
devicetree
In-Reply-To: <1382550852-11508-3-git-send-email-sre@debian.org>
On Wed, 2013-10-23 at 19:54 +0200, Sebastian Reichel wrote:
> Use dev_err() to output errors instead of dev_dbg().
[]
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
[]
> @@ -60,7 +60,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
>
> pwr = input_allocate_device();
> if (!pwr) {
> - dev_dbg(&pdev->dev, "Can't allocate power button\n");
> + dev_err(&pdev->dev, "Can't allocate power button\n");
> return -ENOMEM;
> }
input_allocate_device uses kzalloc and it will emit a
standardized OOM message along with a dump_stack()
so this dev_err/dev_dbg is redundant and not necessary.
^ permalink raw reply
* [PATCHv4 0/3] DT Support for TWL4030 power button
From: Sebastian Reichel @ 2013-10-23 17:54 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
Hi,
This is the fourth iteration of DT support for the TWL4030
power button.
Changes since v3 [0]:
* remove twl4030_pwrbutton_remove function, which is no
longer needed after devm_ conversion.
[0] https://lkml.org/lkml/2013/10/23/353
-- Sebastian
Sebastian Reichel (3):
Input: twl4030-pwrbutton - add device tree support
Input: twl4030-pwrbutton: use dev_err for errors
Input: twl4030-pwrbutton: simplify driver using devm_*
.../bindings/input/twl4030-pwrbutton.txt | 13 ++++++
drivers/input/misc/twl4030-pwrbutton.c | 46 +++++++++-------------
2 files changed, 31 insertions(+), 28 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
--
1.8.4.rc3
^ permalink raw reply
* [PATCHv4 3/3] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Sebastian Reichel @ 2013-10-23 17:54 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382550852-11508-1-git-send-email-sre@debian.org>
Use managed irq resource to simplify the driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index 3efbb13..da30af0 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -58,7 +58,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
int irq = platform_get_irq(pdev, 0);
int err;
- pwr = input_allocate_device();
+ pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
@@ -70,40 +70,23 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr->phys = "twl4030_pwrbutton/input0";
pwr->dev.parent = &pdev->dev;
- err = request_threaded_irq(irq, NULL, powerbutton_irq,
+ err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
- goto free_input_dev;
+ return err;
}
err = input_register_device(pwr);
if (err) {
dev_err(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
+ return err;
}
platform_set_drvdata(pdev, pwr);
return 0;
-
-free_irq:
- free_irq(irq, pwr);
-free_input_dev:
- input_free_device(pwr);
- return err;
-}
-
-static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
-{
- struct input_dev *pwr = platform_get_drvdata(pdev);
- int irq = platform_get_irq(pdev, 0);
-
- free_irq(irq, pwr);
- input_unregister_device(pwr);
-
- return 0;
}
#if IS_ENABLED(CONFIG_OF)
@@ -116,7 +99,6 @@ MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
static struct platform_driver twl4030_pwrbutton_driver = {
.probe = twl4030_pwrbutton_probe,
- .remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv4 2/3] Input: twl4030-pwrbutton: use dev_err for errors
From: Sebastian Reichel @ 2013-10-23 17:54 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382550852-11508-1-git-send-email-sre@debian.org>
Use dev_err() to output errors instead of dev_dbg().
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index a3a0fe3..3efbb13 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -60,7 +60,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr = input_allocate_device();
if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ dev_err(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
}
@@ -74,13 +74,13 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
- dev_dbg(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+ dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
goto free_input_dev;
}
err = input_register_device(pwr);
if (err) {
- dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
+ dev_err(&pdev->dev, "Can't register power button: %d\n", err);
goto free_irq;
}
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv4 1/3] Input: twl4030-pwrbutton - add device tree support
From: Sebastian Reichel @ 2013-10-23 17:54 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382550852-11508-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 power button driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/input/twl4030-pwrbutton.txt | 13 +++++++++++++
drivers/input/misc/twl4030-pwrbutton.c | 16 ++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
new file mode 100644
index 0000000..945ec74
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
@@ -0,0 +1,13 @@
+* TWL4030's pwrbutton device tree bindings
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+ - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+- interrupt: should be one of the following
+ - <8>: For controllers compatible with twl4030
+
+Example:
+ twl_pwrbutton: pwrbutton {
+ compatible = "ti,twl4030-pwrbutton";
+ interrupts = <8>;
+ };
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b9a05fd..a3a0fe3 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
return IRQ_HANDLED;
}
-static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
@@ -106,16 +106,24 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
return 0;
}
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
+ { .compatible = "ti,twl4030-pwrbutton" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+#endif
+
static struct platform_driver twl4030_pwrbutton_driver = {
+ .probe = twl4030_pwrbutton_probe,
.remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
},
};
-
-module_platform_driver_probe(twl4030_pwrbutton_driver,
- twl4030_pwrbutton_probe);
+module_platform_driver(twl4030_pwrbutton_driver);
MODULE_ALIAS("platform:twl4030_pwrbutton");
MODULE_DESCRIPTION("Triton2 Power Button");
--
1.8.4.rc3
^ permalink raw reply related
* Re: [PATCHv3 3/3] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Felipe Balbi @ 2013-10-23 17:44 UTC (permalink / raw)
To: Aaro Koskinen
Cc: Sebastian Reichel, Sebastian Reichel, Dmitry Torokhov,
Grant Likely, Rob Herring, Peter Ujfalusi, Sachin Kamat,
linux-input, linux-kernel, devicetree
In-Reply-To: <20131023172524.GE24448@blackmetal.musicnaut.iki.fi>
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
On Wed, Oct 23, 2013 at 08:25:24PM +0300, Aaro Koskinen wrote:
> Hi,
>
> On Wed, Oct 23, 2013 at 06:47:15PM +0200, Sebastian Reichel wrote:
> > static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
> > {
> > struct input_dev *pwr = platform_get_drvdata(pdev);
> > - int irq = platform_get_irq(pdev, 0);
> >
> > - free_irq(irq, pwr);
> > input_unregister_device(pwr);
>
> The same bug still exists. You don't need to unregister manually any more,
> this whole function can be just reduced to "return 0;".
then it can be removed altogether, no ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCHv3 3/3] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Aaro Koskinen @ 2013-10-23 17:25 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Sebastian Reichel, Dmitry Torokhov, Grant Likely, Rob Herring,
Peter Ujfalusi, Sachin Kamat, linux-input, linux-kernel,
devicetree
In-Reply-To: <1382546835-20212-4-git-send-email-sre@debian.org>
Hi,
On Wed, Oct 23, 2013 at 06:47:15PM +0200, Sebastian Reichel wrote:
> static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
> {
> struct input_dev *pwr = platform_get_drvdata(pdev);
> - int irq = platform_get_irq(pdev, 0);
>
> - free_irq(irq, pwr);
> input_unregister_device(pwr);
The same bug still exists. You don't need to unregister manually any more,
this whole function can be just reduced to "return 0;".
A.
^ permalink raw reply
* [PATCHv3 0/3] DT Support for TWL4030 power button
From: Sebastian Reichel @ 2013-10-23 16:47 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
Hi,
This is the third iteration of DT support for the TWL4030
power button.
Changes since v2 [0]:
* add devicetree binding documentation
* use devm_input_allocate_device
[0] https://lkml.org/lkml/2013/10/23/323
-- Sebastian
Sebastian Reichel (3):
Input: twl4030-pwrbutton - add device tree support
Input: twl4030-pwrbutton: use dev_err for errors
Input: twl4030-pwrbutton: simplify driver using devm_*
.../bindings/input/twl4030-pwrbutton.txt | 13 ++++++++
drivers/input/misc/twl4030-pwrbutton.c | 38 +++++++++++-----------
2 files changed, 32 insertions(+), 19 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
--
1.8.4.rc3
^ permalink raw reply
* [PATCHv3 3/3] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Sebastian Reichel @ 2013-10-23 16:47 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382546835-20212-1-git-send-email-sre@debian.org>
Use managed irq resource to simplify the driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index 3efbb13..91bb497 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -58,7 +58,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
int irq = platform_get_irq(pdev, 0);
int err;
- pwr = input_allocate_device();
+ pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
@@ -70,37 +70,29 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr->phys = "twl4030_pwrbutton/input0";
pwr->dev.parent = &pdev->dev;
- err = request_threaded_irq(irq, NULL, powerbutton_irq,
+ err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
- goto free_input_dev;
+ return err;
}
err = input_register_device(pwr);
if (err) {
dev_err(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
+ return err;
}
platform_set_drvdata(pdev, pwr);
return 0;
-
-free_irq:
- free_irq(irq, pwr);
-free_input_dev:
- input_free_device(pwr);
- return err;
}
static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
{
struct input_dev *pwr = platform_get_drvdata(pdev);
- int irq = platform_get_irq(pdev, 0);
- free_irq(irq, pwr);
input_unregister_device(pwr);
return 0;
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv3 2/3] Input: twl4030-pwrbutton: use dev_err for errors
From: Sebastian Reichel @ 2013-10-23 16:47 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382546835-20212-1-git-send-email-sre@debian.org>
Use dev_err() to output errors instead of dev_dbg().
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index a3a0fe3..3efbb13 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -60,7 +60,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr = input_allocate_device();
if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ dev_err(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
}
@@ -74,13 +74,13 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
- dev_dbg(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+ dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
goto free_input_dev;
}
err = input_register_device(pwr);
if (err) {
- dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
+ dev_err(&pdev->dev, "Can't register power button: %d\n", err);
goto free_irq;
}
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv3 1/3] Input: twl4030-pwrbutton - add device tree support
From: Sebastian Reichel @ 2013-10-23 16:47 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Grant Likely, Rob Herring, Sebastian Reichel, Peter Ujfalusi,
Sachin Kamat, linux-input, linux-kernel, devicetree
In-Reply-To: <1382546835-20212-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 power button driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/input/twl4030-pwrbutton.txt | 13 +++++++++++++
drivers/input/misc/twl4030-pwrbutton.c | 16 ++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
new file mode 100644
index 0000000..945ec74
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
@@ -0,0 +1,13 @@
+* TWL4030's pwrbutton device tree bindings
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+ - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+- interrupt: should be one of the following
+ - <8>: For controllers compatible with twl4030
+
+Example:
+ twl_pwrbutton: pwrbutton {
+ compatible = "ti,twl4030-pwrbutton";
+ interrupts = <8>;
+ };
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b9a05fd..a3a0fe3 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
return IRQ_HANDLED;
}
-static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
@@ -106,16 +106,24 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
return 0;
}
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
+ { .compatible = "ti,twl4030-pwrbutton" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+#endif
+
static struct platform_driver twl4030_pwrbutton_driver = {
+ .probe = twl4030_pwrbutton_probe,
.remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
},
};
-
-module_platform_driver_probe(twl4030_pwrbutton_driver,
- twl4030_pwrbutton_probe);
+module_platform_driver(twl4030_pwrbutton_driver);
MODULE_ALIAS("platform:twl4030_pwrbutton");
MODULE_DESCRIPTION("Triton2 Power Button");
--
1.8.4.rc3
^ permalink raw reply related
* Re: [PATCH V4 1/2] tps6507x-ts: Add DT support
From: Mark Rutland @ 2013-10-23 16:45 UTC (permalink / raw)
To: Manish Badarkhe
Cc: devicetree-discuss@lists.ozlabs.org, devicetree@vger.kernel.org,
linux-input@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
davinci-linux-open-source@linux.davincidsp.com,
grant.likely@secretlab.ca, dmitry.torokhov@gmail.com,
rob.herring@calxeda.com, rob@landley.net
In-Reply-To: <1382545733-8865-2-git-send-email-badarkhe.manish@gmail.com>
On Wed, Oct 23, 2013 at 05:28:52PM +0100, Manish Badarkhe wrote:
> Add device tree based support for TI's tps6507x touchscreen.
>
> Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
> ---
> Changes since V3:
> - Rebased on top of Dmitry's changes
> - Removed error handling for optional DT properties
>
> Changes since V2:
> - Removed unnecessary code.
> - Updated Documentation to provide proper names of
> devicetree properties.
>
> Changes since V1:
> - Updated documentation to specify tps6507x as multifunctional
> device.
> - return proper error value in absence of platform and DT
> data for touchscreen.
> - Updated commit message.
>
> :100755 100755 8fffa3c... e1b9cfd... M Documentation/devicetree/bindings/mfd/tps6507x.txt
> :100644 100644 db604e0... 0cf0eb1... M drivers/input/touchscreen/tps6507x-ts.c
> Documentation/devicetree/bindings/mfd/tps6507x.txt | 24 ++++++-
> drivers/input/touchscreen/tps6507x-ts.c | 72 ++++++++++++--------
> 2 files changed, 67 insertions(+), 29 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> index 8fffa3c..e1b9cfd 100755
> --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
> +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> @@ -1,4 +1,8 @@
> -TPS6507x Power Management Integrated Circuit
> +TPS6507x Multifunctional Device.
> +
> +Features provided by TPS6507x:
> + 1.Power Management Integrated Circuit.
> + 2.Touch-Screen.
>
> Required properties:
> - compatible: "ti,tps6507x"
> @@ -23,6 +27,9 @@ Required properties:
> vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
> vindcdc3-supply : VDCDC3 input.
> vldo1_2-supply : VLDO1 and VLDO2 input.
> +- tsc: This node specifies touch screen data.
This is a node, but is listed un "Required properties". That seems odd.
When is it required?
Why is the data under the tsc subnode? Why not directly under the main node?
> + ti,poll-period : Time at which touch input is getting sampled in ms.
Is this for debounce? Other bindings have similar but differently named
properties.
Why is this necessary? Can the driver not choose a sane value?
> + ti,min-pressure: Minimum pressure value to trigger touch.
What type are these? Single (u32) cells?
What units is ti,min-pressure in?
>
> Regulator Optional properties:
> - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
> @@ -30,6 +37,14 @@ Regulator Optional properties:
> 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
> If this property is not defined, it defaults to 0 (not enabled).
>
> +Touchscreen Optional properties:
> +- ti,vendor : Touchscreen vendor id to populate
> + in sysclass interface.
> +- ti,product: Touchscreen product id to populate
> + in sysclass interface.
> +- ti,version: Touchscreen version id to populate
> + in sysclass interface.
Are these integers, strings, or something else?
What values make sense?
What's the sysclass interface? That sounds like a Linux detail. The properties
might be fine but the description shouldn't need to refer to Linux internals.
> +
> Example:
>
> pmu: tps6507x@48 {
> @@ -88,4 +103,11 @@ Example:
> };
> };
>
> + tsc {
> + ti,poll-period = <30>;
> + ti,min-pressure = <0x30>;
> + ti,vendor = <0>;
> + ti,product = <65070>;
> + ti,version = <0x100>;
> + };
> };
> diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c
> index db604e0..0cf0eb1 100644
> --- a/drivers/input/touchscreen/tps6507x-ts.c
> +++ b/drivers/input/touchscreen/tps6507x-ts.c
> @@ -22,6 +22,8 @@
> #include <linux/mfd/tps6507x.h>
> #include <linux/input/tps6507x-ts.h>
> #include <linux/delay.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
> #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
> #define TPS_DEFAULT_MIN_PRESSURE 0x30
> @@ -206,33 +208,54 @@ done:
> tps6507x_adc_standby(tsc);
> }
>
> +static void tsc_init_data(struct tps6507x_ts *tsc,
> + struct input_dev *input_dev)
> +{
> + struct device_node *node = tsc->dev->of_node;
> + const struct tps6507x_board *tps_board =
> + dev_get_platdata(tsc->dev);
> + const struct touchscreen_init_data *init_data = NULL;
> +
> + if (node)
> + node = of_find_node_by_name(node, "tsc");
As of_find_node_by_name traverses the list of all nodes (not just children),
this may match nodes other than what you expect.
> + if (tps_board)
> + /*
> + * init_data points to array of touchscreen_init structure
> + * coming from the board-evm file.
> + */
> + init_data = tps_board->tps6507x_ts_init_data;
> +
> + if (node == NULL || init_data == NULL) {
> + tsc->poll_dev->poll_interval = TSC_DEFAULT_POLL_PERIOD;
> + tsc->min_pressure = TPS_DEFAULT_MIN_PRESSURE;
> + } else if (init_data) {
> + tsc->poll_dev->poll_interval = init_data->poll_period;
> + tsc->min_pressure = init_data->min_pressure;
> + input_dev->id.vendor = init_data->vendor;
> + input_dev->id.product = init_data->product;
> + input_dev->id.version = init_data->version;
> + } else if (node) {
> + of_property_read_u32(node, "ti,poll-period",
> + &tsc->poll_dev->poll_interval);
> + of_property_read_u16(node, "ti,min-pressure",
> + &tsc->min_pressure);
You didn't mention these were 16-bit values in the binding.
As DTB is encoded big-endian, and you didn't use a /bits/ 16 declaration
(making the property a u32 cell), won't this read 0 in all cases you have a
value in the expected range (as in your example)?
> + of_property_read_u16(node, "ti,vendor",
> + &input_dev->id.vendor);
> + of_property_read_u16(node, "ti,product",
> + &input_dev->id.product);
> + of_property_read_u16(node, "ti,version",
> + &input_dev->id.version);
Similarly for these three.
Thanks,
Mark.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox