summaryrefslogtreecommitdiffstats
path: root/sys/dev/ichsmb/ichsmb.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ichsmb/ichsmb.c')
-rw-r--r--sys/dev/ichsmb/ichsmb.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c
index aed9396..2cfb564 100644
--- a/sys/dev/ichsmb/ichsmb.c
+++ b/sys/dev/ichsmb/ichsmb.c
@@ -96,14 +96,6 @@ static int ichsmb_wait(sc_p sc);
int
ichsmb_probe(device_t dev)
{
- device_t smb;
-
- /* Add child: an instance of the "smbus" device */
- if ((smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) {
- log(LOG_ERR, "%s: no \"%s\" child found\n",
- device_get_nameunit(dev), DRIVER_SMBUS);
- return (ENXIO);
- }
return (BUS_PROBE_DEFAULT);
}
@@ -116,6 +108,14 @@ ichsmb_attach(device_t dev)
{
const sc_p sc = device_get_softc(dev);
int error;
+ device_t smb;
+
+ /* Add child: an instance of the "smbus" device */
+ if ((smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) {
+ log(LOG_ERR, "%s: no \"%s\" child found\n",
+ device_get_nameunit(dev), DRIVER_SMBUS);
+ return (ENXIO);
+ }
/* Clear interrupt conditions */
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, 0xff);
@@ -675,3 +675,17 @@ ichsmb_release_resources(sc_p sc)
}
}
+int ichsmb_detach(device_t dev)
+{
+#if 0
+ const sc_p sc = device_get_softc(dev);
+ bus_generic_detach(dev);
+ device_delete_child(dev, sc->smb);
+ ichsmb_release_resources(sc);
+
+ return 0;
+#else
+ /*smbus drivers don't handle detach child properly*/
+ return EBUSY;
+#endif
+}
OpenPOWER on IntegriCloud