[PATCH V4 32/62] ST SPEAr 13xx : Adding support for SPEAr1310

viresh kumar viresh.kumar at st.com
Wed Jan 19 01:40:48 EST 2011


On 01/19/2011 10:09 AM, viresh kumar wrote:
>>> >> +
>>> >> +#ifdef CONFIG_PCIEPORTBUS
>>> >> +/* this function is needed for PCIE host and device driver. Same
>>> >> + * controller can not be programmed as host as well as device. So host
>>> >> + * driver must call this function and if this function returns 1 then
>>> >> + * only host should add that particular port as RC.
>>> >> + * A port to be added as device, one must also add device's information
>>> >> + * in plat_devs array defined in this file.
>>> >> + * it is the responsibility of calling function to not send port number
>>> >> + * greter than max no of controller(3)
>>> >> + */
>>> >> +int spear1310_pcie_port_is_host(int port)
>>> >> +{
>>> >> +	switch (port) {
>>> >> +	case 0:
>>> >> +		return 0;
>>> >> +	case 1:
>>> >> +		return 1;
>>> >> +	case 2:
>>> >> +		return 1;
>>> >> +	}
>>> >> +	return -EINVAL;
>>> >> +}
>>> >> +#endif
>> > 
>> > It looks like this can be made static.  Also, given the comment, is it worth 
>> > adding a BUG_ON(port > 3)?
>> > 
> will be done. BUG_ON() can be added here.
> 

There is another thought here. We may not require a BUG_ON here.
Returning error would be better, so that driver can take steps accordingly.
Also it is not that much blocking of a issue, that we need BUG_ON.

--
viresh



More information about the linux-arm-kernel mailing list