mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
leds: various: use dev_of_node(dev) instead of dev->of_node
The dev_of_node function should be preferred. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Sean Wang <sean.wang@mediatek.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
parent
2779f4724b
commit
8853c95e99
@ -118,9 +118,9 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
|
||||
struct device_node *nproot, *np;
|
||||
int iset = 0;
|
||||
|
||||
if (!pdev->dev.parent->of_node)
|
||||
if (!dev_of_node(pdev->dev.parent))
|
||||
return -ENODEV;
|
||||
nproot = of_get_child_by_name(pdev->dev.parent->of_node, "leds");
|
||||
nproot = of_get_child_by_name(dev_of_node(pdev->dev.parent), "leds");
|
||||
if (!nproot) {
|
||||
dev_err(&pdev->dev, "failed to find leds node\n");
|
||||
return -ENODEV;
|
||||
|
@ -248,7 +248,7 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
|
||||
}
|
||||
#endif
|
||||
|
||||
child_node = of_get_next_available_child(dev->of_node, NULL);
|
||||
child_node = of_get_next_available_child(dev_of_node(dev), NULL);
|
||||
if (!child_node) {
|
||||
dev_err(dev, "No DT child node found for connected LED.\n");
|
||||
return -EINVAL;
|
||||
|
@ -202,7 +202,7 @@ error:
|
||||
static int an30259a_dt_init(struct i2c_client *client,
|
||||
struct an30259a *chip)
|
||||
{
|
||||
struct device_node *np = client->dev.of_node, *child;
|
||||
struct device_node *np = dev_of_node(&client->dev), *child;
|
||||
int count, ret;
|
||||
int i = 0;
|
||||
const char *str;
|
||||
|
@ -261,7 +261,7 @@ out:
|
||||
|
||||
static int aw2013_probe_dt(struct aw2013 *chip)
|
||||
{
|
||||
struct device_node *np = chip->client->dev.of_node, *child;
|
||||
struct device_node *np = dev_of_node(&chip->client->dev), *child;
|
||||
int count, ret = 0, i = 0;
|
||||
struct aw2013_led *led;
|
||||
|
||||
|
@ -395,7 +395,7 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
|
||||
static int bcm6328_leds_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&pdev->dev);
|
||||
struct device_node *child;
|
||||
void __iomem *mem;
|
||||
spinlock_t *lock; /* memory lock */
|
||||
|
@ -149,7 +149,7 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg,
|
||||
static int bcm6358_leds_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&pdev->dev);
|
||||
struct device_node *child;
|
||||
void __iomem *mem;
|
||||
spinlock_t *lock; /* memory lock */
|
||||
|
@ -202,7 +202,7 @@ static int is31fl319x_parse_child_dt(const struct device *dev,
|
||||
static int is31fl319x_parse_dt(struct device *dev,
|
||||
struct is31fl319x_chip *is31)
|
||||
{
|
||||
struct device_node *np = dev->of_node, *child;
|
||||
struct device_node *np = dev_of_node(dev), *child;
|
||||
int count;
|
||||
int ret;
|
||||
|
||||
|
@ -372,7 +372,7 @@ static int is31fl32xx_parse_dt(struct device *dev,
|
||||
struct device_node *child;
|
||||
int ret = 0;
|
||||
|
||||
for_each_child_of_node(dev->of_node, child) {
|
||||
for_each_child_of_node(dev_of_node(dev), child) {
|
||||
struct is31fl32xx_led_data *led_data =
|
||||
&priv->leds[priv->num_leds];
|
||||
const struct is31fl32xx_led_data *other_led_data;
|
||||
@ -435,7 +435,7 @@ static int is31fl32xx_probe(struct i2c_client *client,
|
||||
|
||||
cdef = device_get_match_data(dev);
|
||||
|
||||
count = of_get_child_count(dev->of_node);
|
||||
count = of_get_child_count(dev_of_node(dev));
|
||||
if (!count)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -259,11 +259,11 @@ static void ktd2692_setup(struct ktd2692_context *led)
|
||||
static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
|
||||
struct ktd2692_led_config_data *cfg)
|
||||
{
|
||||
struct device_node *np = dev->of_node;
|
||||
struct device_node *np = dev_of_node(dev);
|
||||
struct device_node *child_node;
|
||||
int ret;
|
||||
|
||||
if (!dev->of_node)
|
||||
if (!dev_of_node(dev))
|
||||
return -ENXIO;
|
||||
|
||||
led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS);
|
||||
|
@ -523,7 +523,7 @@ static int lp5521_probe(struct i2c_client *client,
|
||||
struct lp55xx_chip *chip;
|
||||
struct lp55xx_led *led;
|
||||
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&client->dev);
|
||||
|
||||
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
|
||||
if (!chip)
|
||||
|
@ -891,7 +891,7 @@ static int lp5523_probe(struct i2c_client *client,
|
||||
struct lp55xx_chip *chip;
|
||||
struct lp55xx_led *led;
|
||||
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&client->dev);
|
||||
|
||||
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
|
||||
if (!chip)
|
||||
|
@ -518,7 +518,7 @@ static int lp5562_probe(struct i2c_client *client,
|
||||
struct lp55xx_chip *chip;
|
||||
struct lp55xx_led *led;
|
||||
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&client->dev);
|
||||
|
||||
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
|
||||
if (!chip)
|
||||
|
@ -306,7 +306,7 @@ static int lp8501_probe(struct i2c_client *client,
|
||||
struct lp55xx_chip *chip;
|
||||
struct lp55xx_led *led;
|
||||
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&client->dev);
|
||||
|
||||
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
|
||||
if (!chip)
|
||||
|
@ -380,7 +380,7 @@ static int lp8860_probe(struct i2c_client *client,
|
||||
{
|
||||
int ret;
|
||||
struct lp8860_led *led;
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&client->dev);
|
||||
struct device_node *child_node;
|
||||
struct led_init_data init_data = {};
|
||||
|
||||
|
@ -68,7 +68,7 @@ static int lt3593_led_probe(struct platform_device *pdev)
|
||||
struct led_init_data init_data = {};
|
||||
const char *tmp;
|
||||
|
||||
if (!dev->of_node)
|
||||
if (!dev_of_node(dev))
|
||||
return -ENODEV;
|
||||
|
||||
led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL);
|
||||
|
@ -599,7 +599,7 @@ static int max77693_led_parse_dt(struct max77693_led_device *led,
|
||||
{
|
||||
struct device *dev = &led->pdev->dev;
|
||||
struct max77693_sub_led *sub_leds = led->sub_leds;
|
||||
struct device_node *node = dev->of_node, *child_node;
|
||||
struct device_node *node = dev_of_node(dev), *child_node;
|
||||
struct property *prop;
|
||||
u32 led_sources[2];
|
||||
int i, ret, fled_id;
|
||||
|
@ -121,7 +121,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
|
||||
if (!pdata)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
parent = of_get_child_by_name(dev->parent->of_node, "leds");
|
||||
parent = of_get_child_by_name(dev_of_node(dev->parent), "leds");
|
||||
if (!parent)
|
||||
goto out_node_put;
|
||||
|
||||
@ -192,7 +192,7 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev)
|
||||
leds->master = mcdev;
|
||||
platform_set_drvdata(pdev, leds);
|
||||
|
||||
if (dev->parent->of_node) {
|
||||
if (dev_of_node(dev->parent)) {
|
||||
pdata = mc13xxx_led_probe_dt(pdev);
|
||||
if (IS_ERR(pdata))
|
||||
return PTR_ERR(pdata);
|
||||
|
@ -369,7 +369,7 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev,
|
||||
static int mt6323_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&pdev->dev);
|
||||
struct device_node *child;
|
||||
struct mt6397_chip *hw = dev_get_drvdata(pdev->dev.parent);
|
||||
struct mt6323_leds *leds;
|
||||
|
@ -419,7 +419,7 @@ static int netxbig_gpio_ext_get(struct device *dev,
|
||||
static int netxbig_leds_get_of_pdata(struct device *dev,
|
||||
struct netxbig_led_platform_data *pdata)
|
||||
{
|
||||
struct device_node *np = dev->of_node;
|
||||
struct device_node *np = dev_of_node(dev);
|
||||
struct device_node *gpio_ext_np;
|
||||
struct platform_device *gpio_ext_pdev;
|
||||
struct device *gpio_ext_dev;
|
||||
|
@ -246,7 +246,7 @@ static void delete_ns2_led(struct ns2_led_data *led_dat)
|
||||
static int
|
||||
ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
|
||||
{
|
||||
struct device_node *np = dev->of_node;
|
||||
struct device_node *np = dev_of_node(dev);
|
||||
struct device_node *child;
|
||||
struct ns2_led *led, *leds;
|
||||
int ret, num_leds = 0;
|
||||
|
@ -507,7 +507,7 @@ static int pca9532_probe(struct i2c_client *client,
|
||||
struct pca9532_data *data = i2c_get_clientdata(client);
|
||||
struct pca9532_platform_data *pca9532_pdata =
|
||||
dev_get_platdata(&client->dev);
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&client->dev);
|
||||
|
||||
if (!pca9532_pdata) {
|
||||
if (np) {
|
||||
|
@ -88,7 +88,7 @@ static enum led_brightness pm8058_led_get(struct led_classdev *cled)
|
||||
static int pm8058_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pm8058_led *led;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct device_node *np = dev_of_node(&pdev->dev);
|
||||
int ret;
|
||||
struct regmap *map;
|
||||
const char *state;
|
||||
|
@ -276,7 +276,7 @@ static int sc27xx_led_register(struct device *dev, struct sc27xx_led_priv *priv)
|
||||
static int sc27xx_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node, *child;
|
||||
struct device_node *np = dev_of_node(dev), *child;
|
||||
struct sc27xx_led_priv *priv;
|
||||
u32 base, count, reg;
|
||||
int err;
|
||||
|
@ -87,11 +87,11 @@ static int spi_byte_probe(struct spi_device *spi)
|
||||
const char *state;
|
||||
int ret;
|
||||
|
||||
if (of_get_child_count(dev->of_node) != 1) {
|
||||
if (of_get_child_count(dev_of_node(dev)) != 1) {
|
||||
dev_err(dev, "Device must have exactly one LED sub-node.");
|
||||
return -EINVAL;
|
||||
}
|
||||
child = of_get_next_child(dev->of_node, NULL);
|
||||
child = of_get_next_child(dev_of_node(dev), NULL);
|
||||
|
||||
led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
|
||||
if (!led)
|
||||
|
@ -56,7 +56,7 @@ static void syscon_led_set(struct led_classdev *led_cdev,
|
||||
static int syscon_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct device_node *np = dev_of_node(dev);
|
||||
struct device *parent;
|
||||
struct regmap *map;
|
||||
struct syscon_led *sled;
|
||||
@ -68,7 +68,7 @@ static int syscon_led_probe(struct platform_device *pdev)
|
||||
dev_err(dev, "no parent for syscon LED\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
map = syscon_node_to_regmap(parent->of_node);
|
||||
map = syscon_node_to_regmap(dev_of_node(parent));
|
||||
if (IS_ERR(map)) {
|
||||
dev_err(dev, "no regmap for syscon LED parent\n");
|
||||
return PTR_ERR(map);
|
||||
|
@ -656,7 +656,7 @@ static int tca6507_probe_gpios(struct i2c_client *client,
|
||||
tca->gpio.set = tca6507_gpio_set_value;
|
||||
tca->gpio.parent = &client->dev;
|
||||
#ifdef CONFIG_OF_GPIO
|
||||
tca->gpio.of_node = of_node_get(client->dev.of_node);
|
||||
tca->gpio.of_node = of_node_get(dev_of_node(&client->dev));
|
||||
#endif
|
||||
err = gpiochip_add_data(&tca->gpio, tca);
|
||||
if (err) {
|
||||
@ -689,7 +689,7 @@ static void tca6507_remove_gpio(struct tca6507_chip *tca)
|
||||
static struct tca6507_platform_data *
|
||||
tca6507_led_dt_init(struct i2c_client *client)
|
||||
{
|
||||
struct device_node *np = client->dev.of_node, *child;
|
||||
struct device_node *np = dev_of_node(&client->dev), *child;
|
||||
struct tca6507_platform_data *pdata;
|
||||
struct led_info *tca_leds;
|
||||
int count;
|
||||
|
@ -148,7 +148,7 @@ static int
|
||||
tlc591xx_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct device_node *np = client->dev.of_node, *child;
|
||||
struct device_node *np = dev_of_node(&client->dev), *child;
|
||||
struct device *dev = &client->dev;
|
||||
const struct tlc591xx *tlc591xx;
|
||||
struct tlc591xx_priv *priv;
|
||||
|
@ -210,7 +210,7 @@ static int omnia_leds_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
struct device_node *np = dev->of_node, *child;
|
||||
struct device_node *np = dev_of_node(dev), *child;
|
||||
struct omnia_leds *leds;
|
||||
struct omnia_led *led;
|
||||
int ret, count;
|
||||
|
Loading…
Reference in New Issue
Block a user