* [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line
@ 2021-03-09 11:23 Andy Shevchenko
2021-03-09 11:23 ` [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise Andy Shevchenko
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:23 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
When requesting optional GPIO echo line, bail out on error,
so user will know that something wrong with the existing property.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index e0de1df2ede0..f89c31aa66f1 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -119,12 +119,12 @@ static int pps_gpio_setup(struct platform_device *pdev)
data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
"echo",
GPIOD_OUT_LOW);
- if (data->echo_pin) {
- if (IS_ERR(data->echo_pin)) {
- dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
- return PTR_ERR(data->echo_pin);
- }
+ if (IS_ERR(data->echo_pin)) {
+ dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
+ return PTR_ERR(data->echo_pin);
+ }
+ if (data->echo_pin) {
ret = of_property_read_u32(np,
"echo-active-ms",
&value);
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
@ 2021-03-09 11:23 ` Andy Shevchenko
2021-03-09 12:25 ` Rodolfo Giometti
2021-03-09 11:23 ` [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove() Andy Shevchenko
` (6 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:23 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
When GPIO APIs return -EPROBE_DEFER there is no need to print the message,
especially taking into consideration that it may repeat several times.
Use dev_err_probe() to avoid log noise in such cases.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index f89c31aa66f1..78c9680e8063 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -110,19 +110,16 @@ static int pps_gpio_setup(struct platform_device *pdev)
data->gpio_pin = devm_gpiod_get(&pdev->dev,
NULL, /* request "gpios" */
GPIOD_IN);
- if (IS_ERR(data->gpio_pin)) {
- dev_err(&pdev->dev,
- "failed to request PPS GPIO\n");
- return PTR_ERR(data->gpio_pin);
- }
+ if (IS_ERR(data->gpio_pin))
+ return dev_err_probe(&pdev->dev, PTR_ERR(data->gpio_pin),
+ "failed to request PPS GPIO\n");
data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
"echo",
GPIOD_OUT_LOW);
- if (IS_ERR(data->echo_pin)) {
- dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
- return PTR_ERR(data->echo_pin);
- }
+ if (IS_ERR(data->echo_pin))
+ return dev_err_probe(&pdev->dev, PTR_ERR(data->echo_pin),
+ "failed to request ECHO GPIO\n");
if (data->echo_pin) {
ret = of_property_read_u32(np,
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove()
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
2021-03-09 11:23 ` [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise Andy Shevchenko
@ 2021-03-09 11:23 ` Andy Shevchenko
2021-03-09 12:25 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data Andy Shevchenko
` (5 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:23 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
The timer along with GPIO API are NULL-aware, there is no need to test
against existing GPIO echo line.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 78c9680e8063..dc9ed6fc3dae 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -240,11 +240,9 @@ static int pps_gpio_remove(struct platform_device *pdev)
struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
pps_unregister_source(data->pps);
- if (data->echo_pin) {
- del_timer_sync(&data->echo_timer);
- /* reset echo pin in any case */
- gpiod_set_value(data->echo_pin, 0);
- }
+ del_timer_sync(&data->echo_timer);
+ /* reset echo pin in any case */
+ gpiod_set_value(data->echo_pin, 0);
dev_info(&pdev->dev, "removed IRQ %d as PPS source\n", data->irq);
return 0;
}
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
2021-03-09 11:23 ` [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise Andy Shevchenko
2021-03-09 11:23 ` [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove() Andy Shevchenko
@ 2021-03-09 11:24 ` Andy Shevchenko
2021-03-09 12:25 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties Andy Shevchenko
` (4 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:24 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
Platform data is a legacy interface to supply device properties
to the driver. In this case we even don't have in-kernel users
for it. Just remove it for good.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 17 +++--------------
include/linux/pps-gpio.h | 19 -------------------
2 files changed, 3 insertions(+), 33 deletions(-)
delete mode 100644 include/linux/pps-gpio.h
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index dc9ed6fc3dae..291240dce79e 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -16,7 +16,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/pps_kernel.h>
-#include <linux/pps-gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/list.h>
#include <linux/of_device.h>
@@ -164,7 +163,6 @@ static int pps_gpio_probe(struct platform_device *pdev)
struct pps_gpio_device_data *data;
int ret;
int pps_default_params;
- const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
/* allocate space for device info */
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
@@ -173,18 +171,9 @@ static int pps_gpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
/* GPIO setup */
- if (pdata) {
- data->gpio_pin = pdata->gpio_pin;
- data->echo_pin = pdata->echo_pin;
-
- data->assert_falling_edge = pdata->assert_falling_edge;
- data->capture_clear = pdata->capture_clear;
- data->echo_active_ms = pdata->echo_active_ms;
- } else {
- ret = pps_gpio_setup(pdev);
- if (ret)
- return -EINVAL;
- }
+ ret = pps_gpio_setup(pdev);
+ if (ret)
+ return -EINVAL;
/* IRQ setup */
ret = gpiod_to_irq(data->gpio_pin);
diff --git a/include/linux/pps-gpio.h b/include/linux/pps-gpio.h
deleted file mode 100644
index 7bf49908be06..000000000000
--- a/include/linux/pps-gpio.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * pps-gpio.h -- PPS client for GPIOs
- *
- * Copyright (C) 2011 James Nuss <jamesnuss@nanometrics.ca>
- */
-
-#ifndef _PPS_GPIO_H
-#define _PPS_GPIO_H
-
-struct pps_gpio_platform_data {
- struct gpio_desc *gpio_pin;
- struct gpio_desc *echo_pin;
- bool assert_falling_edge;
- bool capture_clear;
- unsigned int echo_active_ms;
-};
-
-#endif /* _PPS_GPIO_H */
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
` (2 preceding siblings ...)
2021-03-09 11:24 ` [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data Andy Shevchenko
@ 2021-03-09 11:24 ` Andy Shevchenko
2021-03-09 12:27 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly Andy Shevchenko
` (3 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:24 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
Device property API allows to gather device resources from different sources,
such as ACPI. Convert the drivers to unleash the power of device property API.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 291240dce79e..c6db3a3b257b 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -12,14 +12,14 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/pps_kernel.h>
#include <linux/gpio/consumer.h>
#include <linux/list.h>
-#include <linux/of_device.h>
-#include <linux/of_gpio.h>
+#include <linux/property.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
@@ -102,7 +102,6 @@ static void pps_gpio_echo_timer_callback(struct timer_list *t)
static int pps_gpio_setup(struct platform_device *pdev)
{
struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
- struct device_node *np = pdev->dev.of_node;
int ret;
u32 value;
@@ -121,26 +120,24 @@ static int pps_gpio_setup(struct platform_device *pdev)
"failed to request ECHO GPIO\n");
if (data->echo_pin) {
- ret = of_property_read_u32(np,
- "echo-active-ms",
- &value);
+ ret = device_property_read_u32(&pdev->dev, "echo-active-ms", &value);
if (ret) {
dev_err(&pdev->dev,
- "failed to get echo-active-ms from OF\n");
+ "failed to get echo-active-ms from FW\n");
return ret;
}
data->echo_active_ms = value;
/* sanity check on echo_active_ms */
if (!data->echo_active_ms || data->echo_active_ms > 999) {
dev_err(&pdev->dev,
- "echo-active-ms: %u - bad value from OF\n",
+ "echo-active-ms: %u - bad value from FW\n",
data->echo_active_ms);
return -EINVAL;
}
}
- if (of_property_read_bool(np, "assert-falling-edge"))
- data->assert_falling_edge = true;
+ data->assert_falling_edge =
+ device_property_read_bool(&pdev->dev, "assert-falling-edge");
return 0;
}
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
` (3 preceding siblings ...)
2021-03-09 11:24 ` [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties Andy Shevchenko
@ 2021-03-09 11:24 ` Andy Shevchenko
2021-03-09 12:30 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup() Andy Shevchenko
` (2 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:24 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
In most parts of the code the platform device is not used.
Use struct device pointer directly to reduce code size and
increase readability.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 42 +++++++++++++++-------------------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index c6db3a3b257b..b097da5a659a 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -99,45 +99,39 @@ static void pps_gpio_echo_timer_callback(struct timer_list *t)
gpiod_set_value(info->echo_pin, 0);
}
-static int pps_gpio_setup(struct platform_device *pdev)
+static int pps_gpio_setup(struct device *dev)
{
- struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
+ struct pps_gpio_device_data *data = dev_get_drvdata(dev);
int ret;
u32 value;
- data->gpio_pin = devm_gpiod_get(&pdev->dev,
- NULL, /* request "gpios" */
- GPIOD_IN);
+ data->gpio_pin = devm_gpiod_get(dev, NULL, GPIOD_IN);
if (IS_ERR(data->gpio_pin))
- return dev_err_probe(&pdev->dev, PTR_ERR(data->gpio_pin),
+ return dev_err_probe(dev, PTR_ERR(data->gpio_pin),
"failed to request PPS GPIO\n");
- data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
- "echo",
- GPIOD_OUT_LOW);
+ data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
if (IS_ERR(data->echo_pin))
- return dev_err_probe(&pdev->dev, PTR_ERR(data->echo_pin),
+ return dev_err_probe(dev, PTR_ERR(data->echo_pin),
"failed to request ECHO GPIO\n");
if (data->echo_pin) {
- ret = device_property_read_u32(&pdev->dev, "echo-active-ms", &value);
+ ret = device_property_read_u32(dev, "echo-active-ms", &value);
if (ret) {
- dev_err(&pdev->dev,
- "failed to get echo-active-ms from FW\n");
+ dev_err(dev, "failed to get echo-active-ms from FW\n");
return ret;
}
data->echo_active_ms = value;
/* sanity check on echo_active_ms */
if (!data->echo_active_ms || data->echo_active_ms > 999) {
- dev_err(&pdev->dev,
- "echo-active-ms: %u - bad value from FW\n",
+ dev_err(dev, "echo-active-ms: %u - bad value from FW\n",
data->echo_active_ms);
return -EINVAL;
}
}
data->assert_falling_edge =
- device_property_read_bool(&pdev->dev, "assert-falling-edge");
+ device_property_read_bool(dev, "assert-falling-edge");
return 0;
}
@@ -158,24 +152,26 @@ get_irqf_trigger_flags(const struct pps_gpio_device_data *data)
static int pps_gpio_probe(struct platform_device *pdev)
{
struct pps_gpio_device_data *data;
+ struct device *dev = &pdev->dev;
int ret;
int pps_default_params;
/* allocate space for device info */
- data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
- platform_set_drvdata(pdev, data);
+
+ dev_set_drvdata(dev, data);
/* GPIO setup */
- ret = pps_gpio_setup(pdev);
+ ret = pps_gpio_setup(dev);
if (ret)
return -EINVAL;
/* IRQ setup */
ret = gpiod_to_irq(data->gpio_pin);
if (ret < 0) {
- dev_err(&pdev->dev, "failed to map GPIO to IRQ: %d\n", ret);
+ dev_err(dev, "failed to map GPIO to IRQ: %d\n", ret);
return -EINVAL;
}
data->irq = ret;
@@ -201,17 +197,17 @@ static int pps_gpio_probe(struct platform_device *pdev)
pps_default_params |= PPS_CAPTURECLEAR | PPS_OFFSETCLEAR;
data->pps = pps_register_source(&data->info, pps_default_params);
if (IS_ERR(data->pps)) {
- dev_err(&pdev->dev, "failed to register IRQ %d as PPS source\n",
+ dev_err(dev, "failed to register IRQ %d as PPS source\n",
data->irq);
return PTR_ERR(data->pps);
}
/* register IRQ interrupt handler */
- ret = devm_request_irq(&pdev->dev, data->irq, pps_gpio_irq_handler,
+ ret = devm_request_irq(dev, data->irq, pps_gpio_irq_handler,
get_irqf_trigger_flags(data), data->info.name, data);
if (ret) {
pps_unregister_source(data->pps);
- dev_err(&pdev->dev, "failed to acquire IRQ %d\n", data->irq);
+ dev_err(dev, "failed to acquire IRQ %d\n", data->irq);
return -EINVAL;
}
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup()
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
` (4 preceding siblings ...)
2021-03-09 11:24 ` [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly Andy Shevchenko
@ 2021-03-09 11:24 ` Andy Shevchenko
2021-03-09 12:30 ` Rodolfo Giometti
2021-03-09 12:23 ` [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Rodolfo Giometti
2021-03-15 12:34 ` Andy Shevchenko
7 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-09 11:24 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel
Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
Rearrange optional stuff in pps_gpio_setup() so it will go after mandatory one
and with reduced indentation. This will increase readability of the sources.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/clients/pps-gpio.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index b097da5a659a..35799e6401c9 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -110,28 +110,31 @@ static int pps_gpio_setup(struct device *dev)
return dev_err_probe(dev, PTR_ERR(data->gpio_pin),
"failed to request PPS GPIO\n");
+ data->assert_falling_edge =
+ device_property_read_bool(dev, "assert-falling-edge");
+
data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
if (IS_ERR(data->echo_pin))
return dev_err_probe(dev, PTR_ERR(data->echo_pin),
"failed to request ECHO GPIO\n");
- if (data->echo_pin) {
- ret = device_property_read_u32(dev, "echo-active-ms", &value);
- if (ret) {
- dev_err(dev, "failed to get echo-active-ms from FW\n");
- return ret;
- }
- data->echo_active_ms = value;
- /* sanity check on echo_active_ms */
- if (!data->echo_active_ms || data->echo_active_ms > 999) {
- dev_err(dev, "echo-active-ms: %u - bad value from FW\n",
- data->echo_active_ms);
- return -EINVAL;
- }
+ if (!data->echo_pin)
+ return 0;
+
+ ret = device_property_read_u32(dev, "echo-active-ms", &value);
+ if (ret) {
+ dev_err(dev, "failed to get echo-active-ms from FW\n");
+ return ret;
}
- data->assert_falling_edge =
- device_property_read_bool(dev, "assert-falling-edge");
+ /* sanity check on echo_active_ms */
+ if (!value || value > 999) {
+ dev_err(dev, "echo-active-ms: %u - bad value from FW\n", value);
+ return -EINVAL;
+ }
+
+ data->echo_active_ms = value;
+
return 0;
}
--
2.30.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
` (5 preceding siblings ...)
2021-03-09 11:24 ` [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup() Andy Shevchenko
@ 2021-03-09 12:23 ` Rodolfo Giometti
2021-03-15 12:34 ` Andy Shevchenko
7 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:23 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:23, Andy Shevchenko wrote:
> When requesting optional GPIO echo line, bail out on error,
> so user will know that something wrong with the existing property.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index e0de1df2ede0..f89c31aa66f1 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -119,12 +119,12 @@ static int pps_gpio_setup(struct platform_device *pdev)
> data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
> "echo",
> GPIOD_OUT_LOW);
> - if (data->echo_pin) {
> - if (IS_ERR(data->echo_pin)) {
> - dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
> - return PTR_ERR(data->echo_pin);
> - }
> + if (IS_ERR(data->echo_pin)) {
> + dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
> + return PTR_ERR(data->echo_pin);
> + }
>
> + if (data->echo_pin) {
> ret = of_property_read_u32(np,
> "echo-active-ms",
> &value);
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise
2021-03-09 11:23 ` [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise Andy Shevchenko
@ 2021-03-09 12:25 ` Rodolfo Giometti
0 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:25 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:23, Andy Shevchenko wrote:
> When GPIO APIs return -EPROBE_DEFER there is no need to print the message,
> especially taking into consideration that it may repeat several times.
> Use dev_err_probe() to avoid log noise in such cases.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index f89c31aa66f1..78c9680e8063 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -110,19 +110,16 @@ static int pps_gpio_setup(struct platform_device *pdev)
> data->gpio_pin = devm_gpiod_get(&pdev->dev,
> NULL, /* request "gpios" */
> GPIOD_IN);
> - if (IS_ERR(data->gpio_pin)) {
> - dev_err(&pdev->dev,
> - "failed to request PPS GPIO\n");
> - return PTR_ERR(data->gpio_pin);
> - }
> + if (IS_ERR(data->gpio_pin))
> + return dev_err_probe(&pdev->dev, PTR_ERR(data->gpio_pin),
> + "failed to request PPS GPIO\n");
>
> data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
> "echo",
> GPIOD_OUT_LOW);
> - if (IS_ERR(data->echo_pin)) {
> - dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
> - return PTR_ERR(data->echo_pin);
> - }
> + if (IS_ERR(data->echo_pin))
> + return dev_err_probe(&pdev->dev, PTR_ERR(data->echo_pin),
> + "failed to request ECHO GPIO\n");
>
> if (data->echo_pin) {
> ret = of_property_read_u32(np,
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove()
2021-03-09 11:23 ` [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove() Andy Shevchenko
@ 2021-03-09 12:25 ` Rodolfo Giometti
0 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:25 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:23, Andy Shevchenko wrote:
> The timer along with GPIO API are NULL-aware, there is no need to test
> against existing GPIO echo line.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index 78c9680e8063..dc9ed6fc3dae 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -240,11 +240,9 @@ static int pps_gpio_remove(struct platform_device *pdev)
> struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
>
> pps_unregister_source(data->pps);
> - if (data->echo_pin) {
> - del_timer_sync(&data->echo_timer);
> - /* reset echo pin in any case */
> - gpiod_set_value(data->echo_pin, 0);
> - }
> + del_timer_sync(&data->echo_timer);
> + /* reset echo pin in any case */
> + gpiod_set_value(data->echo_pin, 0);
> dev_info(&pdev->dev, "removed IRQ %d as PPS source\n", data->irq);
> return 0;
> }
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data
2021-03-09 11:24 ` [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data Andy Shevchenko
@ 2021-03-09 12:25 ` Rodolfo Giometti
0 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:25 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:24, Andy Shevchenko wrote:
> Platform data is a legacy interface to supply device properties
> to the driver. In this case we even don't have in-kernel users
> for it. Just remove it for good.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 17 +++--------------
> include/linux/pps-gpio.h | 19 -------------------
> 2 files changed, 3 insertions(+), 33 deletions(-)
> delete mode 100644 include/linux/pps-gpio.h
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index dc9ed6fc3dae..291240dce79e 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -16,7 +16,6 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/pps_kernel.h>
> -#include <linux/pps-gpio.h>
> #include <linux/gpio/consumer.h>
> #include <linux/list.h>
> #include <linux/of_device.h>
> @@ -164,7 +163,6 @@ static int pps_gpio_probe(struct platform_device *pdev)
> struct pps_gpio_device_data *data;
> int ret;
> int pps_default_params;
> - const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
>
> /* allocate space for device info */
> data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> @@ -173,18 +171,9 @@ static int pps_gpio_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, data);
>
> /* GPIO setup */
> - if (pdata) {
> - data->gpio_pin = pdata->gpio_pin;
> - data->echo_pin = pdata->echo_pin;
> -
> - data->assert_falling_edge = pdata->assert_falling_edge;
> - data->capture_clear = pdata->capture_clear;
> - data->echo_active_ms = pdata->echo_active_ms;
> - } else {
> - ret = pps_gpio_setup(pdev);
> - if (ret)
> - return -EINVAL;
> - }
> + ret = pps_gpio_setup(pdev);
> + if (ret)
> + return -EINVAL;
>
> /* IRQ setup */
> ret = gpiod_to_irq(data->gpio_pin);
> diff --git a/include/linux/pps-gpio.h b/include/linux/pps-gpio.h
> deleted file mode 100644
> index 7bf49908be06..000000000000
> --- a/include/linux/pps-gpio.h
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> - * pps-gpio.h -- PPS client for GPIOs
> - *
> - * Copyright (C) 2011 James Nuss <jamesnuss@nanometrics.ca>
> - */
> -
> -#ifndef _PPS_GPIO_H
> -#define _PPS_GPIO_H
> -
> -struct pps_gpio_platform_data {
> - struct gpio_desc *gpio_pin;
> - struct gpio_desc *echo_pin;
> - bool assert_falling_edge;
> - bool capture_clear;
> - unsigned int echo_active_ms;
> -};
> -
> -#endif /* _PPS_GPIO_H */
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties
2021-03-09 11:24 ` [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties Andy Shevchenko
@ 2021-03-09 12:27 ` Rodolfo Giometti
0 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:27 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:24, Andy Shevchenko wrote:
> Device property API allows to gather device resources from different sources,
> such as ACPI. Convert the drivers to unleash the power of device property API.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index 291240dce79e..c6db3a3b257b 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -12,14 +12,14 @@
> #include <linux/init.h>
> #include <linux/kernel.h>
> #include <linux/interrupt.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/pps_kernel.h>
> #include <linux/gpio/consumer.h>
> #include <linux/list.h>
> -#include <linux/of_device.h>
> -#include <linux/of_gpio.h>
> +#include <linux/property.h>
> #include <linux/timer.h>
> #include <linux/jiffies.h>
>
> @@ -102,7 +102,6 @@ static void pps_gpio_echo_timer_callback(struct timer_list *t)
> static int pps_gpio_setup(struct platform_device *pdev)
> {
> struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
> - struct device_node *np = pdev->dev.of_node;
> int ret;
> u32 value;
>
> @@ -121,26 +120,24 @@ static int pps_gpio_setup(struct platform_device *pdev)
> "failed to request ECHO GPIO\n");
>
> if (data->echo_pin) {
> - ret = of_property_read_u32(np,
> - "echo-active-ms",
> - &value);
> + ret = device_property_read_u32(&pdev->dev, "echo-active-ms", &value);
> if (ret) {
> dev_err(&pdev->dev,
> - "failed to get echo-active-ms from OF\n");
> + "failed to get echo-active-ms from FW\n");
> return ret;
> }
> data->echo_active_ms = value;
> /* sanity check on echo_active_ms */
> if (!data->echo_active_ms || data->echo_active_ms > 999) {
> dev_err(&pdev->dev,
> - "echo-active-ms: %u - bad value from OF\n",
> + "echo-active-ms: %u - bad value from FW\n",
> data->echo_active_ms);
> return -EINVAL;
> }
> }
>
> - if (of_property_read_bool(np, "assert-falling-edge"))
> - data->assert_falling_edge = true;
> + data->assert_falling_edge =
> + device_property_read_bool(&pdev->dev, "assert-falling-edge");
> return 0;
> }
>
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly
2021-03-09 11:24 ` [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly Andy Shevchenko
@ 2021-03-09 12:30 ` Rodolfo Giometti
0 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:30 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:24, Andy Shevchenko wrote:
> In most parts of the code the platform device is not used.
> Use struct device pointer directly to reduce code size and
> increase readability.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 42 +++++++++++++++-------------------
> 1 file changed, 19 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index c6db3a3b257b..b097da5a659a 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -99,45 +99,39 @@ static void pps_gpio_echo_timer_callback(struct timer_list *t)
> gpiod_set_value(info->echo_pin, 0);
> }
>
> -static int pps_gpio_setup(struct platform_device *pdev)
> +static int pps_gpio_setup(struct device *dev)
> {
> - struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
> + struct pps_gpio_device_data *data = dev_get_drvdata(dev);
> int ret;
> u32 value;
>
> - data->gpio_pin = devm_gpiod_get(&pdev->dev,
> - NULL, /* request "gpios" */
> - GPIOD_IN);
> + data->gpio_pin = devm_gpiod_get(dev, NULL, GPIOD_IN);
> if (IS_ERR(data->gpio_pin))
> - return dev_err_probe(&pdev->dev, PTR_ERR(data->gpio_pin),
> + return dev_err_probe(dev, PTR_ERR(data->gpio_pin),
> "failed to request PPS GPIO\n");
>
> - data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
> - "echo",
> - GPIOD_OUT_LOW);
> + data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
> if (IS_ERR(data->echo_pin))
> - return dev_err_probe(&pdev->dev, PTR_ERR(data->echo_pin),
> + return dev_err_probe(dev, PTR_ERR(data->echo_pin),
> "failed to request ECHO GPIO\n");
>
> if (data->echo_pin) {
> - ret = device_property_read_u32(&pdev->dev, "echo-active-ms", &value);
> + ret = device_property_read_u32(dev, "echo-active-ms", &value);
> if (ret) {
> - dev_err(&pdev->dev,
> - "failed to get echo-active-ms from FW\n");
> + dev_err(dev, "failed to get echo-active-ms from FW\n");
> return ret;
> }
> data->echo_active_ms = value;
> /* sanity check on echo_active_ms */
> if (!data->echo_active_ms || data->echo_active_ms > 999) {
> - dev_err(&pdev->dev,
> - "echo-active-ms: %u - bad value from FW\n",
> + dev_err(dev, "echo-active-ms: %u - bad value from FW\n",
> data->echo_active_ms);
> return -EINVAL;
> }
> }
>
> data->assert_falling_edge =
> - device_property_read_bool(&pdev->dev, "assert-falling-edge");
> + device_property_read_bool(dev, "assert-falling-edge");
> return 0;
> }
>
> @@ -158,24 +152,26 @@ get_irqf_trigger_flags(const struct pps_gpio_device_data *data)
> static int pps_gpio_probe(struct platform_device *pdev)
> {
> struct pps_gpio_device_data *data;
> + struct device *dev = &pdev->dev;
> int ret;
> int pps_default_params;
>
> /* allocate space for device info */
> - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> if (!data)
> return -ENOMEM;
> - platform_set_drvdata(pdev, data);
> +
> + dev_set_drvdata(dev, data);
>
> /* GPIO setup */
> - ret = pps_gpio_setup(pdev);
> + ret = pps_gpio_setup(dev);
> if (ret)
> return -EINVAL;
>
> /* IRQ setup */
> ret = gpiod_to_irq(data->gpio_pin);
> if (ret < 0) {
> - dev_err(&pdev->dev, "failed to map GPIO to IRQ: %d\n", ret);
> + dev_err(dev, "failed to map GPIO to IRQ: %d\n", ret);
> return -EINVAL;
> }
> data->irq = ret;
> @@ -201,17 +197,17 @@ static int pps_gpio_probe(struct platform_device *pdev)
> pps_default_params |= PPS_CAPTURECLEAR | PPS_OFFSETCLEAR;
> data->pps = pps_register_source(&data->info, pps_default_params);
> if (IS_ERR(data->pps)) {
> - dev_err(&pdev->dev, "failed to register IRQ %d as PPS source\n",
> + dev_err(dev, "failed to register IRQ %d as PPS source\n",
> data->irq);
> return PTR_ERR(data->pps);
> }
>
> /* register IRQ interrupt handler */
> - ret = devm_request_irq(&pdev->dev, data->irq, pps_gpio_irq_handler,
> + ret = devm_request_irq(dev, data->irq, pps_gpio_irq_handler,
> get_irqf_trigger_flags(data), data->info.name, data);
> if (ret) {
> pps_unregister_source(data->pps);
> - dev_err(&pdev->dev, "failed to acquire IRQ %d\n", data->irq);
> + dev_err(dev, "failed to acquire IRQ %d\n", data->irq);
> return -EINVAL;
> }
>
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup()
2021-03-09 11:24 ` [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup() Andy Shevchenko
@ 2021-03-09 12:30 ` Rodolfo Giometti
0 siblings, 0 replies; 15+ messages in thread
From: Rodolfo Giometti @ 2021-03-09 12:30 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Ryan Govostes, Greg Kroah-Hartman
On 09/03/21 12:24, Andy Shevchenko wrote:
> Rearrange optional stuff in pps_gpio_setup() so it will go after mandatory one
> and with reduced indentation. This will increase readability of the sources.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 33 ++++++++++++++++++---------------
> 1 file changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index b097da5a659a..35799e6401c9 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -110,28 +110,31 @@ static int pps_gpio_setup(struct device *dev)
> return dev_err_probe(dev, PTR_ERR(data->gpio_pin),
> "failed to request PPS GPIO\n");
>
> + data->assert_falling_edge =
> + device_property_read_bool(dev, "assert-falling-edge");
> +
> data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
> if (IS_ERR(data->echo_pin))
> return dev_err_probe(dev, PTR_ERR(data->echo_pin),
> "failed to request ECHO GPIO\n");
>
> - if (data->echo_pin) {
> - ret = device_property_read_u32(dev, "echo-active-ms", &value);
> - if (ret) {
> - dev_err(dev, "failed to get echo-active-ms from FW\n");
> - return ret;
> - }
> - data->echo_active_ms = value;
> - /* sanity check on echo_active_ms */
> - if (!data->echo_active_ms || data->echo_active_ms > 999) {
> - dev_err(dev, "echo-active-ms: %u - bad value from FW\n",
> - data->echo_active_ms);
> - return -EINVAL;
> - }
> + if (!data->echo_pin)
> + return 0;
> +
> + ret = device_property_read_u32(dev, "echo-active-ms", &value);
> + if (ret) {
> + dev_err(dev, "failed to get echo-active-ms from FW\n");
> + return ret;
> }
>
> - data->assert_falling_edge =
> - device_property_read_bool(dev, "assert-falling-edge");
> + /* sanity check on echo_active_ms */
> + if (!value || value > 999) {
> + dev_err(dev, "echo-active-ms: %u - bad value from FW\n", value);
> + return -EINVAL;
> + }
> +
> + data->echo_active_ms = value;
> +
> return 0;
> }
>
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
` (6 preceding siblings ...)
2021-03-09 12:23 ` [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Rodolfo Giometti
@ 2021-03-15 12:34 ` Andy Shevchenko
7 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-03-15 12:34 UTC (permalink / raw)
To: linux-kernel; +Cc: Rodolfo Giometti, Ryan Govostes, Greg Kroah-Hartman
On Tue, Mar 09, 2021 at 01:23:57PM +0200, Andy Shevchenko wrote:
> When requesting optional GPIO echo line, bail out on error,
> so user will know that something wrong with the existing property.
Greg, can you apply this series?
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pps/clients/pps-gpio.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index e0de1df2ede0..f89c31aa66f1 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -119,12 +119,12 @@ static int pps_gpio_setup(struct platform_device *pdev)
> data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
> "echo",
> GPIOD_OUT_LOW);
> - if (data->echo_pin) {
> - if (IS_ERR(data->echo_pin)) {
> - dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
> - return PTR_ERR(data->echo_pin);
> - }
> + if (IS_ERR(data->echo_pin)) {
> + dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
> + return PTR_ERR(data->echo_pin);
> + }
>
> + if (data->echo_pin) {
> ret = of_property_read_u32(np,
> "echo-active-ms",
> &value);
> --
> 2.30.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-03-15 12:35 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 11:23 [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Andy Shevchenko
2021-03-09 11:23 ` [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise Andy Shevchenko
2021-03-09 12:25 ` Rodolfo Giometti
2021-03-09 11:23 ` [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove() Andy Shevchenko
2021-03-09 12:25 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data Andy Shevchenko
2021-03-09 12:25 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties Andy Shevchenko
2021-03-09 12:27 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly Andy Shevchenko
2021-03-09 12:30 ` Rodolfo Giometti
2021-03-09 11:24 ` [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup() Andy Shevchenko
2021-03-09 12:30 ` Rodolfo Giometti
2021-03-09 12:23 ` [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line Rodolfo Giometti
2021-03-15 12:34 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.