Author: mav
Date: Thu Jun 14 16:58:03 2018
New Revision: 335151
URL: https://svnweb.freebsd.org/changeset/base/335151

Log:
  MFC r332897 (by imp), r333123:
  Migrate to make_dev_s interface to populate /dev/nvmeX entries

Modified:
  stable/11/sys/dev/nvme/nvme_ns.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/nvme/nvme_ns.c
==============================================================================
--- stable/11/sys/dev/nvme/nvme_ns.c    Thu Jun 14 16:51:39 2018        
(r335150)
+++ stable/11/sys/dev/nvme/nvme_ns.c    Thu Jun 14 16:58:03 2018        
(r335151)
@@ -479,7 +479,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;
 
        ns->ctrlr = ctrlr;
@@ -562,15 +564,19 @@ 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;
+       md_args.mda_si_drv1 = ns;
+       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;
 
        return (0);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to