From patchwork Sun Jun 9 03:08:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 2693641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id F1002DF24C for ; Sun, 9 Jun 2013 03:10:13 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UlW1E-0003jZ-9x; Sun, 09 Jun 2013 03:10:12 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UlW1B-000846-LA; Sun, 09 Jun 2013 03:10:09 +0000 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UlW19-00083D-8F for linux-arm-kernel@lists.infradead.org; Sun, 09 Jun 2013 03:10:07 +0000 Received: by mail-pb0-f53.google.com with SMTP id xb12so5983092pbc.40 for ; Sat, 08 Jun 2013 20:09:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=UgBoN8ahWqgDVXqU1OrK/37jpCYAVlDrVu96O95Hig8=; b=NgMit1DXroYfnTA3+kxQPMfmTf85pIIvZYCZxr58QGTQtxaUI76623iKSs4kuahsG3 qMoQ0Z3OzGrFHxBKAuZsDvtg20aFdQzYjos3/5XneV09NagRyuu/ZS7j1RyTImnH9aCk ZPWV5vZeO+NSjAgnMzn/z/D2DVIyilRNOuxCvFTHBMGFWmq/r5LebL0xv251ptjqDFV/ p2+CFcPfrbTm1MJKYFWkuy0ZQLVdc3WkmQQ6nrxucZy4Ps8ZwP8YrtnsG/BYHYgwvxpi HCYJ8KUAxPzd41LrEGnyuFspEPVRXBzghm5EOLxDEWgybITkzjB0VXdfrPvBiNnPXop5 YZZA== X-Received: by 10.68.194.169 with SMTP id hx9mr4527868pbc.210.1370747385774; Sat, 08 Jun 2013 20:09:45 -0700 (PDT) Received: from localhost.localdomain ([124.73.8.29]) by mx.google.com with ESMTPSA id eq4sm9612631pad.16.2013.06.08.20.09.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Jun 2013 20:09:44 -0700 (PDT) From: Zhangfei Gao To: Grant Likely Subject: [PATCH] gpiolib: remove warnning of allocations with IRQs disabled Date: Sun, 9 Jun 2013 11:08:32 +0800 Message-Id: <1370747312-25957-1-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnqdbE9lxhmTA7Z9Y1QYOCl8JZzZg1TTQwrzgplzZtDYv/OUyiw/aOYeeY/DuC/tZpe13SP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130608_231007_399749_7F2D0527 X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Zhangfei Gao , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Move of_gpiochip_add outof spin_lock, since kzalloc inside of_gpiochip_add -> of_gpiochip_add_pin_range -> gpiochip_add_pin_range -> kzalloc WARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xf8/0xfc() DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) Signed-off-by: Zhangfei Gao --- drivers/gpio/gpiolib.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c2534d6..ff0fd65 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1214,15 +1214,14 @@ int gpiochip_add(struct gpio_chip *chip) } } + spin_unlock_irqrestore(&gpio_lock, flags); + #ifdef CONFIG_PINCTRL INIT_LIST_HEAD(&chip->pin_ranges); #endif of_gpiochip_add(chip); -unlock: - spin_unlock_irqrestore(&gpio_lock, flags); - if (status) goto fail; @@ -1235,6 +1234,9 @@ unlock: chip->label ? : "generic"); return 0; + +unlock: + spin_unlock_irqrestore(&gpio_lock, flags); fail: /* failures here can mean systems won't boot... */ pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n",