Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4602127ybb; Tue, 14 Apr 2020 10:26:03 -0700 (PDT) X-Google-Smtp-Source: APiQypIb6/b3BxP0MqrTDpIqX3Bc/Tz0iBN1Bqx4oEfb8bgY4jDVvh5i3og5mZ1jxB9DXzLhcm3v X-Received: by 2002:a05:6402:1852:: with SMTP id v18mr22230622edy.39.1586885163203; Tue, 14 Apr 2020 10:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586885163; cv=none; d=google.com; s=arc-20160816; b=rCKPaXXdW/jS1/BlsoTZtQikrdcckwG/yVBQGZN7UbYLGRb2GjZ5ICcfU9kgSAgzkw F9AVX6jDENbm9MNPz3ju25TEl+1c8YBjRNK/ZSV9QGiEkY+z70RlANuYlvYEYfqe9gCO xc0AxBv1NzDmUwgY3WJPNUTaZKQM3Ha7qTkXdJ7uhvZKgCwmIAxYUSNn8o83Tr+JjdBm osYpAEM1LFYWvl7eoxVMHdhNs4CZmwAaifTAzzpiL/wbymb5JydXKzlafNovg3fsMcUr wefCelvu6/xQ4X49CpZuAbsf47a/vyu8vkJswmEfJQWSBY5t2h7nmoYdW5CoUHfAvMq5 Hs4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/3gpY0T6lpSOPO2+GjTmqTsZ+xZE38Q838/1g/3N4FM=; b=GedQceZcla9ophqKW+NfVrxtcvN1QFkRm8rg514JX+Bee3BzxUOaX2DZshhT2ofYH5 i4efua2A7JRpRcolGmfrp78ELW2lBO+r47TdidRc6idEn0bALyyyA6JOPxdmWxDvwRYA yKqPFkfwh+vxi+UOY88WR/bLqS5h/C4HptsxFXrioJ105tSAb8YOi2TAHQGHdh4Cdod+ L74j0mE+CFVMy43mgIMiTBIg9TSInreFoulVI/0aGzsnWINniGiENUr/oueHPp26M3qO 5fhMcSAjXVCxe7i9J8TQvsevtqMcxyd/Xx0B9YOKxrWsFnZ0DfvITx2njVUNUqbjntFJ ieqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h+nY5DfV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di18si814977edb.471.2020.04.14.10.25.39; Tue, 14 Apr 2020 10:26:03 -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=@kernel.org header.s=default header.b=h+nY5DfV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407634AbgDNRVg (ORCPT + 99 others); Tue, 14 Apr 2020 13:21:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407622AbgDNRVd (ORCPT ); Tue, 14 Apr 2020 13:21:33 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE77120678; Tue, 14 Apr 2020 17:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586884892; bh=hqDprYjabFxBscfVEG0+5dvJzqZCcHd1opdmPnhd2Ak=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h+nY5DfVYhJx8o/ujjNNyx0kjonVY+DPsN2UhfHMYXXuk8Og3wt4jhCpynBMBQsd2 p21D/wQE6MCWwIlH0ZmgjFqR0D+M4Je8cOa8cweBdHkm6ikP4EFafxr6YWy1ePAAbi 0NzuUD49CAh9h2IhLW6bGuhkMptucBaXFvPmYvhk= Date: Tue, 14 Apr 2020 18:21:29 +0100 From: Mark Brown To: Michael Walle Cc: Bartosz Golaszewski , 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 , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Wim Van Sebroeck , Shawn Guo , Li Yang , Thomas Gleixner , Jason Cooper , Marc Zyngier , Greg Kroah-Hartman Subject: Re: [PATCH v2 10/16] gpio: add a reusable generic gpio_chip using regmap Message-ID: <20200414172129.GJ5412@sirena.org.uk> References: <20200402203656.27047-1-michael@walle.cc> <20200402203656.27047-11-michael@walle.cc> <80bd8661ec8a1f5eda3f09a267846eaa@walle.cc> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LQAwcd5tHl0Qlnzi" Content-Disposition: inline In-Reply-To: X-Cookie: I've only got 12 cards. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --LQAwcd5tHl0Qlnzi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 14, 2020 at 12:07:01PM +0200, Michael Walle wrote: > Am 2020-04-14 11:50, schrieb Bartosz Golaszewski: > > 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. You could define REGMAP_INVALID_ADDR to be (unsigned int)(-1) or some other suitably implausible address and use that as a value. It's possible that there might be a collision with a real address on some device but it should be sufficiently unlikely to be useful, especially if it's not something regmap in general goes and evaluates. For extra safety we could have an API for allowing users to query the register validity information regmap has (or can be given) and gpiolib could then use that to figure out if the value was actually a dummy value but that's probably overdoing it. --LQAwcd5tHl0Qlnzi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl6V8RkACgkQJNaLcl1U h9AnZwf8CXCh0WrZ2WtwfdTJ1yX5W12AkMOk5xoWSFXC9PzRicdAquQGHN0U0Qan v2iy9fXKFP9/vjkpNOP0q8hzXFoFbxcDvTTPUcPJV9Xd/bJ/X2OTXn7qKKLxIA0q 8i5t5KXA1+3upDL3nzJvH/dZULUUz7vP7m1SrwkowgS4asnOJVMfa8vGJLbnxhT5 m9MjUO206PwDS/sUpsK36S+4ccbV5Nzdq50Ce9sWr4szpQnKtAFb0Z8Q9eriTl15 hJxwRBCZJLqzXLYIGVC0eJPv9YrbG3YLM+x+Hb6oxzOuHRWU5B/Kv8n01YeHW5A1 Zk21Hdv+mJcVD0qTQ1dNFzb4QzAp5Q== =mDDb -----END PGP SIGNATURE----- --LQAwcd5tHl0Qlnzi--