Create "smb" device when "smbus" device is attached, so that it's

possible to load/unload smb.ko and smbus-implementing driver in
any order, and get expected results.
This commit is contained in:
Ruslan Ermilov 2005-12-20 21:06:57 +00:00
parent c8d81a41f4
commit 9a77af905e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153569
2 changed files with 11 additions and 11 deletions

View File

@ -58,13 +58,11 @@ struct smb_softc {
static int smb_probe(device_t);
static int smb_attach(device_t);
static int smb_detach(device_t);
static void smb_identify(driver_t *driver, device_t parent);
static devclass_t smb_devclass;
static device_method_t smb_methods[] = {
/* device interface */
DEVMETHOD(device_identify, smb_identify),
DEVMETHOD(device_probe, smb_probe),
DEVMETHOD(device_attach, smb_attach),
DEVMETHOD(device_detach, smb_detach),
@ -94,14 +92,6 @@ static struct cdevsw smb_cdevsw = {
.d_name = "smb",
};
static void
smb_identify(driver_t *driver, device_t parent)
{
if (!device_find_child(parent, "smb", -1))
device_add_child(parent, "smb", -1);
}
static int
smb_probe(device_t dev)
{

View File

@ -49,11 +49,12 @@ static devclass_t smbus_devclass;
* Device methods
*/
static int smbus_probe(device_t);
static int smbus_attach(device_t);
static device_method_t smbus_methods[] = {
/* device interface */
DEVMETHOD(device_probe, smbus_probe),
DEVMETHOD(device_attach, bus_generic_attach),
DEVMETHOD(device_attach, smbus_attach),
DEVMETHOD(device_detach, bus_generic_detach),
/* bus interface */
@ -81,6 +82,15 @@ smbus_probe(device_t dev)
return (0);
}
static int
smbus_attach(device_t dev)
{
device_add_child(dev, NULL, -1);
bus_generic_attach(dev);
return (0);
}
void
smbus_generic_intr(device_t dev, u_char devaddr, char low, char high)
{