Re: [PATCH 08/19] platform/x86: lenovo-yogabook: Add dev local variable to probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 29, 2023 at 9:16 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> Add a "struct device *dev" local variable to probe().
>
> This is a preparation patch for making lenovo-yogabook-wmi also work
> on the Android version of the Yoga Book 1 which does not have a WMI
> interface to deal with toggling the keyboard half between
> touch-keyboard and wacom-digitizer mode.

...

> -       data = devm_kzalloc(&wdev->dev, sizeof(struct yogabook_wmi), GFP_KERNEL);
> +       data = devm_kzalloc(dev, sizeof(struct yogabook_wmi), GFP_KERNEL);
>         if (data == NULL)
>                 return -ENOMEM;

> -       dev_set_drvdata(&wdev->dev, data);
> +       dev_set_drvdata(dev, data);

For robustness' sake I would at the same time move this a bit down to
have (some? at least dev seems to be important) fields in data to be
initialized. Yes, this won't change anything, I hope.

> -       data->dev = &wdev->dev;
> +       data->dev = dev;
>         data->brightness = YB_KBD_BL_DEFAULT;
>         set_bit(YB_KBD_IS_ON, &data->flags);
>         set_bit(YB_DIGITIZER_IS_ON, &data->flags);

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux