public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Driver core change request
@ 2004-10-07  4:54 Dmitry Torokhov
  2004-10-07 21:40 ` Greg KH
  0 siblings, 1 reply; 18+ messages in thread
From: Dmitry Torokhov @ 2004-10-07  4:54 UTC (permalink / raw)
  To: LKML; +Cc: Greg KH, Patrick Mochel

Hi,

I am reworking my sysfs serio patches (trying to get dynamic psmouse
protocol switching) and I am wondering if we could export device_attach
function. Serio system allows user to request device rescan - force current
driver to let go off the device and find another suitable driver. Also user
can manually request device to be disconnected/connected to a driver. By
having device_attach exported I could get rid of some duplicated code.

Also serio allows user to request a specific driver to be bound to a device
in case there are several options (psmouse/serio_raw for example). To do
that and not poke in the driver core guts too much I need something like the
following:

int driver_probe_device(struct device_driver *dev, struct device *dev)
{
        int error;
        
	dev->driver = drv;
        if (drv->probe) {
        	if ((error = drv->probe(dev))) {
                	dev->driver = NULL;
                        return error;
                }
	}
        device_bind_driver(dev);
        return 0;
}


static int bus_match(struct device * dev, struct device_driver * drv)
{
        if (dev->bus->match(dev, drv))
		return driver_probe_device(drv, dev);

        return -ENODEV;
}

I.e driver_probe_device is exported. Does it have a chance to be accepted?

Thanks!

-- 
Dmitry

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] Driver core: add driver_probe_device
@ 2004-10-29 18:57 Dmitry Torokhov
  2004-10-29 20:22 ` Greg KH
  0 siblings, 1 reply; 18+ messages in thread
From: Dmitry Torokhov @ 2004-10-29 18:57 UTC (permalink / raw)
  To: Greg KH; +Cc: LKML, Patrick Mochel

Sorry for breaking the threading...

Greg KH wrote:
> On Fri, Oct 29, 2004 at 01:24:21PM -0500, Dmitry Torokhov wrote:
> > On Friday 29 October 2004 11:37 am, Greg KH wrote:
> > > On Tue, Oct 12, 2004 at 01:31:36AM -0500, Dmitry Torokhov wrote:
> > > > #### AUTHOR dtor_core@ameritech.net
> > > > #### COMMENT START
> > > > ### Comments for ChangeSet
> > > > Driver core: rename bus_match into driver_probe_device and export
> > > >              it so subsystems can bind an individual device to a
> > > >              specific driver without getting involved with driver
> > > >              core internals.
> > >
> > > Applied, thanks.
> > >
> >
> > Greg,
> >
> > What about "bind_mode" device and driver attributes? If you are not
> going
> > to apply them then I need to rework driver_probe_device to not call
> > bus->match() function.
> 
> Hm, I'm not going to apply them, but haven't written that email yet,
> sorry.
> 
> Is things now broken with only these 2 patches applied?
> 
> > The reason is that if bind_mode is not in the core
> > then I need to check these attributes in serio's bus match function, but
> > then I will not be able to use driver_probe_device to force binding when
> > user requests it. And if I don't check bind_mode in serio_bus_match then
> > I will have to do all driver/device mathing by hand which I wanted to
> > avoid in the first place.
> 
> Heh, I understand.  I like the ideas of your next patches, but just not
> the implementation.
> 
> I really like the "driver" part in the device.  But not as a file, let's
> make it a symlink back to the driver that is bound to the device at that
> point in time.  This makes it just like the other symlinks in the sysfs
> tree.
> 
> But if we do that, we still don't have a way to implement what you are
> really trying to do (and it breaks your code as you already have a
> driver file.)  I'll work on what I propose instead in my next message
> (will be a few hours, have real work to do for a bit, sorry...)
>

Well, we can have driver as a symlink and rename my "driver" attribute
into something like "drvctl" (just an example, maybe somebody has better
name in mind, I am not fixed on the name) and make it writable only.
I think it should work well as now device and driver objects are very
symmetrical - they both similarly linked together via device->driver
and driver->device).

Also, driver problem is tangent to the bind_mode as you can play with
bind_mode even without driver attribute (f.e. you have 2 cards and 2
modules, mark one card as manual bind, load first module, change bind
mode to automatic, load another module).

Just wanted to make these two points, now I'll wait for your poroposal
later tonight.

Thanks!

-- 
Dmitry


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-10-30  8:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-07  4:54 Driver core change request Dmitry Torokhov
2004-10-07 21:40 ` Greg KH
2004-10-08  2:59   ` Dmitry Torokhov
2004-10-08 21:48     ` Greg KH
2004-10-12  6:29       ` Dmitry Torokhov
2004-10-12  6:31         ` [PATCH 1/4] Driver core: export device_attach Dmitry Torokhov
2004-10-12  6:31           ` [PATCH 2/4] Driver core: add driver_probe_device Dmitry Torokhov
2004-10-12  6:32             ` [PATCH 3/4] Driver core: add "driver" default attribute Dmitry Torokhov
2004-10-12  6:33               ` [PATCH 4/4] Driver core: add "bind_mode" " Dmitry Torokhov
2004-10-29 16:37             ` [PATCH 2/4] Driver core: add driver_probe_device Greg KH
2004-10-29 18:24               ` Dmitry Torokhov
2004-10-29 18:32                 ` Greg KH
2004-10-29 16:37           ` [PATCH 1/4] Driver core: export device_attach Greg KH
2004-10-21  7:05         ` Driver core change request Dmitry Torokhov
2004-10-21 14:50           ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2004-10-29 18:57 [PATCH 2/4] Driver core: add driver_probe_device Dmitry Torokhov
2004-10-29 20:22 ` Greg KH
2004-10-30  8:26   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox