[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <363c1fc1-5ed7-8a21-a627-58d1338c446f@roeck-us.net>
Date: Fri, 9 Jun 2023 07:37:08 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Joaquin Aramendia <samsagax@...il.com>
Cc: derekjohn.clark@...il.com, jdelvare@...e.com,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (oxp-sensors) Add tt_toggle attribute on supported
boards
On 6/9/23 05:50, Joaquin Aramendia wrote:
>> Why don't you just attach the attribute to the platform device as I
>> had suggested earlier ?
>
> You mean I should do something like this in probe():
>
> static int oxp_platform_probe(struct platform_device *pdev)
> {
> ...
>
> switch (board) {
> case aok_zoe_a1:
> case oxp_mini_amd_a07:
> case oxp_mini_amd_pro:
> pdev->dev.groups = oxp_ec_groups;
> }
> hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL,
> &oxp_ec_chip_info, NULL);
> ...
> }
>
> Would that work? Or even be correct?
No, that would not work, because the platform device already exists.
It would have to be added in the init function, or if done in the probe
function it would have to be added to the platform device with an
explicit call to devm_device_add_group().
Guenter
Powered by blists - more mailing lists