From: John Garry <john.garry@huawei.com>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
<jejb@linux.ibm.com>, <martin.petersen@oracle.com>,
<hare@suse.de>, <hch@lst.de>
Cc: <linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-scsi@vger.kernel.org>, <brking@us.ibm.com>
Subject: Re: [PATCH RFC 2/6] scsi: scsi_transport_sas: Allocate end device target id in the rphy alloc
Date: Wed, 21 Sep 2022 10:21:57 +0100 [thread overview]
Message-ID: <55ee46e7-a07d-d1ef-72fd-1f99b2a04684@huawei.com> (raw)
In-Reply-To: <ecde5199-bb9e-6df4-832a-f3707babd3d6@opensource.wdc.com>
On 20/09/2022 23:02, Damien Le Moal wrote:
>>
>> return &rdev->rphy;
>> }
>> EXPORT_SYMBOL(sas_end_device_alloc);
>> @@ -1500,6 +1505,16 @@ struct sas_rphy *sas_expander_alloc(struct
>> sas_port *parent,
>> }
>> EXPORT_SYMBOL(sas_expander_alloc);
>> +static bool sas_rphy_end_device_valid_tproto(struct sas_rphy *rphy)
>> +{
>> + struct sas_identify *identify = &rphy->identify;
>> +
>> + if (identify->target_port_protocols &
>> + (SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA))
>> + return true;
>> + return false;
>
> You could just do:
>
> return identify->target_port_protocols &
> (SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA))
OK
>
>> +}
>> +
>> /**
>> * sas_rphy_add - add a SAS remote PHY to the device hierarchy
>> * @rphy: The remote PHY to be added
>> @@ -1529,16 +1544,10 @@ int sas_rphy_add(struct sas_rphy *rphy)
>> mutex_lock(&sas_host->lock);
>> list_add_tail(&rphy->list, &sas_host->rphy_list);
>> - if (identify->device_type == SAS_END_DEVICE &&
>> - (identify->target_port_protocols &
>> - (SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA)))
>> - rphy->scsi_target_id = sas_host->next_target_id++;
>> - else if (identify->device_type == SAS_END_DEVICE)
>> - rphy->scsi_target_id = -1;
>> mutex_unlock(&sas_host->lock);
>> if (identify->device_type == SAS_END_DEVICE &&
>
> You could move this check inside sas_rphy_end_device_valid_tproto(),
> no ?
>
Yeah, I suppose I could. I might require a function rename with that.
>> - rphy->scsi_target_id != -1) {
>> + sas_rphy_end_device_valid_tproto(rphy)) {
>> int lun;
>> if (identify->target_port_protocols & SAS_PROTOCOL_SSP)
>> @@ -1667,7 +1676,7 @@ static int sas_user_scan(struct Scsi_Host
>> *shost, uint channel,
>> mutex_lock(&sas_host->lock);
>> list_for_each_entry(rphy, &sas_host->rphy_list, list) {
>> if (rphy->identify.device_type != SAS_END_DEVICE ||
>> - rphy->scsi_target_id == -1)
>> + !sas_rphy_end_device_valid_tproto(rphy))
>> continue;
Thanks,
John
next prev parent reply other threads:[~2022-09-21 9:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 10:27 [PATCH RFC 0/6] libata/scsi/libsas: Allocate SCSI device earlier for ata port probe John Garry
2022-09-20 10:27 ` [PATCH 1/6] scsi: core: Use SCSI_SCAN_RESCAN in __scsi_add_device() John Garry
2022-09-20 22:03 ` Damien Le Moal
2022-09-20 10:27 ` [PATCH RFC 2/6] scsi: scsi_transport_sas: Allocate end device target id in the rphy alloc John Garry
2022-09-20 22:02 ` Damien Le Moal
2022-09-21 9:21 ` John Garry [this message]
2022-09-20 10:27 ` [PATCH RFC 3/6] scsi: core: Add scsi_get_dev() John Garry
2022-09-20 21:58 ` Damien Le Moal
2022-09-21 9:17 ` John Garry
2022-09-20 10:27 ` [PATCH RFC 4/6] ata: libata-scsi: Add ata_scsi_setup_sdev() John Garry
2022-09-20 10:27 ` [PATCH RFC 5/6] scsi: libsas: Add sas_ata_setup_device() John Garry
2022-09-20 10:27 ` [PATCH RFC 6/6] ata: libata-scsi: Allocate sdev early in port probe John Garry
2022-09-21 4:04 ` [PATCH RFC 0/6] libata/scsi/libsas: Allocate SCSI device earlier for ata " Damien Le Moal
2022-09-21 8:24 ` John Garry
2022-09-21 8:31 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55ee46e7-a07d-d1ef-72fd-1f99b2a04684@huawei.com \
--to=john.garry@huawei.com \
--cc=brking@us.ibm.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jejb@linux.ibm.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®