mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 20:04:46 +00:00
nvme: Eliminate the offset of one during block dev creation
At present there is an offset of one added during the creation of block device. This can be very confusing as we wanted to encode the namespace id in the block device name but namespae id cannot be zero. This changes to use the namespace id directly in the block device name, eliminating the offset of one effectively. Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
478f7fc6a0
commit
8c60d40d69
1 changed files with 3 additions and 3 deletions
|
@ -708,7 +708,7 @@ static int nvme_blk_probe(struct udevice *udev)
|
||||||
memset(ns, 0, sizeof(*ns));
|
memset(ns, 0, sizeof(*ns));
|
||||||
ns->dev = ndev;
|
ns->dev = ndev;
|
||||||
/* extract the namespace id from the block device name */
|
/* extract the namespace id from the block device name */
|
||||||
ns->ns_id = trailing_strtol(udev->name) + 1;
|
ns->ns_id = trailing_strtol(udev->name);
|
||||||
if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)(long)id)) {
|
if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)(long)id)) {
|
||||||
free(id);
|
free(id);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -887,12 +887,12 @@ static int nvme_probe(struct udevice *udev)
|
||||||
goto free_queue;
|
goto free_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ndev->nn; i++) {
|
for (int i = 1; i <= ndev->nn; i++) {
|
||||||
struct udevice *ns_udev;
|
struct udevice *ns_udev;
|
||||||
char name[20];
|
char name[20];
|
||||||
|
|
||||||
memset(id, 0, sizeof(*id));
|
memset(id, 0, sizeof(*id));
|
||||||
if (nvme_identify(ndev, i + 1, 0, (dma_addr_t)(long)id)) {
|
if (nvme_identify(ndev, i, 0, (dma_addr_t)(long)id)) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto free_id;
|
goto free_id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue