Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp372658imm; Thu, 21 Jun 2018 20:51:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLozR91s3RZ9zyZvnt+qWql36EZzo6hVJtRveni863KOBo68nv+VSO6fJoFw3RTgNX0LHhM X-Received: by 2002:a63:b307:: with SMTP id i7-v6mr24563376pgf.448.1529639462740; Thu, 21 Jun 2018 20:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529639462; cv=none; d=google.com; s=arc-20160816; b=e/BDbbeGfq/xSVDTnIwpZNvyl5l+CUtnG5/EAntoCb8Q460oB8APrDtx2nGy+5gFa2 efI1sUs8dOBpchASu32KEWVVViSM2g27PpW7mRCf0nTpQ2o0wDqXZy+4dlRPaKwswhHd cYRuNESO8mRoAJe7jQ7sCw6dFD/3iO/7rKhkBmn0ulgGA/rb9Qw7fdy+OEppRC7FBkiW 8nTzl0ogzkxnUD5ycJqUJkKvKFPeajrOCVP9/NptdzuAdaijhhBVXM8Bz74rYGqj5K2x LfgTWHYGnaAvJb5ATYDIL6ocjhdvola9Y0vLFzCcGSjy8g0iNkpT8FlOxaqx8VRkJg9c vVVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=NiBrrI/NhQ+O+4We9/4F3YQo4yLCfWznhoUCxprdAFA=; b=obGpfVf7Km8UVKoAFtXvF3BNHk8AhYWOQLQhtDDfQEynCZPSBce19owbxQEHM+VsHT lpHDoKnf3bWJ4vmBBazzY9AMNWOe24fx1HnMDiQ2xRWfG5giJUUf6ijS7IVpeKVC+OWN IZ7ag9ZEEiEEHJMlVA/xBCe14v7SgJsMFAY0g/mBWDdZBrb1YDkyH97xbxgX/ociBSSI sHz0D6kWhz5/2HySNV6Vs4GUKwDu5o4irV5FKJ1tZzkUm9QNfXFqJb037mrelPBGv9jD dGCT/APg0LwZInz0y4FEGinLWovLoxv03s6SFCmvq06ha0/DfCMxRko5GQY2xTkoCoSN rc9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si6263570plb.478.2018.06.21.20.50.48; Thu, 21 Jun 2018 20:51:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934434AbeFVDtd (ORCPT + 99 others); Thu, 21 Jun 2018 23:49:33 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:64946 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S934377AbeFVDt2 (ORCPT ); Thu, 21 Jun 2018 23:49:28 -0400 X-UUID: 48cfe840b6ac4993a8378577cfd6023a-20180622 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 695077034; Fri, 22 Jun 2018 11:49:22 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 22 Jun 2018 11:49:15 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 22 Jun 2018 11:49:15 +0800 From: To: , CC: , , , Sean Wang , Subject: [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range Date: Fri, 22 Jun 2018 11:49:07 +0800 Message-ID: <098100772163e54fe5ca49576042edbfaf3807a5.1529639050.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang If the pinctrl node has the gpio-ranges property, the range will be added by the gpio core and doesn't need to be added by the pinctrl driver. But for keeping backward compatibility, an explicit pinctrl_add_gpio_range is still needed to be called when there is a missing gpio-ranges in pinctrl node in old dts files. Cc: stable@vger.kernel.org Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC") Signed-off-by: Sean Wang --- drivers/pinctrl/mediatek/pinctrl-mt7622.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c index 42155d4..055074bb 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c @@ -1508,11 +1508,20 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) if (ret < 0) return ret; - ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0, - chip->ngpio); - if (ret < 0) { - gpiochip_remove(chip); - return ret; + /* Just for backward compatible for these old pinctrl nodes without + * "gpio-ranges" property. Otherwise, called directly from a + * DeviceTree-supported pinctrl driver is DEPRECATED. + * Please see Section 2.1 of + * Documentation/devicetree/bindings/gpio/gpio.txt on how to + * bind pinctrl and gpio drivers via the "gpio-ranges" property. + */ + if (!of_find_property(np, "gpio-ranges", NULL)) { + ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0, + chip->ngpio); + if (ret < 0) { + gpiochip_remove(chip); + return ret; + } } return 0; -- 2.7.4