summaryrefslogtreecommitdiff
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-11-23 19:46:09 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-12-01 20:17:32 +0100
commitbefd9b5b0c621af33a363596c65a8fc0176e2795 (patch)
treed0b43a8bef12451c676001992e4406518a6e16c8 /drivers/acpi/ec.c
parentc33676aa48249b007d55198dc8348cd117e3d8cc (diff)
downloadlinux-next-befd9b5b0c621af33a363596c65a8fc0176e2795.tar.gz
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>
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7d7bff4d2100..0077d2c85df8 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -170,7 +170,6 @@ struct acpi_ec_query {
static int acpi_ec_submit_query(struct acpi_ec *ec);
static bool advance_transaction(struct acpi_ec *ec, bool interrupt);
static void acpi_ec_event_handler(struct work_struct *work);
-static void acpi_ec_event_processor(struct work_struct *work);
struct acpi_ec *first_ec;
EXPORT_SYMBOL(first_ec);
@@ -1134,33 +1133,6 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
}
EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
-static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval)
-{
- struct acpi_ec_query *q;
- struct transaction *t;
-
- q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL);
- if (!q)
- return NULL;
-
- INIT_WORK(&q->work, acpi_ec_event_processor);
- t = &q->transaction;
- t->command = ACPI_EC_COMMAND_QUERY;
- t->rdata = pval;
- t->rlen = 1;
- q->ec = ec;
- return q;
-}
-
-static void acpi_ec_delete_query(struct acpi_ec_query *q)
-{
- if (q) {
- if (q->handler)
- acpi_ec_put_query_handler(q->handler);
- kfree(q);
- }
-}
-
static void acpi_ec_event_processor(struct work_struct *work)
{
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)
ec->queries_in_progress--;
spin_unlock_irq(&ec->lock);
- acpi_ec_delete_query(q);
+ acpi_ec_put_query_handler(handler);
+ kfree(q);
+}
+
+static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval)
+{
+ struct acpi_ec_query *q;
+ struct transaction *t;
+
+ q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL);
+ if (!q)
+ return NULL;
+
+ INIT_WORK(&q->work, acpi_ec_event_processor);
+ t = &q->transaction;
+ t->command = ACPI_EC_COMMAND_QUERY;
+ t->rdata = pval;
+ t->rlen = 1;
+ q->ec = ec;
+ return q;
}
static int acpi_ec_submit_query(struct acpi_ec *ec)
@@ -1229,9 +1220,10 @@ static int acpi_ec_submit_query(struct acpi_ec *ec)
spin_unlock_irq(&ec->lock);
+ return 0;
+
err_exit:
- if (result)
- acpi_ec_delete_query(q);
+ kfree(q);
return result;
}