mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, Lucas Stach <lst@pengutronix.de>
Subject: Re: [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs
Date: Mon, 18 May 2020 08:17:44 +0200	[thread overview]
Message-ID: <20200518061744.GH11869@pengutronix.de> (raw)
In-Reply-To: <20200517181941.6982-1-a.fatoum@pengutronix.de>

On Sun, May 17, 2020 at 08:19:39PM +0200, Ahmad Fatoum wrote:
> A barebox environment oftree node may reference its storage by a phandle
> to a partition node under a MCI node. barebox will then call the
> device's detect method to detect the card if this hasn't happened
> before. Out of 17 MCI drivers, 8 host drivers already implement
> a detect method, which just calls mci_detect_card.
> 
> Provide a generic implementation that does the same.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> Cc: Lucas Stach <lst@pengutronix.de>
> ---
>  drivers/mci/mci-core.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index e8844a3c0007..ab80c4d5ba5c 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1806,9 +1806,14 @@ int mci_detect_card(struct mci_host *host)
>  
>  static int mci_detect(struct device_d *dev)
>  {
> -	struct mci *mci = container_of(dev, struct mci, dev);
> +	struct mci *mci;
> +
> +	list_for_each_entry(mci, &mci_list, list) {
> +		if (dev == &mci->dev || dev == mci->host->hw_dev)
> +			return mci_detect_card(mci->host);
> +	}

I think it would look better to keep the existing mci_detect function
and add a new mci_hw_detect which does the loop for the hw device only.

Otherwise I'm happy with this approach.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-05-18  6:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 18:19 Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 3/3] mci: reword MCI_STARTUP text Ahmad Fatoum
2020-05-18  6:17 ` Sascha Hauer [this message]
2020-06-02  8:00 [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Ahmad Fatoum
2020-06-03  7:20 ` Sascha Hauer

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=20200518061744.GH11869@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lst@pengutronix.de \
    /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