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

From: Chris Packham
Date: Wed Jun 28 2017 - 17:15:41 EST


On 28/06/17 21:20, Andy Shevchenko wrote:
>> + 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?
>

Nothing particular. I think I just found more instances of parsing a
"clock-frequency" this way. Happy to change this.

>> +#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().

So what's the current best practice with this? I gather the intent is to
keep the kernel size down by only including the of_match tables on
platforms that actually use a device tree. There are just shy of 1000
instances of of_match_ptr in the current tree (a handful of which are in
drivers/i2c). Have we now reached a point where there are more dt-aware
platforms than unaware ones?