All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Simon Horman <simon.horman@netronome.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH 2/6] mmc: tmio: set tmio_mmc_host to driver data
Date: Mon, 20 Nov 2017 17:18:58 +0900	[thread overview]
Message-ID: <CAK7LNAQZQ13O1pSd5Ah7VDWrZF1MSkLT_QoTDS+uT7C-r09b+g@mail.gmail.com> (raw)
In-Reply-To: <20171119194930.npqfzqvmh4zbcb34@tetsubishi>

2017-11-20 4:49 GMT+09:00 Wolfram Sang <wsa@the-dreams.de>:
> On Tue, Nov 07, 2017 at 05:09:28PM +0900, Masahiro Yamada wrote:
>> The remove, suspend, resume hooks need tmio_mmc_host.  It is tedious
>> to get mmc_host from the driver_data and pass it to mmc_priv().
>> We can directly set tmio_mmc_host to driver data to clean up the code.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> ...
>
>> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
>> index 64b7e9f..ccfbc15 100644
>> --- a/drivers/mmc/host/tmio_mmc.c
>> +++ b/drivers/mmc/host/tmio_mmc.c
>> @@ -128,15 +128,11 @@ static int tmio_mmc_probe(struct platform_device *pdev)
>>  static int tmio_mmc_remove(struct platform_device *pdev)
>>  {
>>       const struct mfd_cell *cell = mfd_get_cell(pdev);
>> -     struct mmc_host *mmc = platform_get_drvdata(pdev);
>> +     struct tmio_mmc_host *host = platform_get_drvdata(pdev);
>>
>> -     if (mmc) {
>> -             struct tmio_mmc_host *host = mmc_priv(mmc);
>> -
>> -             tmio_mmc_host_remove(host);
>> -             if (cell->disable)
>> -                     cell->disable(pdev);
>> -     }
>> +     tmio_mmc_host_remove(host);
>> +     if (cell->disable)
>> +             cell->disable(pdev);
>
> Hmmm, this changes the code logic. Any reason this driver checks for a
> valid 'mmc' and can we safely drop it?
>

This code has been here since the initial support of TMIO
by commit  4a48998fa16121d0fe3436cce43afd6f47424103.

So, we have no way to know the reason
except asking the author, Ian Molton.

My best guess is unnecessary if-conditional was added
and overlooked in the review process.

mmc has been allocated, and platform_set_drvdata() has been called
in the driver probe.

I do not see any case for mmc==NULL.



-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2017-11-20  8:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  8:09 [PATCH 0/6] mmc: tmio, renesas_shci: cleanups, core code change for new driver Masahiro Yamada
2017-11-07  8:09 ` [PATCH 1/6] mmc: renesas_sdhc: remove eprobe jump label Masahiro Yamada
2017-11-20 20:31   ` Wolfram Sang
2017-11-21  3:03     ` Masahiro Yamada
2017-11-07  8:09 ` [PATCH 2/6] mmc: tmio: set tmio_mmc_host to driver data Masahiro Yamada
2017-11-19 19:49   ` Wolfram Sang
2017-11-20  8:18     ` Masahiro Yamada [this message]
2017-11-20  9:20       ` Wolfram Sang
2017-11-20  9:30         ` Masahiro Yamada
2017-11-20 13:22           ` Wolfram Sang
2017-11-20 15:14             ` Masahiro Yamada
2017-11-20 20:40   ` Wolfram Sang
2017-11-07  8:09 ` [PATCH 3/6] mmc: tmio: use devm_ioremap_resource() instead of devm_ioremap() Masahiro Yamada
2017-11-20 20:42   ` Wolfram Sang
2017-11-07  8:09 ` [PATCH 4/6] mmc: tmio: move mmc_host_ops to struct tmio_mmc_host from static data Masahiro Yamada
2017-11-20 20:45   ` Wolfram Sang
2017-11-20 20:48   ` Wolfram Sang
2017-11-23  4:18     ` Masahiro Yamada
2017-11-07  8:09 ` [PATCH 5/6] mmc: tmio, renesas_sdhi: set mmc_host_ops hooks directly Masahiro Yamada
2017-11-20 20:46   ` Wolfram Sang
2017-11-07  8:09 ` [PATCH 6/6] mmc: tmio: move mmc_of_parse() out of tmio_mmc_host_probe() Masahiro Yamada
2017-11-20 20:47   ` Wolfram Sang

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=CAK7LNAQZQ13O1pSd5Ah7VDWrZF1MSkLT_QoTDS+uT7C-r09b+g@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    --cc=yoshihiro.shimoda.uh@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.