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]
Date:   Fri, 7 Oct 2022 19:26:43 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Jean-Jacques Hiblot <jjhiblot@...phandler.com>
Cc:     lee.jones@...aro.org, pavel@....cz, robh+dt@...nel.org,
        sven.schwermer@...ruptive-technologies.com,
        krzysztof.kozlowski+dt@...aro.org, johan+linaro@...nel.org,
        marijn.suijten@...ainline.org, bjorn.andersson@...aro.org,
        jacek.anaszewski@...il.com, linux-leds@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/6] leds: class: store the color index in struct led_classdev

On Fri, Oct 7, 2022 at 6:03 PM Jean-Jacques Hiblot
<jjhiblot@...phandler.com> wrote:
>
> This information might be useful for more than only deriving the led's
> name.
> And since we have this information, we can expose it in the sysfs.

Not sure why you haven't continued a new sentence on the previous line.

...

> +static ssize_t color_show(struct device *dev,
> +               struct device_attribute *attr, char *buf)
> +{
> +       const char *color_text = "invalid";
> +       struct led_classdev *led_cdev = dev_get_drvdata(dev);
> +
> +       if (led_cdev->color < LED_COLOR_ID_MAX)
> +               color_text = led_colors[led_cdev->color];

> +       return sprintf(buf, "%s\n", color_text);

According to the Documentation you must use sysfs_emit() here. It
might be good to update existing code as well (as a separate change).

> +}
> +static DEVICE_ATTR_RO(color);


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ