Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvme: zns: Simplify nvme_zone_parse_entry()

Instead of passing a pointer to a struct nvme_ctrl and a pointer to a
struct nvme_ns_head as the first two arguments of
nvme_zone_parse_entry(), pass only a pointer to a struct nvme_ns as both
the controller structure and ns head structure can be infered from the
namespace structure.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Damien Le Moal and committed by
Keith Busch
945e8263 ba65af9a

+4 -6
+4 -6
drivers/nvme/host/zns.c
··· 146 146 return NULL; 147 147 } 148 148 149 - static int nvme_zone_parse_entry(struct nvme_ctrl *ctrl, 150 - struct nvme_ns_head *head, 149 + static int nvme_zone_parse_entry(struct nvme_ns *ns, 151 150 struct nvme_zone_descriptor *entry, 152 151 unsigned int idx, report_zones_cb cb, 153 152 void *data) 154 153 { 154 + struct nvme_ns_head *head = ns->head; 155 155 struct blk_zone zone = { }; 156 156 157 157 if ((entry->zt & 0xf) != NVME_ZONE_TYPE_SEQWRITE_REQ) { 158 - dev_err(ctrl->device, "invalid zone type %#x\n", 159 - entry->zt); 158 + dev_err(ns->ctrl->device, "invalid zone type %#x\n", entry->zt); 160 159 return -EINVAL; 161 160 } 162 161 ··· 212 213 break; 213 214 214 215 for (i = 0; i < nz && zone_idx < nr_zones; i++) { 215 - ret = nvme_zone_parse_entry(ns->ctrl, ns->head, 216 - &report->entries[i], 216 + ret = nvme_zone_parse_entry(ns, &report->entries[i], 217 217 zone_idx, cb, data); 218 218 if (ret) 219 219 goto out_free;