* [PATCH v3 0/2] small fixes for soc_button_array
@ 2016-11-25 16:36 Benjamin Tissoires
2016-11-25 16:36 ` [PATCH v3 1/2] Input - soc_button_array: use gpio_is_valid() Benjamin Tissoires
2016-11-25 16:36 ` [PATCH v3 2/2] Input - soc_button_array: bail out earlier if gpiod_count is null Benjamin Tissoires
0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2016-11-25 16:36 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
Hi Dmitry,
I am currently trying to clean up my local tree.
These 2 patches are IMO acceptable, so I am sending them with the hope
of being able to remove them from my local tree :)
Cheers,
Benjamin
Benjamin Tissoires (2):
Input - soc_button_array: use gpio_is_valid()
Input - soc_button_array: bail out earlier if gpiod_count is null
drivers/input/misc/soc_button_array.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] Input - soc_button_array: use gpio_is_valid()
2016-11-25 16:36 [PATCH v3 0/2] small fixes for soc_button_array Benjamin Tissoires
@ 2016-11-25 16:36 ` Benjamin Tissoires
2016-11-25 19:38 ` Dmitry Torokhov
2016-11-25 16:36 ` [PATCH v3 2/2] Input - soc_button_array: bail out earlier if gpiod_count is null Benjamin Tissoires
1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Tissoires @ 2016-11-25 16:36 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
gpio_keys will later use gpio_is_valid(). To match the actual
behavior, we should use it here too.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
no changes in v3
Changes in v2:
- fixed gpio_is_valid(gpio) -> !gpio_is_valid(gpio)
---
drivers/input/misc/soc_button_array.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index c14b827..bbd433c 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -17,6 +17,7 @@
#include <linux/acpi.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio_keys.h>
+#include <linux/gpio.h>
#include <linux/platform_device.h>
/*
@@ -92,7 +93,7 @@ soc_button_device_create(struct platform_device *pdev,
continue;
gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
- if (gpio < 0)
+ if (!gpio_is_valid(gpio))
continue;
gpio_keys[n_buttons].type = info->event_type;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] Input - soc_button_array: bail out earlier if gpiod_count is null
2016-11-25 16:36 [PATCH v3 0/2] small fixes for soc_button_array Benjamin Tissoires
2016-11-25 16:36 ` [PATCH v3 1/2] Input - soc_button_array: use gpio_is_valid() Benjamin Tissoires
@ 2016-11-25 16:36 ` Benjamin Tissoires
2016-11-25 19:38 ` Dmitry Torokhov
1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Tissoires @ 2016-11-25 16:36 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
The PNP0C40 device of the Surface 3 doesn't have any GPIO attached to it.
Instead of trying to access the GPIO, request the count beforehand and
bail out if it is null or if an error is returned.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
no changes in v3
changes in v2:
- hunk moved down for better integration with later patches
---
drivers/input/misc/soc_button_array.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index bbd433c..5467d04 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -167,6 +167,11 @@ static int soc_button_probe(struct platform_device *pdev)
button_info = (struct soc_button_info *)id->driver_data;
+ if (gpiod_count(&pdev->dev, KBUILD_MODNAME) <= 0) {
+ dev_info(&pdev->dev, "no GPIO attached, ignoring...\n");
+ return -ENODEV;
+ }
+
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] Input - soc_button_array: bail out earlier if gpiod_count is null
2016-11-25 16:36 ` [PATCH v3 2/2] Input - soc_button_array: bail out earlier if gpiod_count is null Benjamin Tissoires
@ 2016-11-25 19:38 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2016-11-25 19:38 UTC (permalink / raw)
To: Benjamin Tissoires; +Cc: linux-input, linux-kernel
On Fri, Nov 25, 2016 at 05:36:42PM +0100, Benjamin Tissoires wrote:
> The PNP0C40 device of the Surface 3 doesn't have any GPIO attached to it.
> Instead of trying to access the GPIO, request the count beforehand and
> bail out if it is null or if an error is returned.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> no changes in v3
>
> changes in v2:
> - hunk moved down for better integration with later patches
> ---
> drivers/input/misc/soc_button_array.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
> index bbd433c..5467d04 100644
> --- a/drivers/input/misc/soc_button_array.c
> +++ b/drivers/input/misc/soc_button_array.c
> @@ -167,6 +167,11 @@ static int soc_button_probe(struct platform_device *pdev)
>
> button_info = (struct soc_button_info *)id->driver_data;
>
> + if (gpiod_count(&pdev->dev, KBUILD_MODNAME) <= 0) {
> + dev_info(&pdev->dev, "no GPIO attached, ignoring...\n");
Changed this to dev_dbg() and applied, thank you.
> + return -ENODEV;
> + }
> +
> priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> return -ENOMEM;
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/2] Input - soc_button_array: use gpio_is_valid()
2016-11-25 16:36 ` [PATCH v3 1/2] Input - soc_button_array: use gpio_is_valid() Benjamin Tissoires
@ 2016-11-25 19:38 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2016-11-25 19:38 UTC (permalink / raw)
To: Benjamin Tissoires; +Cc: linux-input, linux-kernel
On Fri, Nov 25, 2016 at 05:36:41PM +0100, Benjamin Tissoires wrote:
> gpio_keys will later use gpio_is_valid(). To match the actual
> behavior, we should use it here too.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Applied, thank you.
>
> ---
>
> no changes in v3
>
> Changes in v2:
> - fixed gpio_is_valid(gpio) -> !gpio_is_valid(gpio)
> ---
> drivers/input/misc/soc_button_array.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
> index c14b827..bbd433c 100644
> --- a/drivers/input/misc/soc_button_array.c
> +++ b/drivers/input/misc/soc_button_array.c
> @@ -17,6 +17,7 @@
> #include <linux/acpi.h>
> #include <linux/gpio/consumer.h>
> #include <linux/gpio_keys.h>
> +#include <linux/gpio.h>
> #include <linux/platform_device.h>
>
> /*
> @@ -92,7 +93,7 @@ soc_button_device_create(struct platform_device *pdev,
> continue;
>
> gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
> - if (gpio < 0)
> + if (!gpio_is_valid(gpio))
> continue;
>
> gpio_keys[n_buttons].type = info->event_type;
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-25 19:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 16:36 [PATCH v3 0/2] small fixes for soc_button_array Benjamin Tissoires
2016-11-25 16:36 ` [PATCH v3 1/2] Input - soc_button_array: use gpio_is_valid() Benjamin Tissoires
2016-11-25 19:38 ` Dmitry Torokhov
2016-11-25 16:36 ` [PATCH v3 2/2] Input - soc_button_array: bail out earlier if gpiod_count is null Benjamin Tissoires
2016-11-25 19:38 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).