public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org, Greg K-H <greg@kroah.com>
Cc: gregkh@suse.de
Subject: Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
Date: Thu, 30 Jun 2005 01:25:39 -0500	[thread overview]
Message-ID: <200506300125.40851.dtor_core@ameritech.net> (raw)
In-Reply-To: <11201114613610@kroah.com>

On Thursday 30 June 2005 01:04, Greg KH wrote:
> [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
> 
> This adds a single file, "unbind", to the sysfs directory of every
> device that is currently bound to a driver.  To unbind the driver from
> the device, write anything to this file and they will be disconnected
> from each other.
>

Comment and the patch disagree with each other.
 
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> ---
> commit 151ef38f7c0ec1b0420f04438b0316e3a30bf2e4
> tree 3aa6504e12c08f70cacb7f9de6ef5858b45ee86d
> parent 0edb586049e57c56e625536476931117a57671e9
> author Greg Kroah-Hartman <gregkh@suse.de> Wed, 22 Jun 2005 16:09:05 -0700
> committer Greg Kroah-Hartman <gregkh@suse.de> Wed, 29 Jun 2005 22:48:04 -0700
> 
>  drivers/base/bus.c |   30 ++++++++++++++++++++++++++++++
>  1 files changed, 30 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -133,6 +133,34 @@ static struct kobj_type ktype_bus = {
>  decl_subsys(bus, &ktype_bus, NULL);
>  
>  
> +/* Manually detach a device from it's associated driver. */
> +static int driver_helper(struct device *dev, void *data)
> +{
> +	const char *name = data;
> +
> +	if (strcmp(name, dev->bus_id) == 0)
> +		return 1;
> +	return 0;
> +}
> +
> +static ssize_t driver_unbind(struct device_driver *drv,
> +			     const char *buf, size_t count)
> +{
> +	struct bus_type *bus = get_bus(drv->bus);
> +	struct device *dev;
> +	int err = -ENODEV;
> +
> +	dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
> +	if ((dev) &&
> +	    (dev->driver == drv)) {
> +		device_release_driver(dev);
> +		err = count;
> +	}
> +	return err;
> +}
> +static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
> +
> +
>  static struct device * next_device(struct klist_iter * i)
>  {
>  	struct klist_node * n = klist_next(i);
> @@ -396,6 +424,7 @@ int bus_add_driver(struct device_driver 
>  		module_add_driver(drv->owner, drv);
>  
>  		driver_add_attrs(bus, drv);
> +		driver_create_file(drv, &driver_attr_unbind);
>  	}
>  	return error;
>  }
> @@ -413,6 +442,7 @@ int bus_add_driver(struct device_driver 
>  void bus_remove_driver(struct device_driver * drv)
>  {
>  	if (drv->bus) {
> +		driver_remove_file(drv, &driver_attr_unbind);
>  		driver_remove_attrs(drv->bus, drv);
>  		klist_remove(&drv->knode_bus);
>  		pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
Dmitry

  parent reply	other threads:[~2005-06-30  6:27 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30  6:02 [GIT PATCH] Driver core patches for 2.6.13-rc1 Greg KH
2005-06-30  6:04 ` [PATCH] driver core: add bus_find_device & driver_find_device functions Greg KH
2005-06-30  6:04   ` [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Greg KH
2005-06-30  6:04     ` [PATCH] driver core: change bus_rescan_devices to return void Greg KH
2005-06-30  6:04       ` [PATCH] driver core: Add the ability to bind drivers to devices from userspace Greg KH
2005-06-30  6:04         ` [PATCH] Driver core: Use klist_del() instead of klist_remove() Greg KH
2005-06-30  6:25     ` Dmitry Torokhov [this message]
2005-06-30  6:29       ` [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Greg KH
2005-06-30  6:19 ` [GIT PATCH] Driver core patches for 2.6.13-rc1 Dmitry Torokhov
2005-06-30  6:27   ` Greg KH
2005-06-30 17:22 ` John Lenz
2005-06-30 19:45   ` Greg KH
2005-06-30 21:18     ` [PATCH] add class_interface pointer to add and remove functions John Lenz
2005-07-03 20:59       ` Greg KH
2005-07-06  2:35         ` John Lenz
2005-07-06  7:17           ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2005-07-25  4:09 [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Jon Smirl
2005-07-25  4:58 ` Dmitry Torokhov
2005-07-25 14:28   ` Jon Smirl
2005-07-25 14:48     ` Dmitry Torokhov
2005-07-25 16:30       ` Jon Smirl
2005-07-26  0:00         ` Greg KH
2005-07-26  0:28           ` Jon Smirl
2005-07-26  0:30             ` Greg KH
2005-07-26  0:56               ` Jon Smirl
2005-07-26  1:54                 ` Greg KH
2005-07-26  3:15                   ` Jon Smirl
2005-07-26  3:29                     ` Dmitry Torokhov
2005-07-28  2:05                     ` Jon Smirl
2005-07-28  3:46                       ` Greg KH
2005-07-28  3:59                         ` Jon Smirl
2005-07-28  4:05                           ` Greg KH
2005-07-28  4:49                             ` Jon Smirl
2005-07-28  5:49                               ` Greg KH
2005-07-28  7:04                                 ` Mitchell Blank Jr
2005-07-28 12:54                                   ` Jon Smirl
2005-07-28 13:09                                     ` Oliver Neukum
2005-07-28 13:16                                     ` Paulo Marques
2005-07-28 18:09                                     ` Mitchell Blank Jr
2005-07-28 19:03                                     ` Greg KH
2005-07-28 19:57                                       ` Jon Smirl
2005-07-28 20:22                                         ` Mitchell Blank Jr
2005-07-28 20:27                                           ` Jon Smirl
2005-07-29 18:50                                             ` Jon Smirl
2005-08-06  0:42                                               ` Greg KH
2005-08-06  3:48                                                 ` Jon Smirl
2005-08-21 22:21                                             ` Jon Smirl
2005-07-28 21:10                                         ` Oliver Neukum
2005-07-28 21:12                                           ` Jon Smirl
2002-01-01  7:53                                             ` Pavel Machek
2005-08-05 13:32                                               ` Jon Smirl
2005-08-05 18:01                                                 ` Oliver Neukum
2005-08-05 18:14                                                   ` Jon Smirl
2005-08-05 18:20                                                     ` Oliver Neukum
2005-08-05 18:47                                                       ` Jon Smirl
2005-08-05 20:07                                                         ` Oliver Neukum
2005-08-05 20:33                                                           ` Jon Smirl
2005-08-06  9:39                                                             ` Oliver Neukum
2005-08-07 18:50                                                             ` Pavel Machek
2005-08-07 18:47                                                 ` Pavel Machek
2005-08-07 20:17                                                   ` Jon Smirl
2005-08-07 21:06                                                     ` Pavel Machek
2005-08-05 22:31                                               ` David Weinehall
2005-07-28 21:17                                             ` Oliver Neukum
2005-07-28 12:52                                 ` Jon Smirl
2005-06-24  5:12 [RFC] bind and unbind drivers from userspace through sysfs Greg KH
2005-06-24  5:14 ` [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Greg KH
2005-06-24 15:57   ` Patrick Mochel
2005-06-25  3:27     ` Greg KH
2005-06-25  4:16       ` Dmitry Torokhov
2005-06-25  9:39         ` Michael Tokarev

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=200506300125.40851.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --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