Re: [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices

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

 



On Mon, 2013-05-13 at 11:03 -0700, Nithin Nayak Sujir wrote:
> On the 5718, 5719 and 5720 serdes devices, powering down function 0
> results in all the other ports being powered down. Add code to skip
> function 0 power down.
> 
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Michael Chan <mchan@xxxxxxxxxxxx>
> Signed-off-by: Nithin Nayak Sujir <nsujir@xxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 728d42a..737f035 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -2957,6 +2957,23 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)
>  	return 0;
>  }
>  
> +static bool tg3_phy_power_bug(struct tg3 *tp)
> +{
> +	if (tg3_asic_rev(tp) == ASIC_REV_5700 ||
> +	    tg3_asic_rev(tp) == ASIC_REV_5704 ||
> +	    (tg3_asic_rev(tp) == ASIC_REV_5780 &&
> +	     (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) ||
> +	    (tg3_asic_rev(tp) == ASIC_REV_5717 &&
> +	     !tp->pci_fn) ||
> +	    ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
> +	      tg3_asic_rev(tp) == ASIC_REV_5720) &&
> +	     (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
> +	     !tp->pci_fn))
> +		return true;

I think this would be a lot easier to read and
more easily extended using a switch/case like:

static bool tg3_phy_power_bug(struct tg3 *tp)
{
	switch (tg3_asic_rev(tp)) {
	case ASIC_REV_5700:
	case ASIC_REV_5704:
		return true;
	case ASIC_REV_5717:
		if (!tp_>pci_fn)
			return true;
		return false;
	case ASIC_REV_5719:
	case ASIC_REV_5720:
		if ((tp_>phy_flags & TG3_PHYFLG_PHY_SERDES) &&
		    !tp->pci_fn)
			return true;
		return false;
	case ASIC_REV_5780:
		if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
			return true;
		return false;
	}

	return false;
}


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




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]