2019-12-02 03:29:22

by Can Guo

[permalink] [raw]
Subject: [PATCH] scsi: ufs: Give an unique ID to each ufs-bsg

Considering there can be multiple UFS hosts in SoC, give each ufs-bsg an
unique ID by appending the scsi host number to its device name.

Signed-off-by: Can Guo <[email protected]>

diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c
index dc2f6d2..3ef5b78 100644
--- a/drivers/scsi/ufs/ufs_bsg.c
+++ b/drivers/scsi/ufs/ufs_bsg.c
@@ -202,7 +202,7 @@ int ufs_bsg_probe(struct ufs_hba *hba)
bsg_dev->parent = get_device(parent);
bsg_dev->release = ufs_bsg_node_release;

- dev_set_name(bsg_dev, "ufs-bsg");
+ dev_set_name(bsg_dev, "ufs-bsg%d", shost->host_no);

ret = device_add(bsg_dev);
if (ret)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2019-12-02 07:25:03

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH] scsi: ufs: Give an unique ID to each ufs-bsg

Hi,
>
> Considering there can be multiple UFS hosts in SoC, give each ufs-bsg an unique
> ID by appending the scsi host number to its device name.
Can you refer me to such a design?

Thanks,
Avri

>
> Signed-off-by: Can Guo <[email protected]>
>
> diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c index
> dc2f6d2..3ef5b78 100644
> --- a/drivers/scsi/ufs/ufs_bsg.c
> +++ b/drivers/scsi/ufs/ufs_bsg.c
> @@ -202,7 +202,7 @@ int ufs_bsg_probe(struct ufs_hba *hba)
> bsg_dev->parent = get_device(parent);
> bsg_dev->release = ufs_bsg_node_release;
>
> - dev_set_name(bsg_dev, "ufs-bsg");
> + dev_set_name(bsg_dev, "ufs-bsg%d", shost->host_no);
>
> ret = device_add(bsg_dev);
> if (ret)
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project

2019-12-02 07:33:00

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: Give an unique ID to each ufs-bsg

On 2019-12-02 15:23, Avri Altman wrote:
> Hi,
>>
>> Considering there can be multiple UFS hosts in SoC, give each ufs-bsg
>> an unique
>> ID by appending the scsi host number to its device name.
> Can you refer me to such a design?
>
> Thanks,
> Avri
>

Consider a platform which has an embedded UFS device and supports a UFS
card meanwhile.
This conbination is very popular nowadays. BTW, 845 started supporting
two UFS hosts 3 years ago.

Thanks,

Can Guo

>>
>> Signed-off-by: Can Guo <[email protected]>
>>
>> diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c
>> index
>> dc2f6d2..3ef5b78 100644
>> --- a/drivers/scsi/ufs/ufs_bsg.c
>> +++ b/drivers/scsi/ufs/ufs_bsg.c
>> @@ -202,7 +202,7 @@ int ufs_bsg_probe(struct ufs_hba *hba)
>> bsg_dev->parent = get_device(parent);
>> bsg_dev->release = ufs_bsg_node_release;
>>
>> - dev_set_name(bsg_dev, "ufs-bsg");
>> + dev_set_name(bsg_dev, "ufs-bsg%d", shost->host_no);
>>
>> ret = device_add(bsg_dev);
>> if (ret)
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
>> Forum,
>> a Linux Foundation Collaborative Project

2019-12-02 07:38:58

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH] scsi: ufs: Give an unique ID to each ufs-bsg


>
> Considering there can be multiple UFS hosts in SoC, give each ufs-bsg an unique
> ID by appending the scsi host number to its device name.
>
> Signed-off-by: Can Guo <[email protected]>
Reviewed-by: Avri Altman <[email protected]>

2019-12-02 20:24:04

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: Give an unique ID to each ufs-bsg

On Mon, Dec 02, 2019 at 03:23:25AM +0000, Can Guo wrote:
> Considering there can be multiple UFS hosts in SoC, give each ufs-bsg an
> unique ID by appending the scsi host number to its device name.
>
> Signed-off-by: Can Guo <[email protected]>

Looks good,

Reviewed-by: Christoph Hellwig <[email protected]>

This should also get a Fixes: tag so that it gets backported.