Date: Tue, 18 Mar 2014 08:26:39 -0600 From: Warner Losh <imp@bsdimp.com> To: Luiz Otavio O Souza <lists.br@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: [RFC] lm75 kernel driver and bsnmp module Message-ID: <4B0E494C-A289-435C-89AA-29DEB1A4EAD9@gmail.com> In-Reply-To: <CAB=2f8wqTqQekBPRGdG%2BBqTn-yt1BX-3DW6K5HBt2jptc4g4-g@mail.gmail.com> References: <CAB=2f8wqTqQekBPRGdG%2BBqTn-yt1BX-3DW6K5HBt2jptc4g4-g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mar 17, 2014, at 8:11 AM, Luiz Otavio O Souza <lists.br@gmail.com> =
wrote:
> <lm75.diff>
+#ifdef FDT
+static struct ofw_compat_data compat_data[] =3D {
+ { "freebsd,lm75", HWTYPE_LM75 },
+ { "freebsd,lm75a", HWTYPE_LM75A },
+ { NULL, HWTYPE_NONE },
+};
+#endif
Is there a FDT standard here? It seems like they would fall under the
=93national,lm75=94 bindings that are defined in the =93standard=94 FDT =
spec. You
can find it listed in the =91device-tree/Bindings/i2c/trivial-devices.txt=92=
file in
Linux, or in a similar location in the device-tree vendor tree in =
FreeBSD.
It isn=92t clear that both devices can=92t be handled with the same =
driver, since
the extra bits are supposed to be clear and so the extra if=92s here:
+ if (sc->sc_hwtype =3D=3D HWTYPE_LM75A) {
+ if (buf & LM75_0125C)
+ t +=3D 125;
+ if (buf & LM75_0250C)
+ t +=3D 250;
+ }
+ if (buf & LM75_0500C)
+ t +=3D 500;
which just leaves device type reporting. The only reason I mention is is =
that
Linux doesn=92t seem to differentiate the two at the FDT level.
+ sc->sc_hwtype =3D ofw_bus_search_compatible(dev, =
compat_data)->ocd_data;
I don=92t think that the NULL binding is guaranteed to work that way, so
I=92d suggest dropping the NULL line above and testing explicitly for =
NULL
here instead.
Finally, is pausing for hz on read/write errors the right thing to do? =
Seems like a very
long time...
Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B0E494C-A289-435C-89AA-29DEB1A4EAD9>
