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

ACPI: EC: Relocate acpi_ec_create_query() and drop acpi_ec_delete_query()

Move acpi_ec_create_query() after acpi_ec_event_processor(), drop the
no longer needed forward declaration of the latter, and eliminate
acpi_ec_delete_query() which isn't really necessary.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+23 -31
+23 -31
drivers/acpi/ec.c
··· 170 170 static int acpi_ec_submit_query(struct acpi_ec *ec); 171 171 static bool advance_transaction(struct acpi_ec *ec, bool interrupt); 172 172 static void acpi_ec_event_handler(struct work_struct *work); 173 - static void acpi_ec_event_processor(struct work_struct *work); 174 173 175 174 struct acpi_ec *first_ec; 176 175 EXPORT_SYMBOL(first_ec); ··· 1133 1134 } 1134 1135 EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); 1135 1136 1136 - static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval) 1137 - { 1138 - struct acpi_ec_query *q; 1139 - struct transaction *t; 1140 - 1141 - q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); 1142 - if (!q) 1143 - return NULL; 1144 - 1145 - INIT_WORK(&q->work, acpi_ec_event_processor); 1146 - t = &q->transaction; 1147 - t->command = ACPI_EC_COMMAND_QUERY; 1148 - t->rdata = pval; 1149 - t->rlen = 1; 1150 - q->ec = ec; 1151 - return q; 1152 - } 1153 - 1154 - static void acpi_ec_delete_query(struct acpi_ec_query *q) 1155 - { 1156 - if (q) { 1157 - if (q->handler) 1158 - acpi_ec_put_query_handler(q->handler); 1159 - kfree(q); 1160 - } 1161 - } 1162 - 1163 1137 static void acpi_ec_event_processor(struct work_struct *work) 1164 1138 { 1165 1139 struct acpi_ec_query *q = container_of(work, struct acpi_ec_query, work); ··· 1152 1180 ec->queries_in_progress--; 1153 1181 spin_unlock_irq(&ec->lock); 1154 1182 1155 - acpi_ec_delete_query(q); 1183 + acpi_ec_put_query_handler(handler); 1184 + kfree(q); 1185 + } 1186 + 1187 + static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval) 1188 + { 1189 + struct acpi_ec_query *q; 1190 + struct transaction *t; 1191 + 1192 + q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); 1193 + if (!q) 1194 + return NULL; 1195 + 1196 + INIT_WORK(&q->work, acpi_ec_event_processor); 1197 + t = &q->transaction; 1198 + t->command = ACPI_EC_COMMAND_QUERY; 1199 + t->rdata = pval; 1200 + t->rlen = 1; 1201 + q->ec = ec; 1202 + return q; 1156 1203 } 1157 1204 1158 1205 static int acpi_ec_submit_query(struct acpi_ec *ec) ··· 1220 1229 1221 1230 spin_unlock_irq(&ec->lock); 1222 1231 1232 + return 0; 1233 + 1223 1234 err_exit: 1224 - if (result) 1225 - acpi_ec_delete_query(q); 1235 + kfree(q); 1226 1236 1227 1237 return result; 1228 1238 }