[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YACJobqwDavtg25C@lunn.ch>
Date: Thu, 14 Jan 2021 19:12:49 +0100
From: Andrew Lunn <andrew@...n.ch>
To: George McCollister <george.mccollister@...il.com>
Cc: Vladimir Oltean <olteanv@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Rob Herring <robh@...nel.org>,
"David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
"open list:OPEN FIRMWARE AND..." <devicetree@...r.kernel.org>
Subject: Re: [PATCH net-next v4 2/3] net: dsa: add Arrow SpeedChips XRS700x
driver
> > > +static int xrs700x_detect(struct xrs700x *dev)
> > > +{
> > > + const struct xrs700x_info *info;
> > > + unsigned int id;
> > > + int ret;
> > > +
> > > + ret = regmap_read(dev->regmap, XRS_DEV_ID0, &id);
> > > + if (ret) {
> > > + dev_err(dev->dev, "error %d while reading switch id.\n",
> > > + ret);
> > > + return ret;
> > > + }
> > > +
> > > + info = of_device_get_match_data(dev->dev);
> > > + if (!info)
> > > + return -EINVAL;
> > > +
> > > + if (info->id == id) {
> > > + dev->ds->num_ports = info->num_ports;
> > > + dev_info(dev->dev, "%s detected.\n", info->name);
> > > + return 0;
> > > + }
> > > +
> > > + dev_err(dev->dev, "expected switch id 0x%x but found 0x%x.\n",
> > > + info->id, id);
> >
> > I've been there too, not the smartest of decisions in the long run. See
> > commit 0b0e299720bb ("net: dsa: sja1105: use detected device id instead
> > of DT one on mismatch") if you want a sneak preview of how this is going
> > to feel two years from now. If you can detect the device id you're
> > probably better off with a single compatible string.
>
> Previously Andrew said:
> "Either you need to verify the compatible from day one so it is not
> wrong, or you just use a single compatible "arrow,xrs700x", which
> cannot be wrong."
>
> I did it the first way he suggested, if you would have replied at that
> time to use a single that's the way I would have done it that way.
>
> If you two can agree I should change it to a single string I'd be
> happy to do so.
I'm happy both ways. Marvell uses just on compatible, and has worked
fine. Other drivers have specific compatible strings, and enforce the
match, and that has also worked fine.
So it is really up to you.
Andrew
Powered by blists - more mailing lists