Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
Cc: linux@roeck-us.net, 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 20:45:18 +0200	[thread overview]
Message-ID: <20251022184518.53tqi33jgustwvf5@pali> (raw)
In-Reply-To: <20251022183746.66481-1-biancaa2210329@ssn.edu.in>

Sorry, but I do not understand this patch. dell-smm-hwmon driver is
already using the sysfs interface provided by hwmon subsystem.

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 18:45 UTC|newest]

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

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=20251022184518.53tqi33jgustwvf5@pali \
    --to=pali@kernel.org \
    --cc=biancaa2210329@ssn.edu.in \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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