Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1077729ybz; Thu, 16 Apr 2020 02:22:28 -0700 (PDT) X-Google-Smtp-Source: APiQypLcIDL5LnrptZV94K0VYrMQIpPtRqO7ylh+edZycKBc2ZOagHUTEw8+tgfacmtgRgLTmYb0 X-Received: by 2002:a50:ff07:: with SMTP id a7mr3545710edu.210.1587028948364; Thu, 16 Apr 2020 02:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587028948; cv=none; d=google.com; s=arc-20160816; b=v45rvdiabjADvb+/Tn0grfeet/ysW0IdCm05GQHaEa5o2Er0zWkSt6kJUjv7EJX6Ei efOcxIK+OHpQYIBfNnIB836Sbbepdv3dA/xgiTuPXPsHyiJxFht3XIwCBwRu9F6e49+v 4wMmU0Q+oGwMNXk7ajL1/kkehEbDv4N563t8gmJc5GaGXCATvziiN42l3KWe/08ikTWK Gw0Xf+/cumJXaIm68DZdIuboi5KR4X2gqFtjZ+zKP5Lt3/+v16ukNm8PKmqYdINDBUd8 PnnldpS58T7WnrB+MUkSJlEyMvMPvno8G3PXdMkGnpu+os39mFTG4+waXIO9j9qcEw/9 EB8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iuZQPq25LlhzAjymFw6DX/CB5GWOdpk6lIwmaoZu2BE=; b=y0FDbgldlBJUnxkfW2O7EJ7tWtiLzgTR/wWTba9PVR6kkGed/WdvQ94cDIJYOaHaau FkQYs3NmxXK2fBRq3+6OrG3HK4vKLoVTQ4MLaRXcuSOpFXrStTXAT7apC0KosI+pfkbf ZCHzctsrI5iXorp3YTiBPnYvz6GEbwtFtxmj47axjFKQwPtO8Eht3Jjj8AQsIU12uMfk UqooSKfYi/f4Tb4XQ6HnQcWLX0x2mh9qZPs0NWzKrMH6uULt6yrc7BHcjpTfjscsYJIA bwMrPW996/ZlJ0oDGswo1xqwSdS+mEB6knTd203y7AaG9t+wXq9t/TOIHN5kCNvvAdrl 242Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hkTtnz2D; 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 g9si3891394edu.268.2020.04.16.02.22.05; Thu, 16 Apr 2020 02:22:28 -0700 (PDT) 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=hkTtnz2D; 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 S2502571AbgDPJVD (ORCPT + 99 others); Thu, 16 Apr 2020 05:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2392093AbgDPJUx (ORCPT ); Thu, 16 Apr 2020 05:20:53 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78EBC061A41 for ; Thu, 16 Apr 2020 02:20:51 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id x23so5054232lfq.1 for ; Thu, 16 Apr 2020 02:20:51 -0700 (PDT) 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; bh=iuZQPq25LlhzAjymFw6DX/CB5GWOdpk6lIwmaoZu2BE=; b=hkTtnz2DkVpj5FadPidho1Yi0E3E7wBAIYmB61/Kj4lK/X8UrCLL81x5xmrcWGWc+H azS6fkmcowWvwOnDXcI9l4y6Ucno0mzyziNpLxV9Mthz8Y0YUdXq82D8FzhAITXPdDF8 3tFd/DXFS5Ty+STvGvcwXllNt8lFNMCiTuvCiXYSz2PukY3ig/gTtCqCjuJHHyXpd1A3 QDfx/KUMUCLzLxrTqLoSlNd+gU4YBuAYH/DvcY6yoeUzHZc1o3NaKorVY+VcrIzkfObd u7uovSiNsexRzNZk8c0flO0ZydCK1WaSDd1IcMQT71DefMnE/zm8iho+FD/0QJcA2MJG wMcA== 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; bh=iuZQPq25LlhzAjymFw6DX/CB5GWOdpk6lIwmaoZu2BE=; b=HEM2sToZaoGocszHGAy62a7nYaLmLMQlENaxH/2QxV9DBieN9mOviaZw3U53wTcycK 36shLT205rO5o8yWL8G48UmSuYDfpw4RnqVvNGmKwjau4xNKHpUxqyiE0ZOAfQqJ46hS JccBHhJweQJCRMB132kHToJWWIBsSIXcvyMTFTP65jxVtyUckYlcJvJY/JKUtJxsn8LL d2zjyDFW3AV/HC0AwMtgWJJIenwBVx5WoDUwblz0IacBEEWPj44OAfVARa64uOTorsxH TTP4wFcewcvgOWQxo5FTe2dfZTOhc8tzrk3i/r8lj69Whgj/cPbj2OEMOwXnHjNEvL4s intw== X-Gm-Message-State: AGi0Pubb/BGoSsWjyKoUEtTaVRXmJS7Pu4OqnMVlSH4KNM7Z2pOnpriX AnSoBm3O4hRbpD8th51woCIQ6KlV2QC8L47Ejbxqbg== X-Received: by 2002:a05:6512:52c:: with SMTP id o12mr5352302lfc.217.1587028850060; Thu, 16 Apr 2020 02:20:50 -0700 (PDT) MIME-Version: 1.0 References: <20200402203656.27047-1-michael@walle.cc> <20200402203656.27047-11-michael@walle.cc> <80bd8661ec8a1f5eda3f09a267846eaa@walle.cc> <62d157198a75a59ada15c496deeab49b@walle.cc> In-Reply-To: From: Linus Walleij Date: Thu, 16 Apr 2020 11:20:38 +0200 Message-ID: Subject: Re: [PATCH v2 10/16] gpio: add a reusable generic gpio_chip using regmap To: Michael Walle Cc: Bartosz Golaszewski , linux-gpio , linux-devicetree , LKML , linux-hwmon@vger.kernel.org, linux-pwm@vger.kernel.org, LINUXWATCHDOG , arm-soc , 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 14, 2020 at 9:57 PM Michael Walle wrote: > So what about the following: > > #define GPIO_REGMAP_ADDR_ZERO (unsigned int)(-1) Yeah with regmap explicitly using int I guess we can't use S32_MAX, so that is fair. > So this way the user might assign the base addresses the normal way > except when he wants to use zero, in that case he has to use > > ->base_adr = GPIO_REGMAP_ADDR_ZERO; > > gpio-regmap.c could use then: > > if (base_addr) > something_useful(gpio_regmap_addr(base_addr)); > > unsigned int gpio_regmap_addr(unsigned int addr) > { > return (addr == GPIO_REGMAP_ADDR_ZERO) ? 0 : addr; > } That's reasonably clean. Yours, Linus Walleij