On Tue, 31 Jul 2007, A. Kalten wrote:

> The kernel 2.6.22 was patched and recompiled.
> 
> It shouldn't make a difference but the problem occurs
> only if I load the modules _before_ plugging in the external
> modem.  If I load the modules _after_ plugging in the modem,
> the problem disappears.  (At least this is what happens with
> the patched kernel.  I'll revert back to the unpatched and
> see if this is still the case.)

This shouldn't make any difference.  Your later message was
self-contradictory; you wrote that the oops occurred only if the
modules were loaded before the modem was plugged in, and that it also
occurred if the modules were loaded after the modem was plugged in.

If you unplug the modem without unloading anything, does the error 
occur?

Here's an additional patch for 2.6.22, to be applied along with the 
previous patch.  Let's see what it shows.

Alan Stern


Index: 2.6.22/drivers/usb/core/message.c
===================================================================
--- 2.6.22.orig/drivers/usb/core/message.c
+++ 2.6.22/drivers/usb/core/message.c
@@ -18,6 +18,8 @@
 #include "hcd.h"       /* for usbcore internals */
 #include "usb.h"
 
+extern int attrtest;
+
 static void usb_api_blocking_completion(struct urb *urb)
 {
        complete((struct completion *)urb->context);
@@ -1056,8 +1058,10 @@ void usb_disable_device(struct usb_devic
                                continue;
                        dev_dbg (&dev->dev, "unregistering interface %s\n",
                                interface->dev.bus_id);
+if (dev->parent) attrtest = 1;
                        usb_remove_sysfs_intf_files(interface);
                        device_del (&interface->dev);
+attrtest = 0;
                }
 
                /* Now that the interfaces are unbound, nobody should
@@ -1574,6 +1578,7 @@ free_interfaces:
                        "adding %s (config #%d, interface %d)\n",
                        intf->dev.bus_id, configuration,
                        intf->cur_altsetting->desc.bInterfaceNumber);
+if (dev->parent) attrtest = 1;
                ret = device_add (&intf->dev);
                if (ret != 0) {
                        dev_err(&dev->dev, "device_add(%s) --> %d\n",
@@ -1581,6 +1586,7 @@ free_interfaces:
                        continue;
                }
                usb_create_sysfs_intf_files (intf);
+attrtest = 0;
        }
 
        usb_autosuspend_device(dev);
Index: 2.6.22/fs/sysfs/file.c
===================================================================
--- 2.6.22.orig/fs/sysfs/file.c
+++ 2.6.22/fs/sysfs/file.c
@@ -13,6 +13,9 @@
 
 #include "sysfs.h"
 
+int attrtest;
+EXPORT_SYMBOL(attrtest);
+
 #define to_sattr(a) container_of(a,struct subsys_attribute, attr)
 
 /*
@@ -466,6 +469,8 @@ int sysfs_create_file(struct kobject * k
 {
        BUG_ON(!kobj || !kobj->dentry || !attr);
 
+if (attrtest) printk("%s: create file %p %s\n", kobject_name(kobj), attr,
+attr->name);
        return sysfs_add_file(kobj->dentry, attr, SYSFS_KOBJ_ATTR);
 
 }
@@ -576,6 +581,7 @@ EXPORT_SYMBOL_GPL(sysfs_chmod_file);
 
 void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
 {
+if (attrtest) printk("%s: remove file %p\n", kobject_name(kobj), attr);
        sysfs_hash_and_remove(kobj->dentry, attr->name);
 }
 
Index: 2.6.22/fs/sysfs/group.c
===================================================================
--- 2.6.22.orig/fs/sysfs/group.c
+++ 2.6.22/fs/sysfs/group.c
@@ -17,6 +17,7 @@
 #include <asm/semaphore.h>
 #include "sysfs.h"
 
+extern int attrtest;
 
 static void remove_files(struct dentry * dir, 
                         const struct attribute_group * grp)
@@ -24,8 +25,10 @@ static void remove_files(struct dentry *
        struct attribute *const* attr;
 
        for (attr = grp->attrs; *attr; attr++)
+{if (attrtest) printk("Remove %p\n", *attr);
                sysfs_hash_and_remove(dir,(*attr)->name);
 }
+}
 
 static int create_files(struct dentry * dir,
                        const struct attribute_group * grp)
@@ -34,6 +37,7 @@ static int create_files(struct dentry * 
        int error = 0;
 
        for (attr = grp->attrs; *attr && !error; attr++) {
+if (attrtest) printk("Add %p %s\n", *attr, (*attr)->name);
                error = sysfs_add_file(dir, *attr, SYSFS_KOBJ_ATTR);
        }
        if (error)
@@ -56,6 +60,7 @@ int sysfs_create_group(struct kobject * 
                        return error;
        } else
                dir = kobj->dentry;
+if (attrtest) printk("%s: create group %p\n", kobject_name(kobj), grp);
        dir = dget(dir);
        if ((error = create_files(dir,grp))) {
                if (grp->name)
@@ -78,6 +83,7 @@ void sysfs_remove_group(struct kobject *
        else
                dir = dget(kobj->dentry);
 
+if (attrtest) printk("%s: remove group %p\n", kobject_name(kobj), grp);
        remove_files(dir,grp);
        if (grp->name)
                sysfs_remove_subdir(dir);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to