From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CDB6C433FE for ; Tue, 30 Nov 2021 20:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343680AbhK3U3I (ORCPT ); Tue, 30 Nov 2021 15:29:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343649AbhK3U3H (ORCPT ); Tue, 30 Nov 2021 15:29:07 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F802C061748 for ; Tue, 30 Nov 2021 12:25:47 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id o20so91321797eds.10 for ; Tue, 30 Nov 2021 12:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xpYmBvvU2DPI7NcOwAcZSrIaZbaadaJOsW8BtQ8JfsY=; b=QOBsF9hzrVRWPXdCFhpZuR4jsOgv/PbGcdPPNYZUt5DG4/iBezYWX1WZDgA0tgfEA6 OJIt8S7xtfNk+N/5dUYLKcc+MPrpL4mbHNtrWzrYpoSX6/2sSaTo4TzRwoWopP/XEX5Y sYJaXyyAkU5FYlgR8ZFpsDSNPBLvzws/JfxDL9pxUKWpiAEk47HJv8aujeGTvQIwd88j KDjgQvpFeLu4jcjvLZVPg7UrlqB+0bKiX6IsFny5BNdfMP6Hgy8feP3IspXF53NG4CYE AQYb1Wm10vNq40KNQdLZCU5P05vBv003hxJr5usGB/BdtBz1ZhFHO3pZ9xSUw3SufWRN 7CFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xpYmBvvU2DPI7NcOwAcZSrIaZbaadaJOsW8BtQ8JfsY=; b=MFTv6OsrXMx5by5ABQ0Ym672kmr0PG2UkpAdNEHjtn828jb3WSJwqQ+UVpz/YnMFnT kzqcLGd7Tlmwen5hWXVkWdmuqFFbjjhvvEkiYPw0vkyak6SM50hY57TWbQuLjJRLCdBR ZoIT4vgw3Ug1OzndrR2g9wDKC8JM37qttQkHXW2bh0616T6mjRebqMVxEigNJnWEAoQy /6wzRNolaUKCPMsjWNau8WxKiAajH1O+7hnyT7VbLVYzZNTmd0MoyfZ6zga8/ckfY+yJ w9ZhJIr47Hkwu7Yec9aTnfo4YPKXpyA3jSZKRUIOcbUt5aOvnk4BQxLvXZqtPHMtmCkz NqrA== X-Gm-Message-State: AOAM532AyMf/imvPqgf1VQU/PMaik02Yr/X4V348FKDIqMidvID3YpUz joyABuRbBm+I3YuyyMikmiqUq4aUafT3nVPZEdb4QqpkAPAgMA== X-Google-Smtp-Source: ABdhPJwpOHyPwU//D02mvaCTvO/t1OLrgHo0CeWbUJpEeGnRI0W9ae13A12b4shvOogyxUNSpXpEEiT0kISG5r5dZdU= X-Received: by 2002:a17:907:75f0:: with SMTP id jz16mr1567072ejc.77.1638303945785; Tue, 30 Nov 2021 12:25:45 -0800 (PST) MIME-Version: 1.0 References: <20211130154127.12272-1-brgl@bgdev.pl> <20211130154127.12272-3-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 30 Nov 2021 21:25:35 +0100 Message-ID: Subject: Re: [PATCH v11 2/6] gpiolib: allow to specify the firmware node in struct gpio_chip To: Andy Shevchenko Cc: Kent Gibson , Linus Walleij , Shuah Khan , Geert Uytterhoeven , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 30, 2021 at 5:15 PM Andy Shevchenko wrote: > > On Tue, Nov 30, 2021 at 04:41:23PM +0100, Bartosz Golaszewski wrote: > > Software nodes allow us to represent hierarchies for device components > > that don't have their struct device representation yet - for instance: > > banks of GPIOs under a common GPIO expander. The core gpiolib core > > core .. core ?! > > > however doesn't offer any way of passing this information from the > > drivers. > > > > This extends struct gpio_chip with a pointer to fwnode that can be set > > by the driver and used to pass device properties for child nodes. > > > > This is similar to how we handle device-tree sub-nodes with > > CONFIG_OF_GPIO enabled. > > Not sure I understand the proposal. Can you provide couple of (simplest) > examples? > > And also it sounds like reinventing a wheel. What problem do you have that you > need to solve this way? > > ... > > > +#if IS_ENABLED(CONFIG_OF_GPIO) > > + if (gc->of_node && gc->fwnode) { > > + pr_err("%s: tried to set both the of_node and fwnode in gpio_chip\n", > > + __func__); > > + return -EINVAL; > > + } > > +#endif /* CONFIG_OF_GPIO */ > > I don't like this. It seems like a hack right now. > > Is it possible to convert all GPIO controller drivers to provide an fwnode > rather than doing this? (I believe in most of the drivers we can drop > completely the of_node assignment). > Yes, it's definitely a good idea but I would be careful with just dropping the of_node assignments as callbacks may depend on them later. Also it's not just about the gpio_chip of_node assignment - drivers also use a bunch of OF APIs all around the place. I would prefer that it be done one by one and every modified driver be tested. Bart