Skip to content

Commit

Permalink
Revert "i2c: scmi: Replace open coded device_get_match_data()"
Browse files Browse the repository at this point in the history
This reverts commit 9ae551d. We got a
regression report, so ensure this machine boots again. We will come back
with a better version hopefully.

Reported-by: Josef Johansson <josef@oderland.se>
Link: https://lore.kernel.org/r/4d2d5b04-0b6c-1cb1-a63f-dc06dfe1b5da@oderland.se
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
wsakernel committed Aug 21, 2022
1 parent 568035b commit 3df71d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/i2c/busses/i2c-scmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct acpi_smbus_cmi {
u8 cap_info:1;
u8 cap_read:1;
u8 cap_write:1;
const struct smbus_methods_t *methods;
struct smbus_methods_t *methods;
};

static const struct smbus_methods_t smbus_methods = {
Expand Down Expand Up @@ -361,21 +361,26 @@ 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);
if (!smbus_cmi)
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;
smbus_cmi->cap_info = 0;
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);

Expand Down

0 comments on commit 3df71d7

Please sign in to comment.