From patchwork Mon Apr 30 12:41:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 10371721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 446AC6032A for ; Mon, 30 Apr 2018 12:42:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3457C28AED for ; Mon, 30 Apr 2018 12:42:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28C4828AF0; Mon, 30 Apr 2018 12:42:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1FB828AED for ; Mon, 30 Apr 2018 12:42:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515AbeD3MmK (ORCPT ); Mon, 30 Apr 2018 08:42:10 -0400 Received: from mga06.intel.com ([134.134.136.31]:39224 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753480AbeD3MmH (ORCPT ); Mon, 30 Apr 2018 08:42:07 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2018 05:42:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,346,1520924400"; d="scan'208";a="51127026" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 30 Apr 2018 05:42:05 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman , Hans de Goede Cc: Andy Shevchenko , Guenter Roeck , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 3/4] usb: typec: fusb302: Fix debugfs issue Date: Mon, 30 Apr 2018 15:41:57 +0300 Message-Id: <20180430124158.45269-4-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430124158.45269-1-heikki.krogerus@linux.intel.com> References: <20180430124158.45269-1-heikki.krogerus@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Removing the "fusb302" debugfs directory when unloading the driver. That allows the driver to be loaded more then ones. This fixes an issue where the driver, if unloaded, can't be re-loaded, as the "fusb302" debugfs directory already exists. While here, removing useless condition when creating the debugfs directory. Fixes: 76f0c53d08b9 ("usb: typec: fusb302: Move out of staging") Signed-off-by: Heikki Krogerus --- drivers/usb/typec/fusb302/fusb302.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c index eba6bb890b17..0e5d0aa052f5 100644 --- a/drivers/usb/typec/fusb302/fusb302.c +++ b/drivers/usb/typec/fusb302/fusb302.c @@ -218,11 +218,9 @@ static struct dentry *rootdir; static int fusb302_debugfs_init(struct fusb302_chip *chip) { mutex_init(&chip->logbuffer_lock); - if (!rootdir) { - rootdir = debugfs_create_dir("fusb302", NULL); - if (!rootdir) - return -ENOMEM; - } + rootdir = debugfs_create_dir("fusb302", NULL); + if (!rootdir) + return -ENOMEM; chip->dentry = debugfs_create_file(dev_name(chip->dev), S_IFREG | 0444, rootdir, @@ -234,6 +232,7 @@ static int fusb302_debugfs_init(struct fusb302_chip *chip) static void fusb302_debugfs_exit(struct fusb302_chip *chip) { debugfs_remove(chip->dentry); + debugfs_remove(rootdir); } #else