Skip to content

Commit befd9b5

Browse files
committed
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>
1 parent c33676a commit befd9b5

1 file changed

Lines changed: 23 additions & 31 deletions

File tree

drivers/acpi/ec.c

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ struct acpi_ec_query {
170170
static int acpi_ec_submit_query(struct acpi_ec *ec);
171171
static bool advance_transaction(struct acpi_ec *ec, bool interrupt);
172172
static void acpi_ec_event_handler(struct work_struct *work);
173-
static void acpi_ec_event_processor(struct work_struct *work);
174173

175174
struct acpi_ec *first_ec;
176175
EXPORT_SYMBOL(first_ec);
@@ -1134,33 +1133,6 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
11341133
}
11351134
EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
11361135

1137-
static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval)
1138-
{
1139-
struct acpi_ec_query *q;
1140-
struct transaction *t;
1141-
1142-
q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL);
1143-
if (!q)
1144-
return NULL;
1145-
1146-
INIT_WORK(&q->work, acpi_ec_event_processor);
1147-
t = &q->transaction;
1148-
t->command = ACPI_EC_COMMAND_QUERY;
1149-
t->rdata = pval;
1150-
t->rlen = 1;
1151-
q->ec = ec;
1152-
return q;
1153-
}
1154-
1155-
static void acpi_ec_delete_query(struct acpi_ec_query *q)
1156-
{
1157-
if (q) {
1158-
if (q->handler)
1159-
acpi_ec_put_query_handler(q->handler);
1160-
kfree(q);
1161-
}
1162-
}
1163-
11641136
static void acpi_ec_event_processor(struct work_struct *work)
11651137
{
11661138
struct acpi_ec_query *q = container_of(work, struct acpi_ec_query, work);
@@ -1180,7 +1152,26 @@ static void acpi_ec_event_processor(struct work_struct *work)
11801152
ec->queries_in_progress--;
11811153
spin_unlock_irq(&ec->lock);
11821154

1183-
acpi_ec_delete_query(q);
1155+
acpi_ec_put_query_handler(handler);
1156+
kfree(q);
1157+
}
1158+
1159+
static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval)
1160+
{
1161+
struct acpi_ec_query *q;
1162+
struct transaction *t;
1163+
1164+
q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL);
1165+
if (!q)
1166+
return NULL;
1167+
1168+
INIT_WORK(&q->work, acpi_ec_event_processor);
1169+
t = &q->transaction;
1170+
t->command = ACPI_EC_COMMAND_QUERY;
1171+
t->rdata = pval;
1172+
t->rlen = 1;
1173+
q->ec = ec;
1174+
return q;
11841175
}
11851176

11861177
static int acpi_ec_submit_query(struct acpi_ec *ec)
@@ -1229,9 +1220,10 @@ static int acpi_ec_submit_query(struct acpi_ec *ec)
12291220

12301221
spin_unlock_irq(&ec->lock);
12311222

1223+
return 0;
1224+
12321225
err_exit:
1233-
if (result)
1234-
acpi_ec_delete_query(q);
1226+
kfree(q);
12351227

12361228
return result;
12371229
}

0 commit comments

Comments
 (0)