From: Greg KH <gregkh@suse.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
linux-usb-devel@lists.sourceforge.net, daniel.ritz@gmx.ch,
stern@rowland.harvard.edu
Subject: [patch 02/18] Driver Core: add helper device_is_registered()
Date: Thu, 22 Sep 2005 00:47:24 -0700 [thread overview]
Message-ID: <20050922074724.GC15053@kroah.com> (raw)
In-Reply-To: <20050922074643.GA15053@kroah.com>
[-- Attachment #1: driver-device_is_registered.patch --]
[-- Type: text/plain, Size: 2663 bytes --]
From: Daniel Ritz <daniel.ritz@gmx.ch>
[PATCH] driver core: add helper device_is_registered()
add the helper and use it instead of open coding the klist_node_attached() check
(which is a layering violation IMHO)
idea by Alan Stern.
Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/s390/cio/ccwgroup.c | 2 +-
drivers/usb/core/message.c | 2 +-
drivers/usb/core/usb.c | 6 +++---
include/linux/device.h | 5 +++++
4 files changed, 10 insertions(+), 5 deletions(-)
--- scsi-2.6.orig/drivers/s390/cio/ccwgroup.c 2005-09-21 17:37:54.000000000 -0700
+++ scsi-2.6/drivers/s390/cio/ccwgroup.c 2005-09-21 17:37:59.000000000 -0700
@@ -437,7 +437,7 @@
if (cdev->dev.driver_data) {
gdev = (struct ccwgroup_device *)cdev->dev.driver_data;
if (get_device(&gdev->dev)) {
- if (klist_node_attached(&gdev->dev.knode_bus))
+ if (device_is_registered(&gdev->dev))
return gdev;
put_device(&gdev->dev);
}
--- scsi-2.6.orig/drivers/usb/core/message.c 2005-09-21 17:37:54.000000000 -0700
+++ scsi-2.6/drivers/usb/core/message.c 2005-09-21 17:37:59.000000000 -0700
@@ -987,7 +987,7 @@
/* remove this interface if it has been registered */
interface = dev->actconfig->interface[i];
- if (!klist_node_attached(&interface->dev.knode_bus))
+ if (!device_is_registered(&interface->dev))
continue;
dev_dbg (&dev->dev, "unregistering interface %s\n",
interface->dev.bus_id);
--- scsi-2.6.orig/drivers/usb/core/usb.c 2005-09-21 17:37:54.000000000 -0700
+++ scsi-2.6/drivers/usb/core/usb.c 2005-09-21 17:37:59.000000000 -0700
@@ -303,7 +303,7 @@
/* if interface was already added, bind now; else let
* the future device_add() bind it, bypassing probe()
*/
- if (klist_node_attached(&dev->knode_bus))
+ if (device_is_registered(dev))
device_bind_driver(dev);
return 0;
@@ -336,8 +336,8 @@
if (iface->condition != USB_INTERFACE_BOUND)
return;
- /* release only after device_add() */
- if (klist_node_attached(&dev->knode_bus)) {
+ /* don't release if the interface hasn't been added yet */
+ if (device_is_registered(dev)) {
iface->condition = USB_INTERFACE_UNBINDING;
device_release_driver(dev);
}
--- scsi-2.6.orig/include/linux/device.h 2005-09-21 17:37:54.000000000 -0700
+++ scsi-2.6/include/linux/device.h 2005-09-21 17:38:29.000000000 -0700
@@ -317,6 +317,11 @@
dev->driver_data = data;
}
+static inline int device_is_registered(struct device *dev)
+{
+ return klist_node_attached(&dev->knode_bus);
+}
+
/*
* High level routines for use by the bus drivers
*/
--
next prev parent reply other threads:[~2005-09-22 7:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050922003901.814147000@echidna.kroah.org>
2005-09-22 7:46 ` [patch 00/18] USB and PCI Fixes for 2.6.14-rc2 Greg KH
2005-09-22 7:47 ` [patch 01/18] Driver Core: fis bus rescan devices race Greg KH
2005-09-22 7:47 ` Greg KH [this message]
2005-09-22 7:47 ` [patch 03/18] fix class symlinks in sysfs Greg KH
2005-09-22 7:47 ` [patch 04/18] I2C: remove me from the MAINTAINERS file for i2c Greg Kroah-Hartman
2005-09-22 7:48 ` [patch 05/18] PCI: remove unused "scratch" Greg KH
2005-09-22 7:48 ` [patch 06/18] PCI: convert kcalloc to kzalloc Greg KH
2005-09-22 7:48 ` [patch 07/18] fix drivers/pci/probe.c warning Greg KH
2005-09-22 7:48 ` [patch 08/18] PCI Hotplug: Fix buffer overrun in rpadlpar_sysfs.c Greg KH
2005-09-22 7:48 ` [patch 09/18] ub: fix burning cds Greg KH
2005-09-22 7:48 ` [patch 10/18] USB: more device IDs for Option card driver Greg KH
2005-09-22 7:48 ` [patch 11/18] USB: ftdi_sio: allow baud rate to be changed without raising RTS and DTR Greg KH
2005-09-22 7:48 ` [patch 12/18] USB: fix pxa2xx_udc compile warnings Greg KH
2005-09-22 7:49 ` [patch 13/18] USB: sl811-hcd minor fixes Greg KH
2005-09-22 7:49 ` [patch 14/18] USB: fix pegasus driver Greg KH
2005-09-22 7:49 ` [patch 15/18] usb/serial/option.c: Increase input buffer size Greg KH
2005-09-22 7:49 ` [patch 16/18] USB: Add Novatel CDMA Wireless PC card IDs to airprime Greg KH
2005-09-22 7:49 ` [patch 17/18] ub: Comment out unconditional stall clear Greg KH
2005-09-22 7:49 ` [patch 18/18] USB: Update Documentation/usb/URB.txt Greg KH
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=20050922074724.GC15053@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@osdl.org \
--cc=daniel.ritz@gmx.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=stern@rowland.harvard.edu \
--cc=torvalds@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.