From patchwork Wed Apr 9 11:43:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 28079 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 19201202DD for ; Wed, 9 Apr 2014 11:43:54 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id up15sf7297822pbc.10 for ; Wed, 09 Apr 2014 04:43:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=S7tTfHXDdALx7Sj2BGfjpmSCCy7JcBSf6LdUJJMgccA=; b=WFNBWJc3sfjMnmLKLXNo24Qq/EoANduiJsbnceqJIeL5AD+tP4AA7JvMV6RfkZpJBP 1fWi+LMRpbU8Ie1g/DvHlTBKbVW0kcpL/UriZvyo8UK7PhGnJVctu2m6iQXckI1izeMQ cwcbvMIcLr5rQvpRs8LGXimzCoC/5eSE25P95ohmIhchLdvnjqDgdkLRnJL7aLbh0Niy 26pO+ytz58CI9qTXpXOde0gRIkuCCdsnQSiUowlrc8IHc7+4qLtnK37xbFzwPR4x21no TFsBaHtp5Q0K83m6vFX/xg3/Tk2UXvbNPM/IFuMf+twFOqmwMP4ufI0WPW93LeaNv6yQ eFew== X-Gm-Message-State: ALoCoQnPG9DJjjyDpk5YPobeS+z0yeFQGL0qUb/gK/x09Insj/rjD0czpeVkot3bzvAi/6u4oVuL X-Received: by 10.66.144.228 with SMTP id sp4mr4582779pab.5.1397043834192; Wed, 09 Apr 2014 04:43:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls568064qgd.80.gmail; Wed, 09 Apr 2014 04:43:54 -0700 (PDT) X-Received: by 10.220.2.142 with SMTP id 14mr63843vcj.48.1397043833963; Wed, 09 Apr 2014 04:43:53 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id sq9si96258vdc.35.2014.04.09.04.43.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 04:43:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so1894770veb.25 for ; Wed, 09 Apr 2014 04:43:53 -0700 (PDT) X-Received: by 10.52.33.176 with SMTP id s16mr57604vdi.49.1397043833840; Wed, 09 Apr 2014 04:43:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp322240vcv; Wed, 9 Apr 2014 04:43:53 -0700 (PDT) X-Received: by 10.68.229.68 with SMTP id so4mr11358287pbc.110.1397043833072; Wed, 09 Apr 2014 04:43:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb4si374019pbc.22.2014.04.09.04.43.52; Wed, 09 Apr 2014 04:43:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932791AbaDILnw (ORCPT + 1 other); Wed, 9 Apr 2014 07:43:52 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:35960 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932748AbaDILnv (ORCPT ); Wed, 9 Apr 2014 07:43:51 -0400 Received: by mail-wi0-f170.google.com with SMTP id bs8so9361294wib.5 for ; Wed, 09 Apr 2014 04:43:50 -0700 (PDT) X-Received: by 10.180.221.68 with SMTP id qc4mr9540930wic.30.1397043829971; Wed, 09 Apr 2014 04:43:49 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id u1sm1299849wjx.16.2014.04.09.04.43.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Apr 2014 04:43:48 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: set data first, then chip and handler Date: Wed, 9 Apr 2014 13:43:44 +0200 Message-Id: <1397043824-17518-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , During irq mapping, in irq_set_chip_and_handler() the process of setting this up may incur calls to lock the irqchip, which in turn may need to dereference and use the chip data. So set the data first, then set the chip and handler. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 761013f8b82f..f48817d97480 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1387,8 +1387,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, { struct gpio_chip *chip = d->host_data; - irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); irq_set_chip_data(irq, chip); + irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); #ifdef CONFIG_ARM set_irq_flags(irq, IRQF_VALID); #else