Re: [PATCH] drivers\gpio: use kobj_to_dev

From: Bartosz Golaszewski
Date: Mon Jun 15 2020 - 04:08:26 EST


pt., 12 cze 2020 o 10:05 Wang Qing <wangqing@xxxxxxxx> napisaÅ(a):
>
> Use kobj_to_dev() API instead of container_of().
>
> Signed-off-by: Wang Qing <wangqing@xxxxxxxx>
> ---
> drivers/gpio/gpiolib-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> mode change 100644 => 100755 drivers/gpio/gpiolib-sysfs.c
>
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index 23e3d33..82371fe
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -365,7 +365,7 @@ static DEVICE_ATTR_RW(active_low);
> static umode_t gpio_is_visible(struct kobject *kobj, struct attribute *attr,
> int n)
> {
> - struct device *dev = container_of(kobj, struct device, kobj);
> + struct device *dev = kobj_to_dev(kobj);
> struct gpiod_data *data = dev_get_drvdata(dev);
> struct gpio_desc *desc = data->desc;
> umode_t mode = attr->mode;
> --
> 2.7.4
>

Patch applied, thanks!

Bartosz