* [PATCH] usb: musb_dsps: fix the exit routine for debugfs
@ 2014-04-23 15:39 Olivier Gayot
[not found] ` <1398267583-19159-1-git-send-email-ogayot-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Olivier Gayot @ 2014-04-23 15:39 UTC (permalink / raw)
To: balbi; +Cc: linux-usb, linux-omap, Olivier Gayot, Markus Pargmann
The following commit introduced the debugfs :
40f099e32c2a06bad7d75683421e30fcc74924cd
Author: Markus Pargmann <mpa@pengutronix.de>
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 <ogayot@baylibre.com>
Cc: Markus Pargmann <mpa@pengutronix.de>
---
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;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: musb_dsps: fix the exit routine for debugfs
[not found] ` <1398267583-19159-1-git-send-email-ogayot-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
@ 2014-04-23 15:55 ` Felipe Balbi
[not found] ` <20140423155529.GL9593-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2014-04-23 15:55 UTC (permalink / raw)
To: Olivier Gayot
Cc: balbi-l0cyMroinI0, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Markus Pargmann
[-- Attachment #1: Type: text/plain, Size: 3384 bytes --]
On Wed, Apr 23, 2014 at 05:39:43PM +0200, Olivier Gayot wrote:
> The following commit introduced the debugfs :
>
> 40f099e32c2a06bad7d75683421e30fcc74924cd
> Author: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> 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 <ogayot-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
> Cc: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
> 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 <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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 <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
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;
}
a pull request has already been sent to Greg, should be in v3.15-rc3
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: musb_dsps: fix the exit routine for debugfs
[not found] ` <20140423155529.GL9593-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
@ 2014-04-24 9:07 ` Olivier Gayot
2014-04-24 15:10 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: Olivier Gayot @ 2014-04-24 9:07 UTC (permalink / raw)
To: balbi-l0cyMroinI0
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Markus Pargmann
Ok, thank you, I didn't notice the existing thread.
On Wed, 23 Apr 2014 10:55:29 -0500
Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> wrote:
> On Wed, Apr 23, 2014 at 05:39:43PM +0200, Olivier Gayot wrote:
> > The following commit introduced the debugfs :
> >
> > 40f099e32c2a06bad7d75683421e30fcc74924cd
> > Author: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > 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 <ogayot-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
> > Cc: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > ---
> > 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 <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 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 <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
>
> 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;
> }
>
>
> a pull request has already been sent to Greg, should be in v3.15-rc3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: musb_dsps: fix the exit routine for debugfs
2014-04-24 9:07 ` Olivier Gayot
@ 2014-04-24 15:10 ` Felipe Balbi
0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2014-04-24 15:10 UTC (permalink / raw)
To: Olivier Gayot; +Cc: balbi, linux-usb, linux-omap, Markus Pargmann
[-- Attachment #1: Type: text/plain, Size: 185 bytes --]
Hi,
On Thu, Apr 24, 2014 at 11:07:34AM +0200, Olivier Gayot wrote:
> Ok, thank you, I didn't notice the existing thread.
no problem, but don't top-post please :-s
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-24 15:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 15:39 [PATCH] usb: musb_dsps: fix the exit routine for debugfs Olivier Gayot
[not found] ` <1398267583-19159-1-git-send-email-ogayot-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2014-04-23 15:55 ` Felipe Balbi
[not found] ` <20140423155529.GL9593-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-24 9:07 ` Olivier Gayot
2014-04-24 15:10 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox