Re: [PATCH v3 3/5] i2c: pca-platform: add devicetree awareness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 26, 2017 at 3:44 AM, Chris Packham
<chris.packham@xxxxxxxxxxxxxxxxxxx> wrote:
> Allow devices that use this driver to be registered via a
> devicetree.

Device Tree

Wolfram was being a bit faster to apply it...
> +#include <linux/of.h>
> +#include <linux/of_device.h>

> +       struct device_node *np = pdev->dev.of_node;

>         /* If irq is 0, we do polling. */
> +       if (irq < 0)
> +               irq = 0;

This does not belong to what is written in commit message. Looks like
a separate fix.

> +       i2c->adap.dev.of_node = np;

> +       } else if (np) {

> +               i2c->adap.timeout = HZ;
> +               i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset-gpios", GPIOD_OUT_LOW);
> +               if (IS_ERR(i2c->gpio))
> +                       return PTR_ERR(i2c->gpio);
> +               of_property_read_u32_index(np, "clock-frequency", 0,
> +                                          &i2c->algo_data.i2c_clock);

And what prevents you to use device_property_read_*() here and get rid
of OFstuff?

> +#ifdef CONFIG_OF

Better not to put it...

> +               .of_match_table = of_match_ptr(i2c_pca_of_match_table),

...and get rid of of_match_ptr().

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux