2002-08-16 00:46:31

by Adam Belay

[permalink] [raw]
Subject: driverfs: driver interface



[email protected] wrote:

>
>But a PCI bus could also be present, with a USB controller, and the hid
>driver would be able to handle devices on it too. So how would you show
>this "dual" relationship then?
>
Good point.

Check this out. Rather than explaining it, I've attached it to this
email. It might solve this problem. It's based on an idea I stated
earlier. I haven't quite worked out the details yet and I'm not really
even sure if it's the best thing to do. I created a sample interface
comprised of folders and links and then tarred and gzipped it. I'm
looking forward to some reactions on it. (look in ./driver)

Also I have two questions:

1.) Is it worth it to remove the bus interface?
my answer: I think it is because an interface in which drivers can
have children is far more flexable and scaleable. Also it would result
in less code. I'm looking for some feedback so I can revise my current
efforts.

2.) Should driver management occur through driver model interfaces?
my answer: I already have the code to do this, it's just a matter of
what's the best way to manage drivers. I feel that the driver model is
the best place because it offers the most flexability and it allows for
control over all drivers, not just modules.

Thanks,
Adam

PS: I'm currently working on a patch that just implements the read for
"driver" as discussed earlier.


Attachments:
driverfs.tar.gz (755.00 B)

2002-08-16 01:01:27

by Greg KH

[permalink] [raw]
Subject: Re: driverfs: driver interface

On Thu, Aug 15, 2002 at 08:53:08PM +0000, Adam Belay wrote:
>
> Check this out. Rather than explaining it, I've attached it to this
> email. It might solve this problem. It's based on an idea I stated
> earlier. I haven't quite worked out the details yet and I'm not really
> even sure if it's the best thing to do. I created a sample interface
> comprised of folders and links and then tarred and gzipped it. I'm
> looking forward to some reactions on it. (look in ./driver)

Hm, I think you're missing the whole point about classes. You are
trying to do to the driver code, what will be done with the class
code.

Here's the interaction:
- devices have a driver bound to them
- devices live in the /root tree, showing how they are
interconnected.
- drivers register with a bus (possibly more than one.)
- drivers bind to a device present on a bus, and a class (some
drivers bind to many classes)
- classes interact with userspace somehow, providing the
interface between the device and the user.

As an example:
- A USB keyboard lives in the device tree.
- The USB HID driver binds to the device, and the input class
(both the keyboard and generic subclasses of the input code.)
- the user types keys, and that data gets sent from the USB
code, to the HID driver, to the input core, which then
translates them and sends the info out the /dev node.

Within your model, you are not accounting for the different classes
(input, serial, usb-serial, tty, disk, video, etc.). Take a look at the
documentation for all of this for more information.

> Also I have two questions:
>
> 1.) Is it worth it to remove the bus interface?

No.

> 2.) Should driver management occur through driver model interfaces?

No. Let's leave that the way things are today in this regards.

thanks,

greg k-h