Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp442781rwb; Wed, 16 Nov 2022 03:01:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf4aOAVZdYyfapllGkmKKRn8zqhUKqUpjCRm++esy7Lc6qWpuuNVUIXzE62rDI9Iz7/RbWsV X-Received: by 2002:a17:906:c10:b0:7ad:caf4:9e92 with SMTP id s16-20020a1709060c1000b007adcaf49e92mr17001095ejf.510.1668596515573; Wed, 16 Nov 2022 03:01:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668596515; cv=none; d=google.com; s=arc-20160816; b=oKj4JpRf8mUarrR0sYFSpj3wAl+vGGJ7f+MCsvdFbLATAt6YnDGmd7irk7Wo5HDlCs 4sZRDyQmrJhg4AMGb6CKfKgC35KaZS3U66k+gkaJTHc1/MD3adlD5BfhOyCU9DnOkHtQ cXVe7zlac7B11Khlt3/RtxoMUH1afjQeNpGd/Sv+aC/VAJRXHWPtb4Hl7f6GEsupmh7C Zfqh89/5TBqid262untNFS6iAMNsLI7DHkykvaVu/5wPrwZqii2X5XYPH/GNUoo1nu1v VRQoB03GAxiftY6DIzZF7uT7ebgP6bE0OPMPeJkRwNfI1uQydd29fZfHwCCyg+Y7jpo4 qkeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wZZMUhbKy7ynmOXNWH4kaH5VmBJFo340pscy2ibaMNA=; b=Fcvemq8J1sYOVq83YBU73JP5a2qzkr8KYCqzKI828G3qzsWRGQDlGORVTfScNsH3Gb sIuKZ4qW2KVF6tcZjhrualTkqIWSndsdsDH+ujeQGyDgP5VKc79fNOwfvPtumXtpI7gC XyQfsv5YNkPYXCAcB7Wo91BcCC25wCmBflWfclwo9b1eWFX3D9ay5Re/qfjOXfZC2Xor X5w/HWVQRL0XIjk7ib8BMPEfC9x7cUXuoo7qoqh+Wlv9IuJexU1L7RAfcCC1JKJU8F8B H4j58vxgM9Uyykd2h3ihaZhnY/Jd70h6TinRmy4nOSoQFnRDu2iKtknMq5fg610tnch2 le8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HZ1wSriR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a1709062c4500b007ae74740fa4si11160555ejh.275.2022.11.16.03.01.22; Wed, 16 Nov 2022 03:01:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HZ1wSriR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229495AbiKPKaf (ORCPT + 91 others); Wed, 16 Nov 2022 05:30:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236814AbiKPK3p (ORCPT ); Wed, 16 Nov 2022 05:29:45 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A014F10F9; Wed, 16 Nov 2022 02:26:38 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id n20so22362334ejh.0; Wed, 16 Nov 2022 02:26:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=wZZMUhbKy7ynmOXNWH4kaH5VmBJFo340pscy2ibaMNA=; b=HZ1wSriRfPZJmhfe7cRemFo0WYY/MWcqYreV3FKi50VCEeB2EUUYTJ8Tp+2HzYhq8p haaa/NG86zlsNy8C1hIGIOac28ezcy2vsEzyidHCq0qvdNb2+b87pc30KgKeAhYP4Ewg Z7Lb8rTeBdU2Uiz4iyjvFWcz+Fi6fxB0frQbWeI74t0V7U3W+RcDcpDOtgW8JLKQ75ic BsxuDQmVirB8Yj+rGPht9o+LEIE4PfQzzfJLVw3QypdCzaCUZUzLEUaKTyk/N7FN2qr2 5b55RoLkOkLRtb1SS37lsl5y+z0LtWhgS++aExDsxYMPoBm2CK00Qnqsh3c7xfAKIUvc op3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wZZMUhbKy7ynmOXNWH4kaH5VmBJFo340pscy2ibaMNA=; b=ADMYATEAdV4hVGI2bbAZ+7zlA4lC1K9MW2SW290+10H+g11aQNJdqYtnSFzaH6QMfs ADqExvwIa4HHOeTI8ZzJmxaPAd/hJFHkZnsEKG3q0ffCqmk9trC2nG0w85WUVqXqHCLi XAh2lc7CW3tetKgWwGUwwRDixn/V1JtZB6T4KPg1LgyvI4J2WtEJx6OdnH38lZPyGB2J El0V+bDaqZraQ5a2AuMYgwSVwmtTrWJ6HDkkTIEsJFweFYwqOxeqO1tSJfNJyMhhvs7T 50mD7bYx3wFgSEj6PmOx+mi0jnq3hhvC9extX6GiqbmiYFH6cU1GkzL9B360a53IMIT+ rnlw== X-Gm-Message-State: ANoB5pndN135zj4ddiwDnkvux/KvWMquU0/qPKI/l0sxMmmaL7082/IM rTmqiyNB3cSfw6H5vStC6eo= X-Received: by 2002:a17:906:269a:b0:7ad:84cc:fb33 with SMTP id t26-20020a170906269a00b007ad84ccfb33mr17430651ejc.380.1668594397130; Wed, 16 Nov 2022 02:26:37 -0800 (PST) Received: from orome (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id r18-20020a1709061bb200b0077d37a5d401sm6710292ejg.33.2022.11.16.02.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:26:36 -0800 (PST) Date: Wed, 16 Nov 2022 11:26:34 +0100 From: Thierry Reding To: Marijn Suijten Cc: Brian Masney , Bartosz Golaszewski , Linus Walleij , Andy Shevchenko , Dmitry Torokhov , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Szyprowski , Konrad Dybcio Subject: Re: [PATCH] gpiolib: of: Use correct fwnode for DT-probed chips Message-ID: References: <20221111113732.461881-1-thierry.reding@gmail.com> <20221115111800.t6i6fuszhuasvgka@SoMainline.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="t/QMyFVa0+ws/Ltf" Content-Disposition: inline In-Reply-To: <20221115111800.t6i6fuszhuasvgka@SoMainline.org> User-Agent: Mutt/2.2.8 (2022-11-05) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --t/QMyFVa0+ws/Ltf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 15, 2022 at 12:18:00PM +0100, Marijn Suijten wrote: > On 2022-11-14 16:15:25, Brian Masney wrote: > > On Fri, Nov 11, 2022 at 12:37:32PM +0100, Thierry Reding wrote: > > > From: Thierry Reding > > >=20 > > > The OF node store in chip->fwnode is used to explicitly override the = FW > > > node for a GPIO chip. For chips that use the default FW node (i.e. th= at > > > of their parent device), this will be NULL and cause the chip not to = be > > > fully registered. > > >=20 > > > Instead, use the GPIO device's FW node, which is set to either the no= de > > > of the parent device or the explicit override in chip->fwnode. > > >=20 > > > Fixes: 8afe82550240 ("gpiolib: of: Prepare of_gpiochip_add() / of_gpi= ochip_remove() for fwnode") > > > Tested-by: Marek Szyprowski > > > Signed-off-by: Thierry Reding > >=20 > > Reviewed-by: Brian Masney > > Tested-by: Brian Masney > >=20 > > I separately sent a similar type of patch to fix the same issue today: > > https://lore.kernel.org/linux-arm-msm/20221114202943.2389489-1-bmasney@= redhat.com/T/#u >=20 > For completeness, your linked patch fixes a synchronous external abort > on multiple Qualcomm platforms pointed out in [1]. This patch however > does not, are you sure they fix the exact same issue? >=20 > [1]: https://lore.kernel.org/linux-arm-msm/20221115110800.35gl3j43lmbxm3j= b@SoMainline.org/ Can you check if the below fixes the MSM issue that you're seeing (applied on top of my earlier patch, though with Brian's reverted temporarily)? Thanks, Thierry --- >8 --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 11fb7ec883e9..d692ad5c5a27 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -447,10 +447,11 @@ static unsigned long *gpiochip_allocate_mask(struct g= pio_chip *gc) =20 static unsigned int gpiochip_count_reserved_ranges(struct gpio_chip *gc) { + struct fwnode_handle *fwnode =3D dev_fwnode(&gc->gpiodev->dev); int size; =20 /* Format is "start, count, ..." */ - size =3D fwnode_property_count_u32(gc->fwnode, "gpio-reserved-ranges"); + size =3D fwnode_property_count_u32(fwnode, "gpio-reserved-ranges"); if (size > 0 && size % 2 =3D=3D 0) return size; =20 @@ -471,6 +472,7 @@ static int gpiochip_alloc_valid_mask(struct gpio_chip *= gc) =20 static int gpiochip_apply_reserved_ranges(struct gpio_chip *gc) { + struct fwnode_handle *fwnode =3D dev_fwnode(&gc->gpiodev->dev); unsigned int size; u32 *ranges; int ret; @@ -483,7 +485,7 @@ static int gpiochip_apply_reserved_ranges(struct gpio_c= hip *gc) if (!ranges) return -ENOMEM; =20 - ret =3D fwnode_property_read_u32_array(gc->fwnode, "gpio-reserved-ranges"= , ranges, size); + ret =3D fwnode_property_read_u32_array(fwnode, "gpio-reserved-ranges", ra= nges, size); if (ret) { kfree(ranges); return ret; --- >8 --- --t/QMyFVa0+ws/Ltf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmN0utoACgkQ3SOs138+ s6HY+w/9FPuWzbA0QDSng/u8HNj0vDTsWe/g5Yf3zW0pdt8x3f9eIL3hivFA7aT8 qEMPLl8JbcoK0VX8Jx6/i6VviJthgKxwjT0ET39uwHMEac7e0P5zNPLoY3T6L6Nq EFYUYoiHecionPiKK5DxG6+W08BIVmSM0XnwDvK2INRUQGemxE5qPq35v9NK62Ep nyFZeL2goKpea3F2wUMqFcUHJqVzCaNc7/bgmnrHaAkJpS0kcupkwM4qjPTp3VHl Ey+M/BsS+NB7Eu45xHSOnwwL0jRhj4LGsmM/q0sYS1tQ9aHiO75x/y0S7pqdIyM6 V0zopPZttwy0OLGfZQcMgiSLVj0rpVXVxH50O+w+GbycibQBKpY3PNt+se9G5foK FxsDZcyQuRJwEHYnrLqO+Nlne2795YAQbO4OFakg1DU+DQ3zsL8byWwMKBVCpqdy R0vfwRcC/Bh8CdCs9n0A6//BZhfnsiyXFqyqHxay9QI83/egha4ek8TPEtA6mgMp vxu4mLJJ+XHCU3HkE6t1/IKsCjXcJgFoWs+HcDoq1N0r0u9cIS0wC+ncti6JyEoN r1HmQ4anutzfYz8jATxAR1feMYhtKd3iFWwpmWFbnpMDuj8q6JbGaQVaqmhvbQoU SFGNbDvpzUCUTfEBUKaHRtoNoox6SBu+gzCwpvpIUa9Ml0/v4aw= =XuqC -----END PGP SIGNATURE----- --t/QMyFVa0+ws/Ltf--