[lkml]   [2006]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [GIT PATCH] more Driver core patches for 2.6.19
Am Donnerstag, 14. Dezember 2006 12:51 schrieb Olivier Galibert:
> On Thu, Dec 14, 2006 at 10:56:03AM +0100, Hans-Jürgen Koch wrote:
> > A small German manufacturer produces high-end AD converter cards. He sells
> > 100 pieces per year, only in Germany and only with Windows drivers. He would
> > now like to make his cards work with Linux. He has two driver programmers
> > with little experience in writing Linux kernel drivers. What do you tell him?
> > Write a large kernel module from scratch? Completely rewrite his code
> > because it uses floating point arithmetics?
> Write a small kernel module which:

What you suggest is not a "small kernel module". It's what we have now,
writing a complete driver.

> - create a device node per-card

That's what UIO does, plus some standard sysfs files, that tell you e.g.
the size of the cards memory you can map. There are standard file names
that allow you e.g. to automatically search for all registered uio
drivers and their properties.

> - read the data from the A/D as fast as possible and buffer it in main
> memory without touching it

If the card already has that data in its dual port RAM, you do an
unneccessary copy.

> - implements a read interface to read data from the buffer

Here you do the next unneccessary copy.

> - implement ioctls for whatever controls you need

Implementing ioctls for everything is bad coding style and a has bad
performance. I said "high-end AD card", that means you have a
signal processor on that board, want to download firmware to it
and so on. You end up copying lots of data between user space
and kernel space.

> And that's it.

Yes, that's a complete kernel driver that you'd never get into
a mainline kernel. Furthermore, the card manufacturer would have to
employ at least two experienced Linux _kernel_ programmers. That's
too much for a small company who's business is something different.

> All the rest can be done in userspace, safely, with
> floating point, C++ and everything. If the driver programmers are
> worth their pay, their driver is probably already split logically at
> where the userspace-kernel interface would be.
> And small means small, like 200 lines or so, more if you want to have
> fun with sysfs, poll, aio and their ilk, but that's not a necessity.

You can achieve 100 lines with uio, including sysfs and poll. What you
describe would never fit in 200 lines for a non-trivial card.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-12-14 13:47    [W:0.134 / U:7.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site