Re: C99 Initialisers

From: Russell King
Date: Wed Aug 13 2003 - 16:11:20 EST


On Wed, Aug 13, 2003 at 03:44:44PM -0400, Jeff Garzik wrote:
> Russell King wrote:
> > But what's the point of the extra complexity? People already put
> > references to other structures in the driver_data element, and
> > enums, so completely splitting the device IDs from the module
> > source is not going to be practical.
>
> enums are easy putting direct references would be annoying, but I also
> argue it's potentially broken and wrong to store and export that
> information publicly anyway.

Until new_id occurred, driver_data wasn't public, so this is a new
problem.

> The use of enums instead of pointers is practically required because
> there is a many-to-one relationship of ids to board information structs.

Hmm. Now that driver_data is public, people will bitch when the enums
change. This is _NOT_ something what I want to deal with - if I want
to add a new TI bridge type, I want to add the new TI enumeration
identifier along side the other TI enumeration identifiers, not at the
end. I don't want to worry about whether the user is using the enum
values or not. (eg, so I can use expressions like:
if (id->driver_data >= first_ti_id && id->driver_data <= last_ti_id))

By separating this, it effectively taking away some of the driver authors
freedoms to make choices like this, and this /will/ make driver code more
ugly.

> > Are you thinking of a parser which outputs C code for the module to
> > include? That might be made to work, but it doesn't sound as elegant
> > as the solution being described previously in this thread.
> >
> > "Make the easy things easy (PCI_DEVICE(vendor,device)) and make the
> > not so easy things possible (the long form)"
>
> That ignores the people who also need to get at the data, which must
> first be compiled from C into object code, then extracted via modutils,
> then turned into a computer readable form again, then used.

Could you describe the "user" side of your idea more? ie, what would
get installed onto the filesystem, and how would the tables be used?

--
Russell King (rmk@xxxxxxxxxxxxxxxx) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/