All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 3/4] usb: typec: fusb302: Fix debugfs issue
Date: Mon, 30 Apr 2018 06:34:03 -0700	[thread overview]
Message-ID: <293cc83d-28d9-149e-9c7a-f73b6df930d7@roeck-us.net> (raw)
In-Reply-To: <20180430124158.45269-4-heikki.krogerus@linux.intel.com>

On 04/30/2018 05:41 AM, Heikki Krogerus wrote:
> 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 <heikki.krogerus@linux.intel.com>
> ---
>   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;
> -	}

I think the idea here was to permit more than one instance of the driver,
and have all debugfs file entries under the fusb302 directory. Loading the
second instance will fail after this patch is applied.

> +	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
> 

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [3/4] usb: typec: fusb302: Fix debugfs issue
Date: Mon, 30 Apr 2018 06:34:03 -0700	[thread overview]
Message-ID: <293cc83d-28d9-149e-9c7a-f73b6df930d7@roeck-us.net> (raw)

On 04/30/2018 05:41 AM, Heikki Krogerus wrote:
> 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 <heikki.krogerus@linux.intel.com>
> ---
>   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;
> -	}

I think the idea here was to permit more than one instance of the driver,
and have all debugfs file entries under the fusb302 directory. Loading the
second instance will fail after this patch is applied.

> +	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
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-04-30 13:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 12:41 [PATCH 0/4] usb: typec: fixes for Cherry Trails Heikki Krogerus
2018-04-30 12:41 ` [PATCH 1/4] platform: x86: intel_cht_int33fe: Fix dependencies Heikki Krogerus
2018-04-30 12:41   ` [1/4] " Heikki Krogerus
2018-05-01  9:53   ` [PATCH 1/4] " Hans de Goede
2018-05-01  9:53     ` [1/4] " Hans de Goede
2018-05-02  6:59     ` [PATCH 1/4] " Heikki Krogerus
2018-05-02  6:59       ` [1/4] " Heikki Krogerus
2018-04-30 12:41 ` [PATCH 2/4] usb: typec: tcpm: Release the role mux when exiting Heikki Krogerus
2018-04-30 12:41   ` [2/4] " Heikki Krogerus
2018-04-30 13:40   ` [PATCH 2/4] " Guenter Roeck
2018-04-30 13:40     ` [2/4] " Guenter Roeck
2018-05-01  9:54   ` [PATCH 2/4] " Hans de Goede
2018-05-01  9:54     ` [2/4] " Hans de Goede
2018-04-30 12:41 ` [PATCH 3/4] usb: typec: fusb302: Fix debugfs issue Heikki Krogerus
2018-04-30 12:41   ` [3/4] " Heikki Krogerus
2018-04-30 13:34   ` Guenter Roeck [this message]
2018-04-30 13:34     ` Guenter Roeck
2018-05-02  6:52     ` [PATCH 3/4] " Heikki Krogerus
2018-05-02  6:52       ` [3/4] " Heikki Krogerus
2018-04-30 12:41 ` [PATCH 4/4] usb: roles: intel_xhci: Always allow user control Heikki Krogerus
2018-04-30 12:41   ` [4/4] " Heikki Krogerus
2018-05-01  9:57   ` [PATCH 4/4] " Hans de Goede
2018-05-01  9:57     ` [4/4] " Hans de Goede
2018-05-02  6:52     ` [PATCH 4/4] " Heikki Krogerus
2018-05-02  6:52       ` [4/4] " Heikki Krogerus

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=293cc83d-28d9-149e-9c7a-f73b6df930d7@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.