Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp467972rwb; Sat, 14 Jan 2023 03:30:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXvLfzFnPAWtw/H/kfAP9tLiVu0gyH7e6h4p24dCppjgPDfMBf+fVsnqWoyauE9wsMepvqBk X-Received: by 2002:a17:906:3b53:b0:863:3a9b:6a79 with SMTP id h19-20020a1709063b5300b008633a9b6a79mr9885131ejf.63.1673695808953; Sat, 14 Jan 2023 03:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673695808; cv=none; d=google.com; s=arc-20160816; b=Ni/z4AK/JOx3aIcbEo8wLILmKjDKka/w+1oyoL2OwvWDO7HOkWg9FuamLCqdARWPBX IMusM/kRXwfLddjTms8hQq4qPlRdTjzZTnfaUjCu9jsMtIX8Ena/yfwnbDV4wjYQo3fb sMagFHphRpBk2MM5KgZhf5MkJqA9nElwzl9cVXOdPbuu3O3yHRs7gYog3jybmLvH+zcq gl3tUW4fi07/zg5emzipcqoLejrhza7TbCVPCSyA/6vuaS+StmpRfkkctoJMBFfpMQOu rZ6vr+COOM97VgCMxDI2ZmSAcyDXprK67x0+NHC/FOnWubPp9j2gmx4WSj2HygbLMqNe VE8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=Mhd1iECXILWrGo+KWMVPG1hZWBuC83Lw0Y8ZeYHwKOs=; b=qxhi6N4Jtf//bRdXQIo55HafA49KEK+zT1tEId6TJySVNWVxqg1UyIKVgoTaK7JzV0 ju2ICelh0zI0jr6THA+v/ccLniHtkJM2ZdhR8dixJk0G8L45SCSj8EAr6gaIEo48YAzQ Uc0uWf6z3bY/IZMeNgKC64Rwglv6JFP48QA+TYdA/4TsWI+txA1K8oJQ/lxxrzg3bh2b d8MJ/VlZy1CutQirimS7F/qhX7rB0B0CrpyBADDqHNfi90S/WqbKXziRQkQ1cK2jBgls XL9rDZ2nO8OwWCcseIu3aifZeihRMKAgnTleZpMnjWomjuuT32sK6fMcq+nFHSeoe2R+ Xlww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh18-20020a1709076e9200b0086e6f381e44si143987ejc.73.2023.01.14.03.29.54; Sat, 14 Jan 2023 03:30:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbjANLYK (ORCPT + 53 others); Sat, 14 Jan 2023 06:24:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjANLYI (ORCPT ); Sat, 14 Jan 2023 06:24:08 -0500 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F174769F; Sat, 14 Jan 2023 03:24:07 -0800 (PST) Received: from [192.168.1.139] ([37.4.248.41]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MA844-1pR9Ir05Ck-00Bcor; Sat, 14 Jan 2023 12:23:51 +0100 Message-ID: <4b01c9ae-1603-6f42-431d-1158286557b5@i2se.com> Date: Sat, 14 Jan 2023 12:23:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 1/2] pinctrl: bcm: bcm2835: Switch to use ->add_pin_ranges() Content-Language: en-US To: Andy Shevchenko Cc: Bartosz Golaszewski , Dmitry Torokhov , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden References: <20230113171051.19309-1-andriy.shevchenko@linux.intel.com> <916654ca-e70f-5663-f3a3-9b370c24aea9@i2se.com> From: Stefan Wahren In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:6HKAfuNQkaBL9orJNFnJWW+PACCYyx98Cn1d4oFQCAd5tGj93Fk xcWGVZ/wlrd8FN1VmUHvj9pmlUGqcyQKJydlPJuJ0O4w7Lp32lkkue5Hzt6YmL3ah2aYJ4T 0P5yHBUcOxc32dXI3v0Q9iKkQM1+HXS2ooySbtPOtyaqJHart2SEPK05IhvU/+kvWRu2Rb8 ke+diAtd9wU+WJxOCWoDQ== UI-OutboundReport: notjunk:1;M01:P0:ZW4NK6Ra+8Q=;9XIQMnrNtwC35e4tgE10nkovu6+ O+vVi7ZEAxButdOpskyzbMGwVxGX4hop43zoLCB4j3dx2r07XKp0dTefmr+Rw6SWBbAaF57hz JnXw5I5XFCAjNrW5n2ixsCaYjoxvf42LQOisz7KiY3p60mjRX4MZIInL9Sya5dXJNXN/Nemvv vg5ODh6VrQGTZ96FWjBYFKidYuyWZJorHAE1MvsK60nvwBGFrgOyga0ErgKve8EWxcSZczuDs KdvgdFIn0y4gzEx/WH5Il2qMcsOsSUI4TUEIMFRdg/5/wZNA50sIqt2cH72Mk678sKjKc9qVQ WIubwXDfcvv9Kd9kjjUR/oibgFQhIBA5cM96tLGI7XJXfH7/zYu/GDOUqI63oL7wAiXnfsjiO dfDHFGTRIfKZjm/Xe0Sq3hEAhUZUDnIeyptUCWyV1TWwZ2K2sFQsy+3nb4g7hitTcbX7MYZt2 GjvhUg8ClI1+qq2+1Iyl9UUoeEpzJoaXV27ddfvGrqPHZwa6Wtp12psJcuYSFC0TIsPMt+Z2H 6D9raVBv4DXqdGNNRazAKkIq+H+wTuhxWoR2UcqR6II/uy4w2NmqpwEWg234kFlW2/gvZXEov HPbSCSjmP3L5J3Nded7jahulbAg2mZ1nPjkzP4e+8lZcN0fgPwZbTLdBwxWG/OspNxFCI1bwp GW88xHhyGCbSRFhXCpxX8k6aALg2ig9gT2dD/qvaUg== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 Hi Andy, Am 13.01.23 um 22:31 schrieb Andy Shevchenko: > On Fri, Jan 13, 2023 at 09:13:23PM +0100, Stefan Wahren wrote: >> Am 13.01.23 um 18:10 schrieb Andy Shevchenko: > ... > >>> v2: fixed compilation issues (LKP), Cc'ed to the author of original code >>> >>> Btw, the commit d2b67744fd99 ("pinctrl: bcm2835: implement hook for >>> missing gpio-ranges") seems problematic in the fist place due to >>> odd of_node_put() call. I dunno how that part had been tested, or >>> how it's supposed to work, i.e. where is the counterpart of_node_get(). >>> Anyway this change drops it for good. >> The countpart is in of_pinctrl_get(). I was just following the pattern like >> in other drivers like gpio-rockchip. The original commit has been tested by >> Florian Fainelli and me. I'm not sure if it's safe to drop it completely. > Please, elaborate how of_pinctrl_get() increases refcount of the parameter. > Maybe I'm looking into a wrong place? > >> Btw this is not the only platform affected by the gpio-ranges compatibility >> issue [1]. > This is the only one that uses unnecessary added callback. i didn't have access to any of the other platforms which were also affected. So i thought providing a general solution would be good idea. I wasn't aware of add_pin_ranges(). Since i was annoyed that nobody cared about DTB backward compatibility, i send out a RFC series to fix the GPIO hog regression which breaks the LEDs on the Raspberry Pi. Nobody complained about it. > >>> Perhaps we can check gpio-ranges property presence inside the GPIO >>> library, so this ->add_pin_ranges() won't be called at all. >> I thought this could be very platform specific, so i implemented a hook. But >> yes my initial hack modified gpiolib-of [2]. > The point is that possibly documentation of ->add_pin_ranges() should be > amended to take care of the cases like this. We don't need two or more > hooks to do the same, esp. taking into account that OF specific doesn't > cover other cases. > >> [1] - https://patchwork.kernel.org/project/linux-arm-msm/patch/20180412190138.12372-1-chunkeey@gmail.com/ >> >> [2] - https://lore.kernel.org/linux-arm-kernel/75266ed1-666a-138b-80f1-ae9a06b7bdf3@i2se.com/ >> >>> Also I would like to understand the dance around checking for pin >>> control device. The original commit lacks of comments in the non-trivial >>> code. > Any comment on this? Do you mean the NULL check? of_pinctrl_get() could return NULL, but pinctrl_dev_get_devname() directly access the dev member.