Re: [PATCH v11 7/7] drm/lsdc: add drm driver for loongson display controller

From: Rob Herring
Date: Thu Mar 24 2022 - 09:57:08 EST


On Thu, Mar 24, 2022 at 03:32:01PM +0800, Sui Jingfeng wrote:
>
> On 2022/3/23 04:49, Rob Herring wrote:
> > > + }
> > > +
> > > + spin_lock_init(&li2c->reglock);
> > > +
> > > + snprintf(compat, sizeof(compat), "lsdc,i2c-gpio-%d", index);
> > compatible values shouldn't have an index and you shouldn't need a
> > index in DT. You need to iterate over child nodes with matching
> > compatible.
>
> Why compatible values shouldn't have an index, does devicetree
> specification prohibit this? [1]

Probably not explicitly, but that's fundamentally not how compatible
works. 'compatible' defines WHAT the device is, not WHICH device and
that is used for matching devices to drivers. Drivers work on multiple
instances.

> The recommended format is "manufacturer,model", where manufacturer is a string describing the name
> of the manufacturer (such as a stock ticker symbol), and model specifies the model number. [1]

I don't see anything saying to put the instance in there, do you?

>
> [1] https://www.devicetree.org/specifications/
>