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: <20121211072545.GD8294@avionic-0098.adnet.avionic-design.de>
Date:	Tue, 11 Dec 2012 08:25:45 +0100
From:	Thierry Reding <thierry.reding@...onic-design.de>
To:	Peter Ujfalusi <peter.ujfalusi@...com>
Cc:	Bryan Wu <cooloney@...il.com>, Richard Purdie <rpurdie@...ys.net>,
	Grant Likely <grant.likely@...retlab.ca>,
	linux-kernel@...r.kernel.org, devicetree-discuss@...ts.ozlabs.org,
	linux-doc@...r.kernel.org, linux-leds@...r.kernel.org
Subject: Re: [PATCH v3 4/4] leds: leds-pwm: Add device tree bindings

On Mon, Dec 10, 2012 at 11:00:37AM +0100, Peter Ujfalusi wrote:
[...]
> +LED sub-node properties:
> +- pwms : PWM property, please refer to: 
> +  Documentation/devicetree/bindings/pwm/pwm.txt

Instead of only referring to the generic PWM binding document, this
should probably explain what the PWM device is used for.

> +err:
> +	if (priv->num_leds > 0) {
> +		for (count = priv->num_leds - 1; count >= 0; count--) {
> +			led_classdev_unregister(&priv->leds[count].cdev);
> +			pwm_put(priv->leds[count].pwm);
> +		}
> +	}

Can this not be written more simply as follows?

	while (priv->num_leds--) {
		...
	}

>  static int led_pwm_remove(struct platform_device *pdev)
>  {
> +	struct led_pwm_platform_data *pdata = pdev->dev.platform_data;
>  	struct led_pwm_priv *priv = platform_get_drvdata(pdev);
>  	int i;
>  
> -	for (i = 0; i < priv->num_leds; i++)
> +	for (i = 0; i < priv->num_leds; i++) {
>  		led_classdev_unregister(&priv->leds[i].cdev);
> +		if (!pdata)
> +			pwm_put(priv->leds[i].pwm);
> +	}

Perhaps while at it we can add devm_of_pwm_get() along with exporting
of_pwm_get() so that you don't have to special-case this?

> +static const struct of_device_id of_pwm_leds_match[] = {
> +	{ .compatible = "pwm-leds", },
> +	{},
> +};

Doesn't this cause a compiler warning for !OF builds?

Thierry

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ