acpi/nfit, libnvdimm: Add unlock of nvdimm support for Intel DIMMs
[linux-2.6-microblaze.git] / drivers / nvdimm / dimm.c
index 9899c97..1b3d9e7 100644 (file)
@@ -34,7 +34,11 @@ static int nvdimm_probe(struct device *dev)
                return rc;
        }
 
-       /* reset locked, to be validated below... */
+       /*
+        * The locked status bit reflects explicit status codes from the
+        * label reading commands, revalidate it each time the driver is
+        * activated and re-reads the label area.
+        */
        nvdimm_clear_locked(dev);
 
        ndd = kzalloc(sizeof(*ndd), GFP_KERNEL);
@@ -51,6 +55,16 @@ static int nvdimm_probe(struct device *dev)
        get_device(dev);
        kref_init(&ndd->kref);
 
+       /*
+        * Attempt to unlock, if the DIMM supports security commands,
+        * otherwise the locked indication is determined by explicit
+        * status codes from the label reading commands.
+        */
+       rc = nvdimm_security_unlock(dev);
+       if (rc < 0)
+               dev_err(dev, "failed to unlock dimm: %d\n", rc);
+
+
        /*
         * EACCES failures reading the namespace label-area-properties
         * are interpreted as the DIMM capacity being locked but the