All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org, Anton Vorontsov <cbouatmailru@gmail.com>
Subject: Re: [PATCH 1/2] mmc: sdhci: Replace SDHCI_QUIRK_FORCE_BLK_SZ_2048 with a pklatform hook.
Date: Mon, 7 Feb 2011 19:11:43 +0100	[thread overview]
Message-ID: <20110207181143.GA14626@pengutronix.de> (raw)
In-Reply-To: <20110207175424.GA2065@void.printf.net>

[-- Attachment #1: Type: text/plain, Size: 2368 bytes --]

On Mon, Feb 07, 2011 at 05:54:24PM +0000, Chris Ball wrote:
> Hi Wolfram, thanks for the review,
> 
> On Mon, Feb 07, 2011 at 06:40:39PM +0100, Wolfram Sang wrote:
> > On Sun, Feb 06, 2011 at 01:13:10AM -0500, Chris Ball wrote:
> > > Part of a quirk cleanup run.  This quirk was only used by sdhci-esdhc.
> > > This patch is untested.
> > > 
> > > Signed-off-by: Chris Ball <cjb@laptop.org>
> > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > > index 9e15f41..fcd6188 100644
> > > --- a/drivers/mmc/host/sdhci.c
> > > +++ b/drivers/mmc/host/sdhci.c
> > > @@ -1962,8 +1962,8 @@ int sdhci_add_host(struct sdhci_host *host)
> > >  	 * Maximum block size. This varies from controller to controller and
> > >  	 * is specified in the capabilities register.
> > >  	 */
> > > -	if (host->quirks & SDHCI_QUIRK_FORCE_BLK_SZ_2048) {
> > > -		mmc->max_blk_size = 2;
> > > +	if (host->ops->get_max_blk_size) {
> > > +		mmc->max_blk_size = host->ops->get_max_blk_size(host);
> > >  	} else {
> > >  		mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >>
> > >  				SDHCI_MAX_BLOCK_SHIFT;
> > 
> > I tend to think this could be fixed using io-accessors when reading the
> > caps register?
> 
> Hm, I agree that it would work, but I'm not sure it's going to be
> cleaner/more readable that way.  I like that here we have one place
> for setting the max_blk_size, and it's obvious from the code exactly
> where you need to look to see if it's been overloaded by the driver.

Without the quirk and its handling, we lose the if-else-block which will
lead to:

	mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >>
			SDHCI_MAX_BLOCK_SHIFT;
	if (mmc->max_blk_size >= 3) {
		printk(KERN_WARNING "%s: Invalid maximum block size, "
			"assuming 512 bytes\n", mmc_hostname(mmc));
		mmc->max_blk_size = 0;
	}

This is what I would prefer. Straight code, handling an sdhci-controller
adhering to the standard. A controller failing to do that, will have to take
care of that in its specific source file. For the sdhci-core, it would then
simply look like a "good" controller. We probably can't achieve this for all
quirks, but still...

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-02-07 18:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06  6:13 [PATCH 1/2] mmc: sdhci: Replace SDHCI_QUIRK_FORCE_BLK_SZ_2048 with a pklatform hook Chris Ball
2011-02-07 17:40 ` Wolfram Sang
2011-02-07 17:54   ` Chris Ball
2011-02-07 18:11     ` Wolfram Sang [this message]
2011-05-29  2:27 ` Chris Ball
2011-06-01  4:00   ` Wolfram Sang
2011-06-01  4:42     ` [PATCH 1/2] mmc: sdhci: Replace SDHCI_QUIRK_FORCE_BLK_SZ_2048 with a platform hook Chris Ball
2011-06-01 15:01       ` Nicolas Pitre
2011-06-06 16:53         ` 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=20110207181143.GA14626@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=cbouatmailru@gmail.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.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 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.