Skip to contentSkip to conversation

platform/x86: asus-wireless: Replace open coded acpi_match_device()

PATCH Superseded Andy Shevchenko 2 participants 3 messages Oct 6, 2023 – Oct 7, 2023

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 platform/x86: asus-wireless: Replace open coded acpi_match_device()

Replace open coded acpi_match_device() in asus_wireless_add().

---
v3: rewrote error path logic (Hans)
v2: fixed compilation error

 drivers/platform/x86/asus-wireless.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/platform/x86/asus-wireless.c +4 -8
index abf01e00b799..1a571efa02eb 100644
@@ -148,16 +148,12 @@ static int asus_wireless_add(struct acpi_device *adev)
 	if (err)
 		return err;
 
-	for (id = device_ids; id->id[0]; id++) {
-		if (!strcmp((char *) id->id, acpi_device_hid(adev))) {
-			data->hswc_params =
-				(const struct hswc_params *)id->driver_data;
-			break;
-		}
-	}
-	if (!data->hswc_params)
+	id = acpi_match_device(device_ids, adev);
+	if (!id)
 		return 0;
 
+	data->hswc_params = (const struct hswc_params *)id->driver_data;
+
 	data->wq = create_singlethread_workqueue("asus_wireless_workqueue");
 	if (!data->wq)
 		return -ENOMEM;
Signature · 1 line
2.40.0.1.gaa8946217a0b
Reviewed-by on v3 1/1
#1 lore raw

Hi,

Quoted 8 lines · Andy Shevchenko

Replace open coded acpi_match_device() in asus_wireless_add().

---
v3: rewrote error path logic (Hans)
v2: fixed compilation error

 drivers/platform/x86/asus-wireless.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Thanks, patch looks good to me now:

Regards,

Hans

Quoted 26 lines
drivers/platform/x86/asus-wireless.c +4 -8
index abf01e00b799..1a571efa02eb 100644
@@ -148,16 +148,12 @@ static int asus_wireless_add(struct acpi_device *adev)
 	if (err)
 		return err;
 
-	for (id = device_ids; id->id[0]; id++) {
-		if (!strcmp((char *) id->id, acpi_device_hid(adev))) {
-			data->hswc_params =
-				(const struct hswc_params *)id->driver_data;
-			break;
-		}
-	}
-	if (!data->hswc_params)
+	id = acpi_match_device(device_ids, adev);
+	if (!id)
 		return 0;
 
+	data->hswc_params = (const struct hswc_params *)id->driver_data;
+
 	data->wq = create_singlethread_workqueue("asus_wireless_workqueue");
 	if (!data->wq)
 		return -ENOMEM;
#2 lore raw
Quoted 1 line · Hans de Goede

On 10/6/23 17:53, Andy Shevchenko wrote:

...

Quoted 2 lines

Thanks, patch looks good to me now:

Thanks, but it seems something went wrong (most likely due to age of the patches in my local tree) and confusing "BUILD SUCCESS" from LKP.

Quoted 1 line

drivers/platform/x86/asus-wireless.c static int asus_wireless_add(struct acpi_device *adev) · line 151

Quoted 1 line
drivers/platform/x86/asus-wireless.c +1 -0
+	id = acpi_match_device(device_ids, adev);

This should be acpi_match_acpi_device().

Quoted 2 lines
Quoted 2 lines
drivers/platform/x86/asus-wireless.c +1 -0
+	if (!id)
 		return 0;
Signature · 2 lines
With Best Regards,
Andy Shevchenko