[PATCH v2] mtd: dataflash: add device tree probe support

Mike Frysinger vapier.adi at gmail.com
Wed Jul 20 01:38:07 EDT 2011


On Wed, Jul 20, 2011 at 01:32, Artem Bityutskiy wrote:
> On Wed, 2011-07-20 at 13:28 +0800, Shawn Guo wrote:
>> On Wed, Jul 20, 2011 at 08:17:45AM +0300, Artem Bityutskiy wrote:
>> > On Wed, 2011-07-20 at 12:55 +0800, Shawn Guo wrote:
>> > > On Wed, Jul 20, 2011 at 07:40:38AM +0300, Artem Bityutskiy wrote:
>> > > > On Fri, 2011-07-15 at 12:49 +0800, Shawn Guo wrote:
>> > > > > > > +static const struct of_device_id dataflash_dt_ids[] = {
>> > > > > > > + { .compatible = "atmel,at45xxx", },
>> > > > > > > + { .compatible = "atmel,dataflash", },
>> > > > > > > + { /* sentinel */ }
>> > > > > > > +};
>> > > > > > > +
>> > > > > >
>> > > > > > This should be protected with a #ifdef CONFIG_OF/#else/#endif, and
>> > > > > > there should be a MODULE_DEVICE_TABLE().
>> > > > > >
>> > > > > I personally hate #ifdef stuff.  But okay, I can do it since there
>> > > > > are people being concerned by this little waste of space.
>> > > >
>> > > > I guess the question is - will it compile and work if CONFIG_OF is
>> > > > unset?
>> > > >
>> > > Yes, it will compile, as 'struct of_device_id' is defined in
>> > > include/linux/mod_devicetable.h unconditionally.
>> >
>> > And it will work correctly even though dataflash_dt_ids is not NULL, it
>> > will not confuse MTD layer?
>> >
>> I think for non-dt case, dataflash_dt_ids is not used anyway.  So yes,
>> it will not confuse MTD layer, at least from my testing.
>
> And it is not error-prone? I mean, it is not very likely that someone
> changing MTD could make wrong assumptions and break dataflash driver? If
> so, then we probably do not need ifdefs indeed.

except for the part where device tree code shouldnt be wasting space
on non-device tree systems
-mike



More information about the linux-arm-kernel mailing list