Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6da1f9fd authored by Sandeep Maheswaram's avatar Sandeep Maheswaram Committed by Greg Kroah-Hartman
Browse files

usb: dwc3: qcom: Add helper functions to enable,disable wake irqs



[ Upstream commit 360e8230516de94d74d30c64f0cdcf228b8e8b67 ]

Adding helper functions to enable,disable wake irqs to make
the code simple and readable.

Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Reviewed-by: default avatarPavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: default avatarSandeep Maheswaram <quic_c_sanm@quicinc.com>
Signed-off-by: default avatarKrishna Kurapati <quic_kriskura@quicinc.com>
Link: https://lore.kernel.org/r/1655094654-24052-4-git-send-email-quic_kriskura@quicinc.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: d2d69354226d ("USB: dwc3: qcom: fix NULL-deref on suspend")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5335bb0c
Loading
Loading
Loading
Loading
+26 −32
Original line number Diff line number Diff line
@@ -198,50 +198,44 @@ static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom)
	return dwc->xhci;
}

static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom)
static void dwc3_qcom_enable_wakeup_irq(int irq)
{
	if (qcom->hs_phy_irq) {
		disable_irq_wake(qcom->hs_phy_irq);
		disable_irq_nosync(qcom->hs_phy_irq);
	}
	if (!irq)
		return;

	if (qcom->dp_hs_phy_irq) {
		disable_irq_wake(qcom->dp_hs_phy_irq);
		disable_irq_nosync(qcom->dp_hs_phy_irq);
	enable_irq(irq);
	enable_irq_wake(irq);
}

	if (qcom->dm_hs_phy_irq) {
		disable_irq_wake(qcom->dm_hs_phy_irq);
		disable_irq_nosync(qcom->dm_hs_phy_irq);
	}
static void dwc3_qcom_disable_wakeup_irq(int irq)
{
	if (!irq)
		return;

	if (qcom->ss_phy_irq) {
		disable_irq_wake(qcom->ss_phy_irq);
		disable_irq_nosync(qcom->ss_phy_irq);
	disable_irq_wake(irq);
	disable_irq_nosync(irq);
}

static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom)
{
	dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq);

	dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq);

	dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq);

	dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq);
}

static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
{
	if (qcom->hs_phy_irq) {
		enable_irq(qcom->hs_phy_irq);
		enable_irq_wake(qcom->hs_phy_irq);
	}
	dwc3_qcom_enable_wakeup_irq(qcom->hs_phy_irq);

	if (qcom->dp_hs_phy_irq) {
		enable_irq(qcom->dp_hs_phy_irq);
		enable_irq_wake(qcom->dp_hs_phy_irq);
	}
	dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq);

	if (qcom->dm_hs_phy_irq) {
		enable_irq(qcom->dm_hs_phy_irq);
		enable_irq_wake(qcom->dm_hs_phy_irq);
	}
	dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq);

	if (qcom->ss_phy_irq) {
		enable_irq(qcom->ss_phy_irq);
		enable_irq_wake(qcom->ss_phy_irq);
	}
	dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq);
}

static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)