Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4581293ybb; Tue, 14 Apr 2020 10:02:16 -0700 (PDT) X-Google-Smtp-Source: APiQypIK33jm7bnLbSKWJIop17/lGYotW2T8LnhlDcv7IoKW9puuxNbCOnuRKt39DnUeP4W/JBBY X-Received: by 2002:a17:906:5601:: with SMTP id f1mr1101115ejq.152.1586883736564; Tue, 14 Apr 2020 10:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586883736; cv=none; d=google.com; s=arc-20160816; b=UCw8xoVJbHykoeP0gJvfr4QolIOAgdlsuxgoIsLDhBiLKXU9DcWzlN/kZ9nwxa7Me6 etQDg00lbXp/dWIAnSwKjsaTcewNZtLdBQOgkKhoM8YWX0ZO9k4bUCkLEZ2lq0uWrYmK 33NPXqZVB31lZP0VSWLYOxe8Kr8m3TOUDcl8ZG/yd1PzehnOvrH7kG3g6U15ieY7wHpp wOvSGcRCqGkKB5l3Kg/wQXjMvH/22ZTmkkjHKkdCqxD/LdW37Qep7Yt+ITuxK2quP0TA CniQZk7Lotp3kwvgtBceF9gTnMG9dE8CEexANq3ddmonuXMRARHhKbD7eSAduvcDvITz WdBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GIN7IF6qYtKF4gSfr/AeRIvPX7/eCFsh4TApVUETWoE=; b=KV+vKb1xQ35TjSCo2iXNxGJbCTPqDekE5MQ7N1p9M3nmcYwL+7GuQH3Jyw9dQ927Wb 3XSyK4exK4mg4itN9ez2sdMTZBTuVhZ1Zd07FtN1jHgJxbI6eHLqV4m5WEZn93pNpENZ GhQ2OKEg1ePg598vtlGI05UySp/9l+3t8d+3YFCFXmvtmrlp8vywN8kCfla9ScmeaFvy K6/e/sTI2g04A28rjRey7DbcLs2aUHCgp7/RqyHEl4AV8RE/FvSRUf1GeY02OF5yvPgk wZfjb1Hb1oINcmxg1tfqXTeoQ53CxFJqMWwtXvgJ/cMan56nMdlaw926pI6QnzXHOVav AEXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WJK29o3K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q24si7458237eju.147.2020.04.14.10.01.50; Tue, 14 Apr 2020 10:02:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WJK29o3K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729895AbgDNRAx (ORCPT + 99 others); Tue, 14 Apr 2020 13:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729758AbgDNRAn (ORCPT ); Tue, 14 Apr 2020 13:00:43 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF2F6C061A0C for ; Tue, 14 Apr 2020 10:00:42 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id j4so13973785qkc.11 for ; Tue, 14 Apr 2020 10:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GIN7IF6qYtKF4gSfr/AeRIvPX7/eCFsh4TApVUETWoE=; b=WJK29o3K5MXm6p3VWzbGrHsk0KBRUyWWpDHcGXG/HUX36uIXx5JyvHKhiu1s3JtLtU V7gkFI/q1KmdLMhMMUxBqFlgpBaa0ZkNYnWmTKON4gWBw5jxIE0XBUAq91eeIGYap3zZ OYhvWUkFkEL5+ErE8/pYC7Unq7WRkY9b6ox3OTtr13DORJy7fe4UWueM3dLYCpcH+haM 7s83titQwzbdrha9nbAnzXASShQuNXplRRlunOROJBdfg3Qf8CHG61pH9bI8Yw4wFfA2 c4dSOcHuk/T/b5dEH1oSwrARzE52d5vcmU9CxIdgyuhRNmOaqHvCyIjmpsCkx6zA/Qs+ xdOw== 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=GIN7IF6qYtKF4gSfr/AeRIvPX7/eCFsh4TApVUETWoE=; b=YNWOBgYD2+ibpJB/L8zCyOdz/KHVwjbETT3ITfw0Z6Aa1E8UzI51jzD1aFcbcsTBZz s9DHGi+rBtk4HkGcH7lPFDWFi/f3DfukV83Wb9nz0G6ZpW9yKfQbSwNFZPbo8KP23hu3 ZSFRryrXsNVc1GjuYpxjoiON4rEdiQc+l80OUSd3zyw06KCOIUL2Nl3oCTQ7yzGrTNE7 911p8WogdEMaBF0H90xYR4eVrvFYniDB74eXgrBP/uupi66QTUOdnG3kKd2KE+8zZHhs YItLXnfT63hj4as+bGl0PbkLACr0afSZjdDKGa+ig+UuT3GAYv+mOiP3SGbbSqVdMv7E oqcQ== X-Gm-Message-State: AGi0PuZ2HAzz41LqWtK0bxP7C2d7rYwWytyGFnip+HFmB/ms/APqxzWn GnOQYlqwjYiW5jXVSKihQnSSkxjdLsh9yOSU9efHu5gZ X-Received: by 2002:a05:620a:5f1:: with SMTP id z17mr18160792qkg.21.1586883642039; Tue, 14 Apr 2020 10:00:42 -0700 (PDT) MIME-Version: 1.0 References: <20200402203656.27047-1-michael@walle.cc> <20200402203656.27047-11-michael@walle.cc> <80bd8661ec8a1f5eda3f09a267846eaa@walle.cc> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 14 Apr 2020 19:00:30 +0200 Message-ID: Subject: Re: [PATCH v2 10/16] gpio: add a reusable generic gpio_chip using regmap To: Michael Walle Cc: linux-gpio , linux-devicetree , LKML , linux-hwmon@vger.kernel.org, linux-pwm@vger.kernel.org, LINUXWATCHDOG , arm-soc , Linus Walleij , Rob Herring , Jean Delvare , Guenter Roeck , Lee Jones , Thierry Reding , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Wim Van Sebroeck , Shawn Guo , Li Yang , Thomas Gleixner , Jason Cooper , Marc Zyngier , Mark Brown , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wt., 14 kwi 2020 o 12:07 Michael Walle napisa=C5=82(a): > >> > >> So the best from a user perspective I've could come up with was: > >> > >> ->base_reg =3D GPIO_REGMAP_ADDR(addr); > >> > >> I'm open for suggestions. > >> > > > > Maybe setting the pointer to ERR_PTR(-ENOENT) which will result in > > IS_ERR() returning true? > > Unfortunatly, its not a pointer, but only a regular unsigned int (ie > the type the regmap API has for its "reg" property). It could be a > pointer of course but then the user would have to allocate additional > memory. > > -michael > Eek, of course it's not a pointer. If possible I'd like to avoid this GPIO_REGMAP_ADDR() macro, so how about having some separate field for invalid offsets making every offset 'valid' by default? Linus: do you have a better idea? Bart