diff mbox series

[v1,2/4] cros_ec_lpc: pass driver_data from DMI down to the device

Message ID 20231005160701.19987-4-dustin@howett.net (mailing list archive)
State New, archived
Headers show
Series cros_ec: add support for newer versions of the Framework Laptop | expand

Commit Message

Dustin L. Howett Oct. 5, 2023, 4:07 p.m. UTC
lpc_driver_data will be stored in drvdata until probe is complete, at
which point it will be replaced with an updated copy.

Signed-off-by: Dustin L. Howett <dustin@howett.net>
---
 drivers/platform/chrome/cros_ec_lpc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Tzung-Bi Shih Oct. 11, 2023, 5:29 a.m. UTC | #1
On Thu, Oct 05, 2023 at 11:07:00AM -0500, Dustin L. Howett wrote:
> @@ -615,14 +615,17 @@ static int __init cros_ec_lpc_init(void)
>  {
>  	int ret;
>  	acpi_status status;
> +	const struct dmi_system_id *dmi_match;
>  
>  	status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device,
>  				  &cros_ec_lpc_acpi_device_found, NULL);
>  	if (ACPI_FAILURE(status))
>  		pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME);
>  
> +	dmi_match = dmi_first_match(cros_ec_lpc_dmi_table);
> +
>  	if (!cros_ec_lpc_acpi_device_found &&
> -	    !dmi_check_system(cros_ec_lpc_dmi_table)) {
> +	    !dmi_match) {

The `!dmi_match` then can join to previous line.
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 477e22e31757..ef7943e6a01d 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -615,14 +615,17 @@  static int __init cros_ec_lpc_init(void)
 {
 	int ret;
 	acpi_status status;
+	const struct dmi_system_id *dmi_match;
 
 	status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device,
 				  &cros_ec_lpc_acpi_device_found, NULL);
 	if (ACPI_FAILURE(status))
 		pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME);
 
+	dmi_match = dmi_first_match(cros_ec_lpc_dmi_table);
+
 	if (!cros_ec_lpc_acpi_device_found &&
-	    !dmi_check_system(cros_ec_lpc_dmi_table)) {
+	    !dmi_match) {
 		pr_err(DRV_NAME ": unsupported system.\n");
 		return -ENODEV;
 	}
@@ -635,6 +638,9 @@  static int __init cros_ec_lpc_init(void)
 	}
 
 	if (!cros_ec_lpc_acpi_device_found) {
+		/* Pass the DMI match's driver data down to the platform device */
+		platform_set_drvdata(&cros_ec_lpc_device, dmi_match->driver_data);
+
 		/* Register the device, and it'll get hooked up automatically */
 		ret = platform_device_register(&cros_ec_lpc_device);
 		if (ret) {