lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251222230338-GYA1980456@gentoo.org>
Date: Tue, 23 Dec 2025 07:03:38 +0800
From: Yixun Lan <dlan@...too.org>
To: Troy Mitchell <troy.mitchell@...ux.spacemit.com>
Cc: Linus Walleij <linusw@...nel.org>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>, linux-gpio@...r.kernel.org,
	devicetree@...r.kernel.org, linux-riscv@...ts.infradead.org,
	spacemit@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 2/3] pinctrl: spacemit: k3: add initial pin support

Hi Troy,

On 14:59 Mon 22 Dec     , Troy Mitchell wrote:
> On Sat, Dec 20, 2025 at 06:14:54PM +0800, Yixun Lan wrote:
> > For the pinctrl IP of SpacemiT's K3 SoC, it has different register offset
> > comparing with previous SoC generation, so introduce a function to do the
> > pin to offset mapping. Also add all the pinctrl data.
> > 
> > Signed-off-by: Yixun Lan <dlan@...too.org>
> > ---
> >  drivers/pinctrl/spacemit/Kconfig      |   4 +-
> >  drivers/pinctrl/spacemit/pinctrl-k1.c | 354 +++++++++++++++++++++++++++++++++-
> >  2 files changed, 352 insertions(+), 6 deletions(-)
> > 
> [...]
> > diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
> [...]
> > +static unsigned int spacemit_k3_pin_to_offset(unsigned int pin)
> > +{
> > +	unsigned int offset = pin > 130 ? (pin + 2) : pin;
> Is this necessary? I think it's hard to read. Why not:
> ```
> if (pin > 130)
>   pin += 2;
> 
> return pin << 2;
> ```
> This avoids the extra variable and makes the code clearer.
> > +
> > +	return offset << 2;
No, I do not want to change, it's pretty much a personal taste here,
I did similar as k1_pin_to_offset(), explicitly introduce a variable offset
to let reader know it convert from pin to offsett, which is more readable..

-- 
Yixun Lan (dlan)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ