diff options
Diffstat (limited to 'drivers/nvme/host/core.c')
-rw-r--r-- | drivers/nvme/host/core.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d2c2b6f306..33a592caeb 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only #include <common.h> #include "nvme.h" @@ -20,7 +21,7 @@ int nvme_submit_sync_cmd(struct nvme_ctrl *ctrl, return __nvme_submit_sync_cmd(ctrl, cmd, NULL, buffer, bufflen, 0, NVME_QID_ADMIN); } -EXPORT_SYMBOL_GPL(nvme_sec_submit); +EXPORT_SYMBOL_GPL(nvme_submit_sync_cmd); static int nvme_identify_ctrl(struct nvme_ctrl *dev, struct nvme_id_ctrl **id) { @@ -222,7 +223,7 @@ static void __nvme_revalidate_disk(struct block_device *blk, } static void nvme_setup_rw(struct nvme_ns *ns, struct nvme_command *cmnd, - int block, int num_block) + sector_t block, blkcnt_t num_block) { cmnd->rw.nsid = cpu_to_le32(ns->head->ns_id); cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, block)); @@ -239,7 +240,7 @@ static void nvme_setup_flush(struct nvme_ns *ns, struct nvme_command *cmnd) } static int nvme_submit_sync_rw(struct nvme_ns *ns, struct nvme_command *cmnd, - void *buffer, int block, int num_blocks) + void *buffer, sector_t block, blkcnt_t num_blocks) { /* * ns->ctrl->max_hw_sectors is in units of 512 bytes, so we @@ -251,7 +252,7 @@ static int nvme_submit_sync_rw(struct nvme_ns *ns, struct nvme_command *cmnd, if (num_blocks > max_hw_sectors) { while (num_blocks) { - const int chunk = min_t(int, num_blocks, + const u32 chunk = min_t(blkcnt_t, num_blocks, max_hw_sectors); ret = nvme_submit_sync_rw(ns, cmnd, buffer, block, @@ -275,7 +276,7 @@ static int nvme_submit_sync_rw(struct nvme_ns *ns, struct nvme_command *cmnd, if (ret) { dev_err(ns->ctrl->dev, - "I/O failed: block: %d, num blocks: %d, status code type: %xh, status code %02xh\n", + "I/O failed: block: %llu, num blocks: %llu, status code type: %xh, status code %02xh\n", block, num_blocks, (ret >> 8) & 0xf, ret & 0xff); return -EIO; @@ -286,7 +287,7 @@ static int nvme_submit_sync_rw(struct nvme_ns *ns, struct nvme_command *cmnd, static int nvme_block_device_read(struct block_device *blk, void *buffer, - int block, int num_blocks) + sector_t block, blkcnt_t num_blocks) { struct nvme_ns *ns = to_nvme_ns(blk); struct nvme_command cmnd = { }; @@ -298,7 +299,7 @@ static int nvme_block_device_read(struct block_device *blk, void *buffer, static int __maybe_unused nvme_block_device_write(struct block_device *blk, const void *buffer, - int block, int num_blocks) + sector_t block, blkcnt_t num_blocks) { struct nvme_ns *ns = to_nvme_ns(blk); struct nvme_command cmnd = { }; @@ -360,6 +361,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) ns->blk.dev = ctrl->dev; ns->blk.ops = &nvme_block_device_ops; + ns->blk.type = BLK_TYPE_NVME; ns->blk.cdev.name = strdup(disk_name); __nvme_revalidate_disk(&ns->blk, id); @@ -600,7 +602,7 @@ EXPORT_SYMBOL_GPL(nvme_init_identify); * earliest initialization so that we have the initialized structured around * during probing. */ -int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device_d *dev, +int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, const struct nvme_ctrl_ops *ops) { static int instance = 0; |