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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <73c364ee-2712-4b95-a05b-886c3e4c4e15@lunn.ch>
Date: Wed, 20 Aug 2025 14:34:48 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Daniel Golle <daniel@...rotopia.org>
Cc: Xu Liang <lxu@...linear.com>, Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v3 1/3] net: phy: mxl-86110: add basic support
 for led_brightness_set op

> +# define MXL86110_COM_EXT_LED_GEN_CFG_LFM(x)		({ typeof(x) _x = (x); \
> +							  GENMASK(1 + (3 * (_x)), \
> +								 3 * (_x)); })

> +static int mxl86110_led_brightness_set(struct phy_device *phydev,
> +				       u8 index, enum led_brightness value)
> +{
> +	u16 mask, set;
> +	int ret;
> +
> +	if (index >= MXL86110_MAX_LEDS)
> +		return -EINVAL;
> +
> +	/* force manual control */
> +	set = MXL86110_COM_EXT_LED_GEN_CFG_LFE(index);
> +	/* clear previous force mode */
> +	mask = MXL86110_COM_EXT_LED_GEN_CFG_LFM(index);
> +
> +	/* force LED to be permanently on */
> +	if (value != LED_OFF)
> +		set |= MXL86110_COM_EXT_LED_GEN_CFG_LFME(index);

That is particularly complex. We know index is a u8, so why not
GENMASK_U8(1 + 3 * index, 3 * index)? But set is a u16, so
GENMASK_U16() would also be valid.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ