From patchwork Thu Sep 3 23:18:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Chan X-Patchwork-Id: 45454 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n83NIkQi023208 for ; Thu, 3 Sep 2009 23:18:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932448AbZICXSM (ORCPT ); Thu, 3 Sep 2009 19:18:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756554AbZICXSM (ORCPT ); Thu, 3 Sep 2009 19:18:12 -0400 Received: from smtp-out.google.com ([216.239.33.17]:46714 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756553AbZICXSL (ORCPT ); Thu, 3 Sep 2009 19:18:11 -0400 Received: from zps36.corp.google.com (zps36.corp.google.com [172.25.146.36]) by smtp-out.google.com with ESMTP id n83NIAhC014065; Fri, 4 Sep 2009 00:18:11 +0100 Received: from localhost (cheetara.mtv.corp.google.com [172.18.103.81]) by zps36.corp.google.com with ESMTP id n83NI7I2023272; Thu, 3 Sep 2009 16:18:07 -0700 Received: by localhost (Postfix, from userid 18922) id 8A174504DA0; Thu, 3 Sep 2009 16:18:07 -0700 (PDT) From: Mike Chan To: linux-omap@vger.kernel.org Cc: khilman@deeprootsystems.com, Mike Chan Subject: [PATCH] [ARM] omap: resource: Make resource_refresh() thread safe. Date: Thu, 3 Sep 2009 16:18:07 -0700 Message-Id: <1252019887-4463-1-git-send-email-mike@android.com> X-Mailer: git-send-email 1.5.4.5 X-System-Of-Record: true Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Need to lock the res_mutex when traversing the res_list. Signed-off-by: Mike Chan --- arch/arm/plat-omap/resource.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/resource.c b/arch/arm/plat-omap/resource.c index 25072cd..4631912 100644 --- a/arch/arm/plat-omap/resource.c +++ b/arch/arm/plat-omap/resource.c @@ -234,11 +234,13 @@ int resource_refresh(void) struct shared_resource *resp = NULL; int ret = 0; + down(&res_mutex); list_for_each_entry(resp, &res_list, node) { ret = update_resource_level(resp); if (ret) break; } + up(&res_mutex); return ret; }