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: <20201125103258.GB25562@amd>
Date:   Wed, 25 Nov 2020 11:32:58 +0100
From:   Pavel Machek <pavel@....cz>
To:     Marek Behún <marek.behun@....cz>
Cc:     linux-leds@...r.kernel.org, Dan Murphy <dmurphy@...com>,
        Ondřej Jirman <megous@...ous.com>,
        Russell King <linux@...linux.org.uk>,
        Andrew Lunn <andrew@...n.ch>, linux-kernel@...r.kernel.org,
        Matthias Schiffer <matthias.schiffer@...tq-group.com>,
        Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org
Subject: Re: [PATCH leds + devicetree v2 1/2] leds: trigger: add trigger
 sources validating method and helper functions

Hi!

> Currently we use the `linux,default-trigger` device tree property of a
> LED to define the default trigger which should be activated for a LED.
> 
> But the LED device tree binding also documents the `trigger-sources`
> property, which specifies the source device which should be triggering
> the LED.
> 
> The `trigger-sources` property is currently implemented only in
> drivers/usb/core/ledtrig-usbport.c.
> 
> Lets add a method to struct led_trigger which, if implemented, can check
> whether this trigger should be enabled as default. This check shall be
> done by checking whether the specified `trigger-sources` refers to a
> device compatible with the trigger. For this two new helper functions,
> of_led_count_trigger_sources and of_led_get_trigger_source, are
> implemented.

> +int of_led_count_trigger_sources(struct led_classdev *led_cdev)
> +{
> +	struct device_node *np;
> +	int count;
> +
> +	np = dev_of_node(led_cdev->dev);
> +	if (!np)
> +		return 0;
> +
> +	count = of_count_phandle_with_args(np, "trigger-sources",
> +					   "#trigger-source-cells");
> +	if (count == -ENOENT)
> +		return 0;
> +	else if (count < 0)
> +		dev_warn(led_cdev->dev,
> +			 "Failed parsing trigger sources for %pOF!\n", np);
> +
> +	return count;
> +}

Will this need of_node_put() somewhere?

Best regards,
									Pavel

-- 
http://www.livejournal.com/~pavelmachek

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