Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4435658yba; Wed, 17 Apr 2019 11:25:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzN1wMiO3WiiZrycGC9DwHD6Ojdf7TW+SjhRXNMeB/8enXZJpgOLRJSFb6Dq3csKUh5aBGd X-Received: by 2002:aa7:818a:: with SMTP id g10mr88440067pfi.178.1555525520633; Wed, 17 Apr 2019 11:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555525520; cv=none; d=google.com; s=arc-20160816; b=ebOFApdRL80zMvpP3rcgtUnhZ2wPFrfWID7FR9QdfOe7YkoWtKt5HVhmfeP9JJcDFq NHNU4V2dd17cydA5mAfNJCet/PZPd5YYUBJ0h5Zb0AMLSXh37sf3XVPTb3OS3ngiNG9B bSQpRd65ZvuEv43Eh+RDztgCFDhSF6b109C6iePcjd0x/5b1WBpGVPBuolTZ8XytA+H1 CGmDRTeg9SQQmNryx9P6sDaR8Ivv4Gqx7grrRE36skVCnPNO7pAYEKUQ6c2oDcZhi0Xb mM/TPEwHMlzINEYQcnGomdC5RhOx9K5PqrSyuC5fjjg7jA8fZ61xo2PLQwevn+c/KnU4 C1yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=tlJRbN3fkwnwBElIG4eo2dDE0vPveyeZYpndoAZ+ELE=; b=PZE5qRvxsSb7xpZpL1kud1BaZiD6+DJYDnI5sS/RLN1oX5GktPod8HwxHj75BHV7Qj 2EezysTgiQUOx4GUpcPbqwsrnEjwhIdoUBF8yHIHMHk9HrHUccB03XcbKrEuEicc4DdZ kGpLmvggZZzKiBqhvOO9hiCdMqoZoZSIVnhAyqeN7CE2vynyzPdeTGGBr9mPfctco9fp uAajJj2bMQSbx56Q7OkID23d3NBClv7O/7k/ZFdH0s47y3SU6RIPaq8IDF/ApbI4FULf xlABnWQiuxxbB8QazeMUjU7uNWr+44zzGej+yf+z3UJx9rIyvhjvJ/WRIkIleam7jQkH Ci9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si50461252ple.218.2019.04.17.11.25.06; Wed, 17 Apr 2019 11:25:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731792AbfDQSYI (ORCPT + 99 others); Wed, 17 Apr 2019 14:24:08 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:59064 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728373AbfDQSYH (ORCPT ); Wed, 17 Apr 2019 14:24:07 -0400 Received: (qmail 3228 invoked by uid 2102); 17 Apr 2019 14:24:06 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 17 Apr 2019 14:24:06 -0400 Date: Wed, 17 Apr 2019 14:24:06 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Raul Rangel cc: Greg Kroah-Hartman , , , , , , Sebastian Andrzej Siewior , Martin Blumenstingl , Dmitry Torokhov , Suwan Kim , , "Gustavo A. R. Silva" , Miquel Raynal , Johan Hovold , Mathias Nyman Subject: Re: [PATCH v2] usb/hcd: Send a uevent signaling that the host controller has died In-Reply-To: <20190417175300.GA74282@google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Apr 2019, Raul Rangel wrote: > > > Also where would be a good place to document this? > > > > Documentation/ABI/ is a good start. > I'll add something to Documentation/ABI/testing/xhci-uevent Your patch will apply to all host controllers, not just xhci. The documentation filename should reflect this. Perhaps "usb-uevent"? > > Why do you need to lock something that is "dead"? And why is the idr > > lock the correct one here? > We need to ensure that root_hub is not null. Though I'm not sure the > lock is entirely necessary in this case. usb_remove_hcd stops the work > item before it sets the rhdev to null. The reason I picked > usb_bus_idr_lock was because it's the same lock that usb_remove_hcd uses > when setting rhdev = NULL. > > Alan, what do you think? Should I remove the lock? You're both right; the lock isn't needed because the work is stopped before the root hub gets removed. Acquiring the lock doesn't do any harm, but it isn't needed so you probably should remove it. In fact, you don't even need to test for whether hcd->self.root_hub is non-NULL. Alan Stern