summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2013-01-11 21:42:23 +0000
committerimp <imp@FreeBSD.org>2013-01-11 21:42:23 +0000
commit32e8f5df879b7348e52a40e7caef786d515b2ae2 (patch)
tree4515906cca2f36bacfc681d529c3bdd43960fa89
parent376c20d463471553642222194d6f753af4b3a8b3 (diff)
downloadFreeBSD-src-32e8f5df879b7348e52a40e7caef786d515b2ae2.zip
FreeBSD-src-32e8f5df879b7348e52a40e7caef786d515b2ae2.tar.gz
Pass the device_t into atkbd_{probe,attach}_unit and get the
controller unit and keyboard unit from there. It will be needed for other things in the future as well...
-rw-r--r--sys/dev/atkbdc/atkbd.c12
-rw-r--r--sys/dev/atkbdc/atkbd_atkbdc.c8
-rw-r--r--sys/dev/atkbdc/atkbdreg.h5
3 files changed, 11 insertions, 14 deletions
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c
index 52def3f..199fcb1 100644
--- a/sys/dev/atkbdc/atkbd.c
+++ b/sys/dev/atkbdc/atkbd.c
@@ -66,7 +66,7 @@ static timeout_t atkbd_timeout;
static void atkbd_shutdown_final(void *v);
int
-atkbd_probe_unit(int unit, int ctlr, int irq, int flags)
+atkbd_probe_unit(device_t dev, int irq, int flags)
{
keyboard_switch_t *sw;
int args[2];
@@ -76,27 +76,29 @@ atkbd_probe_unit(int unit, int ctlr, int irq, int flags)
if (sw == NULL)
return ENXIO;
- args[0] = ctlr;
+ args[0] = device_get_unit(device_get_parent(dev));
args[1] = irq;
- error = (*sw->probe)(unit, args, flags);
+ error = (*sw->probe)(device_get_unit(dev), args, flags);
if (error)
return error;
return 0;
}
int
-atkbd_attach_unit(int unit, keyboard_t **kbd, int ctlr, int irq, int flags)
+atkbd_attach_unit(device_t dev, keyboard_t **kbd, int irq, int flags)
{
keyboard_switch_t *sw;
int args[2];
int error;
+ int unit;
sw = kbd_get_switch(ATKBD_DRIVER_NAME);
if (sw == NULL)
return ENXIO;
/* reset, initialize and enable the device */
- args[0] = ctlr;
+ unit = device_get_unit(dev);
+ args[0] = device_get_unit(device_get_parent(dev));
args[1] = irq;
*kbd = NULL;
error = (*sw->probe)(unit, args, flags);
diff --git a/sys/dev/atkbdc/atkbd_atkbdc.c b/sys/dev/atkbdc/atkbd_atkbdc.c
index 8181820..dd0a9d6 100644
--- a/sys/dev/atkbdc/atkbd_atkbdc.c
+++ b/sys/dev/atkbdc/atkbd_atkbdc.c
@@ -104,9 +104,7 @@ atkbdprobe(device_t dev)
bus_release_resource(dev, SYS_RES_IRQ, rid, res);
/* probe the device */
- return atkbd_probe_unit(device_get_unit(dev),
- device_get_unit(device_get_parent(dev)),
- irq, flags);
+ return atkbd_probe_unit(dev, irq, flags);
}
static int
@@ -124,9 +122,7 @@ atkbdattach(device_t dev)
rid = KBDC_RID_KBD;
irq = bus_get_resource_start(dev, SYS_RES_IRQ, rid);
flags = device_get_flags(dev);
- error = atkbd_attach_unit(device_get_unit(dev), &kbd,
- device_get_unit(device_get_parent(dev)),
- irq, flags);
+ error = atkbd_attach_unit(dev, &kbd, irq, flags);
if (error)
return error;
diff --git a/sys/dev/atkbdc/atkbdreg.h b/sys/dev/atkbdc/atkbdreg.h
index cf7ee6b..3d09e44 100644
--- a/sys/dev/atkbdc/atkbdreg.h
+++ b/sys/dev/atkbdc/atkbdreg.h
@@ -39,9 +39,8 @@
#ifdef _KERNEL
-int atkbd_probe_unit(int unit, int ctlr, int irq, int flags);
-int atkbd_attach_unit(int unit, keyboard_t **kbd,
- int ctlr, int irq, int flags);
+int atkbd_probe_unit(device_t dev, int irq, int flags);
+int atkbd_attach_unit(device_t dev, keyboard_t **kbd, int irq, int flags);
#endif
OpenPOWER on IntegriCloud