Re: [PATCH 3/7] net: of_mdio: do not overwrite PHY interrupt configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 5 Dec 2013 14:52:12 -0800, Florian Fainelli <florian@xxxxxxxxxxx> wrote:
> From: Florian Fainelli <f.fainelli@xxxxxxxxx>
> 
> If irq_of_parse_and_map fails to find an interrupt line for a given PHY,
> we will force the PHY interrupt to be PHY_POLL, completely overriding
> the previous value that the MDIO bus may have set for us (e.g:
> PHY_IGNORE_INTERRUPT). In case of failure, just restore the previous
> value.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> ---
>  drivers/of/of_mdio.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
> index f93ebca..4923ab2 100644
> --- a/drivers/of/of_mdio.c
> +++ b/drivers/of/of_mdio.c
> @@ -27,7 +27,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi
>  {
>  	struct phy_device *phy;
>  	bool is_c45;
> -	int rc;
> +	int rc, prev_irq;
>  
>  	is_c45 = of_device_is_compatible(child,
>  					 "ethernet-phy-ieee802.3-c45");
> @@ -37,10 +37,11 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi
>  		return 1;
>  
>  	if (mdio->irq) {
> +		prev_irq= mdio->irq[addr];
>  		mdio->irq[addr] =
>  			irq_of_parse_and_map(child, 0);
>  		if (!mdio->irq[addr])
> -			mdio->irq[addr] = PHY_POLL;
> +			mdio->irq[addr] = prev_irq;
>  	}

Nit, the logic is a little weird the way it is written after the change.
I'd rather see:

	if (mdio->irq) {
		irq = irq_of_parse_and_map(child, 0);
		if (irq)
			mdio->irq[addr] = irq;
	}

Or even more concise:

	if (mdio->irq && irq = irq_of_parse_and_map(child, 0))
		mdio->irq[addr] = irq;

g.

Regardless,

Acked-by: Grant Likely <grant.likely@xxxxxxxxxx>

g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux