Author: imp
Date: Mon Apr 23 22:30:17 2018
New Revision: 332897
URL: https://svnweb.freebsd.org/changeset/base/332897

Log:
  Migrate to make_dev_s interface to populate /dev/nvmeX entries
  
  Submitted by: Michael Hordijk
  Differential Revision: https://reviews.freebsd.org/D15162

Modified:
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sys/dev/nvme/nvme_ns.c
==============================================================================
--- head/sys/dev/nvme/nvme_ns.c Mon Apr 23 22:28:49 2018        (r332896)
+++ head/sys/dev/nvme/nvme_ns.c Mon Apr 23 22:30:17 2018        (r332897)
@@ -494,7 +494,9 @@ int
 nvme_ns_construct(struct nvme_namespace *ns, uint32_t id,
     struct nvme_controller *ctrlr)
 {
+       struct make_dev_args                    md_args;
        struct nvme_completion_poll_status      status;
+       int                                     res;
        int                                     unit;
        uint16_t                                oncs;
        uint8_t                                 dsm;
@@ -590,15 +592,20 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t 
         */
        unit = device_get_unit(ctrlr->dev) * NVME_MAX_NAMESPACES + ns->id - 1;
 
-       ns->cdev = make_dev_credf(0, &nvme_ns_cdevsw, unit,
-           NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d",
+       make_dev_args_init(&md_args);
+       md_args.mda_devsw = &nvme_ns_cdevsw;
+       md_args.mda_unit = unit;
+       md_args.mda_mode = 0600;
+       res = make_dev_s(&md_args, &ns->cdev, "nvme%dns%d",
            device_get_unit(ctrlr->dev), ns->id);
+       if (res != 0)
+               return (ENXIO);
+
 #ifdef NVME_UNMAPPED_BIO_SUPPORT
        ns->cdev->si_flags |= SI_UNMAPPED;
 #endif
 
-       if (ns->cdev != NULL)
-               ns->cdev->si_drv1 = ns;
+       ns->cdev->si_drv1 = ns;
 
        return (0);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to