Linux Documentation
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Cosmo Chou <chou.cosmo@gmail.com>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, jdelvare@suse.com, corbet@lwn.net,
	broonie@kernel.org, naresh.solanki@9elements.com,
	vincent@vtremblay.dev, patrick.rudolph@9elements.com,
	luca.ceresoli@bootlin.com, bhelgaas@google.com, festevam@denx.de,
	alexander.stein@ew.tq-group.com, heiko@sntech.de,
	jernej.skrabec@gmail.com, macromorgan@hotmail.com,
	forbidden405@foxmail.com, sre@kernel.org,
	linus.walleij@linaro.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, cosmo.chou@quantatw.com
Subject: Re: [PATCH v5 1/1] hwmon: Add driver for Astera Labs PT5161L retimer
Date: Tue, 6 Feb 2024 08:33:43 +0100	[thread overview]
Message-ID: <027fddd4-d572-4f9f-bf7a-1980c73017fa@linaro.org> (raw)
In-Reply-To: <b932533c-d1fe-46bb-8187-b0560861e982@roeck-us.net>

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@gmail.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


  reply	other threads:[~2024-02-06  7:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 15:20 [PATCH v5 0/1] hwmon: Add driver for Astera Labs PT5161L retimer Cosmo Chou
2024-02-05 15:20 ` [PATCH v5 1/1] " Cosmo Chou
2024-02-05 15:26   ` Krzysztof Kozlowski
2024-02-05 16:15     ` Guenter Roeck
2024-02-06  7:33       ` Krzysztof Kozlowski [this message]
2024-02-06 15:19         ` Guenter Roeck
2024-02-05 19:43   ` Guenter Roeck
2024-02-06  3:05     ` Cosmo Chou
2024-02-06  3:26       ` Guenter Roeck
2024-02-06  3:53         ` Cosmo Chou
2024-02-06  4:02           ` Guenter Roeck
2024-02-06  4:16             ` Cosmo Chou

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=027fddd4-d572-4f9f-bf7a-1980c73017fa@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=bhelgaas@google.com \
    --cc=broonie@kernel.org \
    --cc=chou.cosmo@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=cosmo.chou@quantatw.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@denx.de \
    --cc=forbidden405@foxmail.com \
    --cc=heiko@sntech.de \
    --cc=jdelvare@suse.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=luca.ceresoli@bootlin.com \
    --cc=macromorgan@hotmail.com \
    --cc=naresh.solanki@9elements.com \
    --cc=patrick.rudolph@9elements.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=vincent@vtremblay.dev \
    /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