Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp305821imp; Thu, 21 Feb 2019 01:43:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZOWn9/ETwIEs1+MYgazugDIGxZXfC3A733/45n3NhVl74/4S5pjVMkDNI+jcpL3aHoBAHU X-Received: by 2002:a65:62ca:: with SMTP id m10mr33368982pgv.6.1550742238075; Thu, 21 Feb 2019 01:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550742238; cv=none; d=google.com; s=arc-20160816; b=Owy0skV1Bn8+y+9PoJJZVshIpVM7ENUdl5lKCWhNgo3kSCWXDAqDGMFF2Za1RIm2+Y OiOdhwXnliQ+Nn6zaGi+VGU/Zc1RH4I5Ohc4xyYvFyVQMXCiAfM3rUZ+gG8gBZZm9f4N puyU+SyfeZfUmryQ3cmVhHYBxJm4jEGUZRv4Ys3YXeSkmpWO4S6tjddzE2hb5Yxsngfx Ds2JChDs/49LkOMFbapv4lJN0lixxLo8ZzRTa0diq0MkhQ+9nCKYodt2vxKyO5Ebwzg3 9l0WwVQSKA9K7kBr83RvxAQBojOJ0IVyWrnx/3FGfTl4J7MWlj3AJiCISzxVLwvgOacc ckFA== 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=fLyItT/z5/2XZidaZ8wic/LJLjAqhGtq2LlqcBV/L3A=; b=T88jZZPtDevoaXHT+0pt6LTLWqGqbPLh6za1rdHxIaI88xjVH/GlEFGapPRTfF6+OF kNJFh3mXr+4H4zUQgiY1Vk7W4GTQZr6n2oNX6kdDOUrkbVXZl7U+JEguHPUT+ktwUAvQ qfUQpGDNHpvQtzqTpMj+idBWn1lCX+0e7rhZXUd0eVeAL0qmNYk3325GF44ZkKbD8dgR iG0pcB64P/A44S9YqCQ8qRy2X0iMe9OURcYXBxgsVN1I2sLlhIKQmmQcsp7EezSC9xBC MXX9znY08A313otwAGnXf7zD5X5vZZWaN6Di9tLo+zD1FDzlBi0maAoH0pFvHQgkodqx Ylbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=kGb5WpPP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i21si14778352pgh.123.2019.02.21.01.43.42; Thu, 21 Feb 2019 01:43:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=kGb5WpPP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727900AbfBUJmy (ORCPT + 99 others); Thu, 21 Feb 2019 04:42:54 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:40560 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727831AbfBUJmx (ORCPT ); Thu, 21 Feb 2019 04:42:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fLyItT/z5/2XZidaZ8wic/LJLjAqhGtq2LlqcBV/L3A=; b=kGb5WpPP4aOnwI9kwYU0eNuUU oO7JK37PMe0KsdXPTd4ztM++g8g5OJPu3fF0QE1Ssvnw/yJKUUKeKwtY2F0wYAX/C5EEm6SVNRrxv yZDHOeY30KSX+Z7fTeCUOfZU4opA47ovh+iRZGwTQugQVpBLewD1dfrllAepO++yiDlQc=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gwksI-0002Iu-Bm; Thu, 21 Feb 2019 09:42:38 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 64D9B1126F2B; Thu, 21 Feb 2019 09:42:37 +0000 (GMT) Date: Thu, 21 Feb 2019 09:42:37 +0000 From: Mark Brown To: Axel Lin Cc: Olliver Schinagl , Chen-Yu Tsai , Priit Laes , Liam Girdwood , LKML Subject: Re: [PATCH] regulator: axp20x: Get rid of AXP20X_xxx_START/END/STEPS defines Message-ID: <20190221094237.GA5970@sirena.org.uk> References: <20190220165013.12774-1-axel.lin@ingics.com> <24E35288-677D-4223-B94A-52A4F37792A8@schinagl.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: X-Cookie: Garbage In -- Gospel Out. 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 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 21, 2019 at 08:22:53AM +0800, Axel Lin wrote: > Olliver Schinagl =E6=96=BC 2019=E5=B9=B42=E6=9C=8821= =E6=97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8A=E5=8D=886:57=E5=AF=AB=E9=81=93=EF=BC= =9A > > On February 20, 2019 5:50:13 PM GMT+01:00, Axel Lin wrote: > > >The AXP20X_xxx_START/END/STEPS defines make the code hard to read and > > >very hard to check the linear range settings because it needs to check > > >the defines one-by-one. > > >The original code without the defines is very good in readability > > >as the meaning of each field of REGULATOR_LINEAR_RANGE is clear. > > >So I suggest to get rid of AXP20X_xxx_START/END/STEPS defines. > > Are you suggesting that magic values and hex numbers are more readable? > For example: > static const struct regulator_linear_range axp803_dcdc234_ranges[] =3D { > REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), > REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000), > }; > Above looks very clear to me as it describes the linear ranges: > 1st linear range: min_uV is 500000, from selector 0 ~ 0x46, the uV_step i= s 10000 > 2nd linear range: min_uV is 1220000, from selector 0x47 ~ 0x4b, the > uV_step is 20000 > And it's easy to check the min_sel and max_sel in each linear range. Frankly I tend to agree with Axel here - the defines are used in exactly one place so their main impact is that you can't read the ranges directly in the array but have to jump around to read through the defines. --ikeVEW9yuYc//A+q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxucowACgkQJNaLcl1U h9BGHwf/Q+ifyezTt87Xs3xlYSMNusmi3EIumBSCRu65XFMH1MM7qA/xGCQCcWF0 4k/0iSwQbo7wbHwdsDaptxPk0sOflhgKNwlO3Lm+R33MbO6JH2Rn/ARamzeipI8T guPQ+QrlMy4GFlAfufnWZOf7hqZh6JEpWw5N5q23swZ4ELlLFkLydRI4jk2SuCkT KMfjYE/ylYcECaHCtbClI8ixZVz8HaCjI0UyoAkGUy04XA63IxOkNRRYxEtzhNNr iZrZvoRwC+RWtkE71Vags0O4lARbwn2Y8NZAZHFUj7Qk0D9N5uxD/kYxQIKPpcOo 7aVK9oPOKbFMmeR2B/9iu93d7f5IMg== =Ia8M -----END PGP SIGNATURE----- --ikeVEW9yuYc//A+q--