* [BK PATCH] More USB patches for 2.6.10-rc1
@ 2004-11-05 0:35 Greg KH
2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:35 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-usb-devel, linux-kernel
Hi,
Here are some more USB fixes and changes for 2.6.10-rc1. All of these
patches should have been in the past few -mm releases.
Big fix here is some PCI suspend fixes (yeah, it came along with some
USB suspend fixes, so it all got mushed together...)
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/usb-2.6
Patches will be posted to linux-usb-devel as a follow-up thread for
those who want to see them.
thanks,
greg k-h
Documentation/usb/usb-serial.txt | 56 +
MAINTAINERS | 16
drivers/block/Kconfig | 2
drivers/block/ub.c | 62 +
drivers/pci/pci-driver.c | 4
drivers/pci/quirks.c | 6
drivers/usb/core/devio.c | 8
drivers/usb/core/hcd-pci.c | 100 ++-
drivers/usb/core/hcd.c | 61 +
drivers/usb/core/hcd.h | 10
drivers/usb/core/hub.c | 36 -
drivers/usb/core/message.c | 25
drivers/usb/core/usb.c | 8
drivers/usb/gadget/Makefile | 2
drivers/usb/gadget/dummy_hcd.c | 452 +++++++------
drivers/usb/gadget/ether.c | 4
drivers/usb/gadget/file_storage.c | 4
drivers/usb/gadget/serial.c | 875 ++++++++++++++++++++-------
drivers/usb/gadget/zero.c | 2
drivers/usb/host/ehci-hcd.c | 146 ++--
drivers/usb/host/ehci-hub.c | 48 -
drivers/usb/host/ehci-mem.c | 5
drivers/usb/host/ehci-q.c | 3
drivers/usb/host/ehci-sched.c | 7
drivers/usb/host/ehci.h | 13
drivers/usb/host/ohci-dbg.c | 144 ++--
drivers/usb/host/ohci-hcd.c | 110 +--
drivers/usb/host/ohci-hub.c | 111 +--
drivers/usb/host/ohci-lh7a404.c | 10
drivers/usb/host/ohci-mem.c | 11
drivers/usb/host/ohci-omap.c | 34 -
drivers/usb/host/ohci-pci.c | 1
drivers/usb/host/ohci-pxa27x.c | 10
drivers/usb/host/ohci-q.c | 189 +++--
drivers/usb/host/ohci-sa1111.c | 10
drivers/usb/host/ohci.h | 262 +++++---
drivers/usb/host/uhci-hcd.c | 42 -
drivers/usb/host/uhci-hcd.h | 2
drivers/usb/host/uhci-hub.c | 2
drivers/usb/input/hid-core.c | 11
drivers/usb/input/powermate.c | 2
drivers/usb/media/stv680.c | 6
drivers/usb/media/usbvideo.c | 79 --
drivers/usb/net/Kconfig | 8
drivers/usb/net/catc.c | 4
drivers/usb/net/usbnet.c | 18
drivers/usb/serial/Kconfig | 15
drivers/usb/serial/Makefile | 1
drivers/usb/serial/cypress_m8.c | 1230 +++++++++++++++++++++++++++++++++++++-
drivers/usb/serial/cypress_m8.h | 55 +
drivers/usb/serial/pl2303.c | 3
drivers/usb/serial/pl2303.h | 14
drivers/usb/serial/usb-serial.c | 111 ++-
drivers/usb/serial/usb-serial.h | 16
54 files changed, 3301 insertions(+), 1165 deletions(-)
-----
<arjan:fenrus.demon.nl>:
o USB: remove dead code in usb video
<lmendez19:austin.rr.com>:
o cypress_m8: add usb-serial driver 'cypress_m8' to kernel tree
o usb-serial: add interrupt out support and improved debug messages
o hid-core: add two devices to device blacklist
Adrian Bunk:
o USB ohci-dbg.c: remove an unused function
o USB stv680.c: remove an unused function
Alan Stern:
o usbcore: add comment to updated hcd.h
o dummy-hcd: removal hcd release
o Non-PCI OHCI drivers: remove hcd release
o USB PCI drivers: hcd release changes
o usbcore: Make the core release hcd structures
o dummy-hcd: Refactor startup and shutdown
o dummy_hcd: minor fixups
o UHCI: Use a sane timeout for device initialization
o USB: Dequeuing of root-hub URBs
o UHCI: Workaround for broken remote wakeup
Arnaldo Carvalho de Melo:
o USB: add id for Siemens x65 series of mobiles to pl2303 driver
David Brownell:
o USB: ohci-omap, updates for omap1510/5910 and innovator
o USB: usb gadget serial driver v2.0
o USB: usb gadget drivers, minor tweaks
o USB: ohci, hooks for big-endian registers
o USB: ohci, remove pre-byteswapped constants
o USB: clean up error messages
o USB: fix bug
o USB: fix ohci_restart warning
o usbcore, diagnostic tweaks
o OHCI suspend/resume updates (minor)
o EHCI suspend/resume updates
o PCI: make pci_save_state() only happen when no suspend()
o usbcore and system sleep states
Greg Kroah-Hartman:
o USB: fix sparse warnings in cypress_m8 driver
o USB: fix up pl2303 device ids that ended up getting duplicated
o USB: fix up serial object reference count bug on error path
Jonathan McDowell:
o USB: add KC2190 support for usbnet
Karsten Wiese:
o UHCI: Convert remainder to bitwise-and
Nishanth Aravamudan:
o pci/quirks: replace schedule_timeout() with msleep()
Pete Zaitcev:
o USB: Patch for ub
Thomas Gleixner:
o Lock initializer unifying Batch 2 (USB)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.3, 2004/11/04 10:12:44-08:00, kay.sievers@vrfy.org
[PATCH] add the physical device and the bus to the hotplug environment
Add the sysfs path of the physical device to the hotplug event of class
and block devices. This should solve the userspace issue not to know if
the device is a virtual one and the "device" symlink will never be created,
but we sit there and wait for it to show up not knowing when we should
give up.
Also the bus name is added to the hotplug event, so we don't need to
reverse lookup in the /sys/bus/* directory which bus our physical
device belongs to. This is e.g. the value matched against the BUS= key,
that may be used in an udev rule.
This is a PCI network card:
ACTION=add
SUBSYSTEM=net
DEVPATH=/class/net/eth0
PHYSDEVPATH=/devices/pci0000:00/0000:00:1e.0/0000:02:01.0
PHYSDEVBUS=pci
INTERFACE=eth0
SEQNUM=827
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/
This is a IDE CDROM:
ACTION=add
SUBSYSTEM=block
DEVPATH=/block/hdc
PHYSDEVPATH=/devices/pci0000:00/0000:00:1f.1/ide1/1.0
PHYSDEVBUS=ide
SEQNUM=1017
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/
This is an USB-stick partition:
ACTION=add
SUBSYSTEM=block
DEVPATH=/block/sda/sda1
PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host1/target1:0:0/1:0:0:0
PHYSDEVBUS=scsi
SEQNUM=1032
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/base/class.c | 26 ++++++++++++++++++++++++++
drivers/block/genhd.c | 40 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 65 insertions(+), 1 deletion(-)
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c 2004-11-04 16:31:01 -08:00
+++ b/drivers/base/class.c 2004-11-04 16:31:01 -08:00
@@ -283,8 +283,34 @@
{
struct class_device *class_dev = to_class_dev(kobj);
int retval = 0;
+ int i = 0;
+ int length = 0;
pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
+
+ if (class_dev->dev) {
+ /* add physical device, backing this device */
+ struct device *dev = class_dev->dev;
+ char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
+
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
+ &length, "PHYSDEVPATH=%s", path);
+ kfree(path);
+
+ /* add bus name of physical device */
+ if (dev->bus)
+ add_hotplug_env_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "PHYSDEVBUS=%s", dev->bus->name);
+
+ /* terminate, set to next free slot, shrink available space */
+ envp[i] = NULL;
+ envp = &envp[i];
+ num_envp -= i;
+ buffer = &buffer[length];
+ buffer_size -= length;
+ }
+
if (class_dev->class->hotplug) {
/* have the bus specific function add its stuff */
retval = class_dev->class->hotplug (class_dev, envp, num_envp,
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c 2004-11-04 16:31:01 -08:00
+++ b/drivers/block/genhd.c 2004-11-04 16:31:01 -08:00
@@ -438,8 +438,46 @@
return ((ktype == &ktype_block) || (ktype == &ktype_part));
}
+static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
+ int num_envp, char *buffer, int buffer_size)
+{
+ struct device *dev = NULL;
+ struct kobj_type *ktype = get_ktype(kobj);
+ int length = 0;
+ int i = 0;
+
+ /* get physical device backing disk or partition */
+ if (ktype == &ktype_block) {
+ struct gendisk *disk = container_of(kobj, struct gendisk, kobj);
+ dev = disk->driverfs_dev;
+ } else if (ktype == &ktype_part) {
+ struct gendisk *disk = container_of(kobj->parent, struct gendisk, kobj);
+ dev = disk->driverfs_dev;
+ }
+
+ if (dev) {
+ /* add physical device, backing this device */
+ char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
+
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
+ &length, "PHYSDEVPATH=%s", path);
+ kfree(path);
+
+ /* add bus name of physical device */
+ if (dev->bus)
+ add_hotplug_env_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "PHYSDEVBUS=%s", dev->bus->name);
+
+ envp[i] = NULL;
+ }
+
+ return 0;
+}
+
static struct kset_hotplug_ops block_hotplug_ops = {
- .filter = block_hotplug_filter,
+ .filter = block_hotplug_filter,
+ .hotplug = block_hotplug,
};
/* declare block_subsys. */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:35 [BK PATCH] More USB patches for 2.6.10-rc1 Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.1, 2004/11/03 13:50:35-08:00, maneesh@in.ibm.com
[PATCH] sysfs: fix sysfs backing store error path confusion
o sysfs_new_dirent to retrun 0 if kmalloc fails. Thanks to Milton Miller
for spotting this.
Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
fs/sysfs/dir.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c 2004-11-04 16:31:16 -08:00
+++ b/fs/sysfs/dir.c 2004-11-04 16:31:16 -08:00
@@ -56,7 +56,7 @@
sd = sysfs_new_dirent(parent_sd, element);
if (!sd)
- return -ENOMEM;
+ return 0;
sd->s_mode = mode;
sd->s_type = type;
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.2, 2004/11/03 13:50:47-08:00, bunk@stusta.de
[PATCH] small sysfs cleanups
The patch below does the following cleanups for the sysfs code:
- remove the unused global function sysfs_mknod
- make some structs and functions static
Please check whether this patch is correct, or whether some of the
things I made static should be used globally in the forseeable future.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
fs/sysfs/dir.c | 2 +-
fs/sysfs/inode.c | 5 -----
fs/sysfs/mount.c | 2 +-
fs/sysfs/symlink.c | 17 +++++++++--------
fs/sysfs/sysfs.h | 2 --
5 files changed, 11 insertions(+), 17 deletions(-)
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c 2004-11-04 16:31:09 -08:00
+++ b/fs/sysfs/dir.c 2004-11-04 16:31:09 -08:00
@@ -201,7 +201,7 @@
return err;
}
-struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
+static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd)
{
struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
diff -Nru a/fs/sysfs/inode.c b/fs/sysfs/inode.c
--- a/fs/sysfs/inode.c 2004-11-04 16:31:09 -08:00
+++ b/fs/sysfs/inode.c 2004-11-04 16:31:09 -08:00
@@ -76,11 +76,6 @@
return error;
}
-int sysfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
-{
- return sysfs_create(dentry, mode, NULL);
-}
-
struct dentry * sysfs_get_dentry(struct dentry * parent, const char * name)
{
struct qstr qstr;
diff -Nru a/fs/sysfs/mount.c b/fs/sysfs/mount.c
--- a/fs/sysfs/mount.c 2004-11-04 16:31:09 -08:00
+++ b/fs/sysfs/mount.c 2004-11-04 16:31:09 -08:00
@@ -22,7 +22,7 @@
.drop_inode = generic_delete_inode,
};
-struct sysfs_dirent sysfs_root = {
+static struct sysfs_dirent sysfs_root = {
.s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling),
.s_children = LIST_HEAD_INIT(sysfs_root.s_children),
.s_element = NULL,
diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
--- a/fs/sysfs/symlink.c 2004-11-04 16:31:09 -08:00
+++ b/fs/sysfs/symlink.c 2004-11-04 16:31:09 -08:00
@@ -9,12 +9,6 @@
#include "sysfs.h"
-struct inode_operations sysfs_symlink_inode_operations = {
- .readlink = generic_readlink,
- .follow_link = sysfs_follow_link,
- .put_link = sysfs_put_link,
-};
-
static int object_depth(struct kobject * kobj)
{
struct kobject * p = kobj;
@@ -157,7 +151,7 @@
}
-int sysfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static int sysfs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
int error = -ENOMEM;
unsigned long page = get_zeroed_page(GFP_KERNEL);
@@ -167,12 +161,19 @@
return 0;
}
-void sysfs_put_link(struct dentry *dentry, struct nameidata *nd)
+static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd)
{
char *page = nd_get_link(nd);
if (!IS_ERR(page))
free_page((unsigned long)page);
}
+
+struct inode_operations sysfs_symlink_inode_operations = {
+ .readlink = generic_readlink,
+ .follow_link = sysfs_follow_link,
+ .put_link = sysfs_put_link,
+};
+
EXPORT_SYMBOL_GPL(sysfs_create_link);
EXPORT_SYMBOL_GPL(sysfs_remove_link);
diff -Nru a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
--- a/fs/sysfs/sysfs.h 2004-11-04 16:31:09 -08:00
+++ b/fs/sysfs/sysfs.h 2004-11-04 16:31:09 -08:00
@@ -17,8 +17,6 @@
extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd);
extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent);
-extern int sysfs_follow_link(struct dentry *, struct nameidata *);
-extern void sysfs_put_link(struct dentry *, struct nameidata *);
extern struct rw_semaphore sysfs_rename_sem;
extern struct super_block * sysfs_sb;
extern struct file_operations sysfs_dir_operations;
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.8, 2004/11/04 10:57:45-08:00, tj@home-tj.org
[PATCH] driver-model: device_add() error path reference counting fix
df_05_device_add_ref_fix.patch
In device_add(), @dev wan't put'd properly when it has zero length
bus_id (error path). Fixed.
Signed-off-by: Tejun Heo <tj@home-tj.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/base/core.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c 2004-11-04 16:30:24 -08:00
+++ b/drivers/base/core.c 2004-11-04 16:30:24 -08:00
@@ -209,12 +209,12 @@
*/
int device_add(struct device *dev)
{
- struct device * parent;
- int error;
+ struct device *parent = NULL;
+ int error = -EINVAL;
dev = get_device(dev);
if (!dev || !strlen(dev->bus_id))
- return -EINVAL;
+ goto Error;
parent = get_device(dev->parent);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.6, 2004/11/04 10:54:31-08:00, tj@home-tj.org
[PATCH] driver-model: sysfs_release() dangling pointer reference fix
df_03_sysfs_release_fix.patch
Some attributes are allocated dynamically (e.g. module and device
parameters) and are usually deallocated when the assoicated kobject is
released. So, it's not safe to access attr after putting the kobject.
Signed-off-by: Tejun Heo <tj@home-tj.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
fs/sysfs/file.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
diff -Nru a/fs/sysfs/file.c b/fs/sysfs/file.c
--- a/fs/sysfs/file.c 2004-11-04 16:30:39 -08:00
+++ b/fs/sysfs/file.c 2004-11-04 16:30:39 -08:00
@@ -330,11 +330,13 @@
{
struct kobject * kobj = to_kobj(filp->f_dentry->d_parent);
struct attribute * attr = to_attr(filp->f_dentry);
+ struct module * owner = attr->owner;
struct sysfs_buffer * buffer = filp->private_data;
if (kobj)
kobject_put(kobj);
- module_put(attr->owner);
+ /* After this point, attr should not be accessed. */
+ module_put(owner);
if (buffer) {
if (buffer->page)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.9, 2004/11/04 11:59:39-08:00, greg@kroah.com
kevent: fix build error if CONFIG_KOBJECT_UEVENT is not selected.
Thanks to Serge Hallyn <serue@us.ibm.com> for pointing this out.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
lib/kobject_uevent.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
--- a/lib/kobject_uevent.c 2004-11-04 16:30:17 -08:00
+++ b/lib/kobject_uevent.c 2004-11-04 16:30:17 -08:00
@@ -168,7 +168,7 @@
#else
static inline int send_uevent(const char *signal, const char *obj,
- const void *buf, int buflen, int gfp_mask)
+ char **envp, int gfp_mask)
{
return 0;
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.7, 2004/11/04 10:55:28-08:00, tj@home-tj.org
[PATCH] driver-model: kobject_add() error path reference counting fix
df_04_kobject_add_ref_fix.patch
In kobject_add(), @kobj wasn't put'd properly on error path. This
patch fixes it.
Signed-off-by: Tejun Heo <tj@home-tj.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
lib/kobject.c | 1 +
1 files changed, 1 insertion(+)
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c 2004-11-04 16:30:32 -08:00
+++ b/lib/kobject.c 2004-11-04 16:30:32 -08:00
@@ -183,6 +183,7 @@
unlink(kobj);
if (parent)
kobject_put(parent);
+ kobject_put(kobj);
} else {
kobject_hotplug(kobj, KOBJ_ADD);
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.5, 2004/11/04 10:48:20-08:00, tj@home-tj.org
[PATCH] driver-model: bus_recan_devices() locking fix
df_02_bus_rescan_devcies_fix.patch
bus_rescan_devices() eventually calls device_attach() and thus
requires write locking the corresponding bus. The original code just
called bus_for_each_dev() which only read locks the bus. This patch
separates __bus_for_each_dev() and __bus_for_each_drv(), which don't
do locking themselves, out from the original functions and call them
with read lock in the original functions and with write lock in
bus_rescan_devices().
Signed-off-by: Tejun Heo <tj@home-tj.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/base/bus.c | 93 +++++++++++++++++++++++++++++++----------------------
1 files changed, 56 insertions(+), 37 deletions(-)
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c 2004-11-04 16:30:46 -08:00
+++ b/drivers/base/bus.c 2004-11-04 16:30:46 -08:00
@@ -135,6 +135,52 @@
decl_subsys(bus, &ktype_bus, NULL);
+static int __bus_for_each_dev(struct bus_type *bus, struct device *start,
+ void *data, int (*fn)(struct device *, void *))
+{
+ struct list_head *head;
+ struct device *dev;
+ int error = 0;
+
+ if (!(bus = get_bus(bus)))
+ return -EINVAL;
+
+ head = &bus->devices.list;
+ dev = list_prepare_entry(start, head, bus_list);
+ list_for_each_entry_continue(dev, head, bus_list) {
+ get_device(dev);
+ error = fn(dev, data);
+ put_device(dev);
+ if (error)
+ break;
+ }
+ put_bus(bus);
+ return error;
+}
+
+static int __bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
+ void * data, int (*fn)(struct device_driver *, void *))
+{
+ struct list_head *head;
+ struct device_driver *drv;
+ int error = 0;
+
+ if (!(bus = get_bus(bus)))
+ return -EINVAL;
+
+ head = &bus->drivers.list;
+ drv = list_prepare_entry(start, head, kobj.entry);
+ list_for_each_entry_continue(drv, head, kobj.entry) {
+ get_driver(drv);
+ error = fn(drv, data);
+ put_driver(drv);
+ if (error)
+ break;
+ }
+ put_bus(bus);
+ return error;
+}
+
/**
* bus_for_each_dev - device iterator.
* @bus: bus type.
@@ -154,30 +200,16 @@
* to retain this data, it should do, and increment the reference
* count in the supplied callback.
*/
+
int bus_for_each_dev(struct bus_type * bus, struct device * start,
void * data, int (*fn)(struct device *, void *))
{
- struct device *dev;
- struct list_head * head;
- int error = 0;
-
- if (!(bus = get_bus(bus)))
- return -EINVAL;
-
- head = &bus->devices.list;
- dev = list_prepare_entry(start, head, bus_list);
+ int ret;
down_read(&bus->subsys.rwsem);
- list_for_each_entry_continue(dev, head, bus_list) {
- get_device(dev);
- error = fn(dev, data);
- put_device(dev);
- if (error)
- break;
- }
+ ret = __bus_for_each_dev(bus, start, data, fn);
up_read(&bus->subsys.rwsem);
- put_bus(bus);
- return error;
+ return ret;
}
/**
@@ -203,27 +235,12 @@
int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
void * data, int (*fn)(struct device_driver *, void *))
{
- struct list_head * head;
- struct device_driver *drv;
- int error = 0;
-
- if(!(bus = get_bus(bus)))
- return -EINVAL;
-
- head = &bus->drivers.list;
- drv = list_prepare_entry(start, head, kobj.entry);
+ int ret;
down_read(&bus->subsys.rwsem);
- list_for_each_entry_continue(drv, head, kobj.entry) {
- get_driver(drv);
- error = fn(drv, data);
- put_driver(drv);
- if(error)
- break;
- }
+ ret = __bus_for_each_drv(bus, start, data, fn);
up_read(&bus->subsys.rwsem);
- put_bus(bus);
- return error;
+ return ret;
}
/**
@@ -590,7 +607,9 @@
{
int count = 0;
- bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);
+ down_write(&bus->subsys.rwsem);
+ __bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);
+ up_write(&bus->subsys.rwsem);
return count;
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.10, 2004/11/04 12:00:12-08:00, rml@novell.com
[PATCH] kobject_uevent: fix init ordering
Looks like kobject_uevent_init is executed before netlink_proto_init and
consequently always fails. Not cool.
Attached patch switches the initialization over from core_initcall (init
level 1) to postcore_initcall (init level 2). Netlink's initialization
is done in core_initcall, so this should fix the problem. We should be
fine waiting until postcore_initcall.
Also a couple white space changes mixed in, because I am anal.
Signed-Off-By: Robert Love <rml@novell.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
lib/kobject_uevent.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
--- a/lib/kobject_uevent.c 2004-11-04 16:30:09 -08:00
+++ b/lib/kobject_uevent.c 2004-11-04 16:30:09 -08:00
@@ -120,9 +120,8 @@
sprintf(attrpath, "%s/%s", path, attr->name);
rc = send_uevent(signal, attrpath, NULL, gfp_mask);
kfree(attrpath);
- } else {
+ } else
rc = send_uevent(signal, path, NULL, gfp_mask);
- }
exit:
kfree(path);
@@ -148,7 +147,6 @@
{
return do_kobject_uevent(kobj, action, attr, GFP_ATOMIC);
}
-
EXPORT_SYMBOL_GPL(kobject_uevent_atomic);
static int __init kobject_uevent_init(void)
@@ -164,7 +162,7 @@
return 0;
}
-core_initcall(kobject_uevent_init);
+postcore_initcall(kobject_uevent_init);
#else
static inline int send_uevent(const char *signal, const char *obj,
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.4, 2004/11/04 10:28:20-08:00, tj@home-tj.org
[PATCH] driver-model: comment fix in bus.c
df_01_driver_attach_comment_fix.patch
bus_match() was renamed to driver_probe_device() but the comment for
device_attach() wasn't updated. This patch updates it.
Signed-off-by: Tejun Heo <tj@home-tj.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/base/bus.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c 2004-11-04 16:30:54 -08:00
+++ b/drivers/base/bus.c 2004-11-04 16:30:54 -08:00
@@ -325,10 +325,10 @@
* driver_attach - try to bind driver to devices.
* @drv: driver.
*
- * Walk the list of devices that the bus has on it and try to match
- * the driver with each one.
- * If bus_match() returns 0 and the @dev->driver is set, we've found
- * a compatible pair.
+ * Walk the list of devices that the bus has on it and try to
+ * match the driver with each one. If driver_probe_device()
+ * returns 0 and the @dev->driver is set, we've found a
+ * compatible pair.
*
* Note that we ignore the -ENODEV error from driver_probe_device(),
* since it's perfectly valid for a driver not to bind to any devices.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2449.2.11, 2004/11/04 12:00:36-08:00, rml@novell.com
[PATCH] kobject_uevent: add MAINTAINER entry
Attached patch adds a MAINTAINER entry for the kernel event layer.
Signed-Off-By: Robert Love <rml@novell.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
MAINTAINERS | 6 ++++++
1 files changed, 6 insertions(+)
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS 2004-11-04 16:30:02 -08:00
+++ b/MAINTAINERS 2004-11-04 16:30:02 -08:00
@@ -1247,6 +1247,12 @@
W: http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/
S: Maintained
+KERNEL EVENT LAYER (KOBJECT_UEVENT)
+P: Robert Love
+M: rml@novell.com
+L: linux-kernel@vger.kernel.org
+S: Maintained
+
LANMEDIA WAN CARD DRIVER
P: Andrew Stanley-Jones
M: asj@lanmedia.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1
2004-11-05 0:48 ` Greg KH
@ 2004-11-05 0:48 ` Greg KH
0 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.2462, 2004/11/04 14:44:35-08:00, maneesh@in.ibm.com
[PATCH] fix kernel BUG at fs/sysfs/dir.c:20!
On Thu, Nov 04, 2004 at 12:52:38PM -0800, Greg KH wrote:
> Hi,
>
> I get the following BUG in the sysfs code when I do:
> - plug in a usb-serial device.
> - open the port with 'cat /dev/ttyUSB0'
> - unplug the device.
> - stop the 'cat' process with control-C
>
> This used to work just fine before your big sysfs changes.
There is a similar problem reported by s390 people where we see parent
kobject (directory) going away before child kobject (sub-directory). It
seems kobject code is able to handle this, but not the sysfs. What could
be happening that in sysfs_remove_dir() of parent directory, we try to
remove its contents. It works well with the regular files as it is the
final removal for sysfs_dirent corresponding to the files. But in case
of sub-directory we are doing an extra sysfs_put(). Once while removing
parent and the other one being the one from when sysfs_remove_dir() is
called for the child.
The following patch worked for the s390 people, I hope same will work in
this case also.
o Do not remove sysfs_dirents corresponding to the sub-directory in
sysfs_remove_dir(). They will be removed in the sysfs_remove_dir() call
for the specific sub-directory.
Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
fs/sysfs/dir.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c 2004-11-04 16:29:54 -08:00
+++ b/fs/sysfs/dir.c 2004-11-04 16:29:54 -08:00
@@ -277,7 +277,7 @@
pr_debug("sysfs %s: removing dir\n",dentry->d_name.name);
down(&dentry->d_inode->i_sem);
list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) {
- if (!sd->s_element)
+ if (!sd->s_element || !(sd->s_type & SYSFS_NOT_PINNED))
continue;
list_del_init(&sd->s_sibling);
sysfs_drop_dentry(sd, dentry);
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2004-11-05 1:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-05 0:35 [BK PATCH] More USB patches for 2.6.10-rc1 Greg KH
2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®