[PATCH v6 3/3] leds/powernv: Add driver for PowerNV platform
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Tue Jul 21 02:55:37 AEST 2015
On 07/20/2015 11:46 AM, Jacek Anaszewski wrote:
> On 19.07.2015 23:40, Jacek Anaszewski wrote:
> [...]
>>>>> +/* Platform driver probe */
>>>>> +static int powernv_led_probe(struct platform_device *pdev)
>>>>> +{
>>>>> + int num_leds;
>>>>> + struct device_node *led_node;
>>>>> + struct powernv_leds_priv *priv;
>>>>> +
>>>>> + led_node = of_find_node_by_path("/ibm,opal/leds");
>>>>> + if (!led_node) {
>>>>> + dev_err(&pdev->dev,
>>>>> + "%s: LED parent device node not found\n", __func__);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + num_leds = powernv_leds_count(led_node);
>>>>> + if (num_leds <= 0) {
>>>>> + dev_err(&pdev->dev,
>>>>> + "%s: No location code found under LED node\n",
>>>>> + __func__);
>>>>> + return -EINVAL;
>>>>> + }
>>
>> You won't need to count the number of LEDs to register, just allocate
>> memory for each LED during parsing with managed resource allocation
>> API.
Jacek,
>
> You can refer to drivers/leds/leds-bcm6328.c in order to gain
> full picture on how this can look like.
> struct powernv_led_data would have to carry the pointer to the
> new common struct.
>
Sure.. Will though this code and will fix powernv code..
Thanks
-Vasant
More information about the Linuxppc-dev
mailing list