Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInterfaceNumber'

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Stern
Date: Wednesday, October 17, 2007 - 7:48 am

On Tue, 16 Oct 2007, Matthew Dharm wrote:


Right.


It's not a big deal to remove the files first.  In fact, here's a patch 
to do it.  Dave, see if this doesn't fix your problem.  I don't like it 
much because it does an unnecessary remove/create cycle, but that's 
better than doing something wrong.

It's slightly odd that the sysfs core logs an error when you try to 
create the same file twice but it doesn't when you try to remove a 
non-existent file (or try to remove an existing file twice).  Oh 
well...

Alan Stern



Index: usb-2.6/drivers/usb/core/message.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/message.c
+++ usb-2.6/drivers/usb/core/message.c
@@ -1643,7 +1643,13 @@ free_interfaces:
 				intf->dev.bus_id, ret);
 			continue;
 		}
-		usb_create_sysfs_intf_files (intf);
+
+		/* The driver's probe method can call usb_set_interface(),
+		 * which would mean the interface's sysfs files are already
+		 * created.  Just in case, we'll remove them first.
+		 */
+		usb_remove_sysfs_intf_files(intf);
+		usb_create_sysfs_intf_files(intf);
 	}
 
 	usb_autosuspend_device(dev);

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
usb+sysfs: duplicate filename 'bInterfaceNumber', Borislav Petkov, (Sun Oct 14, 8:15 am)
Re: usb+sysfs: duplicate filename 'bInterfaceNumber', Dave Young, (Sun Oct 14, 10:57 pm)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ..., Alan Stern, (Wed Oct 17, 7:48 am)