summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib-swnode.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:57 +0000
commitdc50eab76b709d68175a358d6e23a5a3890764d3 (patch)
treec754d0390db060af0213ff994f0ac310e4cfd6e9 /drivers/gpio/gpiolib-swnode.c
parentAdding debian version 6.6.15-2. (diff)
downloadlinux-dc50eab76b709d68175a358d6e23a5a3890764d3.tar.xz
linux-dc50eab76b709d68175a358d6e23a5a3890764d3.zip
Merging upstream version 6.7.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/gpio/gpiolib-swnode.c')
-rw-r--r--drivers/gpio/gpiolib-swnode.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/gpio/gpiolib-swnode.c b/drivers/gpio/gpiolib-swnode.c
index b5a6eaf372..fa52bdb1a2 100644
--- a/drivers/gpio/gpiolib-swnode.c
+++ b/drivers/gpio/gpiolib-swnode.c
@@ -31,22 +31,17 @@ static void swnode_format_propname(const char *con_id, char *propname,
strscpy(propname, "gpios", max_size);
}
-static int swnode_gpiochip_match_name(struct gpio_chip *chip, void *data)
+static struct gpio_device *swnode_get_gpio_device(struct fwnode_handle *fwnode)
{
- return !strcmp(chip->label, data);
-}
-
-static struct gpio_chip *swnode_get_chip(struct fwnode_handle *fwnode)
-{
- const struct software_node *chip_node;
- struct gpio_chip *chip;
+ const struct software_node *gdev_node;
+ struct gpio_device *gdev;
- chip_node = to_software_node(fwnode);
- if (!chip_node || !chip_node->name)
+ gdev_node = to_software_node(fwnode);
+ if (!gdev_node || !gdev_node->name)
return ERR_PTR(-EINVAL);
- chip = gpiochip_find((void *)chip_node->name, swnode_gpiochip_match_name);
- return chip ?: ERR_PTR(-EPROBE_DEFER);
+ gdev = gpio_device_find_by_label(gdev_node->name);
+ return gdev ?: ERR_PTR(-EPROBE_DEFER);
}
struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
@@ -55,7 +50,6 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
{
const struct software_node *swnode;
struct fwnode_reference_args args;
- struct gpio_chip *chip;
struct gpio_desc *desc;
char propname[32]; /* 32 is max size of property name */
int error;
@@ -77,12 +71,17 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
return ERR_PTR(error);
}
- chip = swnode_get_chip(args.fwnode);
+ struct gpio_device *gdev __free(gpio_device_put) =
+ swnode_get_gpio_device(args.fwnode);
fwnode_handle_put(args.fwnode);
- if (IS_ERR(chip))
- return ERR_CAST(chip);
+ if (IS_ERR(gdev))
+ return ERR_CAST(gdev);
- desc = gpiochip_get_desc(chip, args.args[0]);
+ /*
+ * FIXME: The GPIO device reference is put at return but the descriptor
+ * is passed on. Find a proper solution.
+ */
+ desc = gpio_device_get_desc(gdev, args.args[0]);
*flags = args.args[1]; /* We expect native GPIO flags */
pr_debug("%s: parsed '%s' property of node '%pfwP[%d]' - status (%d)\n",