Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5093064ybi; Tue, 4 Jun 2019 00:50:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKvG/T/rE32TrMD6SXUHV8XXj+swnv/bjCyuxW+L7olNq2bvbrVc2zxYW8q+li9shUBipq X-Received: by 2002:a63:de53:: with SMTP id y19mr33283507pgi.166.1559634623668; Tue, 04 Jun 2019 00:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559634623; cv=none; d=google.com; s=arc-20160816; b=fAdpu75/aKI6F/QSRYsxPCcGmE9cUWLP5pg4pa3TMhatNSNG0d7Q56fjDT1wBpBbSa 6TiIxixK+AWbv9zqtV3dW6T3pD1A6XzSx5DnjustV3bWerM6zwOsTls4gorNJ3mL99i5 KCVEfxeWDL2BBuYf6XA/Pe2ay1+cwjO9Vxxogwk06GOv2zS4qruVE5hv4sFWPMpdc8Ul +gqHKNH1b6nsLUlQGLvg/CuJbclVee2SoGviBk3xxOOwongQVk82ULmlxuJ/Q2ldZfPH WrtesWumavXFpkfn8IfSXIInSIHqQ7pGV6gmA+qMsDLmG9yfl+QFO+2ZnBE5URTx4cou 0BBg== 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:date:references :in-reply-to:subject:cc:to:from; bh=Bc8Cs1SJp905xeL89gTjo3I0rHzcSOd94e2yJbh59V4=; b=z9w1nhWsFqw6fheXNWMT5eM97SYpWbIAZDJBNiVRpQOIBZfSQFHAMAUzyqNSMyMUf0 KezS77x5XopwJ/gvrfs1LqyoOmdWvDGHofBXxG3fmFnEg3KExxn+rs3QFV/XOr12Ko9F yUSnubJfpeB0/4Du4auedCl4uaxPN5jRfHvKpG4HuD8WMWgrd3DLWUtMxgikZplQdnbf yiR69mfuFeshW+GvhuBBE24zFD02ovr/YfOqsngtUCakLJdQybg+q6cBbylYQqbt2hVX Z31gXLVqM92ph0cFbWuh937simhJ1sIt8WyfbDXt26ibIeJZeZbRFh+bXcBIZLEBeDh9 dRcw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6si8020047pgn.427.2019.06.04.00.50.07; Tue, 04 Jun 2019 00:50:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726945AbfFDHsB (ORCPT + 99 others); Tue, 4 Jun 2019 03:48:01 -0400 Received: from mga18.intel.com ([134.134.136.126]:25293 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfFDHsB (ORCPT ); Tue, 4 Jun 2019 03:48:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 00:47:59 -0700 X-ExtLoop1: 1 Received: from pipin.fi.intel.com (HELO pipin) ([10.237.72.175]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2019 00:47:56 -0700 From: Felipe Balbi To: Greg Kroah-Hartman , Chunfeng Yun Cc: Matthias Brugger , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH v4] usb: create usb_debug_root for gadget only In-Reply-To: <20190604073706.GA25045@kroah.com> References: <1559633647-29040-1-git-send-email-chunfeng.yun@mediatek.com> <20190604073706.GA25045@kroah.com> Date: Tue, 04 Jun 2019 10:47:55 +0300 Message-ID: <87k1e123mc.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Greg Kroah-Hartman writes: >> +struct dentry *usb_debugfs_init(void) >> +{ >> + if (!usb_debug_root) >> + usb_debug_root = debugfs_create_dir("usb", NULL); >> + >> + atomic_inc(&usb_debug_root_refcnt); >> + >> + return usb_debug_root; >> +} >> +EXPORT_SYMBOL_GPL(usb_debugfs_init); >> + >> +void usb_debugfs_cleanup(void) >> +{ >> + if (atomic_dec_and_test(&usb_debug_root_refcnt)) { >> + debugfs_remove_recursive(usb_debug_root); >> + usb_debug_root = NULL; >> + } >> +} >> +EXPORT_SYMBOL_GPL(usb_debugfs_cleanup); > > Only remove the debugfs subdir if the usbcore module is removed. Create > the debugfs subdir when the usbcore module is loaded. No need for any > reference counting of any sort at all. No need to overthink this :) There is a slight need to overthink. He wants to use the same directory for gadget-only builds too :-) -- balbi