[lkml]   [2005]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[DRIVER MODEL] Add platform_driver
The following set of patches adds a platform_driver structure, which
is much like the pci_driver structure:

struct platform_driver {
int (*probe)(struct platform_device *);
int (*remove)(struct platform_device *);
void (*shutdown)(struct platform_device *);
int (*suspend)(struct platform_device *, pm_message_t state);
int (*resume)(struct platform_device *);
struct device_driver driver;

The idea behind this is to stop using the struct device_driver
suspend/resume fields, and eventually eliminate the other function
pointers from within that structure.


Virtually every other user wraps the device_driver structure in
their own structure, which contains function pointers specific
to their implementation. For instance, pci_driver contains:

int (*probe) (struct pci_dev *dev, const struct pci_device_id *id);
void (*remove) (struct pci_dev *dev);
int (*suspend) (struct pci_dev *dev, pm_message_t state);
int (*resume) (struct pci_dev *dev);
int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);
void (*shutdown) (struct pci_dev *dev);

and as can be seen, the arguments to these methods are typed
according to the bus type.

Hence, the methods in struct device_driver are just adding needless
bloat to the kernel. In addition, use of these device_driver methods
invariably requires a container_of() manipulation of the struct_device
structure, and doing that in every driver is also needless code bloat.

Also, from the type safety aspect, it's better to have methods which
are passed the correct type and if they aren't have a compiler
warning or build failure.

Hence, the following patches introduce struct platform_driver, and
then convert the platform device drivers over to this new model.

Due to the way the conversion is done, unconverted drivers will still
continue to work as before... for the time being.

Patches, which are built on top of my previous driver model patch set,

Russell King
Linux kernel 2.6 ARM Linux -
maintainer of: 2.6 Serial core
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: 2005-11-05 19:15    [W:0.074 / U:0.252 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site