Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp981311pxb; Wed, 3 Mar 2021 23:23:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwubNlOZn2uFnGuC4KZJfYWrWvhl2ZtBeB9le23yYD7/p3qfRxaOnZV8ZrJqYsDGlqd66uw X-Received: by 2002:a17:906:1448:: with SMTP id q8mr2746234ejc.449.1614842609986; Wed, 03 Mar 2021 23:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614842609; cv=none; d=google.com; s=arc-20160816; b=ZNfQDIK8xFuirRlcPLtpcrDaPFWAs/tLyPRGnl6zfn/NqDSvyqeVh6j+XpNxkQ5cf2 gatNwuqYkVNm+WJxPWQjytiD/9Jd6HAozwm0t0jkgGaDQXhSu0FBkyln99uA0zpOvyCl LRNIkw/tMvLJl1W3jOkBOBYHjgAdrvXNYbY5JkVo+fqs2cC8HLhA+mCpw5AVFNoSpEav h6X47XETscj/v2Vixrg/IpTd2myr/MSLtaoNpcwVJwx3ldlJbTvYoRyUECYpckevYkSd /Uy7zYIJFXpJfzNXb5i1ALlHFGSduZYxYZxpE+S0ORabZZJL7kxzOP1635WgHNR5lanN 0rdA== 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=3Nrqj6kb9Z2QHezcr0m3iuedQ5qVAoBvg4Binpr+01U=; b=CNYiInq3QxcqSXHcf4QBFUX2dxPbYUSe/YlWLv5+EG5ZCjJxC+j7tvEz0N/wHDfvVc jOrCoMMrNsLMjXnM82bqLddLRfNv04Wfywmmai5eGA5L/+RRyMf6yVx124RrZproL2Pe tXq/U8d8GrcPQ8eGm1wHYn/9bIaylnfKcYlOR92fmt+UHo7Xb7zejOLpV2ww90oEFF8a In2IH6ymap10ks/Zinwv7EoEzlXsWe1Sw9FWIWz5ntNosVZF5xugnz/PXJK2vH9FFw58 5yabHN9HWAMLUfFQERxbdlRqFpF1tr3/6OpA7h+7W+rVDMe8vptRBd4ONF3EKFR5JX3k 5Q1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lIeUHVCO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd3si8582915edb.360.2021.03.03.23.23.07; Wed, 03 Mar 2021 23:23:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lIeUHVCO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359807AbhCBXIC (ORCPT + 99 others); Tue, 2 Mar 2021 18:08:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379145AbhCBWkC (ORCPT ); Tue, 2 Mar 2021 17:40:02 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DAEC06178B for ; Tue, 2 Mar 2021 14:39:22 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id q25so13659807lfc.8 for ; Tue, 02 Mar 2021 14:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3Nrqj6kb9Z2QHezcr0m3iuedQ5qVAoBvg4Binpr+01U=; b=lIeUHVCOe3jgTgM3KXOxLoR8pvgx/P5vnZQlcH7Az0xthmmx4xUAMEwoxqn5l9jIbm Fy/n07bOcE9TGZVwB87uCc4zW6lufilrfdHYdtsfRjrVsGx7kqhkCZoXLKUqC0flClsa y2P7Kq+x8Z8V01f/Nvd7WqIl/cGyCvOLJoqGdlUqorjngU1GteUOHAw4PgJP7I3QUU59 73KRyMyx/JQI3+RN4dwRF4DBi4AKzlRibvY0af6JNyB/I6IR24Lm8OYLRAxbZj3Z80qG Cxj2frUAbCw9cvhCARCGjnhAoLNoOQWXavR438bafpETmc5atSrPb3Mod4Vc++XkrY86 96Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3Nrqj6kb9Z2QHezcr0m3iuedQ5qVAoBvg4Binpr+01U=; b=Dq8Yr6mafG6mUoEqe9NfnvLcyGJuzj6Tplmt+cRMfdTb+bvSBvZ//aZ7sN26B8XWyY NPmfNZUFHFz9Dux3T14wMb73wXtL2h1afc5aseJpcItd03Jpja45n40ETjrIQO5ej1rm OsdPIq15uCZsrAeouYVSnPZcwuHijKVlGLQyAnhfd4MWdWUqq4+0jahSuR1v4LIslzZx Qsn0wfGcil488MBbo+/M3ExLVDpGIbr+4K9Xkn9boC/H4HPUZYscUofWZwWK3IoaL8v3 A28DJ3Qe9e5PaWf5sQB3Ep35/b8DePyjhjgxV+gEvv3frHs2Jlip9cjfJfMgmNrEBfeY i0TQ== X-Gm-Message-State: AOAM5304Gjw1L8EBgn6YQLHVoHKlkE++tQ1mEcee/B6PaSNVHkwdB8Tj l8IiHs3VQ6suECKtKLrHZxsRYxUKEqmm4T7FV9+3vg== X-Received: by 2002:a05:6512:547:: with SMTP id h7mr13821445lfl.529.1614724760474; Tue, 02 Mar 2021 14:39:20 -0800 (PST) MIME-Version: 1.0 References: <20210302180601.12082-1-noltari@gmail.com> <4af4b519-84eb-3cb4-bb0e-9c5ac6204348@gmail.com> In-Reply-To: <4af4b519-84eb-3cb4-bb0e-9c5ac6204348@gmail.com> From: Linus Walleij Date: Tue, 2 Mar 2021 23:39:09 +0100 Message-ID: Subject: Re: [PATCH] gpio: regmap: move struct gpio_regmap definition To: =?UTF-8?B?w4FsdmFybyBGZXJuw6FuZGV6IFJvamFz?= Cc: Michael Walle , Bartosz Golaszewski , Andy Shevchenko , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 2, 2021 at 7:14 PM =C3=81lvaro Fern=C3=A1ndez Rojas wrote: > I'm trying to add support for bcm63xx pin controllers, and Linus > suggested that I could use gpio regmap instead of adding duplicated code. > However, I need to access gpio_chip inside gpio_regmap to call > pinctrl_add_gpio_range() with gpio_chip.base. Can't you just put the ranges in the device tree using the standard property gpio-ranges? These will be added automatically after the chip is added. It is documented in Documentation/devicetree/bindings/gpio/gpio.txt a bit down the file. The code is in of_gpiochip_add_pin_range() in gpiolib-of.c called from of_gpiochip_add() which is always called when gpiochip_add_data_with_key(), the main gpiochip registering function is called. This would just do the work for you with no effort in the driver. It is a bit counterintuitive that this can be done in the device tree but the hierarchical IRQs cannot do the same clever manouver to map IRQs, sorry. Yours, Linus Walleij