public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* passing function pointers through platform devices?
@ 2007-03-06 18:46 NZG
  2007-03-07  3:53 ` Ben Nizette
  2007-03-07 17:11 ` Paul Sokolovsky
  0 siblings, 2 replies; 10+ messages in thread
From: NZG @ 2007-03-06 18:46 UTC (permalink / raw)
  To: linux-kernel

I'm developing an SPI- bus >MMC/SD block driver translation layer.
As part of this layer the write protect and card detect lines need to be read.
The method for determining the state of these lines will be board specific.

Is it appropriate to pass a function pointer through a platform device 
(declared in the mach initialization) to implement card_available and 
write_protect function calls?
Or is there a cleaner way to do it?

thank you,
NZG

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: passing function pointers through platform devices?
@ 2007-03-07 17:55 David Brownell
  2007-03-09 16:31 ` NZG
  0 siblings, 1 reply; 10+ messages in thread
From: David Brownell @ 2007-03-07 17:55 UTC (permalink / raw)
  To: ngustavson; +Cc: Linux Kernel list

> I'm developing an SPI- bus >MMC/SD block driver translation layer.

Another one?  There's already been significant work in that area.  See for
example

  http://marc.theaimsgroup.com/?l=linux-kernel&m=117000652529003&w=2

Which admittedly didn't behave when I just put it onto my test rig,
but seems nonetheless to be a significant step forward.  It's not like
everyone has hardware that can use such a driver after all!


> As part of this layer the write protect and card detect lines need to be read.
> The method for determining the state of these lines will be board specific.

Example, one usually wants card detect to be an IRQ, to avoid polling...


> Is it appropriate to pass a function pointer through a platform device 
> (declared in the mach initialization) to implement card_available and 
> write_protect function calls?

That's how it's done in that patch.  The model being what the PXA MMC/SD
card driver does, since that's the most generic model I found ... handling
for example systems which need to poll for card detect, as well as ones
that can use real gpio based IRQs.  The mmc_spi driver doesn't need to know
which kind of platform it's got.

- Dave



 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-03-09 16:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 18:46 passing function pointers through platform devices? NZG
2007-03-07  3:53 ` Ben Nizette
2007-03-07 16:37   ` NZG
2007-03-07 17:07     ` Randy Dunlap
2007-03-07 17:36       ` NZG
2007-03-08 18:41     ` Haavard Skinnemoen
2007-03-08 18:57       ` NZG
2007-03-07 17:11 ` Paul Sokolovsky
  -- strict thread matches above, loose matches on Subject: below --
2007-03-07 17:55 David Brownell
2007-03-09 16:31 ` NZG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox