Skip to contentSkip to conversation

platform/x86: wmi: minor improvements

RFC PATCH In review Barnabás Pőcze 2 participants 8 messages Sep 4, 2021 – Sep 13, 2021 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

cover platform/x86: wmi: minor improvements

This patch series contains minor changes in the WMI bus, which aim to remove unnecessary code, get rid of duplication, and various style changes.

Most of the patches should have no observable effect on the behaviour.

Barnabás Pőcze (30):
platform/x86: wmi: fix kernel doc
platform/x86: wmi: fix checkpatch warnings
platform/x86: wmi: remove commas
platform/x86: wmi: remove unnecessary initialization platform/x86: wmi: remove unnecessary initializations platform/x86: wmi: remove unnecessary variable platform/x86: wmi: remove unnecessary argument platform/x86: wmi: remove unnecessary casts platform/x86: wmi: remove stray empty line
platform/x86: wmi: remove unnecessary checks platform/x86: wmi: use BIT() macro
platform/x86: wmi: use bool instead of int
platform/x86: wmi: use dynamic debug to print data about events platform/x86: wmi: use guid_t and guid_equal() platform/x86: wmi: make GUID block packed
platform/x86: wmi: use sysfs_emit()
platform/x86: wmi: use sizeof() instead of hard-coding platform/x86: wmi: use !p to check for NULL platform/x86: wmi: use sizeof(*p) in allocation platform/x86: wmi: remove variable
platform/x86: wmi: move variables
platform/x86: wmi: align arguments of functions platform/x86: wmi: improve debug messages
platform/x86: wmi: do not fail if disabling fails platform/x86: wmi: simplify error handling logic platform/x86: wmi: introduce helper to convert driver to WMI driver platform/x86: wmi: introduce helper to generate method names platform/x86: wmi: introduce helper to determine type platform/x86: wmi: introduce helper to retrieve event data platform/x86: wmi: more detailed error reporting in find_guid()

 drivers/platform/x86/wmi.c | 378 +++++++++++++++++++------------------
 1 file changed, 197 insertions(+), 181 deletions(-)

--
2.33.0

#1 lore raw

RFC PATCH 1/30 platform/x86: wmi: fix kernel doc

The kernel doc erroneously specified wmi_uninstall_notify_handler() for the wmi_remove_notify_handler() function. Fix that.

---
 drivers/platform/x86/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/wmi.c +1 -1
index a76313006bdc..0b931629f0b0 100644
@@ -551,7 +551,7 @@ wmi_notify_handler handler, void *data)
 EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
 
 /**
- * wmi_uninstall_notify_handler - Unregister handler for WMI events
+ * wmi_remove_notify_handler - Unregister handler for WMI events
  * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
  *
  * Unregister handler for events sent to the ACPI-WMI mapper device.

--
2.33.0

#2 lore raw

RFC PATCH 2/30 platform/x86: wmi: fix checkpatch warnings

In reply to Barnabás Pőcze

Fix the following two checkpatch warnings:

* "space required before the open parenthesis '('"
* "that open brace { should be on the previous line"

---
 drivers/platform/x86/wmi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/wmi.c +2 -3
index 0b931629f0b0..73ed17a53af5 100644
@@ -488,7 +488,7 @@ static void wmi_notify_debug(u32 value, void *context)
 		return;
 
 	pr_info("DEBUG Event ");
-	switch(obj->type) {
+	switch (obj->type) {
 	case ACPI_TYPE_BUFFER:
 		pr_cont("BUFFER_TYPE - length %d\n", obj->buffer.length);
 		break;
@@ -1277,8 +1277,7 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event,
 
 		if (wblock->acpi_device->handle == handle &&
 		    (block->flags & ACPI_WMI_EVENT) &&
-		    (block->notify_id == event))
-		{
+		    (block->notify_id == event)) {
 			found_it = true;
 			break;
 		}

--
2.33.0

#3 lore raw

RFC PATCH 3/30 platform/x86: wmi: remove commas

In reply to Barnabás Pőcze

Remove commas that are after terminating entries in arrays.

---
 drivers/platform/x86/wmi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/wmi.c +4 -4
index 73ed17a53af5..67c09d81a676 100644
@@ -714,7 +714,7 @@ static struct attribute *wmi_attrs[] = {
 	&dev_attr_guid.attr,
 	&dev_attr_instance_count.attr,
 	&dev_attr_expensive.attr,
-	NULL,
+	NULL
 };
 ATTRIBUTE_GROUPS(wmi);
 
@@ -729,7 +729,7 @@ static DEVICE_ATTR_RO(notify_id);
 
 static struct attribute *wmi_event_attrs[] = {
 	&dev_attr_notify_id.attr,
-	NULL,
+	NULL
 };
 ATTRIBUTE_GROUPS(wmi_event);
 
@@ -755,13 +755,13 @@ static DEVICE_ATTR_RO(setable);
 static struct attribute *wmi_data_attrs[] = {
 	&dev_attr_object_id.attr,
 	&dev_attr_setable.attr,
-	NULL,
+	NULL
 };
 ATTRIBUTE_GROUPS(wmi_data);
 
 static struct attribute *wmi_method_attrs[] = {
 	&dev_attr_object_id.attr,
-	NULL,
+	NULL
 };
 ATTRIBUTE_GROUPS(wmi_method);
 

--
2.33.0

#4 lore raw

RFC PATCH 4/30 platform/x86: wmi: remove unnecessary initialization

In reply to Barnabás Pőcze

The empty initializer { } is enough to properly initialize the terminating acpi_device_id entry in the device table, so use that.

---
 drivers/platform/x86/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/wmi.c +1 -1
index 67c09d81a676..6ad5962da59b 100644
@@ -91,7 +91,7 @@ static int acpi_wmi_probe(struct platform_device *device);
 static const struct acpi_device_id wmi_device_ids[] = {
 	{"PNP0C14", 0},
 	{"pnp0c14", 0},
-	{"", 0},
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, wmi_device_ids);
 

--
2.33.0

#5 lore raw
In reply to Barnabás Pőcze

Hi Barnabás,

Quoted 38 lines · Barnabás Pőcze

This patch series contains minor changes in the WMI bus, which aim to remove unnecessary code, get rid of duplication, and various style changes.

Most of the patches should have no observable effect on the behaviour.

Barnabás Pőcze (30):
platform/x86: wmi: fix kernel doc
platform/x86: wmi: fix checkpatch warnings
platform/x86: wmi: remove commas
platform/x86: wmi: remove unnecessary initialization platform/x86: wmi: remove unnecessary initializations platform/x86: wmi: remove unnecessary variable platform/x86: wmi: remove unnecessary argument platform/x86: wmi: remove unnecessary casts platform/x86: wmi: remove stray empty line
platform/x86: wmi: remove unnecessary checks platform/x86: wmi: use BIT() macro
platform/x86: wmi: use bool instead of int
platform/x86: wmi: use dynamic debug to print data about events platform/x86: wmi: use guid_t and guid_equal() platform/x86: wmi: make GUID block packed
platform/x86: wmi: use sysfs_emit()
platform/x86: wmi: use sizeof() instead of hard-coding platform/x86: wmi: use !p to check for NULL platform/x86: wmi: use sizeof(*p) in allocation platform/x86: wmi: remove variable
platform/x86: wmi: move variables
platform/x86: wmi: align arguments of functions platform/x86: wmi: improve debug messages
platform/x86: wmi: do not fail if disabling fails platform/x86: wmi: simplify error handling logic platform/x86: wmi: introduce helper to convert driver to WMI driver platform/x86: wmi: introduce helper to generate method names platform/x86: wmi: introduce helper to determine type platform/x86: wmi: introduce helper to retrieve event data platform/x86: wmi: more detailed error reporting in find_guid()

Quoted 2 lines
 drivers/platform/x86/wmi.c | 378 +++++++++++++++++++------------------
 1 file changed, 197 insertions(+), 181 deletions(-)

Thank you for this big cleanup series.

Not sure why this is marked as a RFC?

I've gone over patches 1 - 7 sofar and they all look like straight forward simple cleanups. So I will at least apply those right away.

I've some small remarks to patch 6, which I've fixed up while applying the patch. I will reply to patch 6 with my remarks.

I will continue the process the series and reply to patches which I have any remarks to. Depending on how this goes I might end up merging the first X patches, or just merge everything, we will see :)

Regards,

Hans

#6 lore raw

Hi

2021. szeptember 13., hétfő 11:19 keltezéssel, Hans de Goede írta:

Quoted 9 lines

[...]
Thank you for this big cleanup series.

Not sure why this is marked as a RFC?

I've gone over patches 1 - 7 sofar and they all look like straight forward simple cleanups. So I will at least apply those right away.
[...]

It's RFC because, well, I wanted to get some comments and see if it's not unwanted.

And I had made some local changes since I have sent the series:
patch 17[1] has been replaced. So please ignore that.

[1]: https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/

Best regards,
Barnabás Pőcze

#7 lore raw

Hi,

Quoted 14 lines · Barnabás Pőcze

Hi

2021. szeptember 13., hétfő 11:19 keltezéssel, Hans de Goede írta:

Quoted 9 lines

[...]
Thank you for this big cleanup series.

Not sure why this is marked as a RFC?

I've gone over patches 1 - 7 sofar and they all look like straight forward simple cleanups. So I will at least apply those right away.
[...]

Quoted 4 lines

It's RFC because, well, I wanted to get some comments and see if it's not unwanted.

And I had made some local changes since I have sent the series:
patch 17[1] has been replaced. So please ignore that.

Ok I've dropped patch 17; and sorry if I've caused any extra work for you by picking this up early. I had time to review and process this large series today, so I decided to tackle it right away (now that the merge window is done).

Regards,

Hans