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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12652C3815B for ; Tue, 14 Apr 2020 17:01:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E37512074D for ; Tue, 14 Apr 2020 17:00:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="WJK29o3K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732423AbgDNRAw (ORCPT ); Tue, 14 Apr 2020 13:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729895AbgDNRAn (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 E6398C061A0E for ; Tue, 14 Apr 2020 10:00:42 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id v7so14088633qkc.0 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=ngujypy4T89HgSzv2yk91vzxPo0L/WQsPZx/rj+DeWuRRdGUdongpf1lTyP5iWL2Hc fn/0t7bJOHKEMqaBlIhgHxpJKSh8TH/kg+QlFBHDXuCT1cmCElToIkYZ6qiBv4WqF2dn 6p1fgKTmIFxpqCIFftwH3poH8kChh1wizqSfAj7NbUI871CGtzCaagK9etjvcgKCG+q8 5usoMwsKpw+UR8SkR/CC3COdslI3EBeAwOr27h2mgQAnZfongkO3PtVZVpBloSVxSdAZ Dk24hOjP3SGNsWC+MmgpS3Pfr0HnHnlJbwWynrZiVOaqOWcTo7zUs7mLzLmAHiGHIePM 3p9g== X-Gm-Message-State: AGi0Pub6W2O+UGI1CxkmM1iqNyY6nWl0e2v8Xonjh9sc1pIaBJnlPuLR y7Mt6XK5GtXrX9ZLb7p+q67poyB9D3L7EVj80mS9pQ== X-Google-Smtp-Source: APiQypJAVUbx87PMTgMxPYPAUoh9xIaPNebw3vKNOCwEq+Xku6Borru68lB1wY/XGBsCVLhWsPFHE8/a8s5sITgt6DA= 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-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@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