mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <greg@kroah.com>, Dave Young <hidave.darkstar@gmail.com>,
	bbpetkov@yahoo.de,
	Kernel development list <linux-kernel@vger.kernel.org>,
	USB development list <linux-usb-devel@lists.sourceforge.net>
Subject: Re: [linux-usb-devel] usb+sysfs: duplicate filename 'bInterfaceNumber'
Date: Tue, 16 Oct 2007 09:33:48 -0700	[thread overview]
Message-ID: <20071016163348.GB24082@one-eyed-alien.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0710161046330.4418-100000@iolanthe.rowland.org>

[-- Attachment #1: Type: text/plain, Size: 2101 bytes --]

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: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-10-16 16:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-14 15:15 Borislav Petkov
2007-10-15  5:57 ` Dave Young
2007-10-15 18:38   ` [linux-usb-devel] " Alan Stern
2007-10-16  4:48     ` Greg KH
2007-10-16  5:22       ` Dave Young
2007-10-16 14:55         ` Alan Stern
2007-10-16 16:33           ` Matthew Dharm [this message]
2007-10-16 18:04             ` Alan Stern
2007-10-16 19:13               ` Matthew Dharm
2007-10-17  1:31                 ` Dave Young
2007-10-17 14:48                 ` Alan Stern
2007-10-18  1:52                   ` Dave Young
2007-10-18 22:48                   ` Greg KH
2007-10-25  9:06 Dave Young
2007-10-25 18:11 ` Greg KH
2007-10-26  2:01   ` Dave Young
2007-10-26  2:42     ` Greg KH
2007-10-26  3:11       ` Dave Young
2007-10-26  3:28         ` Greg KH
2007-10-26  4:43           ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071016163348.GB24082@one-eyed-alien.net \
    --to=mdharm-kernel@one-eyed-alien.net \
    --cc=bbpetkov@yahoo.de \
    --cc=greg@kroah.com \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®