public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Belay <ambx1@netscape.net>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@vger.kernel.org
Subject: Re: driverfs: [PATCH] remove bus and improve driver management (2.5.30)
Date: Thu, 15 Aug 2002 10:57:39 +0000	[thread overview]
Message-ID: <3D5B8923.9000609@netscape.net> (raw)
In-Reply-To: 20020815050419.GB30226@kroah.com



greg@kroah.com wrote:

>Hi,
>
>On Wed, Aug 14, 2002 at 10:16:31PM +0000, Adam Belay wrote:
>
>>   This patch removes bus.c from the Driver Model and replaces it with 
>>a more advanced and scaleable driver subsystem.  
>>
>
>Hm, I'm a bit slow, but even with your second drawings, I still don't
>understand this.  Can you add | and - lines to the drawing, it would
>help me understand what you are trying to show here.
>
Sorry about the confusing diagram, I'll just write out paths.  3rd time 
is a charm.

my old driver tree:
/driverfs/bus
/driverfs/bus/pci
/driverfs/bus/pci/drivers/agpgart
/driverfs/bus/pci/drivers/cardbus
/driverfs/bus/pci/drivers/parport_pc
/driverfs/bus/usb
my new tree now:
/driverfs/driver/
/driverfs/driver/pci
/driverfs/driver/pci/agpgart
/driverfs/driver/pci/cardbus
/driverfs/driver/pci/parport_pc

a possibility for my tree when drivers that need it convert to my 
changes  and the driver model in general:
/driverfs/driver/
/driverfs/driver/pci
/driverfs/driver/pci/agpgart
/driverfs/driver/pci/cardbus
/driverfs/driver/pci/parport_pc
/driverfs/driver/pci/parport_pc/lp
/driverfs/driver/pci/usb
/driverfs/driver/pci/usb/hid

* I am not saying that usb has to be done this way but if you notice in 
the first diagram (the old implementation) usb does not have any driver 
representation with pci or if it does it is not displayed.  The lp 
driver is significant because it is imposible to cleanly implement 3 
levels of drivers in the current Driver Model.

>
>
>>   Notice that this implementation not only solves the problems listed 
>>earlier but also it is more scalable because it lists the drivers by 
>>thier true relationship to one another.  These changes actually reduce 
>>the total amount of code as well as the complexity of the entire system 
>>resulting in better efficiency and perhaps even less memory consumption.
>>
>
>But what's the problem you are trying to solve?  How the devices
>interact in the global device tree?  That's already shown properly.  Or
>am I missing something here?
>
    As you can now see in my new diagrams the problem I am trying to 
solve is not how devices are represented but rather how drivers are 
represented.  Sorry I wasn't clear.  I have completely removed bus and 
replaced it with a driver interface.  This is better because a bus does 
not deserve special implementations as it is a driver too.  My more 
scaleable interface can handle both buses and drivers.

>
>
>>   `This patch also provides user level driver management support 
>>through the advanced features of the new interface.  It creates a file 
>>entry named "driver" for each device.
>>To attach a driver simply echo the name of the driver you want to 
>>attach.  For example:
>>#cd ./root/pci0/00:00.0
>>#echo "agpgart" > driver
>>
>
>Hm, how does this bind the driver to the device?  What if the driver
>doesn't want to bind to this device?  And how does userspace know what
>pci device to bind to what driver?  Does it use the information in the
>modules.*map file?  If so, that comes directly from the drivers
>themselves, which are the ones knowing what devices they _should_ be
>bound to, so why not let the driver themselves do the work (well
>actually the very small function at
>drivers/pci/pci-driver.c:pci_match_device() does the work).
>
This feature is well designed, if a driver doesn't want to bind to the 
device the request will fail.  Check the code yourself.  This is simply 
a userspace override for the Driver Model.  This is useful because it 
provides the user with more control over driver management.  If two 
drivers can support the same device and the driver model selects one the 
user doesn't want to use the user can change it.  This could even happen 
now with ALSA and Open Sound.  Since it calls both probe and match it is 
also a great debugging tool.  I'm currently working on a user level 
utility that will take full advantage of this and other driver 
management features.

>
>
>>To remove a driver simply echo remove to the driver file while a driver 
>>is loaded.  For example:
>>#echo "remove" > driver
>>
>
>Again, why?  And does this force the ->remove() function to be called?
>
Yes this does call ->remove() among other things.  In fact it calls 
do_driver_detach.
Why is above.

>
>
>>If you read the driver file you will get the name of the loaded driver 
>>if a driver is loaded.  For example:
>>#cat driver
>>output: agpgart
>>
>
>Now this is a nice idea.  But I was thinking of moving the symlink from
>the bus/pci/devices to be under the specific driver in
>bus/pci/drivers/foo_driver.  That would show you at a simple glance
>which driver is bound to which device.  But putting the name in the
>device entry in the /root tree would be good enough too.
>
There are many ways to go about it.  I even left in a few extra 
fucntions in fs.c for other options.  The question is what's the best 
way to do it?

>
>
>>This patch is against 2.5.30.  The following still needs to be done:
>>1.) port to 2.5.31
>>
>
>Watch out, there are lots of driver model changes already in Linus's
>tree (post 2.5.31.)
>
:-(

If you have any questions feel free to ask.

Thanks,
Adam




  reply	other threads:[~2002-08-15 14:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-14 22:16 driverfs: [PATCH] remove bus and improve driver management (2.5.30) Adam Belay
2002-08-15  5:04 ` Greg KH
2002-08-15 10:57   ` Adam Belay [this message]
     [not found]   ` <3D5B885E.5000407@netscape.net>
2002-08-15 16:23     ` Greg KH
2002-08-15 16:48       ` Patrick Mochel
2002-08-15 20:53       ` driverfs: driver interface Adam Belay
2002-08-16  1:00         ` Greg KH
2002-08-15 16:44     ` driverfs: [PATCH] remove bus and improve driver management (2.5.30) Patrick Mochel
2002-08-15 15:35       ` Adam Belay
  -- strict thread matches above, loose matches on Subject: below --
2002-08-14 22:46 Adam Belay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D5B8923.9000609@netscape.net \
    --to=ambx1@netscape.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox