From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH 2/4] usb: musb: Fix sleeping function called from invalid context for hdrc glue Date: Wed, 9 Nov 2016 08:34:10 -0700 Message-ID: <20161109153409.GU2428@atomide.com> References: <20161107215020.31399-1-tony@atomide.com> <20161107215020.31399-3-tony@atomide.com> <20161108170917.GA3328@localhost> <20161108173413.GM2428@atomide.com> <20161108190331.GA14744@localhost> <20161109012606.GR2428@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20161109012606.GR2428-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> Sender: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Johan Hovold Cc: Bin Liu , Boris Brezillon , Greg Kroah-Hartman , Andreas Kemnade , Felipe Balbi , George Cherian , Kishon Vijay Abraham I , Ivaylo Dimitrov , Ladislav Michl , Laurent Pinchart , Sergei Shtylyov , linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-omap@vger.kernel.org * Tony Lindgren [161108 18:26]: > * Johan Hovold [161108 12:03]: > +int musb_queue_resume_work(struct musb *musb, > + int (*callback)(struct musb *musb, void *data), > + void *data) > +{ > + struct musb_pending_work *w; > + unsigned long flags; > + int error; > + > + if (WARN_ON(!callback)) > + return -EINVAL; > + > + if (pm_runtime_active(musb->controller)) > + return callback(musb, data); > + > + w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC); > + if (!w) > + return -ENOMEM; > + > + w->callback = callback; > + w->data = data; > + spin_lock_irqsave(&musb->list_lock, flags); > + if (musb->is_runtime_suspended) { > + list_add_tail(&w->node, &musb->pending_list); > + error = 0; > + } else { > + dev_err(musb->controller, "could not add resume work %p\n", > + callback); > + devm_kfree(musb->controller, w); > + error = -EINPROGRESS; > + } > + spin_unlock_irqrestore(&musb->list_lock, flags); > + > + if (pm_runtime_active(musb->controller)) > + return musb_run_resume_work(musb); > + > + return error; > +} Hmm I think we can also leave out musb_run_resume_work() at the end, we should not hit that case any longer. Regards, Tony -- 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