mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Florian Fainelli <f.fainelli@gmail.com>, linux-kernel@vger.kernel.org
Cc: bcm-kernel-feedback-list@broadcom.com,
	Jens Axboe <axboe@kernel.dk>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Hans de Goede <hdegoede@redhat.com>, Tejun Heo <tj@kernel.org>,
	Jaedon Shin <jaedon.shin@gmail.com>,
	"open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" 
	<linux-ide@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] ata: ahci_brcm: Perform reset after obtaining resources
Date: Tue, 07 Jan 2020 09:19:33 +0100	[thread overview]
Message-ID: <0ff51b3e4443a03f1d3ee8d3091863e03a22c2cf.camel@pengutronix.de> (raw)
In-Reply-To: <20200106191906.18266-2-f.fainelli@gmail.com>

Hi Florian,

On Mon, 2020-01-06 at 11:19 -0800, Florian Fainelli wrote:
> Resources such as clocks, PHYs, regulators are likely to get a probe
> deferral return code, which could lead to the AHCI controller being
> reset a few times until it gets successfully probed. Since this is
> typically the most time consuming operation, move it after the resources
> have been acquired.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/ata/ahci_brcm.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
> index 13ceca687104..70e3e386d52e 100644
> --- a/drivers/ata/ahci_brcm.c
> +++ b/drivers/ata/ahci_brcm.c
> @@ -453,15 +453,9 @@ static int brcm_ahci_probe(struct platform_device *pdev)
>  	else
>  		reset_name = "ahci";
>  
> -	priv->rcdev = devm_reset_control_get(&pdev->dev, reset_name);
> -	if (!IS_ERR_OR_NULL(priv->rcdev))
> -		reset_control_deassert(priv->rcdev);
> -
>  	hpriv = ahci_platform_get_resources(pdev, 0);
> -	if (IS_ERR(hpriv)) {
> -		ret = PTR_ERR(hpriv);
> -		goto out_reset;
> -	}
> +	if (IS_ERR(hpriv))
> +		return PTR_ERR(hpriv);
>  
>  	hpriv->plat_data = priv;
>  	hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP | AHCI_HFLAG_NO_WRITE_TO_RO;
> @@ -478,6 +472,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)
>  		break;
>  	}
>  
> +	priv->rcdev = devm_reset_control_get(&pdev->dev, reset_name);
> +	if (!IS_ERR_OR_NULL(priv->rcdev))
> +		reset_control_deassert(priv->rcdev);
> +

Please use devm_reset_control_get_optional_exclusive(), that returns
NULL if the requested reset is not specified in the device tree. Do
return the error code on IS_ERR(). You can then call
reset_control_deassert() unconditionally, it checks for and ignores
the NULL pointer.

regards
Philipp


  reply	other threads:[~2020-01-07  8:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 19:19 [PATCH v2 0/2] ata: ahci_brcm: Follow-up changes for BCM7216 Florian Fainelli
2020-01-06 19:19 ` [PATCH v2 1/2] ata: ahci_brcm: Perform reset after obtaining resources Florian Fainelli
2020-01-07  8:19   ` Philipp Zabel [this message]
2020-01-06 19:19 ` [PATCH v2 2/2] ata: ahci_brcm: BCM7216 reset is self de-asserting Florian Fainelli

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=0ff51b3e4443a03f1d3ee8d3091863e03a22c2cf.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=axboe@kernel.dk \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jaedon.shin@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tj@kernel.org \
    /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®