[PATCH] POWERPC: add support of the GiGE switch for mpc8313RDB via fixed PHY

Scott Wood scottwood at freescale.com
Wed Jul 18 02:43:31 EST 2007


This just comments on code style, not semantics...  I agree with Segher
that this isn't the way to do it.

On Tue, Jul 17, 2007 at 04:49:37AM +0400, Vitaly Bordug wrote:
> +#if defined(CONFIG_FIXED_MII_1000_FDX)
> +
> +static int fixed_set_link (void)
> +{
> +	struct fixed_info *phyinfo = fixed_mdio_get_phydev(0);	/* only one fixed phy on this platform */

Line length.

> +	for (np = NULL, i = 0;
> +	     (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL;
> +	     i++) {

Can't we just initialize np and i above, and use a while loop?

> +		memset(&res, 0, sizeof(res));

Not necessary.

> +		ret = of_address_to_resource(np, 0, &res);
> +		if (ret)
> +			return ret;
> +		child = of_find_compatible_node(np, "ethernet-phy","fixed");

Space after comma.

> +		if (!child)
> +			return -ENXIO;
> +		id = (u32*)of_get_property(child, "reg", NULL);

Cast not required.

> +		if (!id)
> +			return -ENXIO;
> +		break;

Why are you using a loop at all if there's a break at the end and no
continue?

> +	}
> +	snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT,  res.start, *id);

Only one space before res.start.

> +	memset(phyinfo->regs,0xff,sizeof(phyinfo->regs[0])*phyinfo->regs_num);

Spaces after commas.

-Scott



More information about the Linuxppc-dev mailing list