All of lore.kernel.org
 help / color / mirror / Atom feed
From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
To: <jikos@kernel.org>, <benjamin.tissoires@redhat.com>,
	<linux-input@vger.kernel.org>
Cc: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Subject: [PATCH 04/11] HID: amd_sfh: Move request_list variable to client data
Date: Tue, 12 Jul 2022 23:48:29 +0530	[thread overview]
Message-ID: <20220712181836.3488343-5-Basavaraj.Natikar@amd.com> (raw)
In-Reply-To: <20220712181836.3488343-1-Basavaraj.Natikar@amd.com>

request_list variable can be used in multiple files to support all
AMD SOCs. Hence move request_list variable to client data.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_client.c | 12 +++++++-----
 drivers/hid/amd-sfh-hid/amd_sfh_hid.h    |  1 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
index fac9e8a66120..e3b3db514c91 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
@@ -18,8 +18,6 @@
 #include "amd_sfh_pcie.h"
 #include "amd_sfh_hid.h"
 
-static struct request_list req_list;
-
 void amd_sfh_set_report(struct hid_device *hid, int report_id,
 			int report_type)
 {
@@ -40,6 +38,7 @@ int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type)
 {
 	struct amdtp_hid_data *hid_data = hid->driver_data;
 	struct amdtp_cl_data *cli_data = hid_data->cli_data;
+	struct request_list *req_list = &cli_data->req_list;
 	int i;
 
 	for (i = 0; i < cli_data->num_hid_devices; i++) {
@@ -56,7 +55,7 @@ int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type)
 			new->report_id = report_id;
 			cli_data->report_id[i] = report_id;
 			cli_data->request_done[i] = false;
-			list_add(&new->list, &req_list.list);
+			list_add(&new->list, &req_list->list);
 			break;
 		}
 	}
@@ -67,13 +66,14 @@ int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type)
 static void amd_sfh_work(struct work_struct *work)
 {
 	struct amdtp_cl_data *cli_data = container_of(work, struct amdtp_cl_data, work.work);
+	struct request_list *req_list = &cli_data->req_list;
 	struct amd_input_data *in_data = cli_data->in_data;
 	struct request_list *req_node;
 	u8 current_index, sensor_index;
 	u8 report_id, node_type;
 	u8 report_size = 0;
 
-	req_node = list_last_entry(&req_list.list, struct request_list, list);
+	req_node = list_last_entry(&req_list->list, struct request_list, list);
 	list_del(&req_node->list);
 	current_index = req_node->current_index;
 	sensor_index = req_node->sensor_idx;
@@ -154,19 +154,21 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
 	struct amd_input_data *in_data = &privdata->in_data;
 	struct amdtp_cl_data *cl_data = privdata->cl_data;
 	struct amd_mp2_sensor_info info;
+	struct request_list *req_list;
 	struct device *dev;
 	u32 feature_report_size;
 	u32 input_report_size;
 	int rc, i, status;
 	u8 cl_idx;
 
+	req_list = &cl_data->req_list;
 	dev = &privdata->pdev->dev;
 
 	cl_data->num_hid_devices = amd_mp2_get_sensor_num(privdata, &cl_data->sensor_idx[0]);
 
 	INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work);
 	INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer);
-	INIT_LIST_HEAD(&req_list.list);
+	INIT_LIST_HEAD(&req_list->list);
 	cl_data->in_data = in_data;
 
 	for (i = 0; i < cl_data->num_hid_devices; i++) {
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.h b/drivers/hid/amd-sfh-hid/amd_sfh_hid.h
index e2e4cc5fc946..ecdd2f48cfb8 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.h
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.h
@@ -52,6 +52,7 @@ struct amdtp_cl_data {
 	struct amd_input_data *in_data;
 	struct delayed_work work;
 	struct delayed_work work_buffer;
+	struct request_list req_list;
 };
 
 /**
-- 
2.25.1


  parent reply	other threads:[~2022-07-12 18:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 18:18 [PATCH 00/11] Fixes and implementation of AMD SFH 1.1 functionality Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 01/11] HID: amd_sfh: Add NULL check for hid device Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 02/11] HID: amd_sfh: Move common macros and structures Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 03/11] HID: amd_sfh: Move request_list struct to header file Basavaraj Natikar
2022-07-12 18:18 ` Basavaraj Natikar [this message]
2022-07-12 18:18 ` [PATCH 05/11] HID: amd_sfh: Add descriptor operations in amd_mp2_ops Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 06/11] HID: amd_sfh: Add PM " Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 07/11] HID: amd_sfh: Add remove operation " Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 08/11] HID: amd_sfh: Move global functions to static Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 09/11] HID: amd_sfh: Move amd_sfh_work to common interface Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 10/11] HID: amd_sfh: Move interrupt handling " Basavaraj Natikar
2022-07-12 18:18 ` [PATCH 11/11] HID: amd_sfh: Implement SFH1.1 functionality Basavaraj Natikar
2022-07-21 11:44 ` [PATCH 00/11] Fixes and implementation of AMD SFH 1.1 functionality Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220712181836.3488343-5-Basavaraj.Natikar@amd.com \
    --to=basavaraj.natikar@amd.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.