[U-Boot] [PATCH 3/9 v2] i.MX31: support GPIO as a chip-select in the mxc_spi driver

Anatolij Gustschin agust at denx.de
Thu Feb 5 18:22:58 CET 2009


Guennadi Liakhovetski wrote:
> On Thu, 5 Feb 2009, Anatolij Gustschin wrote:
> 
>> Guennadi Liakhovetski wrote:
>>
>>> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
>>> index b7bd84b..1341543 100644
>>> --- a/drivers/spi/mxc_spi.c
>>> +++ b/drivers/spi/mxc_spi.c
>> <snip>
>>> @@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
>>>  	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
>>>  		;
>>>  
>>> +	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
>>> +		mx31_gpio_set(mxcs->gpio,
>>> +			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
>> this is a multi-line if statement, I think the preferred coding style
>> is as follows:
>> 	if (...) {
>> 		/*
>> 		 * multi-line if statement
>> 		 */
>> 		...
>> 	}
>> please fix, Thanks!
> 
> Sorry, cannot find this in CodingStyle. Can you point me out?

please see appropriate comments in

http://lists.denx.de/pipermail/u-boot/2008-December/044435.html
or in
http://lists.denx.de/pipermail/u-boot/2008-October/042634.html
(search for "Braces around multi-line if-bodies").

> What I do 
> find there is this example in Chapter 2:
> 
> 	if (condition)
> 		printk(KERN_WARNING "Warning this is a long printk with "
> 						"3 parameters a: %u b: %u "
> 						"c: %u \n", a, b, c);
> 	else
> 		next_statement;
> 
> which implicitly (it is given as an example of breaking lines, not 
> parenthesising) states the contrary to your proposition.

Linux CodingStyle mostly applies for U-Boot coding style, but
sometimes there are little differences.

Best regargs,
Anatolij


More information about the U-Boot mailing list