Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1031935rdb; Sat, 7 Oct 2023 08:53:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEs3zeKRahDlJqYOSwrX0tU7/Sivug4Wx8+bOZunHBOg3OaSozWDwChawwFu2UN0m1Am9+J X-Received: by 2002:a17:902:efc4:b0:1c5:ad14:9095 with SMTP id ja4-20020a170902efc400b001c5ad149095mr8465429plb.64.1696694033723; Sat, 07 Oct 2023 08:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696694033; cv=none; d=google.com; s=arc-20160816; b=Q62C2fcVnSQsPvte44YRfdatyOn15XbnJLaqZz7CbpJoj7miGrh8Eoh9rLgFTdTwJK 59UqJ/zL4hJ2U+fujVRmqINWj/VztSUZjSRMUD57ecDHjtP+i354ljEx9YTxJDBuP+Ng 8DqAoPilNo/XDSw/qkzcua8NsJvkIMuIqqORuXpEXrCMZMVbGvJEOfPibURrgfGfR8Dd PiAmfSzxnQJAoFL6FjT2gvjus4Yd6jyB/yow1EGYxKM5IeyvpOMspDy4jbCJH+qTV147 tJ+R3YR2l1eI6hVkfwcM4sXAir4OfJEtmriECO2vAidV2Og6gwU2D0FBpikmelH+9kaO +fsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XIoRUVFu2cJ5wWu6WRbqqm267XrfNYzNwi2GVhtMIn4=; fh=VU1XH+SQV+3yKCwC/rpCYKGWpNN8h/RxVDyigRHwnGU=; b=FdZuqzuAJ/KoSGKhxhVvRWjCwbIup5d5qMT19bGyw0DHbN/q+2Cf/gTGUT5+1+LRu3 9J0kTk/cJjuqF/cyhObO9nwu9UbKnVu1GWtsByEZmoCjR9yN+WoJiQpiwVtNjaq1kuPe oRvTIbWSTndCaHd+59Ff4P41LouozMUyVv57XM7vZXrAkK21ywc/19ls2/nWRcMZkznF 3s8NkYYz8q2b0AdIiB7MZUmCvVyM3P5cfJJYcpbggXz/5vx5eCgdKrjRRPfbRWibVbbV 7BwxmyCCIxx0Fe8S4HYtcHEYIsNXFHyn01oX7Rg19wTENQuH34yCGuhNi++kcKqX/41H LmZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gRY+TGVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id m17-20020a170902c45100b001c3f6dbe2bdsi2455607plm.105.2023.10.07.08.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 08:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gRY+TGVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 284ED80398FB; Sat, 7 Oct 2023 08:53:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343997AbjJGPxk (ORCPT + 99 others); Sat, 7 Oct 2023 11:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343934AbjJGPxj (ORCPT ); Sat, 7 Oct 2023 11:53:39 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F97BA for ; Sat, 7 Oct 2023 08:53:38 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-5a21ea6baccso38594507b3.1 for ; Sat, 07 Oct 2023 08:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696694017; x=1697298817; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XIoRUVFu2cJ5wWu6WRbqqm267XrfNYzNwi2GVhtMIn4=; b=gRY+TGVpeTqIgehqGyZ6MvdoSL1RVeVwdLFJEN3d466nT4IS7HHMLFDRnktLaZfI4P 289DWXG8/9WqzHKCM/EaERR/PZVz6IDZdQNj0Z6p/j4KqotchYQLouD5egv/b3YJWUMN jPOKM/k1CE7/aNHnFOcO3z/cb2OS+/X7zudMY9yHnClCIi03j3l+e7DPXjVfZ+29JrIp Bj1KGCDwFmv0ZYSpKiI/7uDa6i+LflQBnJD9g79tgiMXhcnOsHmnz7efhDYyLyBxoYZg Vpm8YMaJHRJkeJ6mpnTb2JF2YdCtq5zisSV0BuOyvQujQRX7Lr2LPVnRZajLZozm+bOf qkcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696694017; x=1697298817; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XIoRUVFu2cJ5wWu6WRbqqm267XrfNYzNwi2GVhtMIn4=; b=m32bdLj7e7W6JxvQVQrqhxnMY2oW6M5wzlF0t3uwsH3zonqz/qRiPEN5mXtQtM9Lm1 oz7UC/tlF58Ubh2H+ZSzIkDfBKzWqfXS4PWPX3hE+MtwT/sH5UDNcVdWWY+1v8Ek+/Ic ZxodYTv0ixoz9yFp00UhVgMUxq8enkYV5gWJMyHlZHQbz4ZMcsc3TNu09aFEhb1oEL02 HXXa6H1TX2BQ483F74AlzFVrPbEXHT2XdWNkIYs8BdGw/dP4DTecE3D+Lre4vW5lg/p4 nLVNm8z8P+FF+kdoizTq7shIblnxoEaJjEKlrdJ67tzA0Z1L2K2T9buJ3CfmH3+cBuXE /lBw== X-Gm-Message-State: AOJu0YxWTZ8+k619yuETmjTRQV4XDOPIixA4DsHTAiEKGdxUk6mCf7ye SmmVX8Pxt+I2uuUaRx6u4aUQG+u8ZiTziQMoXWfbwg== X-Received: by 2002:a05:690c:2c8a:b0:5a5:756:44f4 with SMTP id ep10-20020a05690c2c8a00b005a5075644f4mr7775198ywb.22.1696694017572; Sat, 07 Oct 2023 08:53:37 -0700 (PDT) MIME-Version: 1.0 References: <20231006115147.18559-1-brgl@bgdev.pl> In-Reply-To: From: Linus Walleij Date: Sat, 7 Oct 2023 17:53:26 +0200 Message-ID: Subject: Re: [RFC/RFT PATCH] gpiolib: reverse-assign the fwnode to struct gpio_chip To: Andy Shevchenko Cc: Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Dipen Patel , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 07 Oct 2023 08:53:51 -0700 (PDT) X-Spam-Level: ** On Sat, Oct 7, 2023 at 9:45=E2=80=AFAM Andy Shevchenko wr= ote: > The providers decide themselves > if they want to have any specific device node for the chip or inherit > it from the physical hardware. Note, there are two types of the FW descri= ptions > of the GPIO controller, when it's 1:1 to the banks and when it's one devi= ce > with list of children, one per bank. Due to this differences we have > this field in the GPIO chip to begin with. So this is the real problem right, for example a pin controller with six sub-nodes that are GPIO chips but not necessarily devices. In DT terms: pinctrl@0 { compatible =3D "..."; (...) gpio@0 { (...) }; gpio@1 { (....) }; (...) gpio@5 { (....) }; }; And now each of these subnodes spawn a gpio_chip and a gpio_device and now the big question is what fwnode (in this example of node) to use fo= r each. I was under the impression that despite the main device does not spawn subdevices in the Linux device model, the subdevices always have their individual fwnode, and when we create the gpio_chip for it, that creates a gpio_device and that *is* the device for that fwnode, if there is no corresponding say platform_device or similar. So e.g. assigning the fwnode of the parent (the pin controller in this example) to these gpio_chips flattens the hierarchy and that would be a *bug* in my mind (but maybe not in everyone else's mind). But IIUC what you are saying is that sometimes there are drivers that do this? Yours, Linus Walleij