nvmet: Use nvmet_is_port_enabled helper for pi_enable
Subsystems (2)
PATCH 1/2 nvmet: Use nvmet_is_port_enabled helper for pi_enable
Remove code duplication.
Signed-off-by Israel Rukshin <[email protected]>
Reviewed-by Max Gurtovoy <[email protected]>
--- drivers/nvme/target/configfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvme/target/configfs.c +1 -3
@@ -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
PATCH 2/2 nvmet: Fix nvmet_is_port_enabled indentation
Remove extra tab.
Signed-off-by Israel Rukshin <[email protected]>
Reviewed-by Max Gurtovoy <[email protected]>
--- drivers/nvme/target/configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/configfs.c +1 -1
@@ -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
Thanks,
applied to nvme-5.11.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme