Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: jack wang <jack_wang@usish.com>
Cc: linux-scsi@vger.kernel.org, jeff@garzik.org,
	lindar_liu@usish.com, tom_peng@usish.com, aoqingyun@usish.com
Subject: Re: [PATCH 3/5] reuse the original port when reenable the phy in a port
Date: Wed, 08 Jul 2009 18:29:27 +0000	[thread overview]
Message-ID: <1247077767.4159.247.camel@mulgrave.site> (raw)
In-Reply-To: <7813BB8F7D624D168612B73E822A1ED9@usish.com.cn>

On Wed, 2009-07-01 at 20:37 +0800, jack wang wrote:
> >From 24abd7f05d2293e03aacbdd9d620d6378ea5e2aa Mon Sep 17 00:00:00 2001
> From: Tom Peng <tom_peng@usish.com>
> Date: Wed, 1 Jul 2009 19:04:01 +0800
> Subject: [PATCH 3/5] reuse the original port when reenable the phy in a port
> 
> Signed-off-by: Tom Peng <tom_peng@usish.com>
> Signed-off-by: Jack Wang <jack_wang@usish.com>
> Signed-off-by: Lindar Liu <lindar_liu@usish.com>
> ---
>  drivers/scsi/libsas/sas_port.c |   19 +++++++++++++++----
>  1 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
> index e6ac59c..5aad165 100644
> --- a/drivers/scsi/libsas/sas_port.c
> +++ b/drivers/scsi/libsas/sas_port.c
> @@ -69,16 +69,27 @@ static void sas_form_port(struct asd_sas_phy *phy)
>  			SAS_DPRINTK("phy%d matched wide port%d\n", phy->id,
>  				    port->id);
>  			break;
> -		} else if (*(u64 *) port->sas_addr == 0 &&
> port->num_phys==0) {
> -			memcpy(port->sas_addr, phy->sas_addr,
> SAS_ADDR_SIZE);
> -			break;
>  		}
>  		spin_unlock(&port->phy_list_lock);
>  	}
> +	/* The phy does not match any port currently existed, create new one
> */
> +	if (i == sas_ha->num_phys) {
> +		for (i = 0; i < sas_ha->num_phys; i++) {
> +			port = sas_ha->sas_port[i];
> +			spin_lock(&port->phy_list_lock);
> +			if (*(u64 *)port->sas_addr == 0
> +				&& port->num_phys == 0) {
> +				memcpy(port->sas_addr, phy->sas_addr,
> +					SAS_ADDR_SIZE);
> +				break;
> +			}
> +			spin_unlock(&port->phy_list_lock);
> +		}
> +	}

I don't understand why you need this.  It seems identical to the else
leg of the if in the for loop above it, so it wouldn't seem to add
anything to the code.

James



  reply	other threads:[~2009-07-08 18:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01 12:37 [PATCH 3/5] reuse the original port when reenable the phy in a port jack wang
2009-07-08 18:29 ` James Bottomley [this message]
2009-07-09  2:12   ` tom
2009-07-09 15:04     ` James Bottomley

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=1247077767.4159.247.camel@mulgrave.site \
    --to=james.bottomley@hansenpartnership.com \
    --cc=aoqingyun@usish.com \
    --cc=jack_wang@usish.com \
    --cc=jeff@garzik.org \
    --cc=lindar_liu@usish.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tom_peng@usish.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