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: <913204f7-93e7-95f1-c477-85359ea1d73c@gmail.com>
Date:   Wed, 2 Jan 2019 20:16:52 +0100
From:   Jacek Anaszewski <jacek.anaszewski@...il.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>, Pavel Machek <pavel@....cz>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Raphael Teysseyre <rteysseyre@...il.com>,
        Baolin Wang <baolin.wang@...aro.org>,
        linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v5 2/5] leds: Add helper for getting default pattern from
 Device Tree

Hi Krzysztof,

You mentioned change of helper name in the cover
letter, but it still has "classdev" part.

On 1/1/19 3:07 PM, Krzysztof Kozlowski wrote:
> Multiple LED triggers might need to access default pattern so add a
> helper for that.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> ---
>   drivers/leds/led-core.c | 43 +++++++++++++++++++++++++++++++++++++++++
>   include/linux/leds.h    |  3 +++
>   2 files changed, 46 insertions(+)
> 
> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
> index ede4fa0ac2cc..e4b6da73bc12 100644
> --- a/drivers/leds/led-core.c
> +++ b/drivers/leds/led-core.c
> @@ -16,7 +16,9 @@
>   #include <linux/list.h>
>   #include <linux/module.h>
>   #include <linux/mutex.h>
> +#include <linux/of.h>
>   #include <linux/rwsem.h>
> +#include <linux/slab.h>
>   #include "leds.h"
>   
>   DECLARE_RWSEM(leds_list_lock);
> @@ -310,6 +312,47 @@ int led_update_brightness(struct led_classdev *led_cdev)
>   }
>   EXPORT_SYMBOL_GPL(led_update_brightness);
>   
> +/**
> + * led_classdev_get_default_pattern - return default pattern

s/led_classdev/led/

> + *
> + * @led_cdev: the led_classdev structure for this device
> + * @size:     pointer for storing the number of elements in returned array,
> + *            modified only if return != NULL
> + *
> + * Return:    Allocated array of integers with default pattern from DeviceTree
> + *            or NULL.  Caller is responsible for kfree().
> + */
> +u32 *led_classdev_get_default_pattern(struct led_classdev *led_cdev,
> +				      unsigned int *size)

Ditto.

> +{
> +	struct device_node *np = dev_of_node(led_cdev->dev);
> +	u32 *pattern;
> +	int count;
> +
> +	if (!np)
> +		return NULL;
> +
> +	count = of_property_count_u32_elems(np, "led-pattern");
> +	if (count < 0)
> +		return NULL;
> +
> +	pattern = kcalloc(count, sizeof(*pattern), GFP_KERNEL);
> +	if (!pattern)
> +		return NULL;
> +
> +	if (of_property_read_u32_array(np, "led-pattern", pattern, count))
> +		goto err;
> +
> +	*size = count;
> +
> +	return pattern;
> +
> +err:
> +	kfree(pattern);
> +	return NULL;
> +}
> +EXPORT_SYMBOL_GPL(led_classdev_get_default_pattern);

Ditto.

> +
>   /* Caller must ensure led_cdev->led_access held */
>   void led_sysfs_disable(struct led_classdev *led_cdev)
>   {
> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index 5263f87e1d2c..70edf574ba81 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -129,6 +129,9 @@ struct led_classdev {
>   	struct mutex		led_access;
>   };
>   
> +extern u32 *led_classdev_get_default_pattern(struct led_classdev *led_cdev,
> +					     unsigned int *size);
> +

Ditto.

>   extern int of_led_classdev_register(struct device *parent,
>   				    struct device_node *np,
>   				    struct led_classdev *led_cdev);
> 

-- 
Best regards,
Jacek Anaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ