Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: wmi: Merge get_event_data() with wmi_get_notify_data()

Since get_event_data() is only called by wmi_get_notify_data(), it
makes sense to merge both functions.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240901031055.3030-5-W_Armin@gmx.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Armin Wolf and committed by
Hans de Goede
6ed2d7e8 79a56f4c

+17 -26
+17 -26
drivers/platform/x86/wmi.c
··· 166 166 return ACPI_TYPE_BUFFER; 167 167 } 168 168 169 - static acpi_status get_event_data(const struct wmi_block *wblock, struct acpi_buffer *out) 170 - { 171 - union acpi_object param = { 172 - .integer = { 173 - .type = ACPI_TYPE_INTEGER, 174 - .value = wblock->gblock.notify_id, 175 - } 176 - }; 177 - struct acpi_object_list input = { 178 - .count = 1, 179 - .pointer = &param, 180 - }; 181 - 182 - return acpi_evaluate_object(wblock->acpi_device->handle, "_WED", &input, out); 183 - } 184 - 185 169 static int wmidev_match_guid(struct device *dev, const void *data) 186 170 { 187 171 struct wmi_block *wblock = dev_to_wblock(dev); ··· 1113 1129 static int wmi_get_notify_data(struct wmi_block *wblock, union acpi_object **obj) 1114 1130 { 1115 1131 struct acpi_buffer data = { ACPI_ALLOCATE_BUFFER, NULL }; 1132 + union acpi_object param = { 1133 + .integer = { 1134 + .type = ACPI_TYPE_INTEGER, 1135 + .value = wblock->gblock.notify_id, 1136 + } 1137 + }; 1138 + struct acpi_object_list input = { 1139 + .count = 1, 1140 + .pointer = &param, 1141 + }; 1116 1142 acpi_status status; 1117 1143 1118 - if (test_bit(WMI_NO_EVENT_DATA, &wblock->flags)) { 1119 - *obj = NULL; 1120 - return 0; 1121 - } 1122 - 1123 - status = get_event_data(wblock, &data); 1144 + status = acpi_evaluate_object(wblock->acpi_device->handle, "_WED", &input, &data); 1124 1145 if (ACPI_FAILURE(status)) { 1125 1146 dev_warn(&wblock->dev.dev, "Failed to get event data\n"); 1126 1147 return -EIO; ··· 1152 1163 static int wmi_notify_device(struct device *dev, void *data) 1153 1164 { 1154 1165 struct wmi_block *wblock = dev_to_wblock(dev); 1155 - union acpi_object *obj; 1166 + union acpi_object *obj = NULL; 1156 1167 u32 *event = data; 1157 1168 int ret; 1158 1169 ··· 1168 1179 * WMI driver core stops evaluating _WED due to missing 1169 1180 * WMI event consumers. 1170 1181 */ 1171 - ret = wmi_get_notify_data(wblock, &obj); 1172 - if (ret < 0) 1173 - return -EIO; 1182 + if (!test_bit(WMI_NO_EVENT_DATA, &wblock->flags)) { 1183 + ret = wmi_get_notify_data(wblock, &obj); 1184 + if (ret < 0) 1185 + return -EIO; 1186 + } 1174 1187 1175 1188 down_read(&wblock->notify_lock); 1176 1189 /* The WMI driver notify handler conflicts with the legacy WMI handler.