From patchwork Wed Apr 23 15:55:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 28911 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 47D5120534 for ; Wed, 23 Apr 2014 15:58:14 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf6555807oag.2 for ; Wed, 23 Apr 2014 08:58:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=PbKVxREwiLgnKMFmWcyCNcA+4KBIe/sueXZtMSL+9gw=; b=MOYZhkZa/Zbk41xOpRMrHhxiZsmhiu5S2fexPummu6Ztr0u5fe9jX7lUGNLoqikO9g oT08GXvAGrHJYoMPY03KdUe7EFPiPIVF/gXUZ+OBh6nEm0zZO5v34ieoGT4fkE7aqwHV Tatt6M2Ps7s2MnbgRpg84CttgoYPQURIXLqbO4yPcd4g8aWRAC4rMznQyY8C8YLYUgy/ Zvc5ZX5/G5BgiXlLu00cMMBgg4SS8EJhX1DWfpI5egBhblNnF5um0MAeBA1y+/cQHhuh Hcnwm83Aywfs8EuhFngjkcteOHIWWX9m3jBjwvbKFSzodamPm6jWYynyk2zDnm+SDqPW KrQA== X-Gm-Message-State: ALoCoQknIcufdi0YOkIOvwrzkb59FhcRRIRQ5Y6Ls3HeHVsd67Qljr89O8qDASyqxPf306uOxFm/ X-Received: by 10.182.24.5 with SMTP id q5mr26175564obf.23.1398268694553; Wed, 23 Apr 2014 08:58:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.40 with SMTP id 37ls625755qgk.32.gmail; Wed, 23 Apr 2014 08:58:14 -0700 (PDT) X-Received: by 10.58.55.170 with SMTP id t10mr1757926vep.29.1398268694420; Wed, 23 Apr 2014 08:58:14 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id ck5si246159vdd.109.2014.04.23.08.58.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 08:58:14 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so1362065veb.2 for ; Wed, 23 Apr 2014 08:58:14 -0700 (PDT) X-Received: by 10.220.5.129 with SMTP id 1mr440657vcv.71.1398268694348; Wed, 23 Apr 2014 08:58:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp114691vcb; Wed, 23 Apr 2014 08:58:13 -0700 (PDT) X-Received: by 10.68.191.138 with SMTP id gy10mr13974958pbc.169.1398268692906; Wed, 23 Apr 2014 08:58:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck1si871388pad.163.2014.04.23.08.58.12; Wed, 23 Apr 2014 08:58:12 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756585AbaDWP6I (ORCPT + 3 others); Wed, 23 Apr 2014 11:58:08 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:52491 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754222AbaDWP6B (ORCPT ); Wed, 23 Apr 2014 11:58:01 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3NFvpr7011419; Wed, 23 Apr 2014 10:57:51 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3NFvoK6004890; Wed, 23 Apr 2014 10:57:50 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Wed, 23 Apr 2014 10:57:50 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3NFvnGX017733; Wed, 23 Apr 2014 10:57:50 -0500 Date: Wed, 23 Apr 2014 10:55:29 -0500 From: Felipe Balbi To: Olivier Gayot CC: , , , Markus Pargmann Subject: Re: [PATCH] usb: musb_dsps: fix the exit routine for debugfs Message-ID: <20140423155529.GL9593@saruman.home> Reply-To: References: <1398267583-19159-1-git-send-email-ogayot@baylibre.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1398267583-19159-1-git-send-email-ogayot@baylibre.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Wed, Apr 23, 2014 at 05:39:43PM +0200, Olivier Gayot wrote: > The following commit introduced the debugfs : > > 40f099e32c2a06bad7d75683421e30fcc74924cd > Author: Markus Pargmann > Date: Fri Jan 17 10:22:35 2014 +0100 > > usb: musb: dsps, debugfs files > > Unfortunately, a forgotten call to a cleanup function prevents the > probing of musb in case of deferred probe. > > Because musb_init_controller() often retries and creates a new debugfs > directory each time it is called, we need to remove that directory in case the > initialization fails. Otherwise, the debugfs_create_dir() fails at > subsequent calls because the directory already exists. > > Fixed by calling debugfs_remove_recursive() in the exit function. > > Signed-off-by: Olivier Gayot > Cc: Markus Pargmann > --- > drivers/usb/musb/musb_dsps.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c > index 3372ded..c3de0a5 100644 > --- a/drivers/usb/musb/musb_dsps.c > +++ b/drivers/usb/musb/musb_dsps.c > @@ -471,6 +471,8 @@ static int dsps_musb_exit(struct musb *musb) > > del_timer_sync(&glue->timer); > > + debugfs_remove_recursive(glue->dbgfs_root); > + > usb_phy_shutdown(musb->xceiv); > return 0; First of all this commit is wrong, second of all I already have the proper commit: commit 0fca91b8a446d4a38b8f3d4772c4a8665ebcd7b2 Author: Daniel Mack Date: Wed Apr 2 11:46:51 2014 +0200 usb: musb: dsps: move debugfs_remove_recursive() When the platform initialization fails due to missing resources, it will return -EPROBE_DEFER after dsps_musb_init() has been called. dsps_musb_init() calls dsps_musb_dbg_init() to allocate the debugfs nodes. At a later point in time, the probe will be retried, and dsps_musb_dbg_init() will be called again. debugfs_create_dir() will fail this time, as the node already exists, and so the entire device probe will fail with -ENOMEM. Fix this by moving debugfs_remove_recursive() from dsps_remove() to the plaform's exit function, so it will be cleanly torn down when the probe fails. It also feels more natural this way, as .exit is the counterpart to .init. Signed-off-by: Daniel Mack Signed-off-by: Felipe Balbi a pull request has already been sent to Greg, should be in v3.15-rc3 diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 3372ded..e2fd263 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -470,8 +470,9 @@ static int dsps_musb_exit(struct musb *musb) struct dsps_glue *glue = dev_get_drvdata(dev->parent); del_timer_sync(&glue->timer); - usb_phy_shutdown(musb->xceiv); + debugfs_remove_recursive(glue->dbgfs_root); + return 0; } @@ -708,8 +709,6 @@ static int dsps_remove(struct platform_device *pdev) pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); - debugfs_remove_recursive(glue->dbgfs_root); - return 0; }