Author: imp
Date: Fri Jan 11 21:42:23 2013
New Revision: 245315
URL: http://svnweb.freebsd.org/changeset/base/245315

Log:
  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...

Modified:
  head/sys/dev/atkbdc/atkbd.c
  head/sys/dev/atkbdc/atkbd_atkbdc.c
  head/sys/dev/atkbdc/atkbdreg.h

Modified: head/sys/dev/atkbdc/atkbd.c
==============================================================================
--- head/sys/dev/atkbdc/atkbd.c Fri Jan 11 21:19:45 2013        (r245314)
+++ head/sys/dev/atkbdc/atkbd.c Fri Jan 11 21:42:23 2013        (r245315)
@@ -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
        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);

Modified: head/sys/dev/atkbdc/atkbd_atkbdc.c
==============================================================================
--- head/sys/dev/atkbdc/atkbd_atkbdc.c  Fri Jan 11 21:19:45 2013        
(r245314)
+++ head/sys/dev/atkbdc/atkbd_atkbdc.c  Fri Jan 11 21:42:23 2013        
(r245315)
@@ -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;
 

Modified: head/sys/dev/atkbdc/atkbdreg.h
==============================================================================
--- head/sys/dev/atkbdc/atkbdreg.h      Fri Jan 11 21:19:45 2013        
(r245314)
+++ head/sys/dev/atkbdc/atkbdreg.h      Fri Jan 11 21:42:23 2013        
(r245315)
@@ -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
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to