Thread (13 messages) flat view 13 messages, 3 authors, 2015-07-21

Re: [PATCH v6 3/3] leds/powernv: Add driver for PowerNV platform

From: Vasant Hegde <hidden>
Date: 2015-07-20 16:56:35
Also in: linux-leds

On 07/20/2015 11:46 AM, Jacek Anaszewski wrote:
On 19.07.2015 23:40, Jacek Anaszewski wrote:
[...]
quoted
quoted
quoted
quoted
+/* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help