From patchwork Tue Sep 27 23:07:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 77073 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp129551qgf; Tue, 27 Sep 2016 16:07:43 -0700 (PDT) X-Received: by 10.98.149.149 with SMTP id c21mr52278452pfk.33.1475017663619; Tue, 27 Sep 2016 16:07:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tr8si4815708pac.46.2016.09.27.16.07.43; Tue, 27 Sep 2016 16:07:43 -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; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754630AbcI0XH0 (ORCPT + 4 others); Tue, 27 Sep 2016 19:07:26 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:34339 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755989AbcI0XHP (ORCPT ); Tue, 27 Sep 2016 19:07:15 -0400 Received: by mail-pf0-f173.google.com with SMTP id l25so10391589pfb.1 for ; Tue, 27 Sep 2016 16:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=PaaWTrmQucWkE571RF5EziXp/lhO+D1Y3RTKb1i75Hs=; b=QVrp8sAUeo1bvT//S0SSBypNwC3bLXGXhaLtqpF5Gm51kTXoB8lP/rZMxo1nyhKY54 a2JyGhm8pFquEzv0bGdf5zcNuguSqAgovg1RgZYQDcpiMPRG5usuUiuW7zgnI4BpRqnF whdK2qaYLn6nP/fEkfzZb93EyU4/tlAx3HgXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PaaWTrmQucWkE571RF5EziXp/lhO+D1Y3RTKb1i75Hs=; b=ZJLxhwbipvbx56eRwyViZ2DOmFb1KFbBqMVaDT1308ZBS6MEnTPnVifuvnQoEJ/+1M eTY+2xjDGwEcuNJPVtk5Yt/I3zYP36h5ejcSLgrrTT4RU08KYkpz/ijLd411/J5fKQCr pqaf4I13kICvYenchgGs1kcpE1iwmQc+dOeNCDECgceQCpl+9C9w//VcRdh4mqZES8L+ UqcbsBVsu3xo5yzwhYgbfoDcxaPDZqvJD3OIiVcSxajJXDlqjDCi23iTi7B2QvsmaKcx j6hOZtFEee+lx0fNrSwJtw+UIkbGd/zpR0RMfkb5vUVz3ZGJ6EtE4JDao379OY6rrJBT 2/LA== X-Gm-Message-State: AE9vXwMM4/9y43nbgc+L1RApnr+2SQ1U16/9snw0yyM2GQtx3QZ5gojuVzFVcRvBkEW7jHq6 X-Received: by 10.98.2.215 with SMTP id 206mr52359452pfc.89.1475017634126; Tue, 27 Sep 2016 16:07:14 -0700 (PDT) Received: from localhost.localdomain.localdomain ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id id6sm636040pad.28.2016.09.27.16.07.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 16:07:13 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , Patrice Chotard , Mika Westerberg Subject: [PATCH] gpio: stmpe: forbid unused lines to be mapped as IRQs Date: Tue, 27 Sep 2016 16:07:04 -0700 Message-Id: <1475017624-29686-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Exploit the new mechanism for masking off disallowed IRQs added by Mika Westerberg to properly manage the STMPE "norequest mask" to disallow also mapping said lines as IRQs. Cc: Patrice Chotard Cc: Mika Westerberg Signed-off-by: Linus Walleij --- drivers/gpio/gpio-stmpe.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index b51c5be55c3a..432b2ee173c7 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -13,6 +13,7 @@ #include #include #include +#include /* * These registers are modified under the irq bus lock and cached to avoid @@ -449,6 +450,8 @@ static int stmpe_gpio_probe(struct platform_device *pdev) of_property_read_u32(np, "st,norequest-mask", &stmpe_gpio->norequest_mask); + if (stmpe_gpio->norequest_mask) + stmpe_gpio->chip.irq_need_valid_mask = true; if (irq < 0) dev_info(&pdev->dev, @@ -473,6 +476,14 @@ static int stmpe_gpio_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to get irq: %d\n", ret); goto out_disable; } + if (stmpe_gpio->norequest_mask) { + int i; + + /* Forbid unused lines to be mapped as IRQs */ + for (i = 0; i < sizeof(u32); i++) + if (stmpe_gpio->norequest_mask & BIT(i)) + clear_bit(i, stmpe_gpio->chip.irq_valid_mask); + } ret = gpiochip_irqchip_add(&stmpe_gpio->chip, &stmpe_gpio_irq_chip, 0,