All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org
Cc: Rodolfo Giometti <giometti@enneenne.com>,
	Ryan Govostes <rgovostes@whoi.edu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties
Date: Tue,  9 Mar 2021 13:24:01 +0200	[thread overview]
Message-ID: <20210309112403.36633-5-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20210309112403.36633-1-andriy.shevchenko@linux.intel.com>

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


  parent reply	other threads:[~2021-03-09 11:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Andy Shevchenko [this message]
2021-03-09 12:27   ` [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210309112403.36633-5-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=giometti@enneenne.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgovostes@whoi.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.