From: Bin Liu <b-liu-l0cyMroinI0@public.gmane.org>
To: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Boris Brezillon
<boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Andreas Kemnade <andreas-cLv4Z9ELZ06ZuzBka8ofvg@public.gmane.org>,
Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
Ivaylo Dimitrov
<ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Ladislav Michl <ladis-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
Sergei Shtylyov
<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/6] usb: musb: Fix broken use of static variable for multiple instances
Date: Fri, 11 Nov 2016 13:14:51 -0600 [thread overview]
Message-ID: <20161111191430.GB17372@uda0271908> (raw)
In-Reply-To: <20161111184302.2438-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Hi,
On Fri, Nov 11, 2016 at 10:42:57AM -0800, Tony Lindgren wrote:
> We can't use static variable first for checking when musb is
> initialized when we have multiple musb instances like on am335x.
>
> Tested-by: Ladislav Michl <ladis-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
> Reviewed-by: Johan Hovold <johan-UKKVnA4tBMC5azolltMz9laTQe2KTcn/@public.gmane.org>
> Tested-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/usb/musb/musb_core.c | 9 +++++----
> drivers/usb/musb/musb_core.h | 2 ++
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -2291,6 +2291,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
> if (status)
> goto fail5;
>
> + musb->is_initialized = 1;
> pm_runtime_mark_last_busy(musb->controller);
> pm_runtime_put_autosuspend(musb->controller);
>
> @@ -2629,7 +2630,6 @@ static int musb_runtime_suspend(struct device *dev)
> static int musb_runtime_resume(struct device *dev)
> {
> struct musb *musb = dev_to_musb(dev);
> - static int first = 1;
>
> /*
> * When pm_runtime_get_sync called for the first time in driver
> @@ -2640,9 +2640,10 @@ static int musb_runtime_resume(struct device *dev)
> * Also context restore without save does not make
> * any sense
> */
> - if (!first)
> - musb_restore_context(musb);
> - first = 0;
> + if (!musb->is_initialized)
> + return 0;
> +
> + musb_restore_context(musb);
>
> if (musb->need_finish_resume) {
> musb->need_finish_resume = 0;
> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -385,6 +385,8 @@ struct musb {
> int a_wait_bcon; /* VBUS timeout in msecs */
> unsigned long idle_timeout; /* Next timeout in jiffies */
>
> + unsigned is_initialized:1;
> +
The musb strcut is getting bigger and bigger. Is it possible to not add
a new variable but use one initialized in musb_init_controller() for
this flag purpose? Readability shouldn't be an issue, since it is only
used once in musb_runtime_resume().
Sorry I missed if this patch has been sent before.
Regards,
-Bin.
> /* active means connected and not suspended */
> unsigned is_active:1;
>
> --
> 2.10.2
--
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
next prev parent reply other threads:[~2016-11-11 19:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-11 18:42 [PATCHv2 0/6] musb fixes for v4.9-rc cycle Tony Lindgren
[not found] ` <20161111184302.2438-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-11 18:42 ` [PATCH 1/6] usb: musb: Fix broken use of static variable for multiple instances Tony Lindgren
[not found] ` <20161111184302.2438-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-11 19:14 ` Bin Liu [this message]
2016-11-11 20:05 ` Tony Lindgren
[not found] ` <20161111200519.GG7138-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-11 20:12 ` Bin Liu
2016-11-11 18:42 ` [PATCH 2/6] usb: musb: Fix sleeping function called from invalid context for hdrc glue Tony Lindgren
2016-11-11 18:42 ` [PATCH 3/6] usb: musb: Fix PM for hub disconnect Tony Lindgren
2016-11-11 18:43 ` [PATCH 4/6] phy: twl4030-usb: Fix for musb session bit based PM Tony Lindgren
2016-11-11 18:43 ` [PATCH 5/6] usb: musb: Add missing pm_runtime_disable and drop 2430 PM timeout Tony Lindgren
[not found] ` <20161111184302.2438-6-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-14 15:57 ` Johan Hovold
2016-11-11 18:43 ` [PATCH 6/6] usb: musb: Drop pointless PM runtime code for dsps glue Tony Lindgren
[not found] ` <20161111184302.2438-7-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-14 15:59 ` Johan Hovold
2016-11-14 21:26 ` Tony Lindgren
2016-11-11 23:28 ` [PATCHv2 0/6] musb fixes for v4.9-rc cycle Laurent Pinchart
-- strict thread matches above, loose matches on Subject: below --
2016-11-15 21:37 [PATCHv3 " Tony Lindgren
[not found] ` <20161115213755.12316-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-15 21:37 ` [PATCH 1/6] usb: musb: Fix broken use of static variable for multiple instances Tony Lindgren
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=20161111191430.GB17372@uda0271908 \
--to=b-liu-l0cymroini0@public.gmane.org \
--cc=andreas-cLv4Z9ELZ06ZuzBka8ofvg@public.gmane.org \
--cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=kishon-l0cyMroinI0@public.gmane.org \
--cc=ladis-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox