public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Yan <yanaijie@huawei.com>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	<martin.petersen@oracle.com>, <jejb@linux.ibm.com>
Cc: <linux-scsi@vger.kernel.org>, <hare@suse.com>, <hch@lst.de>,
	<bvanassche@acm.org>, <jinpu.wang@cloud.ionos.com>,
	<john.g.garry@oracle.com>
Subject: Re: [PATCH 3/3] scsi: libsas: Simplify sas_check_parent_topology()
Date: Mon, 3 Apr 2023 10:07:21 +0800	[thread overview]
Message-ID: <44328ec1-e47b-87ee-344a-2455993e8f09@huawei.com> (raw)
In-Reply-To: <48d385f7-92b5-4e99-7e32-119db6a74f3f@opensource.wdc.com>

On 2023/4/2 13:00, Damien Le Moal wrote:
> On 4/1/23 17:15, Jason Yan wrote:
>> Factor out a new helper sas_check_phy_topology() to simplify
>> sas_check_parent_topology(). And centralize the calling of
>> sas_print_parent_topology_bug().
>>
>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
>> ---
>>   drivers/scsi/libsas/sas_expander.c | 95 +++++++++++++++++-------------
>>   1 file changed, 55 insertions(+), 40 deletions(-)
>>
>> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
>> index c0841652f0e0..bffcccdbda6b 100644
>> --- a/drivers/scsi/libsas/sas_expander.c
>> +++ b/drivers/scsi/libsas/sas_expander.c
>> @@ -1238,11 +1238,59 @@ static int sas_check_eeds(struct domain_device *child,
>>   	return res;
>>   }
>>   
>> -/* Here we spill over 80 columns.  It is intentional.
>> - */
>> -static int sas_check_parent_topology(struct domain_device *child)
>> +
>> +static int sas_check_phy_topology(struct domain_device *child, struct ex_phy *parent_phy)
> 
> Long line. Break after the first argument.

The max line warning in checkpatch has been changed to 100[1]. But 80 is
still preferred. So you are right, I will fix it.

[1] bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning")

> 
>>   {
>>   	struct expander_device *child_ex = &child->ex_dev;
>> +	struct ex_phy *child_phy = &child_ex->ex_phy[parent_phy->attached_phy_id];
>> +	struct expander_device *parent_ex = &child->parent->ex_dev;
>> +	bool print_topology_bug = false;
>> +	int res = 0;
>> +
>> +	switch (child->parent->dev_type) {
>> +	case SAS_EDGE_EXPANDER_DEVICE:
>> +		if (child->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
>> +			if (parent_phy->routing_attr != SUBTRACTIVE_ROUTING ||
>> +				child_phy->routing_attr != TABLE_ROUTING) {
>> +				res = -ENODEV;
>> +				print_topology_bug = true;
>> +			}
>> +		} else if (parent_phy->routing_attr == SUBTRACTIVE_ROUTING) {
>> +			if (child_phy->routing_attr == SUBTRACTIVE_ROUTING) {
>> +				res = sas_check_eeds(child, parent_phy, child_phy);
>> +			}
> 
> The "else if" below should not be on a different line.

Good catch. Will fix.

Thanks,
Jason

> 
>> +			else if (child_phy->routing_attr != TABLE_ROUTING) {
>> +				res = -ENODEV;
>> +				print_topology_bug = true;
[...]

  reply	other threads:[~2023-04-03  2:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01  8:15 [PATCH 0/3] scsi: libsas: remove empty branches and code simplification Jason Yan
2023-04-01  8:15 ` [PATCH 1/3] scsi: libsas: Simplify sas_check_eeds() Jason Yan
2023-04-02  4:58   ` Damien Le Moal
2023-04-03  1:37     ` Jason Yan
2023-04-03  8:12       ` John Garry
2023-04-03  9:11         ` Jason Yan
2023-04-01  8:15 ` [PATCH 2/3] scsi: libsas: Remove an empty branch in sas_check_parent_topology() Jason Yan
2023-04-01  8:15 ` [PATCH 3/3] scsi: libsas: Simplify sas_check_parent_topology() Jason Yan
2023-04-02  5:00   ` Damien Le Moal
2023-04-03  2:07     ` Jason Yan [this message]
2023-04-03  3:13     ` Jason Yan

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=44328ec1-e47b-87ee-344a-2455993e8f09@huawei.com \
    --to=yanaijie@huawei.com \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=john.g.garry@oracle.com \
    --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