From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Linus Walleij" <linus.walleij@linaro.org>,
platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 5/8] platform/x86: x86-android-tablets: Create a platform_device from module_init()
Date: Sun, 10 Sep 2023 13:19:59 +0200 [thread overview]
Message-ID: <32206240-a06a-2c4f-c520-4243ad9ddca5@redhat.com> (raw)
In-Reply-To: <CAHp75Vf0HC-PUZWLniUPZSYVbeVW33sT9yOQxgeftXi+GmQppw@mail.gmail.com>
Hi,
On 9/10/23 10:07, Andy Shevchenko wrote:
> On Sat, Sep 9, 2023 at 5:18 PM Hans de Goede <hdegoede@redhat.com> 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?
Yes I added this to protect 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?
No this will not be harmful, x86_android_tablet_probe() also
checks the DMI table and it will return -ENODEV when there is
no match.
So we just end up with an unused x86_android_tablets platform-device
and otherwise no harm is done.
I guess my main reason here is to not change manual loading
behavior, before the entire insmod would fail since
module_init() would return -ENODEV, this preserves this
behavior.
But you are right that this check can be dropped without
any bad side-effects.
I'll drop the check before merging this.
>
>> + 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.
Ack, I'll fix this before merging this.
Regards,
Hans
>
>> module_init(x86_android_tablet_init);
>> -module_exit(x86_android_tablet_cleanup);
>> +module_exit(x86_android_tablet_exit);
>
next prev parent reply other threads:[~2023-09-10 11:20 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-09 14:18 [PATCH 0/8] x86-android-tablets: Stop using gpiolib private APIs Hans de Goede
2023-09-09 14:18 ` [PATCH 1/8] gpiolib: acpi: Check if a GPIO is listed in ignore_interrupt earlier Hans de Goede
2023-09-10 7:51 ` Andy Shevchenko
2023-09-11 5:24 ` Mika Westerberg
2023-09-11 9:50 ` Bartosz Golaszewski
2023-09-09 14:18 ` [PATCH 2/8] gpiolib: acpi: Add a ignore interrupt quirk for Peaq C1010 Hans de Goede
2023-09-10 7:53 ` Andy Shevchenko
2023-09-11 5:24 ` Mika Westerberg
2023-09-11 9:51 ` Bartosz Golaszewski
2023-09-09 14:18 ` [PATCH 3/8] platform/x86: x86-android-tablets: Remove invalid_aei_gpiochip from " Hans de Goede
2023-09-11 9:52 ` Bartosz Golaszewski
2023-09-09 14:18 ` [PATCH 4/8] platform/x86: x86-android-tablets: Remove invalid_aei_gpiochip support Hans de Goede
2023-09-10 7:56 ` Andy Shevchenko
2023-09-10 7:57 ` Andy Shevchenko
2023-09-09 14:18 ` [PATCH 5/8] platform/x86: x86-android-tablets: Create a platform_device from module_init() Hans de Goede
2023-09-10 8:07 ` Andy Shevchenko
2023-09-10 11:19 ` Hans de Goede [this message]
2023-09-09 14:18 ` [PATCH 6/8] platform/x86: x86-android-tablets: Stop using gpiolib private APIs Hans de Goede
2023-09-10 8:24 ` Andy Shevchenko
2023-09-10 11:26 ` Hans de Goede
2023-09-11 12:49 ` Bartosz Golaszewski
2023-09-11 12:56 ` Andy Shevchenko
2023-09-11 12:59 ` Hans de Goede
2023-09-11 12:59 ` Bartosz Golaszewski
2023-09-10 11:28 ` Hans de Goede
2023-09-11 12:50 ` Bartosz Golaszewski
2023-09-11 13:07 ` Hans de Goede
2023-09-11 13:18 ` Bartosz Golaszewski
2023-09-11 13:32 ` Hans de Goede
2023-09-11 13:37 ` Bartosz Golaszewski
2023-09-11 13:53 ` Hans de Goede
2023-09-11 14:04 ` Bartosz Golaszewski
2023-09-11 14:12 ` Hans de Goede
2023-09-11 15:36 ` Andy Shevchenko
2023-09-11 16:03 ` Bartosz Golaszewski
2023-09-09 14:18 ` [PATCH 7/8] platform/x86: x86-android-tablets: Use platform-device as gpio-keys parent Hans de Goede
2023-09-09 14:18 ` [PATCH 8/8] platform/x86: x86-android-tablets: Drop "linux,power-supply-name" from lenovo_yt3_bq25892_0_props[] Hans de Goede
2023-09-11 8:18 ` [PATCH 0/8] x86-android-tablets: Stop using gpiolib private APIs Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32206240-a06a-2c4f-c520-4243ad9ddca5@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=brgl@bgdev.pl \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox