Re: Fundamental Design Flaw of the Device Driver Model?

From: pHilipp Zabel
Date: Fri Aug 22 2008 - 07:29:45 EST


On Fri, Aug 22, 2008 at 11:32 AM, Eric Miao <eric.y.miao@xxxxxxxxx> wrote:
> On Fri, Aug 22, 2008 at 5:03 PM, Pavel Machek <pavel@xxxxxxx> wrote:
>>> Fundamental Design Flaw of the Device Driver Model?
>>> ===================================================
>>>
>>> Sorry for the misleading subject, its purpose is to draw your attention :-)
>>> The ideas below are preliminary and I hope I'm not making serious mistakes
>>> here.
>>>
>>> This question has actually been around in my mind for several months, when
>>> I started to work on some devices with multiple functions. Specifically, a
>>> Power Management IC (PMIC in short in the following text) usually includes
>>> LEDs support (charging, indication...) audio, touch screen, power monitoring,
>>> LDOs, DC-DC bucks, and possibly some others.
>>>
>>> The initial two ideas came into my mind were:
>>>
>>> 1. separate the functions into multiple devices, write a driver for each
>>> of these devices
>>
>> Go for 1.
>>
>>> 4. An intermediate device with no bus, no driver, no many other things
>>> is really not something deserving a "struct device", that's a waste
>>> of memory.
>>
>> Memory is not _that_ expensive, and struct device is not that
>> big. Adding infrastructure to driver model for supporting this would
>> also cost you memory, this time in .text segment.
>>
>
> Actually I don't mind wasting additional memory for a better structure,
> but option (1) isn't. And I just assume you have read to the end of thi
> mail, then you will see it's more like a concept change,no fundamental
> change to the code itself.
>
> Actually the reason to have two different kind of devices are obvious:
>
> 1. physical device - handles the bus related operations (read, write,
> locking, I/O)
> 2. virtual device - handles the functionality (interface with the
> upper framework)
>
> With this separation, the same IP on different semiconductor can be
> shared naturally. There are lot of such products esp in embedded market,
> with multiple shared IPs within a single die.
>
> Attached is a patch series to get you guys a feeling how the option
> (1) will look like, and think again about the device-driver relationship,
> the correctness of introducing an intermediate platform_device.

Instead of allocating/adding the platform subdevices manually in
da903x_add_subdevs, couldn't you use the MFD (multi function device)
infrastructure that seems to be intended for this case? Also, I think
that the da9030 base driver would then better fit in drivers/mfd, not
drivers/i2c/chips (didn't Jean Delvare himself state that ideally
drivers/i2c/chips should be empty?).

regards
Philipp
--
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/