[lkml]   [2005]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: [PATCH] kernel - I2C adaptor for ColdFire 5282 CPU
Enclosed please find the updated patch that incorporates changes for all
the comments I received.

The volatile declaration in the m528xsim.h is needed because the
declaration refers to the ColdFire 5282 register mapping. The volatile
declaration is actually not needed in my I2C driver but someone may
include the m528xsim.h file in his/her applications and we need to force
the compiler not to do any optimization on the register mapping.


-----Original Message-----
From: Randy.Dunlap []
Sent: April 5, 2005 11:44 PM
To: Derek Cheung
Cc: 'Andrew Morton';;
Subject: Re: [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.

[unhandled content-type:application/octet-stream]
 \ /
  Last update: 2005-04-10 18:52    [W:0.128 / U:5.464 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site