Re: usb+sysfs: duplicate filename 'bInterfaceNumber'

Matthew Dharm <[email protected]>
Newsgroups gmane.linux.usb.devel,gmane.linux.kernel
Organization One Eyed Alien Networks
Message-ID <[email protected]>
On Tue, Oct 16, 2007 at 10:55:54AM -0400, Alan Stern wrote:
> On Tue, 16 Oct 2007, Dave Young wrote:
> 
> > > I finally duplicated this on one of my machines here at boot time, with
> > > USB built into the kernel.  I'll work tomorrow on tracking this down
> > > further...
> > Hi,
> > I add some printk messages, dump_stack and some others, here is the
> > dmesg dump with debug info(lines begin with "hidave"):
> 
> Okay, good, the extra printk messages show exactly where the problem 
> lies.
> 
> In usb_set_configuration(), each new interfaces is registered and then
> usb_create_sysfs_intf_files() gets called for that interface.  This
> makes sense, because obviously we can't create sysfs files for an
> interface before it is registered.
> 
> The problem is that during registration drivers get probed, and drivers 
> sometimes call usb_set_interface() from their probe method.  This 
> routine also calls usb_create_sysfs_intf_files(), and the result is 
> that the sysfs files get created twice:
> 
> 	First by usb_set_interface, from the driver probe;
> 
> 	Then by usb_set_configuration, when registration is
> 	finished.
> 
> I can think of two possible ways around the problem.  One is to add a 
> bit to the usb_interface structure, recording whether the sysfs files 
> have been created.  The other is always to remove the files just before 
> trying to create them.

I haven't looked at this code at all, but neither approach feels right to
me.

How does this work at all?  Even if you load a driver later, wouldn't it
call usb_set_interface(), which would call usb_create_sysfs_intf_files()
and hit the same issue?

Heck, why do both call usb_create_sysfs_intf_file()?  I would guess if
you're *changing* the active configuration you would need to do that, but
why in usb_set_interface() at all?

Matt

-- 
Matthew Dharm                              Home: [email protected] 
Maintainer, Linux USB Mass Storage Driver

I say, what are all those naked people doing?
					-- Big client to Stef
User Friendly, 12/14/1997

-------------------------------------------------------------------------
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/

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHFOfsHL9iwnUZqnkRAt5lAJ49jhKFScgOI9sWpqMWd0xlAFz54QCfUcRL
3UEcJFm5k2VHdelFAWrAJuU=
=JqwZ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.