mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 03:01:41 +02:00
gpio: latch: use generic device properties
Replace calls to OF-specific interface with generic device property getters. This is good practice and also drops implicit run-time dependency on CONFIG_OF. Link: https://lore.kernel.org/r/20250211120847.42437-1-brgl@bgdev.pl Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
d50a7908df
commit
3150619d1a
|
|
@ -44,6 +44,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include "gpiolib.h"
|
||||
|
|
@ -138,9 +139,9 @@ static bool gpio_latch_can_sleep(struct gpio_latch_priv *priv, unsigned int n_la
|
|||
|
||||
static int gpio_latch_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct gpio_latch_priv *priv;
|
||||
unsigned int n_latches;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
|
|
@ -172,14 +173,16 @@ static int gpio_latch_probe(struct platform_device *pdev)
|
|||
spin_lock_init(&priv->spinlock);
|
||||
}
|
||||
|
||||
of_property_read_u32(np, "setup-duration-ns", &priv->setup_duration_ns);
|
||||
device_property_read_u32(dev, "setup-duration-ns",
|
||||
&priv->setup_duration_ns);
|
||||
if (priv->setup_duration_ns > DURATION_NS_MAX) {
|
||||
dev_warn(&pdev->dev, "setup-duration-ns too high, limit to %d\n",
|
||||
DURATION_NS_MAX);
|
||||
priv->setup_duration_ns = DURATION_NS_MAX;
|
||||
}
|
||||
|
||||
of_property_read_u32(np, "clock-duration-ns", &priv->clock_duration_ns);
|
||||
device_property_read_u32(dev, "clock-duration-ns",
|
||||
&priv->clock_duration_ns);
|
||||
if (priv->clock_duration_ns > DURATION_NS_MAX) {
|
||||
dev_warn(&pdev->dev, "clock-duration-ns too high, limit to %d\n",
|
||||
DURATION_NS_MAX);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user