Skip to contentSkip to conversation

nvmet: Use nvmet_is_port_enabled helper for pi_enable

PATCH Applied Israel Rukshin 2 participants 3 messages Jan 7, 2021 – Jan 12, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nvmet: Use nvmet_is_port_enabled helper for pi_enable

Remove code duplication.

---
 drivers/nvme/target/configfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvme/target/configfs.c +1 -3
index c61ffd767062..b2021bf6cee5 100644
@@ -266,10 +266,8 @@ static ssize_t nvmet_param_pi_enable_store(struct config_item *item,
 	if (strtobool(page, &val))
 		return -EINVAL;
 
-	if (port->enabled) {
-		pr_err("Disable port before setting pi_enable value.\n");
+	if (nvmet_is_port_enabled(port, __func__))
 		return -EACCES;
-	}
 
 	port->pi_enable = val;
 	return count;
Signature · 7 lines
2.18.2


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#1 lore raw

PATCH 2/2 nvmet: Fix nvmet_is_port_enabled indentation

Remove extra tab.

---
 drivers/nvme/target/configfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/configfs.c +1 -1
index b2021bf6cee5..635a7cb45d0b 100644
@@ -45,7 +45,7 @@ static bool nvmet_is_port_enabled(struct nvmet_port *p, const char *caller)
 {
 	if (p->enabled)
 		pr_err("Disable port '%u' before changing attribute in %s\n",
-				le16_to_cpu(p->disc_addr.portid), caller);
+		       le16_to_cpu(p->disc_addr.portid), caller);
 	return p->enabled;
 }
 
Signature · 7 lines
2.18.2


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme