login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
October
»
17
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInterfaceNumber'
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Dave Young
Subject:
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInterfaceNumber'
Date: Wednesday, October 17, 2007 - 6:52 pm
On 10/17/07, Alan Stern <stern@rowland.harvard.edu> wrote:
quoted text
> On Tue, 16 Oct 2007, Matthew Dharm wrote: > > > On Tue, Oct 16, 2007 at 02:04:43PM -0400, Alan Stern wrote: > > > On Tue, 16 Oct 2007, Matthew Dharm wrote: > > > > > > > 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? > > > > > > usb_set_interface() is smart enough to remove the old interface files > > > before creating new ones, since it expects them to exist already. > > > Hence there's no problem in that scenario. > > > > > > But usb_set_configuration doesn't expect there to be any pre-existing > > > interface files, because there isn't even an interface until the > > > registration is performed. > > > > And I'm guessing that you can't call usb_create_sysfs_intf_files() until > > registration is performed, right? > > Right. > > > > The most important reason has to do with the endpoint pseudo-devices. > > > Different altsettings can have different endpoints, so those have to be > > > removed and re-created whenever the altsetting changes. > > > > Right, altsettings. I forgot about those. I only ever think in terms of > > multiple configurations. > > > > *grumble* > > > > If usb_set_interface() has to be smart enough to remove existing files > > first already, then I guess it's reasonably symmetric to have > > usb_set_configuration() have the same smarts. Maybe they can share some > > common code, even. > > 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.
Although it's not the best fix, the problem is fixed, Thanks.
quoted text
> > 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); > >
-
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
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
, (Mon Oct 15, 11:38 am)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Greg KH
, (Mon Oct 15, 9:48 pm)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Dave Young
, (Mon Oct 15, 10:22 pm)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Alan Stern
, (Tue Oct 16, 7:55 am)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Matthew Dharm
, (Tue Oct 16, 9:33 am)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Alan Stern
, (Tue Oct 16, 11:04 am)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Matthew Dharm
, (Tue Oct 16, 12:13 pm)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Dave Young
, (Tue Oct 16, 6:31 pm)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Alan Stern
, (Wed Oct 17, 7:48 am)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Dave Young
, (Wed Oct 17, 6:52 pm)
Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInte ...
, Greg KH
, (Thu Oct 18, 3:48 pm)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v2 11/11] sched: update tg->shares after cpu.shares write
Ingo Molnar
Re: [RFC] Cpu-hotplug: Using the Process Freezer (try2)
Michal Nazarewicz
Re: [PATCH] USB: Gadget: g_multi: added INF file for gadget with multiple configur...
Eric W. Biederman
Re: init's children list is long and slows reaping children.
Jeffrey V. Merkey
Re: Versioning file system
git
:
Matthieu Moy
Re: Bugs in Gitosis
Daniel Barkalow
Re: About git and the use of SHA-1
David Lang
Re: mingw, windows, crlf/lf, and git
Shawn O. Pearce
Re: Bugs in Gitosis
Junio C Hamano
Re: [PATCH 14/21] Convert ce_path_match() to use struct pathspec
linux-netdev
:
David Miller
Re: [2.6.30-rc3] powerpc: compilation error of mace module
David Miller
Re: [PATCH] ipv6: fix display of local and remote sit endpoints
Cong Wang
Re: [PATCH] s2io: add dynamic LRO disable support
Tobacco New Year Promo
Eric Dumazet
Re: [PATCH] net: implement emergency route cache rebulds when gc_elasticity is exc...
git-commits-head
:
Linux Kernel Mailing List
V4L/DVB: tm6000: add special usb request to quit i2c tuner transfer
Linux Kernel Mailing List
of/flattree: merge early_init_dt_scan_memory() common code
Linux Kernel Mailing List
b43: N-PHY: add some registers and structs definitions
Linux Kernel Mailing List
powerpc: Move /proc/ppc64 to /proc/powerpc and add symlink
Linux Kernel Mailing List
drivers/acpi: use kasprintf
openbsd-misc
:
Ted Bullock
Re: Proliant DL380 G3 cannot get on network
Eric Furman
Re: Defending OpenBSD Performance
Damien Miller
Re: Patching a SSH 'Weakness'
Tony Abernethy
Re: The Atheros story in much fewer words
Nick Holland
Re: 1 out of 3 hunks failed--saving rejects to kerberosV/src/lib/krb5/crypto.c.rej
Colocation donated by:
Syndicate