From patchwork Tue Jul 21 12:52:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 246742 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2892608ilg; Tue, 21 Jul 2020 05:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6NUn9zT+FVqp9iSJzUMX1ew2dW5TdMGTIY97O4985w5y/kf8+Q2p0i7oXX9awr9o9yFcl X-Received: by 2002:a17:906:3ac4:: with SMTP id z4mr23601055ejd.65.1595335952464; Tue, 21 Jul 2020 05:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595335952; cv=none; d=google.com; s=arc-20160816; b=REtTdhCsd4If2amAVHA3QBUCiRgb705F3EHm4+758EfrfT9zJp12GDEqFFywc5syfg KS8uoCPpfjgiEyqbIIPCQk6u4lI2mr/p9yq9OCZQwj/cl7hw+dY8KtaJzDVN9wAng9wx KyZyLxWOjjNs+JW/NJMTCiQaB5oWiww/GtgEAA7EwXI+oGh3ibtGBHkhxIr7YmSwGUku zVXkDujpSnYWFUJGzQjAnO0Ec7CXD9JQM4mdae/+w32kYiRzNCcKjCwMi/EkgT7tccBm 8BYQbZyEb7A3YJNmq71S+BjXO3pXR4B1iQsFnz5cPTbdfT/3/Qca7NaDdwQtpt+1rX0J GBAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5p9l2h7oULuMDcdpJWOvN0sr4rIBBOAw+sXoQ3u2g7o=; b=htdmneewThARCswYSDPT/PkiztipPHlQqnzBZF5CZ7e2TGhCtnhWQ1/cAiAmY0zpnO /Qm+lmsAKyhvvq46sRwHi7LYbcFkhfyWPTNOkyyiV75te36xk44OfSRjY70+h/i+hxk2 rRNw1q1drlGMfp7nkfYzhJ/c0hbxluvVYCn0v4DhF0uuBJZSON2jekyVC/rPV2WCSKI3 oVJFSSBfXtc4MwWBvACIi3pATNp3SpA3XidOcmJt8BwmjJ2y4MVsHxvYQjobdYVXKTh4 8CMQW6ohzCEBNCw4pR3eLmfM/csOGfyC6NwRNIKrWhjr5WGem9EOA52XXpR59fFBR4C1 icdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o4u/PqPq"; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si12891087ejz.145.2020.07.21.05.52.31; Tue, 21 Jul 2020 05:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o4u/PqPq"; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726616AbgGUMwb (ORCPT + 5 others); Tue, 21 Jul 2020 08:52:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbgGUMwa (ORCPT ); Tue, 21 Jul 2020 08:52:30 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 685E4C061794 for ; Tue, 21 Jul 2020 05:52:30 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id u25so11606905lfm.1 for ; Tue, 21 Jul 2020 05:52:30 -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:mime-version :content-transfer-encoding; bh=5p9l2h7oULuMDcdpJWOvN0sr4rIBBOAw+sXoQ3u2g7o=; b=o4u/PqPqzxiQElL8rBTc4vdmM7RVLBpjy39iUyUzMuQ79QMX05IXLkOAHtsE/l5/Nv 1uQzuosFiLIRWDam3WX3EXEhrRJ0m1ywUl1fKs5UArH8rFxzqTbusVLw/iPyB8/ihRyt RGfo8Ze+Kwh161jbWBW/cENcOVDaXfA9gXXFaZCqN/kCd4Vg9he4p6fpg1obAZArtYbA vh6kAyKOgu5vE1VMDXkLesottgKOxToLrBjognlGaDPGeEOyONOBqjAjam3qb4eqhco9 1oFdfYZ7gbgzjlcx9WtADry6t9jQsOZsaa/aLsdLgvbLLSSiy6xr82otdSvECVH07f+L cbMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5p9l2h7oULuMDcdpJWOvN0sr4rIBBOAw+sXoQ3u2g7o=; b=LHk9udAJapBMfcVIze7bog86zZpicZvllbKHpTzsOJEXr7250VbH6C4SGbE0YvtQId 0xxe7b1W4n7Jn7Dow4MkkfiZNGAPeF9SIAxWi6BPPCch5/IVUO9uwUThJaYTDmZvd/OJ w0xcKelQibFZdLSo+XLrvqHR6JC85brZySpX6bSU8z/5z/5C1Mw2kSpYUB6uqDRNVJ7y SJ/BMLyXbtzfJ96sop6stlIqCb/QGK+unBn61fgV491o3R77ntDMQb283mPwSDxvZW+h PQI+DvKPCRCmx8RTV/uzM87jGRF6jVB4i/UAgLsx4lLjB9yr96KmPM2q2Mm1ad5mYZmv od4g== X-Gm-Message-State: AOAM533wUDbjGa7J+Qlm8+dwyXnY9ggoTNjWV8D0TwCRW9HF0oUzUDox rFA5+bgNGR2Mkj+VKH3IF1A8FRIYWeo= X-Received: by 2002:a05:6512:6cc:: with SMTP id u12mr12623251lff.148.1595335948559; Tue, 21 Jul 2020 05:52:28 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id b9sm2308825lfi.88.2020.07.21.05.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 05:52:27 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Andy Shevchenko , =?utf-8?q?Jan_Kundr=C3=A1t?= , Phil Reid , Lars Poeschel , Jason Kridner Subject: [PATCH] pinctrl: mcp23s08: Use irqchip template Date: Tue, 21 Jul 2020 14:52:23 +0200 Message-Id: <20200721125223.344411-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Cc: Andy Shevchenko Cc: Jan Kundrát Cc: Phil Reid Cc: Lars Poeschel Cc: Jason Kridner Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-mcp23s08.c | 44 ++++++++++-------------------- 1 file changed, 14 insertions(+), 30 deletions(-) -- 2.26.2 Reviewed-by: Andy Shevchenko diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 151931b593f6..42b12ea14d6b 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -522,29 +522,6 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp) return 0; } -static int mcp23s08_irqchip_setup(struct mcp23s08 *mcp) -{ - struct gpio_chip *chip = &mcp->chip; - int err; - - err = gpiochip_irqchip_add_nested(chip, - &mcp->irq_chip, - 0, - handle_simple_irq, - IRQ_TYPE_NONE); - if (err) { - dev_err(chip->parent, - "could not connect irqchip to gpiochip: %d\n", err); - return err; - } - - gpiochip_set_nested_irqchip(chip, - &mcp->irq_chip, - mcp->irq); - - return 0; -} - /*----------------------------------------------------------------------*/ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, @@ -589,10 +566,6 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, if (ret < 0) goto fail; - ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp); - if (ret < 0) - goto fail; - mcp->irq_controller = device_property_read_bool(dev, "interrupt-controller"); if (mcp->irq && mcp->irq_controller) { @@ -629,11 +602,22 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, } if (mcp->irq && mcp->irq_controller) { - ret = mcp23s08_irqchip_setup(mcp); - if (ret) - goto fail; + struct gpio_irq_chip *girq = &mcp->chip.irq; + + girq->chip = &mcp->irq_chip; + /* This will let us handle the parent IRQ in the driver */ + girq->parent_handler = NULL; + girq->num_parents = 0; + girq->parents = NULL; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_simple_irq; + girq->threaded = true; } + ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp); + if (ret < 0) + goto fail; + mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops; mcp->pinctrl_desc.confops = &mcp_pinconf_ops; mcp->pinctrl_desc.npins = mcp->chip.ngpio;