aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2012-10-22 19:29:27 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-14 18:15:59 -0500
commitf351d027eea545a7996af54fce99f5668a67fec5 (patch)
treee79628268b0c5dcaca14f7b0cb0620b3288ac761
parent77b67063bb6bce6d475e910d3b886a606d0d91f7 (diff)
ACPI / EC: Cleanup the member name for spinlock/mutex in struct
Current member names for mutex/spinlock are a little confusing. Change the { struct mutex lock; spinlock_t curr_lock; } to { struct mutex mutex; spinlock_t lock; } So that the code is cleaner and easier to read. Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/ec.c52
-rw-r--r--drivers/acpi/internal.h4
2 files changed, 28 insertions, 28 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index a51df9681319..29f349ccf62b 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -158,10 +158,10 @@ static int ec_transaction_done(struct acpi_ec *ec)
158{ 158{
159 unsigned long flags; 159 unsigned long flags;
160 int ret = 0; 160 int ret = 0;
161 spin_lock_irqsave(&ec->curr_lock, flags); 161 spin_lock_irqsave(&ec->lock, flags);
162 if (!ec->curr || ec->curr->done) 162 if (!ec->curr || ec->curr->done)
163 ret = 1; 163 ret = 1;
164 spin_unlock_irqrestore(&ec->curr_lock, flags); 164 spin_unlock_irqrestore(&ec->lock, flags);
165 return ret; 165 return ret;
166} 166}
167 167
@@ -175,7 +175,7 @@ static void start_transaction(struct acpi_ec *ec)
175static void advance_transaction(struct acpi_ec *ec, u8 status) 175static void advance_transaction(struct acpi_ec *ec, u8 status)
176{ 176{
177 unsigned long flags; 177 unsigned long flags;
178 spin_lock_irqsave(&ec->curr_lock, flags); 178 spin_lock_irqsave(&ec->lock, flags);
179 if (!ec->curr) 179 if (!ec->curr)
180 goto unlock; 180 goto unlock;
181 if (ec->curr->wlen > ec->curr->wi) { 181 if (ec->curr->wlen > ec->curr->wi) {
@@ -200,7 +200,7 @@ err:
200 if (in_interrupt()) 200 if (in_interrupt())
201 ++ec->curr->irq_count; 201 ++ec->curr->irq_count;
202unlock: 202unlock:
203 spin_unlock_irqrestore(&ec->curr_lock, flags); 203 spin_unlock_irqrestore(&ec->lock, flags);
204} 204}
205 205
206static int acpi_ec_sync_query(struct acpi_ec *ec); 206static int acpi_ec_sync_query(struct acpi_ec *ec);
@@ -238,9 +238,9 @@ static int ec_poll(struct acpi_ec *ec)
238 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) 238 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
239 break; 239 break;
240 pr_debug(PREFIX "controller reset, restart transaction\n"); 240 pr_debug(PREFIX "controller reset, restart transaction\n");
241 spin_lock_irqsave(&ec->curr_lock, flags); 241 spin_lock_irqsave(&ec->lock, flags);
242 start_transaction(ec); 242 start_transaction(ec);
243 spin_unlock_irqrestore(&ec->curr_lock, flags); 243 spin_unlock_irqrestore(&ec->lock, flags);
244 } 244 }
245 return -ETIME; 245 return -ETIME;
246} 246}
@@ -253,17 +253,17 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
253 if (EC_FLAGS_MSI) 253 if (EC_FLAGS_MSI)
254 udelay(ACPI_EC_MSI_UDELAY); 254 udelay(ACPI_EC_MSI_UDELAY);
255 /* start transaction */ 255 /* start transaction */
256 spin_lock_irqsave(&ec->curr_lock, tmp); 256 spin_lock_irqsave(&ec->lock, tmp);
257 /* following two actions should be kept atomic */ 257 /* following two actions should be kept atomic */
258 ec->curr = t; 258 ec->curr = t;
259 start_transaction(ec); 259 start_transaction(ec);
260 if (ec->curr->command == ACPI_EC_COMMAND_QUERY) 260 if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
261 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); 261 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
262 spin_unlock_irqrestore(&ec->curr_lock, tmp); 262 spin_unlock_irqrestore(&ec->lock, tmp);
263 ret = ec_poll(ec); 263 ret = ec_poll(ec);
264 spin_lock_irqsave(&ec->curr_lock, tmp); 264 spin_lock_irqsave(&ec->lock, tmp);
265 ec->curr = NULL; 265 ec->curr = NULL;
266 spin_unlock_irqrestore(&ec->curr_lock, tmp); 266 spin_unlock_irqrestore(&ec->lock, tmp);
267 return ret; 267 return ret;
268} 268}
269 269
@@ -292,7 +292,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
292 return -EINVAL; 292 return -EINVAL;
293 if (t->rdata) 293 if (t->rdata)
294 memset(t->rdata, 0, t->rlen); 294 memset(t->rdata, 0, t->rlen);
295 mutex_lock(&ec->lock); 295 mutex_lock(&ec->mutex);
296 if (test_bit(EC_FLAGS_BLOCKED, &ec->flags)) { 296 if (test_bit(EC_FLAGS_BLOCKED, &ec->flags)) {
297 status = -EINVAL; 297 status = -EINVAL;
298 goto unlock; 298 goto unlock;
@@ -335,7 +335,7 @@ end:
335 if (ec->global_lock) 335 if (ec->global_lock)
336 acpi_release_global_lock(glk); 336 acpi_release_global_lock(glk);
337unlock: 337unlock:
338 mutex_unlock(&ec->lock); 338 mutex_unlock(&ec->mutex);
339 return status; 339 return status;
340} 340}
341 341
@@ -468,10 +468,10 @@ void acpi_ec_block_transactions(void)
468 if (!ec) 468 if (!ec)
469 return; 469 return;
470 470
471 mutex_lock(&ec->lock); 471 mutex_lock(&ec->mutex);
472 /* Prevent transactions from being carried out */ 472 /* Prevent transactions from being carried out */
473 set_bit(EC_FLAGS_BLOCKED, &ec->flags); 473 set_bit(EC_FLAGS_BLOCKED, &ec->flags);
474 mutex_unlock(&ec->lock); 474 mutex_unlock(&ec->mutex);
475} 475}
476 476
477void acpi_ec_unblock_transactions(void) 477void acpi_ec_unblock_transactions(void)
@@ -481,10 +481,10 @@ void acpi_ec_unblock_transactions(void)
481 if (!ec) 481 if (!ec)
482 return; 482 return;
483 483
484 mutex_lock(&ec->lock); 484 mutex_lock(&ec->mutex);
485 /* Allow transactions to be carried out again */ 485 /* Allow transactions to be carried out again */
486 clear_bit(EC_FLAGS_BLOCKED, &ec->flags); 486 clear_bit(EC_FLAGS_BLOCKED, &ec->flags);
487 mutex_unlock(&ec->lock); 487 mutex_unlock(&ec->mutex);
488} 488}
489 489
490void acpi_ec_unblock_transactions_early(void) 490void acpi_ec_unblock_transactions_early(void)
@@ -536,9 +536,9 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
536 handler->handle = handle; 536 handler->handle = handle;
537 handler->func = func; 537 handler->func = func;
538 handler->data = data; 538 handler->data = data;
539 mutex_lock(&ec->lock); 539 mutex_lock(&ec->mutex);
540 list_add(&handler->node, &ec->list); 540 list_add(&handler->node, &ec->list);
541 mutex_unlock(&ec->lock); 541 mutex_unlock(&ec->mutex);
542 return 0; 542 return 0;
543} 543}
544 544
@@ -547,14 +547,14 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler);
547void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) 547void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
548{ 548{
549 struct acpi_ec_query_handler *handler, *tmp; 549 struct acpi_ec_query_handler *handler, *tmp;
550 mutex_lock(&ec->lock); 550 mutex_lock(&ec->mutex);
551 list_for_each_entry_safe(handler, tmp, &ec->list, node) { 551 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
552 if (query_bit == handler->query_bit) { 552 if (query_bit == handler->query_bit) {
553 list_del(&handler->node); 553 list_del(&handler->node);
554 kfree(handler); 554 kfree(handler);
555 } 555 }
556 } 556 }
557 mutex_unlock(&ec->lock); 557 mutex_unlock(&ec->mutex);
558} 558}
559 559
560EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); 560EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
@@ -601,9 +601,9 @@ static void acpi_ec_gpe_query(void *ec_cxt)
601 struct acpi_ec *ec = ec_cxt; 601 struct acpi_ec *ec = ec_cxt;
602 if (!ec) 602 if (!ec)
603 return; 603 return;
604 mutex_lock(&ec->lock); 604 mutex_lock(&ec->mutex);
605 acpi_ec_sync_query(ec); 605 acpi_ec_sync_query(ec);
606 mutex_unlock(&ec->lock); 606 mutex_unlock(&ec->mutex);
607} 607}
608 608
609static int ec_check_sci(struct acpi_ec *ec, u8 state) 609static int ec_check_sci(struct acpi_ec *ec, u8 state)
@@ -691,10 +691,10 @@ static struct acpi_ec *make_acpi_ec(void)
691 if (!ec) 691 if (!ec)
692 return NULL; 692 return NULL;
693 ec->flags = 1 << EC_FLAGS_QUERY_PENDING; 693 ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
694 mutex_init(&ec->lock); 694 mutex_init(&ec->mutex);
695 init_waitqueue_head(&ec->wait); 695 init_waitqueue_head(&ec->wait);
696 INIT_LIST_HEAD(&ec->list); 696 INIT_LIST_HEAD(&ec->list);
697 spin_lock_init(&ec->curr_lock); 697 spin_lock_init(&ec->lock);
698 return ec; 698 return ec;
699} 699}
700 700
@@ -853,12 +853,12 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
853 853
854 ec = acpi_driver_data(device); 854 ec = acpi_driver_data(device);
855 ec_remove_handlers(ec); 855 ec_remove_handlers(ec);
856 mutex_lock(&ec->lock); 856 mutex_lock(&ec->mutex);
857 list_for_each_entry_safe(handler, tmp, &ec->list, node) { 857 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
858 list_del(&handler->node); 858 list_del(&handler->node);
859 kfree(handler); 859 kfree(handler);
860 } 860 }
861 mutex_unlock(&ec->lock); 861 mutex_unlock(&ec->mutex);
862 release_region(ec->data_addr, 1); 862 release_region(ec->data_addr, 1);
863 release_region(ec->command_addr, 1); 863 release_region(ec->command_addr, 1);
864 device->driver_data = NULL; 864 device->driver_data = NULL;
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index ca75b9ce0489..509dcaa17555 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -58,11 +58,11 @@ struct acpi_ec {
58 unsigned long data_addr; 58 unsigned long data_addr;
59 unsigned long global_lock; 59 unsigned long global_lock;
60 unsigned long flags; 60 unsigned long flags;
61 struct mutex lock; 61 struct mutex mutex;
62 wait_queue_head_t wait; 62 wait_queue_head_t wait;
63 struct list_head list; 63 struct list_head list;
64 struct transaction *curr; 64 struct transaction *curr;
65 spinlock_t curr_lock; 65 spinlock_t lock;
66}; 66};
67 67
68extern struct acpi_ec *first_ec; 68extern struct acpi_ec *first_ec;