Date: Wed, 14 Mar 2018 07:52:03 -0700 From: Nathan Whitehorn <nwhitehorn@freebsd.org> To: Wojciech Macek <wma@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330925 - in head/sys: conf powerpc/powernv Message-ID: <cdfbe502-9bba-b012-aa38-905619535840@freebsd.org> In-Reply-To: <201803140920.w2E9K3mn019118@repo.freebsd.org> References: <201803140920.w2E9K3mn019118@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 03/14/18 02:20, Wojciech Macek wrote: > Author: wma > Date: Wed Mar 14 09:20:03 2018 > New Revision: 330925 > URL: https://svnweb.freebsd.org/changeset/base/330925 > > Log: > PowerNV: Fix I2C to compile if FDT is disabled > > Submitted by: Wojciech Macek <wma@semihalf.com> > Obtained from: Semihalf > Sponsored by: IBM, QCM Technologies I don't think this makes any sense, for several reasons: 1. You are gating on #ifdef FDT for things that are using the OF_* API and aren't actually FDT-specific, so the #ifdef checks are testing the wrong thing. 2. It isn't possible to even build a PowerPC/AIM kernel, like PowerNV, without the Open Firmware support code that this uses, so there is no circumstance in which this helps anything. 3. The PowerNV platform is non-functional without a device tree intrinsically, so, even if you could build a kernel like this somehow, it would be impossible for it to work. Given all of that, why was this necessary? It seems to just add pointless #ifdef to code that does not need it. -Nathan > > Modified: > head/sys/conf/files.powerpc > head/sys/powerpc/powernv/opal_i2c.c > head/sys/powerpc/powernv/opal_i2cm.c > head/sys/powerpc/powernv/powernv_centaur.c > head/sys/powerpc/powernv/powernv_xscom.c > > Modified: head/sys/conf/files.powerpc > ============================================================================== > --- head/sys/conf/files.powerpc Wed Mar 14 08:48:40 2018 (r330924) > +++ head/sys/conf/files.powerpc Wed Mar 14 09:20:03 2018 (r330925) > @@ -186,8 +186,8 @@ powerpc/powermac/vcoregpio.c optional powermac > powerpc/powernv/opal.c optional powernv > powerpc/powernv/opal_console.c optional powernv > powerpc/powernv/opal_dev.c optional powernv > -powerpc/powernv/opal_i2c.c optional iicbus fdt powernv > -powerpc/powernv/opal_i2cm.c optional iicbus fdt powernv > +powerpc/powernv/opal_i2c.c optional iicbus powernv > +powerpc/powernv/opal_i2cm.c optional iicbus powernv > powerpc/powernv/opal_pci.c optional powernv pci > powerpc/powernv/opalcall.S optional powernv > powerpc/powernv/platform_powernv.c optional powernv > > Modified: head/sys/powerpc/powernv/opal_i2c.c > ============================================================================== > --- head/sys/powerpc/powernv/opal_i2c.c Wed Mar 14 08:48:40 2018 (r330924) > +++ head/sys/powerpc/powernv/opal_i2c.c Wed Mar 14 09:20:03 2018 (r330925) > @@ -120,7 +120,9 @@ static int > opal_i2c_probe(device_t dev) > { > > +#ifdef FDT > if (!(ofw_bus_is_compatible(dev, "ibm,opal-i2c"))) > +#endif > return (ENXIO); > > device_set_desc(dev, "opal-i2c"); > @@ -131,6 +133,7 @@ opal_i2c_probe(device_t dev) > static int > opal_i2c_attach(device_t dev) > { > +#ifdef FDT > struct opal_i2c_softc *sc; > int len; > > @@ -150,6 +153,9 @@ opal_i2c_attach(device_t dev) > I2C_LOCK_INIT(sc); > > return (bus_generic_attach(dev)); > +#else > + return (ENXIO); > +#endif > } > > static int > > Modified: head/sys/powerpc/powernv/opal_i2cm.c > ============================================================================== > --- head/sys/powerpc/powernv/opal_i2cm.c Wed Mar 14 08:48:40 2018 (r330924) > +++ head/sys/powerpc/powernv/opal_i2cm.c Wed Mar 14 09:20:03 2018 (r330925) > @@ -57,14 +57,17 @@ struct opal_i2cm_softc > > static int opal_i2cm_attach(device_t); > static int opal_i2cm_probe(device_t); > +#ifdef FDT > static const struct ofw_bus_devinfo * > opal_i2cm_get_devinfo(device_t, device_t); > +#endif > > static device_method_t opal_i2cm_methods[] = { > /* Device interface */ > DEVMETHOD(device_probe, opal_i2cm_probe), > DEVMETHOD(device_attach, opal_i2cm_attach), > > +#ifdef FDT > /* ofw_bus interface */ > DEVMETHOD(ofw_bus_get_devinfo, opal_i2cm_get_devinfo), > DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), > @@ -72,6 +75,7 @@ static device_method_t opal_i2cm_methods[] = { > DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), > DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), > DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), > +#endif > > DEVMETHOD_END > }; > @@ -82,8 +86,10 @@ static int > opal_i2cm_probe(device_t dev) > { > > +#ifdef FDT > if (!(ofw_bus_is_compatible(dev, "ibm,centaur-i2cm") || > ofw_bus_is_compatible(dev, "ibm,power8-i2cm"))) > +#endif > return (ENXIO); > > device_set_desc(dev, "centaur-i2cm"); > @@ -93,6 +99,7 @@ opal_i2cm_probe(device_t dev) > static int > opal_i2cm_attach(device_t dev) > { > +#ifdef FDT > phandle_t child; > device_t cdev; > struct ofw_bus_devinfo *dinfo; > @@ -116,13 +123,18 @@ opal_i2cm_attach(device_t dev) > } > > return (bus_generic_attach(dev)); > +#else > + return (ENXIO); > +#endif > } > > +#ifdef FDT > static const struct ofw_bus_devinfo * > opal_i2cm_get_devinfo(device_t dev, device_t child) > { > return (device_get_ivars(child)); > } > +#endif > > DEFINE_CLASS_0(opal_i2cm, opal_i2cm_driver, opal_i2cm_methods, > sizeof(struct opal_i2cm_softc)); > > Modified: head/sys/powerpc/powernv/powernv_centaur.c > ============================================================================== > --- head/sys/powerpc/powernv/powernv_centaur.c Wed Mar 14 08:48:40 2018 (r330924) > +++ head/sys/powerpc/powernv/powernv_centaur.c Wed Mar 14 09:20:03 2018 (r330925) > @@ -57,14 +57,17 @@ struct powernv_centaur_softc > > static int powernv_centaur_attach(device_t); > static int powernv_centaur_probe(device_t); > +#ifdef FDT > static const struct ofw_bus_devinfo * > powernv_centaur_get_devinfo(device_t, device_t); > +#endif > > static device_method_t powernv_centaur_methods[] = { > /* Device interface */ > DEVMETHOD(device_probe, powernv_centaur_probe), > DEVMETHOD(device_attach, powernv_centaur_attach), > > +#ifdef FDT > /* ofw_bus interface */ > DEVMETHOD(ofw_bus_get_devinfo, powernv_centaur_get_devinfo), > DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), > @@ -72,7 +75,7 @@ static device_method_t powernv_centaur_methods[] = { > DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), > DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), > DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), > - > +#endif > DEVMETHOD_END > }; > > @@ -82,7 +85,9 @@ static int > powernv_centaur_probe(device_t dev) > { > > +#ifdef FDT > if (!(ofw_bus_is_compatible(dev, "ibm,centaur"))) > +#endif > return (ENXIO); > > device_set_desc(dev, "centaur"); > @@ -92,6 +97,7 @@ powernv_centaur_probe(device_t dev) > static int > powernv_centaur_attach(device_t dev) > { > +#ifdef FDT > phandle_t child; > device_t cdev; > struct ofw_bus_devinfo *dinfo; > @@ -115,13 +121,18 @@ powernv_centaur_attach(device_t dev) > } > > return (bus_generic_attach(dev)); > +#else > + return (ENXIO); > +#endif > } > > +#ifdef FDT > static const struct ofw_bus_devinfo * > powernv_centaur_get_devinfo(device_t dev, device_t child) > { > return (device_get_ivars(child)); > } > +#endif > > DEFINE_CLASS_0(powernv_centaur, powernv_centaur_driver, powernv_centaur_methods, > sizeof(struct powernv_centaur_softc)); > > Modified: head/sys/powerpc/powernv/powernv_xscom.c > ============================================================================== > --- head/sys/powerpc/powernv/powernv_xscom.c Wed Mar 14 08:48:40 2018 (r330924) > +++ head/sys/powerpc/powernv/powernv_xscom.c Wed Mar 14 09:20:03 2018 (r330925) > @@ -57,14 +57,17 @@ struct powernv_xscom_softc > > static int powernv_xscom_attach(device_t); > static int powernv_xscom_probe(device_t); > +#ifdef FDT > static const struct ofw_bus_devinfo * > powernv_xscom_get_devinfo(device_t, device_t); > +#endif > > static device_method_t powernv_xscom_methods[] = { > /* Device interface */ > DEVMETHOD(device_probe, powernv_xscom_probe), > DEVMETHOD(device_attach, powernv_xscom_attach), > > +#ifdef FDT > /* ofw_bus interface */ > DEVMETHOD(ofw_bus_get_devinfo, powernv_xscom_get_devinfo), > DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), > @@ -72,6 +75,7 @@ static device_method_t powernv_xscom_methods[] = { > DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), > DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), > DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), > +#endif > > DEVMETHOD_END > }; > @@ -82,7 +86,9 @@ static int > powernv_xscom_probe(device_t dev) > { > > +#ifdef FDT > if (!(ofw_bus_is_compatible(dev, "ibm,xscom"))) > +#endif > return (ENXIO); > > device_set_desc(dev, "xscom"); > @@ -92,6 +98,7 @@ powernv_xscom_probe(device_t dev) > static int > powernv_xscom_attach(device_t dev) > { > +#ifdef FDT > phandle_t child; > device_t cdev; > struct ofw_bus_devinfo *dinfo; > @@ -115,13 +122,18 @@ powernv_xscom_attach(device_t dev) > } > > return (bus_generic_attach(dev)); > +#else > + return (ENXIO); > +#endif > } > > +#ifdef FDT > static const struct ofw_bus_devinfo * > powernv_xscom_get_devinfo(device_t dev, device_t child) > { > return (device_get_ivars(child)); > } > +#endif > > DEFINE_CLASS_0(powernv_xscom, powernv_xscom_driver, powernv_xscom_methods, > sizeof(struct powernv_xscom_softc)); >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cdfbe502-9bba-b012-aa38-905619535840>