From patchwork Wed Jul 28 23:40:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 114946 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SNfJw9007015 for ; Wed, 28 Jul 2010 23:41:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751369Ab0G1XlQ (ORCPT ); Wed, 28 Jul 2010 19:41:16 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:52198 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459Ab0G1XlH (ORCPT ); Wed, 28 Jul 2010 19:41:07 -0400 Received: by bwz1 with SMTP id 1so18052bwz.19 for ; Wed, 28 Jul 2010 16:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=bMHCDCYsATPtkgpO3IuKSQGgn2Wo9fknUWSwp4xFi8E=; b=WFtDM99ShJ+HrF+Z1asF9htXU58Tah3s611XJxqCjpgWCK5nzH9NGQ3hSL7edvy+sM I2v9Gk8YL1KCdOArNoVruFq90AE1S2OUcHD86FfvjJe7r5fSRguNPY272ufwaVSbk4i2 hnIjWLZJry7qNS2jbq2kbeguTxgdxI2wga2Hc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=g5FNEcabbrm/r3N+zavpQCO3LEitMwhFzyEvlYOK8UeeWIiQOqcHH3hIfZ8bqWs80N fuOxbIxJbcVYVHBjDpikjeYWTrJKTtdE58ZNcwjl5TdL4wHMgg2OsCMpNTw44lkk8P3v NwJ36K2AypCk8OQSBNaby30i+mXLUk9TUXEy8= Received: by 10.204.127.65 with SMTP id f1mr8727000bks.55.1280360464229; Wed, 28 Jul 2010 16:41:04 -0700 (PDT) Received: from localhost.localdomain (IGLD-84-229-112-176.inter.net.il [84.229.112.176]) by mx.google.com with ESMTPS id bq20sm104935bkb.16.2010.07.28.16.41.02 (version=SSLv3 cipher=RC4-MD5); Wed, 28 Jul 2010 16:41:03 -0700 (PDT) From: Maxim Levitsky To: lirc-list@lists.sourceforge.net Cc: Jarod Wilson , linux-input@vger.kernel.org, linux-media@vger.kernel.org, Mauro Carvalho Chehab , Christoph Bartelmus , Maxim Levitsky Subject: [PATCH 3/9] IR: replace spinlock with mutex. Date: Thu, 29 Jul 2010 02:40:46 +0300 Message-Id: <1280360452-8852-4-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1280360452-8852-1-git-send-email-maximlevitsky@gmail.com> References: <1280360452-8852-1-git-send-email-maximlevitsky@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 23:41:19 +0000 (UTC) diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index ab9c4da..c6a80b3 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -13,7 +13,7 @@ */ #include -#include +#include #include #include "ir-core-priv.h" @@ -24,7 +24,7 @@ static LIST_HEAD(ir_raw_client_list); /* Used to handle IR raw handler extensions */ -static DEFINE_SPINLOCK(ir_raw_handler_lock); +static DEFINE_MUTEX(ir_raw_handler_lock); static LIST_HEAD(ir_raw_handler_list); static u64 available_protocols; @@ -41,10 +41,10 @@ static void ir_raw_event_work(struct work_struct *work) container_of(work, struct ir_raw_event_ctrl, rx_work); while (kfifo_out(&raw->kfifo, &ev, sizeof(ev)) == sizeof(ev)) { - spin_lock(&ir_raw_handler_lock); + mutex_lock(&ir_raw_handler_lock); list_for_each_entry(handler, &ir_raw_handler_list, list) handler->decode(raw->input_dev, ev); - spin_unlock(&ir_raw_handler_lock); + mutex_unlock(&ir_raw_handler_lock); raw->prev_ev = ev; } } @@ -150,9 +150,9 @@ u64 ir_raw_get_allowed_protocols() { u64 protocols; - spin_lock(&ir_raw_handler_lock); + mutex_lock(&ir_raw_handler_lock); protocols = available_protocols; - spin_unlock(&ir_raw_handler_lock); + mutex_unlock(&ir_raw_handler_lock); return protocols; } @@ -180,12 +180,12 @@ int ir_raw_event_register(struct input_dev *input_dev) return rc; } - spin_lock(&ir_raw_handler_lock); + mutex_lock(&ir_raw_handler_lock); list_add_tail(&ir->raw->list, &ir_raw_client_list); list_for_each_entry(handler, &ir_raw_handler_list, list) if (handler->raw_register) handler->raw_register(ir->raw->input_dev); - spin_unlock(&ir_raw_handler_lock); + mutex_unlock(&ir_raw_handler_lock); return 0; } @@ -200,12 +200,12 @@ void ir_raw_event_unregister(struct input_dev *input_dev) cancel_work_sync(&ir->raw->rx_work); - spin_lock(&ir_raw_handler_lock); + mutex_lock(&ir_raw_handler_lock); list_del(&ir->raw->list); list_for_each_entry(handler, &ir_raw_handler_list, list) if (handler->raw_unregister) handler->raw_unregister(ir->raw->input_dev); - spin_unlock(&ir_raw_handler_lock); + mutex_unlock(&ir_raw_handler_lock); kfifo_free(&ir->raw->kfifo); kfree(ir->raw); @@ -220,13 +220,13 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) { struct ir_raw_event_ctrl *raw; - spin_lock(&ir_raw_handler_lock); + mutex_lock(&ir_raw_handler_lock); list_add_tail(&ir_raw_handler->list, &ir_raw_handler_list); if (ir_raw_handler->raw_register) list_for_each_entry(raw, &ir_raw_client_list, list) ir_raw_handler->raw_register(raw->input_dev); available_protocols |= ir_raw_handler->protocols; - spin_unlock(&ir_raw_handler_lock); + mutex_unlock(&ir_raw_handler_lock); return 0; } @@ -236,13 +236,13 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) { struct ir_raw_event_ctrl *raw; - spin_lock(&ir_raw_handler_lock); + mutex_lock(&ir_raw_handler_lock); list_del(&ir_raw_handler->list); if (ir_raw_handler->raw_unregister) list_for_each_entry(raw, &ir_raw_client_list, list) ir_raw_handler->raw_unregister(raw->input_dev); available_protocols &= ~ir_raw_handler->protocols; - spin_unlock(&ir_raw_handler_lock); + mutex_unlock(&ir_raw_handler_lock); } EXPORT_SYMBOL(ir_raw_handler_unregister);