mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre Ossman <drzeus-mmc@drzeus.cx>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-kernel@vger.kernel.org, Alex Dubov <oakad@yahoo.com>
Subject: Re: RFC: Driver for CB710/720 memory card reader (MMC part) - v2
Date: Sat, 4 Oct 2008 21:51:22 +0200	[thread overview]
Message-ID: <20081004215122.0626cd7b@mjolnir.drzeus.cx> (raw)
In-Reply-To: <20080925062924.GA32105@rere.qmqm.pl>

On Thu, 25 Sep 2008 08:29:24 +0200
Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:

> 
> This should be almost ready. mmc-test passes up to a point where it
> tries non-sector-size writes to the card - I didn't have time to look
> into this further, yet.
> 

If you can't figure it out, just make sure the driver fails the
requests with -EINVAL.

> > > +/* sg-to-PIO buffer */
> [and its API]
> > Why this complex system? Can't you use the handlers the kernel already
> > provides? You also get a lot of special handling with those, e.g.
> > highmem.
> 
> I looked at linux/lib/scatterlist.c and found nothing really useful. If
> there were some preconditions always met for scatterlists - like that block
> does not span multiple pages, or at least 16-byte block don't, then most
> of this code can go away. It looks complicated, because it implements
> a special iterator interface that always returns multiple-of-16-byte blocks
> for reading or writing. This makes the PIO loops very simple and fast
> (the bounce_buffer case was never triggered by mmc-block in my tests).
> 

The buffers leave no alignment guarantees unfortunately. 

Have a look at the current sdhci.c PIO routines though. It uses the sg
iterator helpers and keeps track of four byte chunks (as opposed to the
16 byte ones you need).

> > > +static void cb710_mmc_enable_irq(struct cb710_chip *chip, int enable)
> > > +{
> > > +	unsigned long flags;
> > > +
> > > +	spin_lock_irqsave(&chip->irq_lock, flags);
> > > +	__cb710_mmc_enable_irq(chip, enable);
> > > +	spin_unlock_irqrestore(&chip->irq_lock, flags);
> > > +}
> > This is a fairly useless wrapper. Look over how it is called instead.
> 
> Can you expand on this? Right now irq handler doesn't call
> __cb710_mmc_enable_irq() but modifies registers itself. This will
> change eventually.
> 

Just require that the lock must be held by the caller when invoking
cb710_mmc_enable_irq(). It's usually easier to keep track of locks by
keeping the lock handling at entry points into the driver.

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  rdesktop, core developer          http://www.rdesktop.org

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

  reply	other threads:[~2008-10-04 19:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-07 21:52 MMC host driver requirements Michał Mirosław
2008-09-09  7:18 ` Pierre Ossman
2008-09-09  9:06   ` Michał Mirosław
2008-09-11 20:13     ` Driver for CB710/720 memory card reader (MMC part) Michał Mirosław
2008-09-12 23:43       ` RFC: " Michał Mirosław
2008-09-20 11:00         ` Pierre Ossman
2008-09-25  6:29           ` RFC: Driver for CB710/720 memory card reader (MMC part) - v2 Michał Mirosław
2008-10-04 19:51             ` Pierre Ossman [this message]
2008-10-29 14:11               ` RFC: Driver for CB710/720 memory card reader (MMC part) - v3 Michał Mirosław
2008-11-14 21:06                 ` Pierre Ossman
2009-02-01 18:54                   ` Michał Mirosław
2009-02-21 12:46                     ` Pierre Ossman
2009-05-08 15:16                       ` [PATCH/RFC 2.6.29.2] Driver for CB710/720 memory card reader (MMC part) - v4 Michał Mirosław
2009-05-22 11:27                         ` Pierre Ossman
2009-05-22 17:55                           ` [PATCH 2.6.29.3] Driver for CB710/720 memory card reader (MMC part) - v5 Michał Mirosław
2009-05-22 18:33                             ` [PATCH 2.6.29.4] Driver for CB710/720 memory card reader (MMC part) - v5 fixed Michał Mirosław
2009-05-27 20:13                               ` Pierre Ossman
2009-06-04 10:24                                 ` Michał Mirosław
2009-06-05  9:26                                   ` Michał Mirosław
2009-06-13 10:39                                   ` Pierre Ossman
2009-05-22 19:04                           ` [PATCH/RFC 2.6.29.2] Driver for CB710/720 memory card reader (MMC part) - v4 Bartlomiej Zolnierkiewicz

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=20081004215122.0626cd7b@mjolnir.drzeus.cx \
    --to=drzeus-mmc@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=oakad@yahoo.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

all inboxes | Powered by JetHome®