[lkml]   [2005]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] kernel - I2C adaptor for ColdFire 5282 CPU
Derek Cheung wrote:
>> Below please find the patch file I "diff" against Linux It
>> contains the I2C adaptor for ColdFire 5282 CPU. Since most ColdFire
>> shares the same I2C register set, the code can be easily adopted for
>> other ColdFire CPUs for I2C operations.
>> I have tested the code on a ColdFire 5282Lite CPU board
>> ( running uClinux 2.6.9
>> with LM75 and DS1621 temperature sensor chips. As advised by David
>> McCullough, the code will be incorporated in the next uClinux
> release.
>> The patch contains:
>> linux/drivers/i2c/busses
>> i2c-mcf5282.c (new file)

Limit source code lines to 80 characters (including comment lines).

+static int mcf5282_read_data():

+ if (ackType == NACK)
+ *MCF5282_I2C_I2CR |= MCF5282_I2C_I2CR_TXAK; // generate NA
+ else
+ *MCF5282_I2C_I2CR &= ~MCF5282_I2C_I2CR_TXAK; //
generate ACK

The 2 assignments above should begin in the same column.
Also, kernel comment style is C /* ... */, not C++ (or C99) // style.

+ if (timeout <= 0)
+ printk("%s - I2C IIF never set. Timeout is %d \n",
__FUNCTION__, timeout);

All printk() calls should have a KERN_WARNING or KERN_ERR or
KERN_DEBUG level used in it...

+ if (timeout <= 0 )

No space before the closing ')'.

+static int mcf5282_write_data():

+ if (timeout <=0)
should be (add a space)
+ if (timeout <= 0)

+ if (timeout <= 0 )
Drop space before ')'

Drop the debugging printk's and DEREK_DEBUG blocks.

+ switch (size) {
We usually don't indent the 'case' line to save one indent level.
It helps when using 8-space tabs.

+ // this is not yet ready!!!
Put blocks like this inside
#if 0

+static u32 mcf5282_func(struct i2c_adapter *adapter)
Don't use parens on return statements.

+static int __init i2c_mcf5282_init():
is not driver registration needed? I don't know the I2C
subsystem, so maybe not...

Big Question: does most Coldfire or I2C use volatile so heavily,
or is it just this one driver that does that? Volatile here
semms very overused.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-04-06 13:31    [W:0.092 / U:10.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site