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, 19 Apr 2018 17:19:21 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Phil Elwell <phil@...pberrypi.org>
Cc:     Woojung Huh <woojung.huh@...rochip.com>,
        Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Randy Dunlap <rdunlap@...radead.org>, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org
Subject: Re: [PATCH v3 2/3] lan78xx: Read LED states from Device Tree

> @@ -2077,6 +2085,28 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
>  	mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control);
>  	phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv);
>  
> +	if (phydev->mdio.dev.of_node) {
> +		u32 reg;
> +		int len;
> +
> +		len = of_property_count_elems_of_size(phydev->mdio.dev.of_node,
> +						      "microchip,led-modes",
> +						      sizeof(u32));
> +		if (len >= 0) {
> +			/* Ensure the appropriate LEDs are enabled */
> +			lan78xx_read_reg(dev, HW_CFG, &reg);
> +			reg &= ~(HW_CFG_LED0_EN_ |
> +				 HW_CFG_LED1_EN_ |
> +				 HW_CFG_LED2_EN_ |
> +				 HW_CFG_LED3_EN_);
> +			reg |= (len > 0) * HW_CFG_LED0_EN_ |
> +				(len > 1) * HW_CFG_LED1_EN_ |
> +				(len > 2) * HW_CFG_LED2_EN_ |
> +				(len > 3) * HW_CFG_LED3_EN_;
> +			lan78xx_write_reg(dev, HW_CFG, reg);
> +		}
> +	}
> +

Humm. Not nice. But i cannot think of a cleaner way of doing this.

Reviewed-by: Andrew Lunn <andrew@...n.ch>

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ