Re: [PATCH 5/8] platform/x86: x86-android-tablets: Create a platform_device from module_init()

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

 



On Sat, Sep 9, 2023 at 5:18 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> Create a platform_device from module_init() and change
> x86_android_tablet_init() / cleanup() into platform_device
> probe() and remove() functions.
>
> This is a preparation patch for refactoring x86_android_tablet_get_gpiod()
> to no longer use gpiolib private functions like gpiochip_find().

...

> +static int __init x86_android_tablet_init(void)
> +{

> +       if (!dmi_first_match(x86_android_tablet_ids)) {

Why do we need this? Module alias is based on DMI matching, is it
against manual loading?

> +               pr_err("error loaded on unknown tablet model\n");
> +               return -ENODEV;
> +       }
> +
> +       x86_android_tablet_device = platform_create_bundle(&x86_android_tablet_driver,
> +                                                  x86_android_tablet_probe,
> +                                                  NULL, 0, NULL, 0);

So, in case of manual loading, would it be harmful for non-listed platforms?

> +       return PTR_ERR_OR_ZERO(x86_android_tablet_device);
> +}
> +
> +static void __exit x86_android_tablet_exit(void)
> +{
> +       platform_device_unregister(x86_android_tablet_device);
> +       platform_driver_unregister(&x86_android_tablet_driver);
> +}

> +

Instead of adding this blank line you can move
module_init()/module_exit() closer to the respective callbacks.

>  module_init(x86_android_tablet_init);
> -module_exit(x86_android_tablet_cleanup);
> +module_exit(x86_android_tablet_exit);

-- 
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