diff mbox series

[10/11] HID: amd_sfh: Move interrupt handling to common interface

Message ID 20220712181836.3488343-11-Basavaraj.Natikar@amd.com (mailing list archive)
State Mainlined
Commit 014730c40b793fd638b534356cb82c064b2955f5
Delegated to: Jiri Kosina
Headers show
Series Fixes and implementation of AMD SFH 1.1 functionality | expand

Commit Message

Basavaraj Natikar July 12, 2022, 6:18 p.m. UTC
Interrupt handling can be used in multiple files to support all
AMD SOCs. Hence move interrupt handling to common interface.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_client.c | 6 ++----
 drivers/hid/amd-sfh-hid/amd_sfh_common.h | 4 ++++
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c   | 8 ++++----
 3 files changed, 10 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
index 8e686081c8fc..f95e623040f3 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
@@ -178,8 +178,7 @@  static void amd_sfh_resume(struct amd_mp2_dev *mp2)
 	}
 
 	schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP));
-	if (mp2->mp2_ops->clear_intr)
-		mp2->mp2_ops->clear_intr(mp2);
+	amd_sfh_clear_intr(mp2);
 }
 
 static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
@@ -202,8 +201,7 @@  static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
 	}
 
 	cancel_delayed_work_sync(&cl_data->work_buffer);
-	if (mp2->mp2_ops->clear_intr)
-		mp2->mp2_ops->clear_intr(mp2);
+	amd_sfh_clear_intr(mp2);
 }
 
 int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_common.h b/drivers/hid/amd-sfh-hid/amd_sfh_common.h
index b3dd758ecca4..1efb72ec116f 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_common.h
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_common.h
@@ -66,4 +66,8 @@  struct amd_mp2_ops {
 
 void amd_sfh_work(struct work_struct *work);
 void amd_sfh_work_buffer(struct work_struct *work);
+void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata);
+int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata);
+void amd_sfh_clear_intr(struct amd_mp2_dev *privdata);
+int amd_sfh_irq_init(struct amd_mp2_dev *privdata);
 #endif
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index c9a9ac11f124..1425b57f3580 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -92,7 +92,7 @@  static void amd_stop_all_sensor_v2(struct amd_mp2_dev *privdata)
 	writel(cmd_base.ul, privdata->mmio + AMD_C2P_MSG0);
 }
 
-static void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata)
+void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata)
 {
 	if (readl(privdata->mmio + AMD_P2C_MSG(4))) {
 		writel(0, privdata->mmio + AMD_P2C_MSG(4));
@@ -100,7 +100,7 @@  static void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata)
 	}
 }
 
-static void amd_sfh_clear_intr(struct amd_mp2_dev *privdata)
+void amd_sfh_clear_intr(struct amd_mp2_dev *privdata)
 {
 	if (privdata->mp2_ops->clear_intr)
 		privdata->mp2_ops->clear_intr(privdata);
@@ -113,7 +113,7 @@  static irqreturn_t amd_sfh_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
+int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
 {
 	int rc;
 
@@ -279,7 +279,7 @@  static void mp2_select_ops(struct amd_mp2_dev *privdata)
 	}
 }
 
-static int amd_sfh_irq_init(struct amd_mp2_dev *privdata)
+int amd_sfh_irq_init(struct amd_mp2_dev *privdata)
 {
 	if (privdata->mp2_ops->init_intr)
 		return privdata->mp2_ops->init_intr(privdata);