There is no need to be stuck with OF node when we may use agnostic
firmware node instead.
It allows users to get property if needed independently of provider.
Note, some OF parts are left because %pfw [1] is in progress.
[1]: https://lore.kernel.org/patchwork/cover/
1054863/
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
#include <linux/leds.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/leds.h>
#include <linux/list.h>
#include <linux/module.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
return PTR_ERR(led_cdev->dev);
}
if (init_data && init_data->fwnode)
return PTR_ERR(led_cdev->dev);
}
if (init_data && init_data->fwnode)
- led_cdev->dev->of_node = to_of_node(init_data->fwnode);
+ led_cdev->dev->fwnode = init_data->fwnode;
if (ret)
dev_warn(parent, "Led %s renamed to %s due to name collision",
if (ret)
dev_warn(parent, "Led %s renamed to %s due to name collision",
u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size)
{
u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size)
{
- struct device_node *np = dev_of_node(led_cdev->dev);
+ struct fwnode_handle *fwnode = led_cdev->dev->fwnode;
- if (!np)
- return NULL;
-
- count = of_property_count_u32_elems(np, "led-pattern");
+ count = fwnode_property_count_u32(fwnode, "led-pattern");
if (count < 0)
return NULL;
if (count < 0)
return NULL;
if (!pattern)
return NULL;
if (!pattern)
return NULL;
- if (of_property_read_u32_array(np, "led-pattern", pattern, count)) {
+ if (fwnode_property_read_u32_array(fwnode, "led-pattern", pattern, count)) {
kfree(pattern);
return NULL;
}
kfree(pattern);
return NULL;
}