Skip to content

Commit 360e823

Browse files
Sandeep Maheswaramgregkh
authored andcommitted
usb: dwc3: qcom: Add helper functions to enable,disable wake irqs
Adding helper functions to enable,disable wake irqs to make the code simple and readable. Reviewed-by: Matthias Kaehlcke <[email protected]> Reviewed-by: Pavankumar Kondeti <[email protected]> Signed-off-by: Sandeep Maheswaram <[email protected]> Signed-off-by: Krishna Kurapati <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 649f5c8 commit 360e823

File tree

1 file changed

+26
-32
lines changed

1 file changed

+26
-32
lines changed

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -296,50 +296,44 @@ static void dwc3_qcom_interconnect_exit(struct dwc3_qcom *qcom)
296296
icc_put(qcom->icc_path_apps);
297297
}
298298

299+
static void dwc3_qcom_enable_wakeup_irq(int irq)
300+
{
301+
if (!irq)
302+
return;
303+
304+
enable_irq(irq);
305+
enable_irq_wake(irq);
306+
}
307+
308+
static void dwc3_qcom_disable_wakeup_irq(int irq)
309+
{
310+
if (!irq)
311+
return;
312+
313+
disable_irq_wake(irq);
314+
disable_irq_nosync(irq);
315+
}
316+
299317
static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom)
300318
{
301-
if (qcom->hs_phy_irq) {
302-
disable_irq_wake(qcom->hs_phy_irq);
303-
disable_irq_nosync(qcom->hs_phy_irq);
304-
}
319+
dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq);
305320

306-
if (qcom->dp_hs_phy_irq) {
307-
disable_irq_wake(qcom->dp_hs_phy_irq);
308-
disable_irq_nosync(qcom->dp_hs_phy_irq);
309-
}
321+
dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq);
310322

311-
if (qcom->dm_hs_phy_irq) {
312-
disable_irq_wake(qcom->dm_hs_phy_irq);
313-
disable_irq_nosync(qcom->dm_hs_phy_irq);
314-
}
323+
dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq);
315324

316-
if (qcom->ss_phy_irq) {
317-
disable_irq_wake(qcom->ss_phy_irq);
318-
disable_irq_nosync(qcom->ss_phy_irq);
319-
}
325+
dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq);
320326
}
321327

322328
static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
323329
{
324-
if (qcom->hs_phy_irq) {
325-
enable_irq(qcom->hs_phy_irq);
326-
enable_irq_wake(qcom->hs_phy_irq);
327-
}
330+
dwc3_qcom_enable_wakeup_irq(qcom->hs_phy_irq);
328331

329-
if (qcom->dp_hs_phy_irq) {
330-
enable_irq(qcom->dp_hs_phy_irq);
331-
enable_irq_wake(qcom->dp_hs_phy_irq);
332-
}
332+
dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq);
333333

334-
if (qcom->dm_hs_phy_irq) {
335-
enable_irq(qcom->dm_hs_phy_irq);
336-
enable_irq_wake(qcom->dm_hs_phy_irq);
337-
}
334+
dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq);
338335

339-
if (qcom->ss_phy_irq) {
340-
enable_irq(qcom->ss_phy_irq);
341-
enable_irq_wake(qcom->ss_phy_irq);
342-
}
336+
dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq);
343337
}
344338

345339
static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)

0 commit comments

Comments
 (0)