gpio fixes for v5.19-rc7

- fix a configfs attribute of the gpio-sim module
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmLTuvwACgkQEacuoBRx
 13LOOA//bBuEfWc2SuG1zJQvybJThAkbrjjm6pq/4sRxzDiP2WJJgrA/Q/+NyvP4
 8NXOMV8BXSmrVKw3ORmAUj0PvpPqIKAW6QByNr3SQLI7YtU3QzYSA3HNj1LbuFjd
 5J0hz41U57tvL5LdR3f4nMpGA+1Qwk8EcOLeM+gHry1vjzQDSmWG9DR92FtrJpXw
 t40Vw0dUjHjXIVNRmCe3rR2dDjcLah1VM3OuNGAvdXKCMsD6V0ofVCkIVJq/aLiM
 7Kn6c72WuObyKBiPIgyMyEDLvwLO6DPAg4CG/sfjQOf87PzqqdPfFzdwzbDnKQAA
 CzIQRqcSr8wKPB14b4KWiAc19SSWl+/usw8uRjj5SgBdsmdfUEb8DjsU8t+ibEQz
 S43V3K9jimA3tddOeqYkThCnG5vwi1N3gKzdBPes+RSS8W2Z4Ag2QsqWaPyNAO51
 CXZk6zjgbS9qgPJ69XkircPMdVnylcbpbTypLFiQ6aiCpEYi7E9TEUdhfLE6oiVo
 XlASbrRt5ecMXwOLgy4T+2SZPWGMlvAab2rBb+RgS7GWHVuV8hbbgApSTZ4fCQre
 O7oTgk80TWwhbF1tY90MRqZwtrrxLIU0E95Pqzgk0h6boo458pq58dWSEGQTQyF+
 6E0Ch78izCJIObKfgMR/Ufil3PrM8qP8D/IrWcv3tUvTszWkOLI=
 =qZDQ
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-07-17 07:58:19 -07:00
commit 2eccaca7b6
1 changed files with 5 additions and 11 deletions

View File

@ -991,28 +991,22 @@ static struct configfs_attribute *gpio_sim_device_config_attrs[] = {
};
struct gpio_sim_chip_name_ctx {
struct gpio_sim_device *dev;
struct fwnode_handle *swnode;
char *page;
};
static int gpio_sim_emit_chip_name(struct device *dev, void *data)
{
struct gpio_sim_chip_name_ctx *ctx = data;
struct fwnode_handle *swnode;
struct gpio_sim_bank *bank;
/* This would be the sysfs device exported in /sys/class/gpio. */
if (dev->class)
return 0;
swnode = dev_fwnode(dev);
if (device_match_fwnode(dev, ctx->swnode))
return sprintf(ctx->page, "%s\n", dev_name(dev));
list_for_each_entry(bank, &ctx->dev->bank_list, siblings) {
if (bank->swnode == swnode)
return sprintf(ctx->page, "%s\n", dev_name(dev));
}
return -ENODATA;
return 0;
}
static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *item,
@ -1020,7 +1014,7 @@ static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *item,
{
struct gpio_sim_bank *bank = to_gpio_sim_bank(item);
struct gpio_sim_device *dev = gpio_sim_bank_get_device(bank);
struct gpio_sim_chip_name_ctx ctx = { dev, page };
struct gpio_sim_chip_name_ctx ctx = { bank->swnode, page };
int ret;
mutex_lock(&dev->lock);