linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/1] i2c: scmi: Replace open coded device_get_match_data()
@ 2022-07-08 12:09 Andy Shevchenko
  2022-07-16 12:30 ` Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2022-07-08 12:09 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, linux-kernel; +Cc: Wolfram Sang

Replace open coded device_get_match_data() in acpi_smbus_cmi_add().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: used device_get_match_data()
v3: fixed couple of warnings (LKP)
 drivers/i2c/busses/i2c-scmi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
index 6746aa46d96c..79798fc7462a 100644
--- a/drivers/i2c/busses/i2c-scmi.c
+++ b/drivers/i2c/busses/i2c-scmi.c
@@ -30,7 +30,7 @@ struct acpi_smbus_cmi {
 	u8 cap_info:1;
 	u8 cap_read:1;
 	u8 cap_write:1;
-	struct smbus_methods_t *methods;
+	const struct smbus_methods_t *methods;
 };
 
 static const struct smbus_methods_t smbus_methods = {
@@ -361,7 +361,6 @@ static acpi_status acpi_smbus_cmi_query_methods(acpi_handle handle, u32 level,
 static int acpi_smbus_cmi_add(struct acpi_device *device)
 {
 	struct acpi_smbus_cmi *smbus_cmi;
-	const struct acpi_device_id *id;
 	int ret;
 
 	smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);
@@ -369,6 +368,7 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
 		return -ENOMEM;
 
 	smbus_cmi->handle = device->handle;
+	smbus_cmi->methods = device_get_match_data(&device->dev);
 	strcpy(acpi_device_name(device), ACPI_SMBUS_HC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_SMBUS_HC_CLASS);
 	device->driver_data = smbus_cmi;
@@ -376,11 +376,6 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
 	smbus_cmi->cap_read = 0;
 	smbus_cmi->cap_write = 0;
 
-	for (id = acpi_smbus_cmi_ids; id->id[0]; id++)
-		if (!strcmp(id->id, acpi_device_hid(device)))
-			smbus_cmi->methods =
-				(struct smbus_methods_t *) id->driver_data;
-
 	acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
 			    acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread
[parent not found: <20220708120958.74034-1-andriy.shevchenko () linux ! intel ! com>]

end of thread, other threads:[~2022-08-25 18:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-08 12:09 [PATCH v3 1/1] i2c: scmi: Replace open coded device_get_match_data() Andy Shevchenko
2022-07-16 12:30 ` Wolfram Sang
     [not found] <20220708120958.74034-1-andriy.shevchenko () linux ! intel ! com>
2022-08-16  6:03 ` Josef Johansson
2022-08-16 10:18   ` Wolfram Sang
2022-08-16 10:20     ` Josef Johansson
2022-08-16 10:27       ` Wolfram Sang
2022-08-23 14:29     ` Andy Shevchenko
2022-08-25 15:14   ` Andy Shevchenko
2022-08-25 16:54     ` Josef Johansson
2022-08-25 17:41       ` Andy Shevchenko
2022-08-25 18:16         ` Josef Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).