From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Pali Rohár" <pali@kernel.org>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Marek Behún" <marek.behun@nic.cz>
Subject: Re: [PATCH 1/2] mmc: core: Do not export MMC_NAME= and MODALIAS=mmc:block for SDIO cards
Date: Wed, 27 May 2020 09:34:54 +0200 [thread overview]
Message-ID: <CAPDyKFptJ470iNGJ8pJCodnyqKcr263Seb3OPp4Pg0b3st8-zQ@mail.gmail.com> (raw)
In-Reply-To: <20200526154334.21222-1-pali@kernel.org>
On Tue, 26 May 2020 at 17:43, Pali Rohár <pali@kernel.org> wrote:
>
> SDIO non-combo cards are not handled by mmc_block driver and do not have
> accessible CID register which is used for MMC_NAME= construction.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Marek Behún <marek.behun@nic.cz>
> ---
> drivers/mmc/core/bus.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 74de3f2dd..103eea7cd 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -93,15 +93,20 @@ mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
> return retval;
> }
>
> - retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card));
> - if (retval)
> - return retval;
> -
> - /*
> - * Request the mmc_block device. Note: that this is a direct request
> - * for the module it carries no information as to what is inserted.
> - */
> - retval = add_uevent_var(env, "MODALIAS=mmc:block");
> + if (card->type != MMC_TYPE_SDIO) {
> + retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card));
> + if (retval)
> + return retval;
> +
> + /*
> + * Request the mmc_block device.
> + * Note: that this is a direct request for the module it carries
> + * no information as to what is inserted.
> + */
> + retval = add_uevent_var(env, "MODALIAS=mmc:block");
> + if (retval)
> + return retval;
> + }
>
> return retval;
> }
> --
> 2.20.1
>
Overall this change makes sense to me, but at nitpick...
Rather than adding new nestled if-sentences, I suggest converting the
function into using the "early returns" pattern instead.
For example, already in the switch loop, above the code you change, we
could just return 0 instead of setting type = NULL. Likewise, you can
check "if (card->type == MMC_TYPE_SDIO) return 0;"
Kind regards
Uffe
prev parent reply other threads:[~2020-05-27 7:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 15:43 [PATCH 1/2] mmc: core: Do not export MMC_NAME= and MODALIAS=mmc:block for SDIO cards Pali Rohár
2020-05-26 15:43 ` [PATCH 2/2] mmc: core: Export device/vendor ids from Common CIS " Pali Rohár
2020-05-27 7:39 ` Ulf Hansson
2020-05-27 8:00 ` Pali Rohár
2020-05-27 8:13 ` Ulf Hansson
2020-05-27 11:08 ` [PATCH v2 1/2] mmc: core: Do not export MMC_NAME= and MODALIAS=mmc:block " Pali Rohár
2020-05-27 11:08 ` [PATCH v2 2/2] mmc: core: Export device/vendor ids from Common CIS " Pali Rohár
2020-05-28 10:14 ` Ulf Hansson
2020-05-28 10:14 ` [PATCH v2 1/2] mmc: core: Do not export MMC_NAME= and MODALIAS=mmc:block " Ulf Hansson
2020-05-27 7:34 ` Ulf Hansson [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=CAPDyKFptJ470iNGJ8pJCodnyqKcr263Seb3OPp4Pg0b3st8-zQ@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=pali@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;
as well as URLs for NNTP newsgroup(s).