lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdoqPOZz4GG6Sr2npZwjYHDVMo2pmNGqyBRrnen2j8k7g@mail.gmail.com>
Date:   Tue, 9 Aug 2022 11:27:15 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     "Luke D. Jones" <luke@...nes.dev>
Cc:     Hans de Goede <hdegoede@...hat.com>,
        Barnabás Pőcze <pobrn@...tonmail.com>,
        Pavel Machek <pavel@....cz>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 5/6] asus-wmi: Convert all attr-show to use sysfs_emit

On Tue, Aug 9, 2022 at 4:51 AM Luke D. Jones <luke@...nes.dev> wrote:
>
> This changes all *_show attributes in asus-wmi.c to use sysfs_emit()
> instead of the older method of writing to the output buffer manually.

This looks good to me,
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

(Carry the tag with a new version of the series in this patch)

Hans, I guess this one can be applied so it will be less of a burden
on reviewing the rest.

> Signed-off-by: Luke D. Jones <luke@...nes.dev>
> ---
>  drivers/platform/x86/asus-wmi.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 719223804c0e..78f1f3af1b12 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -942,7 +942,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device,
>                                                  struct device_attribute *attr,
>                                                  char *buf)
>  {
> -       return sprintf(buf, "%d\n", charge_end_threshold);
> +       return sysfs_emit(buf, "%d\n", charge_end_threshold);
>  }
>
>  static DEVICE_ATTR_RW(charge_control_end_threshold);
> @@ -2032,7 +2032,7 @@ static ssize_t pwm1_show(struct device *dev,
>                 value = -1;
>         }
>
> -       return sprintf(buf, "%d\n", value);
> +       return sysfs_emit(buf, "%d\n", value);
>  }
>
>  static ssize_t pwm1_store(struct device *dev,
> @@ -2092,7 +2092,7 @@ static ssize_t fan1_input_show(struct device *dev,
>                 return -ENXIO;
>         }
>
> -       return sprintf(buf, "%d\n", value < 0 ? -1 : value*100);
> +       return sysfs_emit(buf, "%d\n", value < 0 ? -1 : value * 100);
>  }
>
>  static ssize_t pwm1_enable_show(struct device *dev,
> @@ -2110,7 +2110,7 @@ static ssize_t pwm1_enable_show(struct device *dev,
>          * in practice on X532FL at least (the bit is always 0) and there's
>          * also nothing in the DSDT to indicate that this behaviour exists.
>          */
> -       return sprintf(buf, "%d\n", asus->fan_pwm_mode);
> +       return sysfs_emit(buf, "%d\n", asus->fan_pwm_mode);
>  }
>
>  static ssize_t pwm1_enable_store(struct device *dev,
> @@ -2178,7 +2178,7 @@ static ssize_t fan1_label_show(struct device *dev,
>                                           struct device_attribute *attr,
>                                           char *buf)
>  {
> -       return sprintf(buf, "%s\n", ASUS_FAN_DESC);
> +       return sysfs_emit(buf, "%s\n", ASUS_FAN_DESC);
>  }
>
>  static ssize_t asus_hwmon_temp1(struct device *dev,
> @@ -2371,7 +2371,7 @@ static ssize_t fan_boost_mode_show(struct device *dev,
>  {
>         struct asus_wmi *asus = dev_get_drvdata(dev);
>
> -       return scnprintf(buf, PAGE_SIZE, "%d\n", asus->fan_boost_mode);
> +       return sysfs_emit(buf, "%d\n", asus->fan_boost_mode);
>  }
>
>  static ssize_t fan_boost_mode_store(struct device *dev,
> @@ -2924,7 +2924,7 @@ static ssize_t throttle_thermal_policy_show(struct device *dev,
>         struct asus_wmi *asus = dev_get_drvdata(dev);
>         u8 mode = asus->throttle_thermal_policy_mode;
>
> -       return scnprintf(buf, PAGE_SIZE, "%d\n", mode);
> +       return sysfs_emit(buf, "%d\n", mode);
>  }
>
>  static ssize_t throttle_thermal_policy_store(struct device *dev,
> --
> 2.37.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ