Skip to content

Commit 2eccaca

Browse files
committed
Merge tag 'gpio-fixes-for-v5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fix from Bartosz Golaszewski: - fix a configfs attribute of the gpio-sim module * tag 'gpio-fixes-for-v5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: sim: fix the chip_name configfs item
2 parents 8ad4b6f + 7329b07 commit 2eccaca

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/gpio/gpio-sim.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -991,36 +991,30 @@ static struct configfs_attribute *gpio_sim_device_config_attrs[] = {
991991
};
992992

993993
struct gpio_sim_chip_name_ctx {
994-
struct gpio_sim_device *dev;
994+
struct fwnode_handle *swnode;
995995
char *page;
996996
};
997997

998998
static int gpio_sim_emit_chip_name(struct device *dev, void *data)
999999
{
10001000
struct gpio_sim_chip_name_ctx *ctx = data;
1001-
struct fwnode_handle *swnode;
1002-
struct gpio_sim_bank *bank;
10031001

10041002
/* This would be the sysfs device exported in /sys/class/gpio. */
10051003
if (dev->class)
10061004
return 0;
10071005

1008-
swnode = dev_fwnode(dev);
1006+
if (device_match_fwnode(dev, ctx->swnode))
1007+
return sprintf(ctx->page, "%s\n", dev_name(dev));
10091008

1010-
list_for_each_entry(bank, &ctx->dev->bank_list, siblings) {
1011-
if (bank->swnode == swnode)
1012-
return sprintf(ctx->page, "%s\n", dev_name(dev));
1013-
}
1014-
1015-
return -ENODATA;
1009+
return 0;
10161010
}
10171011

10181012
static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *item,
10191013
char *page)
10201014
{
10211015
struct gpio_sim_bank *bank = to_gpio_sim_bank(item);
10221016
struct gpio_sim_device *dev = gpio_sim_bank_get_device(bank);
1023-
struct gpio_sim_chip_name_ctx ctx = { dev, page };
1017+
struct gpio_sim_chip_name_ctx ctx = { bank->swnode, page };
10241018
int ret;
10251019

10261020
mutex_lock(&dev->lock);

0 commit comments

Comments
 (0)