Allow i2c hardware drivers to declare their own relationships to ofw_iicbus

rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in
the ofw_iicbus source.  This means hw drivers will no longer be required to
use one of a few predefined driver names.  They will also now be able to
decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE
and to set which pass to attach on for early modules.

Mainly, this adds extern declarations for the driver and devclass variables.
It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant
with the way we use ofw_ prefixes on this stuff.
This commit is contained in:
ian 2018-02-18 19:33:28 +00:00
parent 91b2a928ff
commit 123fced6e5
2 changed files with 6 additions and 4 deletions

View File

@ -77,5 +77,7 @@ void iicbus_init_frequency(device_t dev, u_int bus_freq);
extern driver_t iicbus_driver;
extern devclass_t iicbus_devclass;
extern driver_t ofw_iicbus_driver;
extern devclass_t ofw_iicbus_devclass;
#endif

View File

@ -76,15 +76,15 @@ struct ofw_iicbus_devinfo {
struct ofw_bus_devinfo opd_obdinfo;
};
devclass_t ofwiicbus_devclass;
devclass_t ofw_iicbus_devclass;
DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods,
sizeof(struct iicbus_softc), iicbus_driver);
EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass,
EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofw_iicbus_devclass,
0, 0, BUS_PASS_BUS);
EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass,
EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofw_iicbus_devclass,
0, 0, BUS_PASS_BUS);
EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofwiicbus_devclass,
EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofw_iicbus_devclass,
0, 0, BUS_PASS_BUS);
MODULE_VERSION(ofw_iicbus, 1);
MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1);