On Wed, 3 Oct 2012 19:07:31 +0200, Baruch Siach wrote:

> I think that a template driver in the mainline kernel would be a great 
> contribution to the kernel.

On my side, I am questioning whether this is a goal that can actually
be achieved.

In practice, Constantine driver will never be useful as a template for
any driver, for two main reasons:

 * It is only showing how to write a raw character driver, while most
   drivers in the kernel are integrated inside an existing subsystem,
   that requires the implementation of subsystem-specific APIs (tty
   subsystem, mtd subsystem, input subsystem, network subsystem, etc.).
   Therefore, each of those subsystems would require a separate
   template driver. And in fact some of them already have such a
   template, see for example
   http://lxr.free-electrons.com/source/drivers/video/skeletonfb.c for
   the framebuffer subsystem. Doing similar skeleton drivers for each
   subsystem would most likely be a lot more useful.

 * This driver only shows how to implement a platform driver, while
   only some of the drivers are platform drivers. Many other are I2C
   drivers, SPI drivers, USB drivers, PCI drivers, etc. and therefore
   this template does not show any of this. Another example is that
   this driver is a platform driver, but does not support the Device
   Tree, which is needed on ARM, PowerPC, Microblaze and probably at
   least another architecture.

Therefore the whole idea of writing a "generic template kernel driver"
is doomed to fail, as it is simply not possible.

Also, /proc entries are deprecated for drivers. No new driver should
create one. Use debugfs instead for debugging features, or possibly
sysfs if this is actually relevant.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
_______________________________________________
Celinux-dev mailing list
Celinux-dev@lists.celinuxforum.org
https://lists.celinuxforum.org/mailman/listinfo/celinux-dev

Reply via email to