Commit cedb3b2a authored by Andy Shevchenko's avatar Andy Shevchenko

platform/x86: wmi: Replace list_for_each() by list_for_each_entry()

In all cases list_for_each() followed by list_entry(),
so, replace them by list_for_each_entry() macro.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent 7f166add
...@@ -130,13 +130,11 @@ static bool find_guid(const char *guid_string, struct wmi_block **out) ...@@ -130,13 +130,11 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
uuid_le guid_input; uuid_le guid_input;
struct wmi_block *wblock; struct wmi_block *wblock;
struct guid_block *block; struct guid_block *block;
struct list_head *p;
if (uuid_le_to_bin(guid_string, &guid_input)) if (uuid_le_to_bin(guid_string, &guid_input))
return false; return false;
list_for_each(p, &wmi_block_list) { list_for_each_entry(wblock, &wmi_block_list, list) {
wblock = list_entry(p, struct wmi_block, list);
block = &wblock->gblock; block = &wblock->gblock;
if (memcmp(block->guid, &guid_input, 16) == 0) { if (memcmp(block->guid, &guid_input, 16) == 0) {
...@@ -519,7 +517,6 @@ wmi_notify_handler handler, void *data) ...@@ -519,7 +517,6 @@ wmi_notify_handler handler, void *data)
struct wmi_block *block; struct wmi_block *block;
acpi_status status = AE_NOT_EXIST; acpi_status status = AE_NOT_EXIST;
uuid_le guid_input; uuid_le guid_input;
struct list_head *p;
if (!guid || !handler) if (!guid || !handler)
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
...@@ -527,9 +524,8 @@ wmi_notify_handler handler, void *data) ...@@ -527,9 +524,8 @@ wmi_notify_handler handler, void *data)
if (uuid_le_to_bin(guid, &guid_input)) if (uuid_le_to_bin(guid, &guid_input))
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
list_for_each(p, &wmi_block_list) { list_for_each_entry(block, &wmi_block_list, list) {
acpi_status wmi_status; acpi_status wmi_status;
block = list_entry(p, struct wmi_block, list);
if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { if (memcmp(block->gblock.guid, &guid_input, 16) == 0) {
if (block->handler && if (block->handler &&
...@@ -560,7 +556,6 @@ acpi_status wmi_remove_notify_handler(const char *guid) ...@@ -560,7 +556,6 @@ acpi_status wmi_remove_notify_handler(const char *guid)
struct wmi_block *block; struct wmi_block *block;
acpi_status status = AE_NOT_EXIST; acpi_status status = AE_NOT_EXIST;
uuid_le guid_input; uuid_le guid_input;
struct list_head *p;
if (!guid) if (!guid)
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
...@@ -568,9 +563,8 @@ acpi_status wmi_remove_notify_handler(const char *guid) ...@@ -568,9 +563,8 @@ acpi_status wmi_remove_notify_handler(const char *guid)
if (uuid_le_to_bin(guid, &guid_input)) if (uuid_le_to_bin(guid, &guid_input))
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
list_for_each(p, &wmi_block_list) { list_for_each_entry(block, &wmi_block_list, list) {
acpi_status wmi_status; acpi_status wmi_status;
block = list_entry(p, struct wmi_block, list);
if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { if (memcmp(block->gblock.guid, &guid_input, 16) == 0) {
if (!block->handler || if (!block->handler ||
...@@ -610,15 +604,13 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out) ...@@ -610,15 +604,13 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
union acpi_object params[1]; union acpi_object params[1];
struct guid_block *gblock; struct guid_block *gblock;
struct wmi_block *wblock; struct wmi_block *wblock;
struct list_head *p;
input.count = 1; input.count = 1;
input.pointer = params; input.pointer = params;
params[0].type = ACPI_TYPE_INTEGER; params[0].type = ACPI_TYPE_INTEGER;
params[0].integer.value = event; params[0].integer.value = event;
list_for_each(p, &wmi_block_list) { list_for_each_entry(wblock, &wmi_block_list, list) {
wblock = list_entry(p, struct wmi_block, list);
gblock = &wblock->gblock; gblock = &wblock->gblock;
if ((gblock->flags & ACPI_WMI_EVENT) && if ((gblock->flags & ACPI_WMI_EVENT) &&
...@@ -1260,11 +1252,9 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event, ...@@ -1260,11 +1252,9 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event,
{ {
struct guid_block *block; struct guid_block *block;
struct wmi_block *wblock; struct wmi_block *wblock;
struct list_head *p;
bool found_it = false; bool found_it = false;
list_for_each(p, &wmi_block_list) { list_for_each_entry(wblock, &wmi_block_list, list) {
wblock = list_entry(p, struct wmi_block, list);
block = &wblock->gblock; block = &wblock->gblock;
if (wblock->acpi_device->handle == handle && if (wblock->acpi_device->handle == handle &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment