From: Simon Horman <horms@verge.net.au>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Magnus Damm <magnus.damm@gmail.com>,
linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Ai Kyuse <ai.kyuse.uw@renesas.com>
Subject: Re: [PATCH/RFC v2 1/3] mmc: tmio: Add tuning support
Date: Mon, 23 May 2016 10:33:08 +0900 [thread overview]
Message-ID: <20160523013308.GF25562@verge.net.au> (raw)
In-Reply-To: <87fut9siq8.wl%kuninori.morimoto.gx@renesas.com>
On Mon, May 23, 2016 at 12:53:59AM +0000, Kuninori Morimoto wrote:
>
> Hi Simon
>
> Thank you for your patch.
> Picky comment from me :)
Thanks for noticing these things and sorry for not having
done so myself.
> > From: Ai Kyuse <ai.kyuse.uw@renesas.com>
> >
> > Add tuning support for use with SDR104 mode
> >
> > Signed-off-by: Ai Kyuse <ai.kyuse.uw@renesas.com>
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > ---
> (snip)
> > @@ -160,6 +161,11 @@ struct tmio_mmc_host {
> > unsigned int direction, int blk_size);
> > int (*start_signal_voltage_switch)(struct mmc_host *mmc,
> > struct mmc_ios *ios);
> > + unsigned int (*init_tuning)(struct tmio_mmc_host *host);
> > + int (*prepare_tuning)(struct tmio_mmc_host *host, unsigned long tap);
> > + int (*select_tuning)(struct tmio_mmc_host *host, bool *tap);
> > + bool (*retuning)(struct tmio_mmc_host *host);
> > + void (*hw_reset)(struct tmio_mmc_host *host);
> > };
>
> There is no (*retuning) code ?
Thanks, I think returning should simply be removed.
> > +static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
> > +{
> > + struct tmio_mmc_host *host = mmc_priv(mmc);
> > + unsigned int num = 0;
> > + int i, ret = 0;
> > + bool *tap;
> > +
> > + if (host->init_tuning)
> > + num = host->init_tuning(host);
> > + if (!num) {
> > + /* Tuning is not supported */
> > + ret = 0;
> > + goto out;
> > + }
> > +
> > + tap = kmalloc(num * 2, GFP_KERNEL);
> > + if (tap == NULL) {
> > + ret = -ENOMEM;
> > + goto out;
> > + }
>
> if (!tap) {
> ...
> }
ok
> > + /*
> > + * Issue CMD19 twice for each tap
> > + */
> > + for (i = 0; i < 2 * num; i++) {
> > + int err;
> > +
> > + if (host->prepare_tuning)
> > + host->prepare_tuning(host, i);
>
> you want to check return value here ?
> int (*prepare_tuning)(xxx);
The implementation of prepare_tuning doesn't seem to ever return an error.
Perhaps it would be best to just change the type to:
void (*prepare_tuning)(xxx);
> > + err = mmc_send_tuning(host->mmc, opcode, NULL);
> > + if (err && err != -EILSEQ) {
> > + ret = err;
> > + goto err_free;
> > + }
> > + tap[i] = (err == 0);
> > +
> > + mdelay(1);
> > + }
> > +
> > + if (host->select_tuning)
> > + ret = host->select_tuning(host, tap);
>
> Here, "tap" was alloc:ed array, but there is no array_size parameter.
> A littile bit strange for me..., but I'm not sure
Right. I think its safe. But its not very clean.
I will add a size parameter.
next prev parent reply other threads:[~2016-05-23 1:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-20 7:02 [PATCH/RFC v2 0/3] UHS-I SDR-104 support for sh_mobile_sdhi Simon Horman
2016-05-20 7:02 ` [PATCH/RFC v2 1/3] mmc: tmio: Add tuning support Simon Horman
2016-05-23 0:53 ` Kuninori Morimoto
2016-05-23 1:33 ` Simon Horman [this message]
2016-05-20 7:02 ` [PATCH/RFC v2 2/3] mmc: sh_mobile_sdhi: " Simon Horman
2016-05-23 0:57 ` Kuninori Morimoto
2016-05-23 1:34 ` Simon Horman
2016-05-23 2:14 ` Kuninori Morimoto
2016-05-20 7:02 ` [PATCH/RFC v2 3/3] ARM: dts: r8a7790: lager: Enable UHS-I SDR-104 Simon Horman
2016-05-24 0:41 ` [PATCH/RFC v2 0/3] UHS-I SDR-104 support for sh_mobile_sdhi Simon Horman
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=20160523013308.GF25562@verge.net.au \
--to=horms@verge.net.au \
--cc=ai.kyuse.uw@renesas.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox