From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mmc: spi: Fix card detection during probe
Date: Tue, 26 Feb 2019 12:29:21 +0100 [thread overview]
Message-ID: <20190226112921.GB7654@latitude> (raw)
In-Reply-To: <CAPDyKFpinj0-DbfzJ3ioUkjdUAg7cJQuZD-xjbfQXB+VV2fTpw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]
On Tue, Feb 26, 2019 at 09:18:06AM +0100, Ulf Hansson wrote:
> On Sun, 10 Feb 2019 at 18:31, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote:
> >
> > When using the mmc_spi driver with a card-detect pin, I noticed that the
> > card was not detected immediately after probe, but only after it was
> > unplugged and plugged back in (and the CD IRQ fired).
> >
> > The call tree looks something like this:
> >
> > mmc_spi_probe
> > mmc_add_host
> > mmc_start_host
> > _mmc_detect_change
> > mmc_schedule_delayed_work(&host->detect, 0)
> > mmc_rescan
> > host->bus_ops->detect(host)
> > mmc_detect
> > _mmc_detect_card_removed
> > host->ops->get_cd(host)
> > mmc_gpio_get_cd -> -ENOSYS (ctx->cd_gpio not set)
> > mmc_gpiod_request_cd
> > ctx->cd_gpio = desc
> >
> > To fix this issue, call mmc_detect_change after the card-detect GPIO/IRQ
> > is registered.
> >
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
>
> This works well as fix and for stable! However, we should probably
> clean up the code in ->probe() to avoid this thing altogether.
I figured that calling mmc_gpiod_request_cd before mmc_add_host *should*
avoid the 'return -ENOSYS' in mmc_gpio_get_cd. However it turned out to
be not as simple as swapping around a few lines in mmc_spi_probe, when I
wrote/tested this patch.
> Anyway, I send a patch for that - on top.
Thanks!
> Applied for fixes and added a stable tag, thanks!
Great.
Thanks,
Jonathan Neuschäfer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-02-26 11:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-10 17:31 [PATCH] mmc: spi: Fix card detection during probe Jonathan Neuschäfer
2019-02-11 8:27 ` Linus Walleij
2019-02-26 8:18 ` Ulf Hansson
2019-02-26 11:29 ` Jonathan Neuschäfer [this message]
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=20190226112921.GB7654@latitude \
--to=j.neuschaefer@gmx.net \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.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