Revert "Define PNP info after defining driver modules"

This reverts commit aa37baf3d7.

The reverted commit was motivated by a problem observed on stable/12,
but it turns out that a better solution was committed in r348309 but not
MFCed.  So, revert this change since it is unnecessary and not really
correct: it assumes that the order in which module metadata records is
defined determines their order in the output linker set.  While this
seems to hold in my testing, it is not guaranteed.

Reported by:	cem
Discussed with:	imp
MFC after:	3 days
This commit is contained in:
Mark Johnston 2021-01-23 10:55:09 -05:00
parent 9940ac808d
commit 519b64e27f
11 changed files with 19 additions and 31 deletions

View File

@ -96,6 +96,7 @@ static struct ofw_compat_data compat_data[] = {
{"ti,am335x-timer-1ms", 1}, {"ti,am335x-timer-1ms", 1},
{NULL, 0}, {NULL, 0},
}; };
SIMPLEBUS_PNP_INFO(compat_data);
/* /*
* A table relating pad names to the hardware timer number they can be mux'd to. * A table relating pad names to the hardware timer number they can be mux'd to.
@ -617,5 +618,4 @@ static driver_t dmtpps_driver = {
static devclass_t dmtpps_devclass; static devclass_t dmtpps_devclass;
DRIVER_MODULE(am335x_dmtpps, simplebus, dmtpps_driver, dmtpps_devclass, 0, 0); DRIVER_MODULE(am335x_dmtpps, simplebus, dmtpps_driver, dmtpps_devclass, 0, 0);
SIMPLEBUS_PNP_INFO(compat_data);
MODULE_DEPEND(am335x_dmtpps, ti_sysc, 1, 1, 1); MODULE_DEPEND(am335x_dmtpps, ti_sysc, 1, 1, 1);

View File

@ -199,6 +199,7 @@ static struct ofw_compat_data compat_data[] = {
{"ti,am33xx-ehrpwm", true}, {"ti,am33xx-ehrpwm", true},
{NULL, false}, {NULL, false},
}; };
SIMPLEBUS_PNP_INFO(compat_data);
static void static void
am335x_ehrpwm_cfg_duty(struct am335x_ehrpwm_softc *sc, u_int chan, u_int duty) am335x_ehrpwm_cfg_duty(struct am335x_ehrpwm_softc *sc, u_int chan, u_int duty)
@ -712,7 +713,6 @@ static driver_t am335x_ehrpwm_driver = {
static devclass_t am335x_ehrpwm_devclass; static devclass_t am335x_ehrpwm_devclass;
DRIVER_MODULE(am335x_ehrpwm, am335x_pwmss, am335x_ehrpwm_driver, am335x_ehrpwm_devclass, 0, 0); DRIVER_MODULE(am335x_ehrpwm, am335x_pwmss, am335x_ehrpwm_driver, am335x_ehrpwm_devclass, 0, 0);
SIMPLEBUS_PNP_INFO(compat_data);
MODULE_VERSION(am335x_ehrpwm, 1); MODULE_VERSION(am335x_ehrpwm, 1);
MODULE_DEPEND(am335x_ehrpwm, am335x_pwmss, 1, 1, 1); MODULE_DEPEND(am335x_ehrpwm, am335x_pwmss, 1, 1, 1);
MODULE_DEPEND(am335x_ehrpwm, pwmbus, 1, 1, 1); MODULE_DEPEND(am335x_ehrpwm, pwmbus, 1, 1, 1);

View File

@ -65,6 +65,8 @@ static struct ofw_compat_data compat_data[] = {
{"gpioiic", true}, /* Deprecated old freebsd compat string */ {"gpioiic", true}, /* Deprecated old freebsd compat string */
{NULL, false} {NULL, false}
}; };
OFWBUS_PNP_INFO(compat_data);
SIMPLEBUS_PNP_INFO(compat_data);
static phandle_t static phandle_t
gpioiic_get_node(device_t bus, device_t dev) gpioiic_get_node(device_t bus, device_t dev)
@ -368,13 +370,7 @@ static driver_t gpioiic_driver = {
}; };
DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0); DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0);
#ifdef FDT
OFWBUS_PNP_INFO(compat_data);
#endif
DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0); DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0);
#ifdef FDT
SIMPLEBUS_PNP_INFO(compat_data);
#endif
DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0);
MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1); MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1);

View File

@ -47,6 +47,7 @@ static struct ofw_compat_data compat_data[] = {
{"pps-gpio", 1}, {"pps-gpio", 1},
{NULL, 0} {NULL, 0}
}; };
SIMPLEBUS_PNP_INFO(compat_data);
#endif /* FDT */ #endif /* FDT */
static devclass_t pps_devclass; static devclass_t pps_devclass;
@ -290,6 +291,5 @@ static driver_t pps_fdt_driver = {
}; };
DRIVER_MODULE(gpiopps, simplebus, pps_fdt_driver, pps_devclass, 0, 0); DRIVER_MODULE(gpiopps, simplebus, pps_fdt_driver, pps_devclass, 0, 0);
SIMPLEBUS_PNP_INFO(compat_data);
#endif /* FDT */ #endif /* FDT */

View File

@ -72,6 +72,8 @@ static struct ofw_compat_data compat_data[] = {
{"dht11", true}, {"dht11", true},
{NULL, false} {NULL, false}
}; };
OFWBUS_PNP_INFO(compat_data);
SIMPLEBUS_PNP_INFO(compat_data);
#endif /* FDT */ #endif /* FDT */
#define PIN_IDX 0 /* Use the first/only configured pin. */ #define PIN_IDX 0 /* Use the first/only configured pin. */
@ -409,11 +411,7 @@ DEFINE_CLASS_0(gpioths, gpioths_driver, gpioths_methods, sizeof(struct gpioths_s
#ifdef FDT #ifdef FDT
DRIVER_MODULE(gpioths, simplebus, gpioths_driver, gpioths_devclass, 0, 0); DRIVER_MODULE(gpioths, simplebus, gpioths_driver, gpioths_devclass, 0, 0);
SIMPLEBUS_PNP_INFO(compat_data);
#endif #endif
DRIVER_MODULE(gpioths, gpiobus, gpioths_driver, gpioths_devclass, 0, 0); DRIVER_MODULE(gpioths, gpiobus, gpioths_driver, gpioths_devclass, 0, 0);
#ifdef FDT
OFWBUS_PNP_INFO(compat_data);
#endif
MODULE_DEPEND(gpioths, gpiobus, 1, 1, 1); MODULE_DEPEND(gpioths, gpiobus, 1, 1, 1);

View File

@ -152,6 +152,7 @@ static struct ofw_compat_data compat_data[] = {
{"ti,ads1115", (uintptr_t)&ads111x_chip_infos[5]}, {"ti,ads1115", (uintptr_t)&ads111x_chip_infos[5]},
{NULL, (uintptr_t)NULL}, {NULL, (uintptr_t)NULL},
}; };
IICBUS_FDT_PNP_INFO(compat_data);
#endif #endif
struct ads111x_softc { struct ads111x_softc {
@ -608,8 +609,5 @@ static driver_t ads111x_driver = {
static devclass_t ads111x_devclass; static devclass_t ads111x_devclass;
DRIVER_MODULE(ads111x, iicbus, ads111x_driver, ads111x_devclass, NULL, NULL); DRIVER_MODULE(ads111x, iicbus, ads111x_driver, ads111x_devclass, NULL, NULL);
#ifdef FDT
IICBUS_FDT_PNP_INFO(compat_data);
#endif
MODULE_VERSION(ads111x, 1); MODULE_VERSION(ads111x, 1);
MODULE_DEPEND(ads111x, iicbus, 1, 1, 1); MODULE_DEPEND(ads111x, iicbus, 1, 1, 1);

View File

@ -58,6 +58,8 @@ static struct ofw_compat_data compat_data[] = {
{"i2c-mux-gpio", true}, {"i2c-mux-gpio", true},
{NULL, false} {NULL, false}
}; };
OFWBUS_PNP_INFO(compat_data);
SIMPLEBUS_PNP_INFO(compat_data);
#endif /* FDT */ #endif /* FDT */
#include <dev/iicbus/iiconf.h> #include <dev/iicbus/iiconf.h>
@ -253,13 +255,7 @@ static devclass_t gpiomux_devclass;
DEFINE_CLASS_1(iic_gpiomux, iic_gpiomux_driver, gpiomux_methods, DEFINE_CLASS_1(iic_gpiomux, iic_gpiomux_driver, gpiomux_methods,
sizeof(struct gpiomux_softc), iicmux_driver); sizeof(struct gpiomux_softc), iicmux_driver);
DRIVER_MODULE(iic_gpiomux, simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0); DRIVER_MODULE(iic_gpiomux, simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0);
#ifdef FDT
SIMPLEBUS_PNP_INFO(compat_data);
#endif
DRIVER_MODULE(iic_gpiomux, ofw_simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0); DRIVER_MODULE(iic_gpiomux, ofw_simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0);
#ifdef FDT
OFWBUS_PNP_INFO(compat_data);
#endif
#ifdef FDT #ifdef FDT
DRIVER_MODULE(ofw_iicbus, iic_gpiomux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, iic_gpiomux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0);

View File

@ -63,6 +63,7 @@ static struct ofw_compat_data compat_data[] = {
{"lltc,ltc4306", CHIP_LTC4306}, {"lltc,ltc4306", CHIP_LTC4306},
{NULL, CHIP_NONE} {NULL, CHIP_NONE}
}; };
IICBUS_FDT_PNP_INFO(compat_data);
#endif #endif
#include <dev/iicbus/mux/iicmux.h> #include <dev/iicbus/mux/iicmux.h>
@ -245,8 +246,8 @@ static devclass_t ltc430x_devclass;
DEFINE_CLASS_1(ltc430x, ltc430x_driver, ltc430x_methods, DEFINE_CLASS_1(ltc430x, ltc430x_driver, ltc430x_methods,
sizeof(struct ltc430x_softc), iicmux_driver); sizeof(struct ltc430x_softc), iicmux_driver);
DRIVER_MODULE(ltc430x, iicbus, ltc430x_driver, ltc430x_devclass, 0, 0); DRIVER_MODULE(ltc430x, iicbus, ltc430x_driver, ltc430x_devclass, 0, 0);
#ifdef FDT #ifdef FDT
IICBUS_FDT_PNP_INFO(compat_data);
DRIVER_MODULE(ofw_iicbus, ltc430x, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, ltc430x, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0);
#else #else
DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0);
@ -254,3 +255,4 @@ DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0);
MODULE_DEPEND(ltc430x, iicmux, 1, 1, 1); MODULE_DEPEND(ltc430x, iicmux, 1, 1, 1);
MODULE_DEPEND(ltc430x, iicbus, 1, 1, 1); MODULE_DEPEND(ltc430x, iicbus, 1, 1, 1);

View File

@ -50,6 +50,7 @@ static struct ofw_compat_data compat_data[] = {
{"nxp,pca9547", 1}, {"nxp,pca9547", 1},
{NULL, 0} {NULL, 0}
}; };
IICBUS_FDT_PNP_INFO(compat_data);
#include <dev/iicbus/mux/iicmux.h> #include <dev/iicbus/mux/iicmux.h>
@ -154,7 +155,6 @@ static devclass_t pca9547_devclass;
DEFINE_CLASS_1(iicmux, pca9547_driver, pca9547_methods, DEFINE_CLASS_1(iicmux, pca9547_driver, pca9547_methods,
sizeof(struct pca9547_softc), iicmux_driver); sizeof(struct pca9547_softc), iicmux_driver);
DRIVER_MODULE(pca_iicmux, iicbus, pca9547_driver, pca9547_devclass, 0, 0); DRIVER_MODULE(pca_iicmux, iicbus, pca9547_driver, pca9547_devclass, 0, 0);
IICBUS_FDT_PNP_INFO(compat_data);
DRIVER_MODULE(iicbus, iicmux, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(iicbus, iicmux, iicbus_driver, iicbus_devclass, 0, 0);
DRIVER_MODULE(ofw_iicbus, iicmux, ofw_iicbus_driver, ofw_iicbus_devclass, DRIVER_MODULE(ofw_iicbus, iicmux, ofw_iicbus_driver, ofw_iicbus_devclass,
0, 0); 0, 0);

View File

@ -49,6 +49,8 @@ static struct ofw_compat_data compat_data[] = {
{"w1-gpio", true}, {"w1-gpio", true},
{NULL, false} {NULL, false}
}; };
OFWBUS_PNP_INFO(compat_data);
SIMPLEBUS_PNP_INFO(compat_data);
#endif /* FDT */ #endif /* FDT */
#define OW_PIN 0 #define OW_PIN 0
@ -392,13 +394,9 @@ static driver_t owc_gpiobus_driver = {
#ifdef FDT #ifdef FDT
DRIVER_MODULE(owc_gpiobus, simplebus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); DRIVER_MODULE(owc_gpiobus, simplebus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0);
SIMPLEBUS_PNP_INFO(compat_data);
#endif #endif
DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0);
#ifdef FDT
OFWBUS_PNP_INFO(compat_data);
#endif
MODULE_DEPEND(owc_gpiobus, ow, 1, 1, 1); MODULE_DEPEND(owc_gpiobus, ow, 1, 1, 1);
MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1); MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1);
MODULE_VERSION(owc_gpiobus, 1); MODULE_VERSION(owc_gpiobus, 1);

View File

@ -52,6 +52,9 @@ static struct ofw_compat_data compat_data[] = {
{"freebsd,pwmc", true}, {"freebsd,pwmc", true},
{NULL, false}, {NULL, false},
}; };
PWMBUS_FDT_PNP_INFO(compat_data);
#endif #endif
struct pwmc_softc { struct pwmc_softc {
@ -203,8 +206,5 @@ static driver_t pwmc_driver = {
static devclass_t pwmc_devclass; static devclass_t pwmc_devclass;
DRIVER_MODULE(pwmc, pwmbus, pwmc_driver, pwmc_devclass, 0, 0); DRIVER_MODULE(pwmc, pwmbus, pwmc_driver, pwmc_devclass, 0, 0);
#ifdef FDT
PWMBUS_FDT_PNP_INFO(compat_data);
#endif
MODULE_DEPEND(pwmc, pwmbus, 1, 1, 1); MODULE_DEPEND(pwmc, pwmbus, 1, 1, 1);
MODULE_VERSION(pwmc, 1); MODULE_VERSION(pwmc, 1);