[lkml]   [2001]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] New Driver Model for 2.5
On Friday 19 October 2001 09:57, Henning P. Schmiedehausen wrote:
> Benjamin Herrenschmidt <> writes:
> >>> struct device {
> And a version field! Please add a version field right to the
> beginning. This would make supporting legacy drivers in later versions
> _much_ easier.

IMHO it would be a good idea not to create and fill those structs using a
function, instead of letting the driver code create the struct or using

In the current version of the patch struct device is allocated using

struct device *device_alloc_dev(void);

and then later registered using

int device_register_dev(struct device *dev);

In other words the fields are set by the bus driver. The problem is that when
somebody adds a new, required field then existing code will silently break.
So I would propose to think about using something like

struct device *device_create_dev(const char *name,
const char *bus_id,
struct device_driver *driver,
void *driver_data,
void *platform_data,
u32 current_state);

The advantage is that when you add a new field the old code won't compile
before it has been fixed. It also allows you to do large changes in the
underlying code without breaking source compatibility.
The disadvantage is that you cannot add a field that should be specifier by
the caller without either adding a new function or destroying source


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-03-22 13:08    [W:0.080 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site