Re: [PATCH 4/5] netdev/phy: Add driver for Broadcom BCM87XX 10G Ethernet PHYs

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

 



On Tue, 2012-05-22 at 10:59 -0700, David Daney wrote:
> From: David Daney <david.daney@xxxxxxxxxx>

trivia:

> diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
[]
> @@ -0,0 +1,237 @@

> +static int bcm87xx_of_reg_init(struct phy_device *phydev)
> +{
> +	const __be32 *paddr;
> +	int len, i, ret;
> +
> +	if (!phydev->dev.of_node)
> +		return 0;
> +
> +	paddr = of_get_property(phydev->dev.of_node,
> +				"broadcom,c45-reg-init", &len);
> +	if (!paddr || len < (4 * sizeof(*paddr)))
> +		return 0;
> +
> +	ret = 0;
> +	len /= sizeof(*paddr);
> +	for (i = 0; i < len - 3; i += 4) {
> +		u16 devid = be32_to_cpup(paddr + i);
> +		u16 reg = be32_to_cpup(paddr + i + 1);
> +		u16 mask = be32_to_cpup(paddr + i + 2);
> +		u16 val_bits = be32_to_cpup(paddr + i + 3);
> +		int val;

These might read better as

	len /= 4;
	for (i = 0; i < len; i++) {
		u16 devid	= be32_to_cpu(*paddr++);
		u16 reg		= be32_to_cpu(*paddr++);
		u16 mask	= be32_to_cpu(*paddr++);
		u16 val_bits	= be32_to_cpu(*paddr++);
		...
	}




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux