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:   Sat, 21 Dec 2019 20:37:58 +0100
From:   Pavel Machek <pavel@....cz>
To:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
Cc:     mazziesaccount@...il.com,
        Jacek Anaszewski <jacek.anaszewski@...il.com>,
        Dan Murphy <dmurphy@...com>, Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Lee Jones <lee.jones@...aro.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
        linux-gpio@...r.kernel.org, linux-rtc@...r.kernel.org
Subject: Re: [PATCH v7 11/12] leds: Add common LED binding parsing support to
 LED class/core

Hi!

> Qucik grep for 'for_each' or 'linux,default-trigger' or

quick.

> If init_data is goven but no starting point for node lookup - then

is given.

> (parent) device's own DT node is used. If no led-compatible is given,
> then of_match is searched for. If neither led-compatible not of_match

nor of_match.

> is given then device's own node or passed starting point are used as
> such.
> 
> Signed-off-by: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
> ---
> 
> No changes since v6
> 
>  drivers/leds/led-class.c |  99 +++++++++++++--
>  drivers/leds/led-core.c  | 258 ++++++++++++++++++++++++++++++++-------
>  include/linux/leds.h     |  94 ++++++++++++--
>  3 files changed, 385 insertions(+), 66 deletions(-)

Quite a lot of code added here. Can I trust you that we we'll delete
320 lines by converting driver or two?

> +static void led_add_props(struct led_classdev *ld, struct led_properties *props)
> +{
> +	if (props->default_trigger)
> +		ld->default_trigger = props->default_trigger;
> +	/*
> +	 * According to binding docs the LED is by-default turned OFF unless
> +	 * default_state is used to indicate it should be ON or that state
> +	 * should be kept as is
> +	 */
> +	if (props->default_state) {
> +		ld->brightness = LED_OFF;
> +		if (!strcmp(props->default_state, "on"))
> +			ld->brightness = LED_FULL;

Max brightness is not always == LED_FULL these days.

> @@ -322,6 +398,10 @@ int led_classdev_register_ext(struct device *parent,
>  			led_cdev->name);
>  
>  	return 0;
> +err_out:
> +	if (led_cdev->fwnode_owned)
> +		fwnode_handle_put(fw);
> +	return ret;
>  }

led_cdev->fwnode_owned = false here?


> +/**
> + * led_find_fwnode - find fwnode for led
> + * @parent	LED controller device
> + * @init_data	led init data with match information
> + *
> + * Scans the firmware nodes and returns node matching the given init_data.
> + * NOTE: Function increases refcount for found node. Caller must decrease
> + * refcount using fwnode_handle_put when finished with node.
> + */
> +struct fwnode_handle *led_find_fwnode(struct device *parent,
> +				      struct led_init_data *init_data)
> +{
> +	struct fwnode_handle *fw;
> +
> +	/*
> +	 * This should never be called W/O init data. We could always return

without

> +	 * For now we do only do node look-up for drivers which populate
> +	 * the new match properties. We could and perhaps should do
> +	 * fw = dev_fwnode(parent); if given fwnode is NULL. But in order to
> +	 * not break existing setups we keep the old behaviour and just directly

not to break.

> +	/*
> +	 * Simple things are pretty. I think simplest is to use DT node-name
> +	 * for matching the node with LED - same way regulators use the node
> +	 * name to match with desc.
> +	 *
> +	 * This may not work with existing LED DT entries if the node name has
> +	 * been freely selectible. In order to this to work the binding doc

selectable?

> +	/**
> +	 * Please note, logic changed - if invalid property is found we bail
> +	 * early out without parsing the rest of the properties. Originally
> +	 * this was the case only for 'label' property. I don't know the
> +	 * rationale behind original logic allowing invalid properties to be
> +	 * given. If there is a reason then we should reconsider this.
> +	 * Intuitively it feels correct to just yell and quit if we hit value we
> +	 * don't understand - but intuition may be wrong at times :)
> +	 */

Is this supposed to be linuxdoc?

> +/**
> + * led_find_fwnode - find fwnode matching given LED init data
> + * @parent: LED controller device this LED is driven by
> + * @init_data: the LED class device initialization data
> + *
> + * Find the fw node matching given LED init data.
> + * NOTE: Function increases refcount for found node. Caller must decrease
> + * refcount using fwnode_handle_put when finished with node.
> + *
> + * Returns: node handle or NULL if matching fw node was not found
> + */
> +struct fwnode_handle *led_find_fwnode(struct device *parent,
> +				      struct led_init_data *init_data);
> +

If function _gets_ the node and increments its usage count, is it
normally called "get"?

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ