2.2 -> 2.4 kernel driver port

2.2 -> 2.4 kernel driver port

Post by Trevor Barto » Wed, 19 Jun 2002 17:32:52



Can anyone give me any indication of what's involved to port a driver
written from the 2.2 series kernels to the 2.4 series?  A quick
configure and compilation (of something I've previously written
here) brings up errors, some C types seeme to have changed regarding
calls to interruptible_sleep_on() and others.

Is there a lot to change, or is it pretty straightforward?  From my
brief scan of the standard drivers the kernel interface model seems
different, or is there some sort of backward compatibility?

I'm really trying to get some idea of the amount of work involved
before I think about starting modding any code!

Thanks,
Trev

--
Trevor Barton
Isotek Electronics Ltd, 9 Clayton Wood Bank, Leeds, LS16 6QZ, UK.
Tel: +44 (113) 275 1339, Fax +44 (113) 224 9827

Views expressed are my own and not necessarily those of Isotek Electronics Ltd.

 
 
 

2.2 -> 2.4 kernel driver port

Post by Pete Zaitc » Thu, 20 Jun 2002 06:07:46


Quote:> Can anyone give me any indication of what's involved to port a driver
> written from the 2.2 series kernels to the 2.4 series?  A quick
> configure and compilation (of something I've previously written
> here) brings up errors, some C types seeme to have changed regarding
> calls to interruptible_sleep_on() and others.

sleep_on was deprecated, because 95% of driver writers cannot
wrap their minds around the concept correctly, and produce
racy code. Use add_wait_queue/schedule/del_wait_queue.

Quote:> Is there a lot to change, or is it pretty straightforward?

It depends on the driver. Some drivers hardly change at all
since 2.0 days (e.g. zs.c). Others change in a straightforward
way with introduction of PCI DMA API (sunlance.c).

I saw driver writers who do very bad things, for instance the
latest fad is to run threads and read files from drivers; this
sits on top of inherently unstable API. Such drivers are a PITA
to maintain.

-- Pete

 
 
 

2.2 -> 2.4 kernel driver port

Post by JMisiurewi » Thu, 20 Jun 2002 06:15:10


On 18 Jun 2002 08:32:52 GMT,

Quote:>Can anyone give me any indication of what's involved to port a driver
>written from the 2.2 series kernels to the 2.4 series?  A quick
>configure and compilation (of something I've previously written
>here) brings up errors, some C types seeme to have changed regarding
>calls to interruptible_sleep_on() and others.

>I'm really trying to get some idea of the amount of work involved
>before I think about starting modding any code!

Not much work -- as I remember porting the VME driver 2.2->2.4 by
myself. Not understanding the driver internals, just taking a look at
the waitqueues initializations and usage in old/new code, I spent
about half a day and three Ooops/hangs/coredumps. After that amount of
work, the driver started working flawlessly.

The difference was in waitqueue structure, but there are new macros to
declare and initialize the queue; then some functions working on the
queue need pointers instead of values (or maybe inverse ;-), and that
was all.

Have a nice night ;-).
JM

--

Politechnika Warszawska                    Warsaw University of Technology
Wydzia3 Elektroniki                        Electronics Engineering
Instytut Systemow Elektronicznych   ---    Inst. of Electronic Systems

 
 
 

2.2 -> 2.4 kernel driver port

Post by Michael Schnel » Thu, 20 Jun 2002 15:34:00



23:07

Quote:>> Can anyone give me any indication of what's involved to port a driver
>> written from the 2.2 series kernels to the 2.4 series?


AFAIK, a major difference is how device files are created. 2.4 supports
having the driver create the files on initialization (device file system)
while in 2.2 the drivers only can be attached to existing device files.

The 2nd edition of "Linux device drivers" handles the differences between
2.2. and 2.4

-Michael Schnell, Lumino GmbH,
 Oppumer Stra?e 81-83, D-47799 Krefeld, Germany.

 Tel.: +49-2151-8196-72  Fax: +49-2151-8196-66-72

 
 
 

2.2 -> 2.4 kernel driver port

Post by Pete Zaitc » Fri, 21 Jun 2002 02:27:42



>>> Can anyone give me any indication of what's involved to port a driver
>>> written from the 2.2 series kernels to the 2.4 series?

> AFAIK, a major difference is how device files are created. 2.4 supports
> having the driver create the files on initialization (device file system)
> while in 2.2 the drivers only can be attached to existing device files.

devfs has almost zero impact on drivers. It only adds devfs_
prefix to registration functions, that's about all.
Besides, nobody in his right mind uses devfs anyways.
I think out of major distros only Mandrake ships it.

-- Pete