[PATCH v2 09/10] RapidIO: Add support for IDT CPS Gen2 switches

Andrew Morton akpm at linux-foundation.org
Wed Sep 15 08:20:49 EST 2010


On Tue, 14 Sep 2010 10:59:22 -0400
Alexandre Bounine <alexandre.bounine at idt.com> wrote:

> +static int
> +idtg2_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
> +		       u16 table, u16 route_destid, u8 route_port)
> +{
> +	/*
> +	 * Select routing table to update
> +	 */
> +	if (table == RIO_GLOBAL_TABLE)
> +		table = 0;
> +	else
> +		table++;
> +
> +	rio_mport_write_config_32(mport, destid, hopcount,
> +				  LOCAL_RTE_CONF_DESTID_SEL, table);
> +
> +	/*
> +	 * Program destination port for the specified destID
> +	 */
> +	rio_mport_write_config_32(mport, destid, hopcount,
> +				  RIO_STD_RTE_CONF_DESTID_SEL_CSR,
> +				  (u32)route_destid);
> +
> +	rio_mport_write_config_32(mport, destid, hopcount,
> +				  RIO_STD_RTE_CONF_PORT_SEL_CSR,
> +				  (u32)route_port);
> +	udelay(10);
> +
> +	return 0;
> +}

The handling of `table' is strange.  One would expect the caller of
this function to provide the correct table index, and for the caller to
increment that index at an appropriate time.

So I take a look around but cannot find any means by which
->add_entry() is called with anything other than RIO_GLOBAL_TABLE. 
Maybe I missed something.  Is this all dead code?


More information about the Linuxppc-dev mailing list