Author: kib
Date: Sat Feb 20 13:21:59 2016
New Revision: 295839
URL: https://svnweb.freebsd.org/changeset/base/295839

Log:
  Switch /dev/hpet to use make_dev_s(9).  Device needs si_drv1
  initializated, do it correctly even though hpet cannot be loaded as
  module.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/dev/acpica/acpi_hpet.c

Modified: head/sys/dev/acpica/acpi_hpet.c
==============================================================================
--- head/sys/dev/acpica/acpi_hpet.c     Sat Feb 20 12:53:53 2016        
(r295838)
+++ head/sys/dev/acpica/acpi_hpet.c     Sat Feb 20 13:21:59 2016        
(r295839)
@@ -422,8 +422,9 @@ hpet_attach(device_t dev)
 {
        struct hpet_softc *sc;
        struct hpet_timer *t;
+       struct make_dev_args mda;
        int i, j, num_msi, num_timers, num_percpu_et, num_percpu_t, cur_cpu;
-       int pcpu_master;
+       int pcpu_master, error;
        static int maxhpetet = 0;
        uint32_t val, val2, cvectors, dvectors;
        uint16_t vendor, rev;
@@ -746,10 +747,14 @@ hpet_attach(device_t dev)
                }
        }
 
-       sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL,
-           0600, "hpet%d", device_get_unit(dev));
-       if (sc->pdev) {
-               sc->pdev->si_drv1 = sc;
+       make_dev_args_init(&mda);
+       mda.mda_devsw = &hpet_cdevsw;
+       mda.mda_uid = UID_ROOT;
+       mda.mda_gid = GID_WHEEL;
+       mda.mda_mode = 0600;
+       mda.mda_si_drv1 = sc;
+       error = make_dev_s(&mda, &sc->pdev, "hpet%d", device_get_unit(dev));
+       if (error == 0) {
                sc->mmap_allow = 1;
                TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow",
                    &sc->mmap_allow);
@@ -766,9 +771,10 @@ hpet_attach(device_t dev)
                    OID_AUTO, "mmap_allow_write",
                    CTLFLAG_RW, &sc->mmap_allow_write, 0,
                    "Allow userland write to the HPET register space");
-       } else
-               device_printf(dev, "could not create /dev/hpet%d\n",
-                   device_get_unit(dev));
+       } else {
+               device_printf(dev, "could not create /dev/hpet%d, error %d\n",
+                   device_get_unit(dev), error);
+       }
 
        return (0);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to