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: <ZDfj5I3l4O1FkiW3@duo.ucw.cz>
Date:   Thu, 13 Apr 2023 13:13:40 +0200
From:   Pavel Machek <pavel@....cz>
To:     Naresh Solanki <naresh.solanki@...ements.com>
Cc:     Lee Jones <lee@...nel.org>,
        Patrick Rudolph <patrick.rudolph@...ements.com>,
        linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org
Subject: Re: [PATCH v4] leds: max597x: Add support for max597x

Hi!

> From: Patrick Rudolph <patrick.rudolph@...ements.com>
> 
> max597x is hot swap controller with indicator LED support.
> This driver uses DT property to configure led during boot time &
> also provide the LED control in sysfs.
> 
> DTS example:
>     i2c {
>         #address-cells = <1>;
>         #size-cells = <0>;
>         regulator@3a {
>             compatible = "maxim,max5978";
>             reg = <0x3a>;
>             vss1-supply = <&p3v3>;
> 
>             regulators {
>                 sw0_ref_0: sw0 {
>                     shunt-resistor-micro-ohms = <12000>;
>                 };
>             };
> 
>             leds {
>                 #address-cells = <1>;
>                 #size-cells = <0>;
>                 led@0 {
>                     reg = <0>;
>                     label = "led0";
>                     default-state = "on";
>                 };
>                 led@1 {
>                     reg = <1>;
>                     label = "led1";
>                     default-state = "on";
>                 };
>             };
>         };
>     };
>

Yeah, well, dts bindings need to be properly documented, and example
goes to the binding, right?

Plus, we should have better names than led0/led1. Something like
hdd0:green:something, based on what the LED does and what are you hot
swapping. See/modify Documentation/leds/well-known-leds.txt .


> +static int max597x_led_set_brightness(struct led_classdev *cdev,
> +				      enum led_brightness brightness)
> +{
> +	struct max597x_led *ddata = ldev_to_maxled(cdev);
> +	int ret, val;
> +
> +	if (!ddata->regmap)
> +		return -ENODEV;
> +
> +	/* Set/Clear corresponding bit for given led index */

"/clear".

> +	val = !brightness ? BIT(ddata->index) : 0;
> +	ret = regmap_update_bits(ddata->regmap, MAX5970_REG_LED_FLASH, BIT(ddata->index), val);
> +	if (ret < 0)
> +		dev_err(cdev->dev, "failed to set brightness %d", ret);

'\n"'.

> +	ddata->cdev.brightness_set_blocking = max597x_led_set_brightness;
> +	ddata->cdev.default_trigger = "none";

So what do these leds normally do? Should they be registered with
common function to handle default triggers etc?

> +	ddata->index = reg;
> +	ddata->regmap = regmap;
> +	ret = devm_led_classdev_register(dev, &ddata->cdev);
> +	if (ret)
> +		dev_err(dev, "Error initializing LED %s", ddata->cdev.name);

'\n"'.

> +module_platform_driver(max597x_led_driver);
> +MODULE_AUTHOR("Patrick Rudolph <patrick.rudolph@...ements.com>");
> +MODULE_DESCRIPTION("MAX5970_hot-swap controller LED driver");

"MAX5970 hot-swap"?

> +MODULE_LICENSE("GPL");
> 
> base-commit: 11e572d06c23d61683e20a98bd16f550ef17ac65
> prerequisite-patch-id: 456044abe991b2ff3b521d337825432789d71b29

?? Send prerequisites in the series?

BR,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ