From c5728e585aff5a2ecf32911c49599e07e7c90f9d Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Lv Zheng Date: Tue, 10 Jun 2014 16:40:33 +0800 Subject: [PATCH 08/11] ACPI/EC: Move "struct transaction" to drivers/acpi/internal.h. This patch moves "struct transaction" to drivers/acpi/internal.h as a future extension requires this change. This patch seperates such change to form a single commit to make the future extension simpler. This patch also renames all "struct transaction" into "struct acpi_ec_transaction". to avoid any naming collisions in the shared header. Signed-off-by: Lv Zheng --- drivers/acpi/ec.c | 67 ++++++++++++++++++++++++----------------------- drivers/acpi/internal.h | 14 +++++++++- 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 65238fa..e2a1be9 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -107,18 +107,6 @@ struct acpi_ec_query_handler { struct kref kref; }; -struct transaction { - const u8 *wdata; - u8 *rdata; - unsigned short irq_count; - u8 command; - u8 wi; - u8 ri; - u8 wlen; - u8 rlen; - u8 flags; -}; - static struct acpi_ec_query_handler * acpi_ec_get_query_handler(struct acpi_ec_query_handler *handler); static void acpi_ec_put_query_handler(struct acpi_ec_query_handler *handler); @@ -185,7 +173,7 @@ static int ec_transaction_completed(struct acpi_ec *ec) static bool advance_transaction(struct acpi_ec *ec) { - struct transaction *t; + struct acpi_ec_transaction *t; u8 status; bool wakeup = false; @@ -285,7 +273,7 @@ static int ec_poll(struct acpi_ec *ec) } static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, - struct transaction *t) + struct acpi_ec_transaction *t) { unsigned long tmp; int ret = 0; @@ -306,7 +294,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, return ret; } -static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) +static int acpi_ec_transaction(struct acpi_ec *ec, + struct acpi_ec_transaction *t) { int status; u32 glk; @@ -359,18 +348,22 @@ unlock: static int acpi_ec_burst_enable(struct acpi_ec *ec) { u8 d; - struct transaction t = {.command = ACPI_EC_BURST_ENABLE, - .wdata = NULL, .rdata = &d, - .wlen = 0, .rlen = 1}; + struct acpi_ec_transaction t = { + .command = ACPI_EC_BURST_ENABLE, + .wdata = NULL, .wlen = 0, + .rdata = &d, .rlen = 1 + }; return acpi_ec_transaction(ec, &t); } static int acpi_ec_burst_disable(struct acpi_ec *ec) { - struct transaction t = {.command = ACPI_EC_BURST_DISABLE, - .wdata = NULL, .rdata = NULL, - .wlen = 0, .rlen = 0}; + struct acpi_ec_transaction t = { + .command = ACPI_EC_BURST_DISABLE, + .wdata = NULL, .wlen = 0, + .rdata = NULL, .rlen = 0 + }; return (acpi_ec_read_status(ec) & ACPI_EC_FLAG_BURST) ? acpi_ec_transaction(ec, &t) : 0; @@ -380,9 +373,11 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) { int result; u8 d; - struct transaction t = {.command = ACPI_EC_COMMAND_READ, - .wdata = &address, .rdata = &d, - .wlen = 1, .rlen = 1}; + struct acpi_ec_transaction t = { + .command = ACPI_EC_COMMAND_READ, + .wdata = &address, .wlen = 1, + .rdata = &d, .rlen = 1 + }; result = acpi_ec_transaction(ec, &t); *data = d; @@ -392,9 +387,11 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data) { u8 wdata[2] = { address, data }; - struct transaction t = {.command = ACPI_EC_COMMAND_WRITE, - .wdata = wdata, .rdata = NULL, - .wlen = 2, .rlen = 0}; + struct acpi_ec_transaction t = { + .command = ACPI_EC_COMMAND_WRITE, + .wdata = wdata, .wlen = 2, + .rdata = NULL, .rlen = 0 + }; return acpi_ec_transaction(ec, &t); } @@ -436,9 +433,11 @@ int ec_transaction(u8 command, const u8 * wdata, unsigned wdata_len, u8 * rdata, unsigned rdata_len) { - struct transaction t = {.command = command, - .wdata = wdata, .rdata = rdata, - .wlen = wdata_len, .rlen = rdata_len}; + struct acpi_ec_transaction t = { + .command = command, + .wdata = wdata, .wlen = wdata_len, + .rdata = rdata, .rlen = rdata_len + }; if (!first_ec) return -ENODEV; @@ -522,9 +521,11 @@ static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) { int result; u8 d; - struct transaction t = {.command = ACPI_EC_COMMAND_QUERY, - .wdata = NULL, .rdata = &d, - .wlen = 0, .rlen = 1}; + struct acpi_ec_transaction t = { + .command = ACPI_EC_COMMAND_QUERY, + .wdata = NULL, .wlen = 0, + .rdata = &d, .rlen = 1 + }; if (!ec || !data) return -EINVAL; /* diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 7de5b60..6a5564a 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -113,6 +113,18 @@ void acpi_early_processor_set_pdc(void); /* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */ +struct acpi_ec_transaction { + const u8 *wdata; + u8 *rdata; + unsigned short irq_count; + u8 command; + u8 wi; + u8 ri; + u8 wlen; + u8 rlen; + u8 flags; +}; + struct acpi_ec { acpi_handle handle; unsigned long gpe; @@ -123,7 +135,7 @@ struct acpi_ec { struct mutex mutex; wait_queue_head_t wait; struct list_head list; - struct transaction *curr; + struct acpi_ec_transaction *curr; spinlock_t lock; }; -- 1.7.10