On Mon, Jul 11, 2022 at 7:35 PM Bartosz Golaszewski brgl@bgdev.pl wrote:
The chip_name configs attribute always displays the device name of the first GPIO bank because the logic of the relevant function is simply wrong.
Fix it by correctly comparing the bank's swnode against the GPIO device's children.
Fixes: cb8c474e79be ("gpio: sim: new testing module") Cc: stable@vger.kernel.org Reported-by: Kent Gibson warthog618@gmail.com Signed-off-by: Bartosz Golaszewski brgl@bgdev.pl
...
struct gpio_sim_chip_name_ctx {
struct gpio_sim_device *dev;
struct fwnode_handle *swnode;
I would call it fwnode even if we know the backend provider.
char *page;
};
...
struct fwnode_handle *swnode;
Do you still need this? See below.
...
swnode = dev_fwnode(dev);
if (swnode == ctx->swnode)
return sprintf(ctx->page, "%s\n", dev_name(dev));
So, now it can be
if (device_match_fwnode(dev, ctx->fwnode)) return sprintf(...);