All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Armin Wolf <W_Armin@gmx.de>, rafael@kernel.org
Cc: markgross@kernel.org, lenb@kernel.org, hmh@hmh.eng.br,
	matan@svgalib.org, corentin.chary@gmail.com, jeremy@system76.com,
	productdev@system76.com, mario.limonciello@amd.com,
	pobrn@protonmail.com, coproscefalo@gmail.com,
	platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@intel.com>
Subject: Re: [PATCH v2 2/2] platform/x86: dell: Add new dell-wmi-ddv driver
Date: Fri, 21 Oct 2022 11:58:32 +0200	[thread overview]
Message-ID: <ca8222fe-4b15-eb1f-46be-2e8288ea1cd1@redhat.com> (raw)
In-Reply-To: <11964cd1-94b5-dc6a-a6c9-7fd5fe335ed4@gmx.de>

Hi Armin, Rafael,

On 10/21/22 11:34, Armin Wolf wrote:
> Am 29.09.22 um 15:12 schrieb Hans de Goede:
> 
>> Hi,
>>
>> On 9/29/22 11:50, Andy Shevchenko wrote:
>>> On Wed, Sep 28, 2022 at 10:57:16PM +0200, Armin Wolf wrote:
>>>> Am 28.09.22 um 12:47 schrieb Andy Shevchenko:
>>>>> On Tue, Sep 27, 2022 at 10:45:21PM +0200, Armin Wolf wrote:
>>> ...
>>>
>>>>>> +static void dell_wmi_ddv_debugfs_init(struct wmi_device *wdev)
>>>>> Strictly speaking this should return int (see below).
>>>>>
>>>>>> +{
>>>>>> +    struct dentry *entry;
>>>>>> +    char name[64];
>>>>>> +Fujitsu Academy
>>>>>>
>>>>>> +    scnprintf(name, ARRAY_SIZE(name), "%s-%s", DRIVER_NAME, dev_name(&wdev->dev));
>>>>>> +    entry = debugfs_create_dir(name, NULL);
>>>>>> +
>>>>>> +    debugfs_create_devm_seqfile(&wdev->dev, "fan_sensor_information", entry,
>>>>>> +                    dell_wmi_ddv_fan_read);
>>>>>> +    debugfs_create_devm_seqfile(&wdev->dev, "thermal_sensor_information", entry,
>>>>>> +                    dell_wmi_ddv_temp_read);
>>>>>> +
>>>>>> +    devm_add_action_or_reset(&wdev->dev, dell_wmi_ddv_debugfs_remove, entry);
>>>>> return devm...
>>>>>
>>>>> This is not related to debugfs and there is no rule to avoid checking error
>>>>> codes from devm_add_action_or_reset().
>>>>>
>>>> According to the documentation of debugfs_create_dir(), drivers should work fine if debugfs
>>>> initialization fails. Thus the the return value of dell_wmi_ddv_debugfs_init() would be ignored
>>>> when called, which means that returning an error would serve no purpose.
>>>> Additionally, devm_add_action_or_reset() automatically executes the cleanup function if devres
>>>> registration fails, so we do not have to care about that.
>>> The problem with your code that if devm_ call fails and you ain't stop probing
>>> the remove-insert module (or unbind-bind) cycle will fail, because of existing
>>> (leaked) debugfs dentries.
>> No it won't if the devm_ call fails then it will directly call
>> the passed in handler so in this case we can simply continue
>> without debugfs entries (which will have been removed by the
>> handler). The directly calling of the action handler on
>> failure is the whole difference between devm_add_action()
>> and devm_add_action_or_reset()
>>
>> So using it this way in the case of a debugfs init function
>> is fine.
>>
>>>>>> +        .name = DRIVER_NAME,
>>>>> I would use explicit literal since this is a (semi-) ABI, and having it as
>>>>> a define feels not fully right.
>>>> The driver name is used in two places (init and debugfs), so having a define for it
>>>> avoids problems in case someone forgets to change both.
>>> Which is exactly what we must prevent developer to do. If changing debugfs it
>>> mustn't change the driver name, because the latter is ABI, while the former is
>>> not.
>> Arguably both are not really ABI. Drivers have been renamed in the past
>> without issues for userspace.
>>
>> Regards,
>>
>> Hans
>>
> What is the current status of this patch set?

I indicated to Rafael (ACPI subsys maintainer) that I consider this ready
for merging and tried to coordinate this with Rafael, but that email
seems to have fallen through the cracks, likely due to it being pretty
close to the 6.1 merge window. So lets try again:

Rafael, from my pov this patch-set is ready for merging, since 2/2 depends
on "[PATCH v2 1/2] ACPI: battery: Pass battery hook pointer to hook callbacks"
we need to coordinate this.

Since even patch 1/2 mostly touches files under drivers/platform/x86 I would
prefer to merge this through the pdx86 tree, may I have your ack for this ?

> If necessary, i can submit an v3 patch set which includes the
> patch regarding the minor style fixes. I also tested the driver on my Dell Insprion 3505 for some time, so
> i can proof it works.

I can squash the follow up patch into 2/2 when merging this myself. From
my pov no action is needed from you on this at this moment on time. But
it is good that you send a friendly ping about this :)

Regards,

Hans




  reply	other threads:[~2022-10-21  9:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 20:45 [PATCH v2 0/2] platform/x86: dell: Add new dell-wmi-ddv driver Armin Wolf
2022-09-27 20:45 ` [PATCH v2 1/2] ACPI: battery: Pass battery hook pointer to hook callbacks Armin Wolf
2022-10-24 13:19   ` Rafael J. Wysocki
2022-10-24 13:47   ` Hans de Goede
2022-09-27 20:45 ` [PATCH v2 2/2] platform/x86: dell: Add new dell-wmi-ddv driver Armin Wolf
2022-09-28 10:47   ` Andy Shevchenko
2022-09-28 11:33     ` Hans de Goede
2022-09-28 14:16       ` Andy Shevchenko
2022-09-28 20:57     ` Armin Wolf
2022-09-29  9:50       ` Andy Shevchenko
2022-09-29 13:12         ` Hans de Goede
2022-10-21  9:34           ` Armin Wolf
2022-10-21  9:58             ` Hans de Goede [this message]
2022-09-29  9:51       ` Andy Shevchenko
2022-09-28  9:52 ` [PATCH v2 0/2] " Hans de Goede
2022-09-28 10:48   ` Andy Shevchenko
2022-09-28 11:37     ` Hans de Goede

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=ca8222fe-4b15-eb1f-46be-2e8288ea1cd1@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=W_Armin@gmx.de \
    --cc=andriy.shevchenko@intel.com \
    --cc=coproscefalo@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=hmh@hmh.eng.br \
    --cc=jeremy@system76.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=markgross@kernel.org \
    --cc=matan@svgalib.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    --cc=productdev@system76.com \
    --cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.