[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <027fddd4-d572-4f9f-bf7a-1980c73017fa@linaro.org>
Date: Tue, 6 Feb 2024 08:33:43 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Cosmo Chou <chou.cosmo@...il.com>, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org, jdelvare@...e.com,
corbet@....net, broonie@...nel.org, naresh.solanki@...ements.com,
vincent@...emblay.dev, patrick.rudolph@...ements.com,
luca.ceresoli@...tlin.com, bhelgaas@...gle.com, festevam@...x.de,
alexander.stein@...tq-group.com, heiko@...ech.de, jernej.skrabec@...il.com,
macromorgan@...mail.com, forbidden405@...mail.com, sre@...nel.org,
linus.walleij@...aro.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-doc@...r.kernel.org, cosmo.chou@...ntatw.com
Subject: Re: [PATCH v5 1/1] hwmon: Add driver for Astera Labs PT5161L retimer
On 05/02/2024 17:15, Guenter Roeck wrote:
> On Mon, Feb 05, 2024 at 04:26:08PM +0100, Krzysztof Kozlowski wrote:
>> On 05/02/2024 16:20, Cosmo Chou wrote:
>>> This driver implements support for temperature monitoring of Astera Labs
>>> PT5161L series PCIe retimer chips.
>>>
>>> This driver implementation originates from the CSDK available at
>>> Link: https://github.com/facebook/openbmc/tree/helium/common/recipes-lib/retimer-v2.14
>>> The communication protocol utilized is based on the I2C/SMBus standard.
>>>
>>> Signed-off-by: Cosmo Chou <chou.cosmo@...il.com>
>>> ---
> [ ... ]
>
>>> +
>>> +static int __init pt5161l_init(void)
>>> +{
>>> + pt5161l_debugfs_dir = debugfs_create_dir("pt5161l", NULL);
>>
>> Drivers don't need initcalls. For sure any debugfs should not be handled
>> here but in probe.
>>
>
> Lots of hwmon drivers have init functions, for basic chip detection of
> Super-I/O chips (example: drivers/hwmon/nct6775-platform.c) and to create
> a parent debugfs subdirectory for the driver. The probe function then adds
> subdirecties per chip instantiation. Example for pmbus, in
> drivers/hwmon/pmbus/pmbus_core.c:
Core bus components are a bit different...
>
> static int __init pmbus_core_init(void)
> {
> pmbus_debugfs_dir = debugfs_create_dir("pmbus", NULL);
> if (IS_ERR(pmbus_debugfs_dir))
> pmbus_debugfs_dir = NULL;
>
> return 0;
> }
>
> static void __exit pmbus_core_exit(void)
> {
> debugfs_remove_recursive(pmbus_debugfs_dir);
> }
>
> Are you saying this is all wrong ? What alternative would you suggest ?
Just create parent directory in probe and only keep remove in __exit.
But you are right that might not be much better approach.
Best regards,
Krzysztof
Powered by blists - more mailing lists