* 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-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:11 ` Paul Sokolovsky
1 sibling, 1 reply; 10+ messages in thread
From: Ben Nizette @ 2007-03-07 3:53 UTC (permalink / raw)
To: NZG; +Cc: Linux Kernel list
NZG wrote:
> 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?
Once the generic GPIO framework migrates upstream from -mm you should
just pass the GPIO token from board-specific code and gpio_get_value() it.
--Ben.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: passing function pointers through platform devices?
2007-03-07 3:53 ` Ben Nizette
@ 2007-03-07 16:37 ` NZG
2007-03-07 17:07 ` Randy Dunlap
2007-03-08 18:41 ` Haavard Skinnemoen
0 siblings, 2 replies; 10+ messages in thread
From: NZG @ 2007-03-07 16:37 UTC (permalink / raw)
To: Ben Nizette; +Cc: Linux Kernel list
> Once the generic GPIO framework migrates upstream from -mm
Thank you, but I've reorganized my system to pass platform resources to a
driver, which then registers simple gpio/pwm/quadencoder type devices as
standard classes declared in a subdirectory. Specific methods are then
simple exported by stackable drivers.
It's unlikely I will adopt the GPIO interface at this point unless they really
bring something new to the table.
I googled extensively and requested information on any current work here
before I began this project and got zip. (see forwarded email paste)
I also emailed Robert Schwebel directly and he told me to ask VGER as it was
being developed by someone else.
I don't mean to sound rude, but I really tried to build on existing work and
it wasn't made available, so I've gone my own way, I had not other choice.
P.S. Forgive my VGER newbness, but what is "-mm" ?
thx,
NZG
> ---------- Forwarded Message ----------
>
> Subject: GPIO device class driver
> Date: Tuesday 20 February 2007 10:40 am
> From: NZG <ngustavson@emacinc.com>
> To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
>
> I am currently developing support for an ep9xx based SBC and want to export
> it's GPIO through sysfs in a simple and standard way,
> without adding yet another platform specific gpio driver to the kernel.
>
> As I understand it, a gpio class has already been begun by Robert Schwebel
> in but has not as of yet become part of the mainstream kernel.
>
> Searching the archives for this yields no results since 2006.
>
> Can anyone point me to a current patch?
> I'd like to start from there.
>
> thank you,
> NZG
>
> -------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: passing function pointers through platform devices?
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
1 sibling, 1 reply; 10+ messages in thread
From: Randy Dunlap @ 2007-03-07 17:07 UTC (permalink / raw)
To: NZG; +Cc: Ben Nizette, Linux Kernel list
On Wed, 7 Mar 2007 10:37:00 -0600 NZG wrote:
> > Once the generic GPIO framework migrates upstream from -mm
> Thank you, but I've reorganized my system to pass platform resources to a
> driver, which then registers simple gpio/pwm/quadencoder type devices as
> standard classes declared in a subdirectory. Specific methods are then
> simple exported by stackable drivers.
> It's unlikely I will adopt the GPIO interface at this point unless they really
> bring something new to the table.
>
> I googled extensively and requested information on any current work here
> before I began this project and got zip. (see forwarded email paste)
>
> I also emailed Robert Schwebel directly and he told me to ask VGER as it was
> being developed by someone else.
>
> I don't mean to sound rude, but I really tried to build on existing work and
> it wasn't made available, so I've gone my own way, I had not other choice.
>
> P.S. Forgive my VGER newbness, but what is "-mm" ?
See http://kernel.org/patchtypes/mm.html:
"""
The -mm patches to the Linux kernel
The -mm patches are a set of patches, released by Andrew Morton, against the official kernel series. They are frequently more experimental in nature than the official series. These patches are available in Andrew's kernel directory:
/pub/linux/kernel/people/akpm/
"""
> thx,
> NZG
>
> > ---------- Forwarded Message ----------
> >
> > Subject: GPIO device class driver
> > Date: Tuesday 20 February 2007 10:40 am
> > From: NZG <ngustavson@emacinc.com>
> > To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
> >
> > I am currently developing support for an ep9xx based SBC and want to export
> > it's GPIO through sysfs in a simple and standard way,
> > without adding yet another platform specific gpio driver to the kernel.
> >
> > As I understand it, a gpio class has already been begun by Robert Schwebel
> > in but has not as of yet become part of the mainstream kernel.
> >
> > Searching the archives for this yields no results since 2006.
> >
> > Can anyone point me to a current patch?
> > I'd like to start from there.
> >
> > thank you,
> > NZG
> >
> > -------------------------------------------------
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: passing function pointers through platform devices?
2007-03-07 17:07 ` Randy Dunlap
@ 2007-03-07 17:36 ` NZG
0 siblings, 0 replies; 10+ messages in thread
From: NZG @ 2007-03-07 17:36 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Ben Nizette, Linux Kernel list
> The -mm patches are a set of patches, released by Andrew Morton, against
> the official kernel series. They are frequently more experimental in nature
> than the official series. These patches are available in Andrew's kernel
> directory:
Thank you for pointing this out, I will use at as another source for
background work before beginning future projects.
NZG
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: passing function pointers through platform devices?
2007-03-07 16:37 ` NZG
2007-03-07 17:07 ` Randy Dunlap
@ 2007-03-08 18:41 ` Haavard Skinnemoen
2007-03-08 18:57 ` NZG
1 sibling, 1 reply; 10+ messages in thread
From: Haavard Skinnemoen @ 2007-03-08 18:41 UTC (permalink / raw)
To: NZG; +Cc: Ben Nizette, Linux Kernel list
On 3/7/07, NZG <ngustavson@emacinc.com> wrote:
> > Once the generic GPIO framework migrates upstream from -mm
It already has:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=4c20386c8d0719b42503efe65abe47ad3fb3d711
> I googled extensively and requested information on any current work here
> before I began this project and got zip. (see forwarded email paste)
Your mail seems to be about a gpio userspace interface, which is
something entirely different from an in-kernel API, although I suppose
it should be possible to build a userspace interface on top of the
generic in-kernel API.
If you're looking for a way to do GPIO from a driver, the new generic
GPIO API should offer what you need, assuming it has actually been
implemented on your platform.
Haavard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: passing function pointers through platform devices?
2007-03-06 18:46 passing function pointers through platform devices? NZG
2007-03-07 3:53 ` Ben Nizette
@ 2007-03-07 17:11 ` Paul Sokolovsky
1 sibling, 0 replies; 10+ messages in thread
From: Paul Sokolovsky @ 2007-03-07 17:11 UTC (permalink / raw)
To: NZG; +Cc: linux-kernel
Hello NZG,
Tuesday, March 6, 2007, 8:46:29 PM, you wrote:
> 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?
Apparently it must be appropriate, because that's pretty natural
and clean - if you can pass data, why wouldn't you be able to pass
methods?
I assume your usecase is to pass board-specific code, defined in
machine definition, down to a device driver. We (handhelds.org) go
even further and recently tried passing function pointers in opposite
direction - from device driver to client code which will use the
device, via device's platform_data.
That essentially implements virtual methods on devices, allowing
device clients to perform operations on them without bothering to know
how actually the operation is implemented, i.e. offers better
functionality separation and code reuse which OOP offers.
Either way, be assured that you're not the only one who puts Linux
Driver Model under full use.
> thank you,
> NZG
--
Best regards,
Paul mailto:pmiscml@gmail.com
^ 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
* Re: passing function pointers through platform devices?
2007-03-07 17:55 David Brownell
@ 2007-03-09 16:31 ` NZG
0 siblings, 0 replies; 10+ messages in thread
From: NZG @ 2007-03-09 16:31 UTC (permalink / raw)
To: David Brownell; +Cc: Linux Kernel list
On Wednesday 07 March 2007 11:55 am, David Brownell wrote:
> > 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
Nice, I'll build on that, my previous work ignored the SPI/MMC layers (because
they didn't exist at the time) and just build a stacked driver on a character
SPI driver. This gives me some direction as to how to proceed.
> 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!
True, but it's fairly common right now, until every microcontroller gets a
hardware SD controller (which seems to be the trend)
> 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.
Sounds good, thanks
NZG
^ 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