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]
Date: Thu, 4 Jan 2024 22:42:23 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>,
	Rob Herring <robh+dt@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	William Zhang <william.zhang@...adcom.com>,
	Anand Gore <anand.gore@...adcom.com>,
	Kursad Oney <kursad.oney@...adcom.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Rafał Miłecki <rafal@...ecki.pl>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	Jacek Anaszewski <jacek.anaszewski@...il.com>,
	Fernández Rojas <noltari@...il.com>,
	Sven Schwermer <sven.schwermer@...ruptive-technologies.com>,
	linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	netdev@...r.kernel.org
Subject: Re: [net-next PATCH v8 3/5] net: phy: add support for PHY LEDs
 polarity modes

On Thu, Jan 04, 2024 at 02:20:45PM +0100, Andrew Lunn wrote:
> > +	if (phydev->drv->led_polarity_set) {
> > +		if (of_property_read_bool(led, "active-low"))
> > +			set_bit(PHY_LED_ACTIVE_LOW, &modes);
> > +		if (of_property_read_bool(led, "inactive-high-impedance"))
> > +			set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
> > +
> > +		err = phydev->drv->led_polarity_set(phydev, index, modes);
> > +		if (err)
> > +			return err;
> > +	}
> 
> I think we should return an error if asked to set the mode, but its
> not implemented by the driver. Something like:
> 
> 	if (of_property_read_bool(led, "active-low"))
> 		set_bit(PHY_LED_ACTIVE_LOW, &modes);
> 	if (of_property_read_bool(led, "inactive-high-impedance"))
> 		set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
> 
> 		
> 	if (mode)
> 		if (phydev->drv->led_polarity_set) {
> 			return -EINVAL;
> 		} else {
> 			err = phydev->drv->led_polarity_set(phydev, index, modes);
> 			if (err)
> 				return err;
> 		}
> 	}
> 
> > +	/**
> > +	 * @led_polarity_set: Set the LED polarity if active low
> 
> The 'if active low' is not ouw of date, since it is used for more than
> that.
> 
> > +	 * @dev: PHY device which has the LED
> > +	 * @index: Which LED of the PHY device or -1
> > +	 * @modes: bitmap of LED polarity modes
> > +	 *
> > +	 * Configure LED with all the required polarity modes in @modes
> > +	 * to make it correctly turn ON or OFF.
> 
> index == -1 should be explained.
>

If you are referring to the special way of setting the LED globally,
that is not a thing anymore. Rob pointed out that having the double
reference in DT is problematic and PHY driver should handle that
internally.

> > +	 *
> > +	 * Returns 0, or an error code.
> > +	 */
> > +	int (*led_polarity_set)(struct phy_device *dev, int index,
> > +				unsigned long modes);
> 
> 
>     Andrew
> 
> ---
> pw-bot: cr

-- 
	Ansuel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ