* [PATCH] omap2430 musb: Make musb_otg_notification non-blocking
@ 2011-12-30 1:36 NeilBrown
2012-01-24 8:56 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2011-12-30 1:36 UTC (permalink / raw)
To: Felipe Balbi; +Cc: linux-omap, linux-usb
[-- Attachment #1: Type: text/plain, Size: 2553 bytes --]
This callback is on an 'atomic notificaitons' queue but is written
as a blocking notifier.
Convert to use a work-queue to run from non-atomic context.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index b3c065a..fb90d94 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -352,6 +352,8 @@ struct musb {
struct timer_list otg_timer;
struct notifier_block nb;
+ struct work_struct notify_work;
+ unsigned long event;
struct dma_controller *dma_controller;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ba85f27..a0fe317 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -223,11 +223,11 @@ static inline void omap2430_low_level_init(struct musb *musb)
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}
-/* blocking notifier support */
-static int musb_otg_notifications(struct notifier_block *nb,
- unsigned long event, void *unused)
+/* work function for atomic notifier */
+static void musb_otg_notify_work(struct work_struct *ws)
{
- struct musb *musb = container_of(nb, struct musb, nb);
+ struct musb *musb = container_of(ws, struct musb, notify_work);
+ unsigned long event = musb->event;
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *pdata = dev->platform_data;
struct omap_musb_board_data *data = pdata->board_data;
@@ -274,8 +274,18 @@ static int musb_otg_notifications(struct notifier_block *nb,
break;
default:
dev_dbg(musb->controller, "ID float\n");
- return NOTIFY_DONE;
+ break;
}
+}
+
+static int musb_otg_notifications(struct notifier_block *nb,
+ unsigned long event,
+ void *unused)
+{
+ struct musb *musb = container_of(nb, struct musb, nb);
+
+ musb->event = event;
+ schedule_work(&musb->notify_work);
return NOTIFY_OK;
}
@@ -323,6 +333,7 @@ static int omap2430_musb_init(struct musb *musb)
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
+ INIT_WORK(&musb->notify_work, musb_otg_notify_work);
musb->nb.notifier_call = musb_otg_notifications;
status = otg_register_notifier(musb->xceiv, &musb->nb);
@@ -386,6 +397,7 @@ static void omap2430_musb_disable(struct musb *musb)
static int omap2430_musb_exit(struct musb *musb)
{
del_timer_sync(&musb_idle_timer);
+ cancel_work_sync(&musb->notify_work);
omap2430_low_level_exit(musb);
otg_put_transceiver(musb->xceiv);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] omap2430 musb: Make musb_otg_notification non-blocking
2011-12-30 1:36 [PATCH] omap2430 musb: Make musb_otg_notification non-blocking NeilBrown
@ 2012-01-24 8:56 ` Felipe Balbi
2012-01-25 0:59 ` NeilBrown
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2012-01-24 8:56 UTC (permalink / raw)
To: NeilBrown; +Cc: Felipe Balbi, linux-omap, linux-usb
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
On Fri, Dec 30, 2011 at 12:36:28PM +1100, NeilBrown wrote:
>
>
> This callback is on an 'atomic notificaitons' queue but is written
> as a blocking notifier.
>
> Convert to use a work-queue to run from non-atomic context.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
doesn't apply.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] omap2430 musb: Make musb_otg_notification non-blocking
2012-01-24 8:56 ` Felipe Balbi
@ 2012-01-25 0:59 ` NeilBrown
2012-01-25 8:47 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2012-01-25 0:59 UTC (permalink / raw)
To: balbi; +Cc: linux-omap, linux-usb
[-- Attachment #1: Type: text/plain, Size: 1881 bytes --]
On Tue, 24 Jan 2012 10:56:12 +0200 Felipe Balbi <balbi@ti.com> wrote:
> On Fri, Dec 30, 2011 at 12:36:28PM +1100, NeilBrown wrote:
> >
> >
> > This callback is on an 'atomic notificaitons' queue but is written
> > as a blocking notifier.
> >
> > Convert to use a work-queue to run from non-atomic context.
> >
> > Signed-off-by: NeilBrown <neilb@suse.de>
>
> doesn't apply.
>
It did 1 month ago when I sent it :-)
It seems that commit 712d8efafbbcbe617f9ad706f6ca1ffea4bbf2e8
fixed the same problem already.
The following patch adds a few little bits
Thanks,
NeilBrown
musb/omap2430 minor cleanups.
1/ remove incorrect comment (it is a non-blocking notifier)
2/ Use correct symbolic return value for notifier
3/ Make sure otg_notifier_work is cancelled before module exit.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index c27bbbf..df719ea 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -222,7 +222,6 @@ static inline void omap2430_low_level_init(struct musb *musb)
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}
-/* blocking notifier support */
static int musb_otg_notifications(struct notifier_block *nb,
unsigned long event, void *unused)
{
@@ -231,7 +230,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
musb->xceiv_event = event;
schedule_work(&musb->otg_notifier_work);
- return 0;
+ return NOTIFY_OK;
}
static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
@@ -386,6 +385,7 @@ static void omap2430_musb_disable(struct musb *musb)
static int omap2430_musb_exit(struct musb *musb)
{
del_timer_sync(&musb_idle_timer);
+ cancel_work_sync(&musb->otg_notifier_work);
omap2430_low_level_exit(musb);
otg_put_transceiver(musb->xceiv);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] omap2430 musb: Make musb_otg_notification non-blocking
2012-01-25 0:59 ` NeilBrown
@ 2012-01-25 8:47 ` Felipe Balbi
0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2012-01-25 8:47 UTC (permalink / raw)
To: NeilBrown; +Cc: balbi, linux-omap, linux-usb
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]
On Wed, Jan 25, 2012 at 11:59:54AM +1100, NeilBrown wrote:
> On Tue, 24 Jan 2012 10:56:12 +0200 Felipe Balbi <balbi@ti.com> wrote:
>
> > On Fri, Dec 30, 2011 at 12:36:28PM +1100, NeilBrown wrote:
> > >
> > >
> > > This callback is on an 'atomic notificaitons' queue but is written
> > > as a blocking notifier.
> > >
> > > Convert to use a work-queue to run from non-atomic context.
> > >
> > > Signed-off-by: NeilBrown <neilb@suse.de>
> >
> > doesn't apply.
> >
>
> It did 1 month ago when I sent it :-)
>
> It seems that commit 712d8efafbbcbe617f9ad706f6ca1ffea4bbf2e8
> fixed the same problem already.
>
> The following patch adds a few little bits
>
> Thanks,
> NeilBrown
>
>
>
> musb/omap2430 minor cleanups.
>
> 1/ remove incorrect comment (it is a non-blocking notifier)
> 2/ Use correct symbolic return value for notifier
> 3/ Make sure otg_notifier_work is cancelled before module exit.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
applied, thanks
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-25 8:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-30 1:36 [PATCH] omap2430 musb: Make musb_otg_notification non-blocking NeilBrown
2012-01-24 8:56 ` Felipe Balbi
2012-01-25 0:59 ` NeilBrown
2012-01-25 8:47 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).