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: 17705 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f200.google.com (mail-gg0-f200.google.com [209.85.161.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 28A6B2390C for ; Sun, 9 Jun 2013 03:09:48 +0000 (UTC) Received: by mail-gg0-f200.google.com with SMTP id k5sf5146902ggd.3 for ; Sat, 08 Jun 2013 20:09:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=UgBoN8ahWqgDVXqU1OrK/37jpCYAVlDrVu96O95Hig8=; b=BSPvogKp81KUCcYuvt5g9EVID9gTkBcxWYeB8lsZ02z598QqnlLo8R+ept79Wcja+Z J+3YqdwdvyXGKcwJOA5bSfjeVd9NVekQy1NRlkxDCF7ueU4Zg1Dkxr4LUfQ0VzJJQQh5 IZjSiX1q1zamv3XxyT9b/qhjdkkN6e0E7rNwqBGDn5aLI8k7dCofO6pzmCGA4mHHrJdM ZTcQgd5dlsDBlq6VoOAPqMir15ibhcXi2l4R0dLrWhExaP9SSbg3L7Peg+Lni09X2hrl MKrC75YL+3QlG62g0bBMgl3MuHqG5njFNbda3yE7Yd90jdg9WrgYChgyK3IqxwntbV3h 3fOg== X-Received: by 10.224.174.145 with SMTP id t17mr5018437qaz.4.1370747387609; Sat, 08 Jun 2013 20:09:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.52.40 with SMTP id q8ls2370727qeo.1.gmail; Sat, 08 Jun 2013 20:09:47 -0700 (PDT) X-Received: by 10.52.190.130 with SMTP id gq2mr2211833vdc.37.1370747387334; Sat, 08 Jun 2013 20:09:47 -0700 (PDT) Received: from mail-ve0-x22a.google.com (mail-ve0-x22a.google.com [2607:f8b0:400c:c01::22a]) by mx.google.com with ESMTPS id to9si2594276vdc.6.2013.06.08.20.09.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Jun 2013 20:09:47 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22a; Received: by mail-ve0-f170.google.com with SMTP id 14so4003721vea.1 for ; Sat, 08 Jun 2013 20:09:47 -0700 (PDT) X-Received: by 10.52.155.67 with SMTP id vu3mr2172925vdb.94.1370747387213; Sat, 08 Jun 2013 20:09:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp28539vcb; Sat, 8 Jun 2013 20:09:46 -0700 (PDT) X-Received: by 10.68.160.226 with SMTP id xn2mr4629924pbb.174.1370747386144; Sat, 08 Jun 2013 20:09:46 -0700 (PDT) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id px9si2389106pbb.335.2013.06.08.20.09.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Jun 2013 20:09:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of zhangfei.gao@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id 14so3584022pdj.12 for ; Sat, 08 Jun 2013 20:09:45 -0700 (PDT) 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 Cc: linux-arm-kernel@lists.infradead.org, Zhangfei Gao 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: ALoCoQkcIZbeTGtnRAiV9hN+c3jvD32tof84SB33XM4klXhodaH6Gwf5ggWAhX6/lG0KvuRnPCZ7 X-Original-Sender: zhangfei.gao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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",