mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Pali Rohár" <pali@kernel.org>
Cc: Biancaa Ramesh <biancaa2210329@ssn.edu.in>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] hwmon: migrate i8k procfs interface to sysfs
Date: Wed, 22 Oct 2025 12:00:14 -0700	[thread overview]
Message-ID: <c4605534-e715-4d39-9361-6e95bc03ba30@roeck-us.net> (raw)
In-Reply-To: <20251022184518.53tqi33jgustwvf5@pali>

On Wed, Oct 22, 2025 at 08:45:18PM +0200, Pali Rohár wrote:
> Sorry, but I do not understand this patch. dell-smm-hwmon driver is
> already using the sysfs interface provided by hwmon subsystem.
> 
It is also weirdly incomplete, and it claims to be "confidential and
intended for the named recipient(s) only". Git says it is corrupted,
and it doesn't look like a real patch.

> > --- a/drivers/hwmon/dell-smm-hwmon.c
> > +++ b/drivers/hwmon/dell-smm-hwmon.c
> > @@ -XXX,40 +XXX,80 @@
> > -// Remove procfs interface

I'll take the patch author by their word:

" If you have received this email in error please delete it and
  notify the sender immediately.
"

To the author: Please consider yourself notified, and I will delete the
patch as directed.

Guenter

> On Thursday 23 October 2025 00:07:46 Biancaa Ramesh wrote:
> > The i8k driver currently exposes Dell laptop hardware monitoring
> > information via a deprecated /proc/i8k interface.
> > 
> > This patch removes the procfs file creation and replaces it with
> > standard sysfs attributes under the hwmon subsystem.
> > 
> > - Removes i8k procfs registration and operations.
> > - Creates sysfs attributes for temperature, fan speeds, and power status.
> > - Registers these attributes via devm_hwmon_device_register_with_groups().
> > - Cleans up legacy procfs code for a cleaner, modern, and supported interface.
> > 
> > This migration aligns with Linux kernel best practices to phase out
> > deprecated and legacy procfs files in favor of a structured sysfs approach.
> > 
> > Signed-off-by: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
> > ---
> >  drivers/hwmon/dell-smm-hwmon.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 100 insertions(+), 40 deletions(-)
> > 
> > diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
> > index oldhash..newhash 100644
> > --- a/drivers/hwmon/dell-smm-hwmon.c
> > +++ b/drivers/hwmon/dell-smm-hwmon.c
> > @@ -XXX,40 +XXX,80 @@
> > -// Remove procfs interface
> > -static int i8k_proc_show(struct seq_file *seq, void *offset)
> > -{
> > -    struct dell_smm_data *data = seq->private;
> > -    // ...
> > -}
> > -
> > -static const struct proc_ops i8k_proc_ops = {
> > -    .proc_open = i8k_open_fs,
> > -    .proc_read = seq_read,
> > -    .proc_lseek = seq_lseek,
> > -    .proc_release = single_release,
> > -    .proc_ioctl = i8k_ioctl,
> > -};
> > -
> > -static void i8k_exit_procfs(void *param)
> > -{
> > -    remove_proc_entry("i8k", NULL);
> > -}
> > -
> > -static void __init i8k_init_procfs(struct device *dev)
> > -{
> > -    struct dell_smm_data *data = dev_get_drvdata(dev);
> > -    // ...
> > -    if (proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data))
> > -        devm_add_action_or_reset(dev, i8k_exit_procfs, NULL);
> > -}
> > +// Define sysfs attributes for temps and fans
> > +static ssize_t temp1_input_show(struct device *dev, struct device_attribute *attr, char *buf)
> > +{
> > +    struct dell_smm_data *data = dev_get_drvdata(dev);
> > +    int temp = i8k_get_temp(data, 0);
> > +    if (temp < 0)
> > +        return temp;
> > +    return sprintf(buf, "%d\n", temp * 1000);
> > +}
> > +
> > +static DEVICE_ATTR_RO(temp1_input);
> > +
> > +static ssize_t fan1_input_show(struct device *dev, struct device_attribute *attr, char *buf)
> > +{
> > +    struct dell_smm_data *data = dev_get_drvdata(dev);
> > +    int speed = i8k_get_fan_speed(data, 0);
> > +    if (speed < 0)
> > +        return speed;
> > +    return sprintf(buf, "%d\n", speed);
> > +}
> > +
> > +static DEVICE_ATTR_RO(fan1_input);
> > +
> > +static struct attribute *dell_smm_attrs[] = {
> > +    &dev_attr_temp1_input.attr,
> > +    &dev_attr_fan1_input.attr,
> > +    NULL,
> > +};
> > +
> > +static const struct attribute_group dell_smm_group = {
> > +    .attrs = dell_smm_attrs,
> > +};
> > +
> > +static const struct attribute_group *dell_smm_groups[] = {
> > +    &dell_smm_group,
> > +    NULL,
> > +};
> > +
> > +static int dell_smm_init_cdev(struct device *dev)
> > +{
> > +    struct dell_smm_data *data = dev_get_drvdata(dev);
> > +    struct device *hwmon_dev;
> > +
> > +    hwmon_dev = devm_hwmon_device_register_with_groups(dev, "dell_smm", data, dell_smm_groups);
> > +    return PTR_ERR_OR_ZERO(hwmon_dev);
> > +}
> > +
> > +static int __init dell_smm_probe(struct platform_device *pdev)
> > +{
> > +    int ret;
> > +
> > +    ret = dell_smm_init_data(&pdev->dev, &i8k_smm_ops);
> > +    if (ret < 0)
> > +        return ret;
> > +
> > +    ret = dell_smm_init_hwmon(&pdev->dev);
> > +    if (ret)
> > +        return ret;
> > +
> > +    ret = dell_smm_init_cdev(&pdev->dev);
> > +    if (ret)
> > +        return ret;
> > +
> > +    return 0;
> > +}
> > 
> > -- 
> > ::DISCLAIMER::
> > 
> > ---------------------------------------------------------------------
> > The 
> > contents of this e-mail and any attachment(s) are confidential and
> > intended 
> > for the named recipient(s) only. Views or opinions, if any,
> > presented in 
> > this email are solely those of the author and may not
> > necessarily reflect 
> > the views or opinions of SSN Institutions (SSN) or its
> > affiliates. Any form 
> > of reproduction, dissemination, copying, disclosure,
> > modification, 
> > distribution and / or publication of this message without the
> > prior written 
> > consent of authorized representative of SSN is strictly
> > prohibited. If you 
> > have received this email in error please delete it and
> > notify the sender 
> > immediately.
> > ---------------------------------------------------------------------
> > Header of this mail should have a valid DKIM signature for the domain 
> > ssn.edu.in <http://www.ssn.edu.in/>

      reply	other threads:[~2025-10-22 19:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 18:37 Biancaa Ramesh
2025-10-22 18:45 ` Pali Rohár
2025-10-22 19:00   ` Guenter Roeck [this message]

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=c4605534-e715-4d39-9361-6e95bc03ba30@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=biancaa2210329@ssn.edu.in \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali@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

all inboxes | Powered by JetHome®