All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Derek Cheung <derek.cheung@sympatico.ca>
Cc: "'Andrew Morton'" <akpm@osdl.org>,
	greg@kroah.com, Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 -  I2C adaptor for ColdFire 5282 CPU
Date: Tue, 05 Apr 2005 20:43:45 -0700	[thread overview]
Message-ID: <42535AF1.5080008@osdl.org> (raw)
In-Reply-To: <003901c53a51$0093b7d0$1501a8c0@Mainframe>

Derek Cheung wrote:
> 
>> Below please find the patch file I "diff" against Linux 2.6.11.6. It
>> contains the I2C adaptor for ColdFire 5282 CPU. Since most ColdFire
> CPU
>> 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
>> (http://www.axman.com/Pages/cml-5282LITE.html) 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) {
+                case I2C_SMBUS_QUICK:
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
or
#if NOT_READY_YET
#endif
blocks.

+static u32 mcf5282_func(struct i2c_adapter *adapter)
+{
+	return(I2C_FUNC_SMBUS_QUICK |
+	       I2C_FUNC_SMBUS_BYTE |
+	       I2C_FUNC_SMBUS_PROC_CALL |
+	       I2C_FUNC_SMBUS_BYTE_DATA |
+	       I2C_FUNC_SMBUS_WORD_DATA |
+	       I2C_FUNC_SMBUS_BLOCK_DATA);
+};
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.


-- 
~Randy

  parent reply	other threads:[~2005-04-06  3:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050405044836.GA17336@kroah.com>
2005-04-06  2:18 ` [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU Derek Cheung
2005-04-06  2:21   ` Andrew Morton
2005-04-06  2:33     ` Derek Cheung
2005-04-06  3:10       ` Randy.Dunlap
2005-04-07 22:37         ` Matt Mackall
2005-04-07 22:42           ` [PATCH] Add dontdiff file Randy.Dunlap
2005-04-06  3:43       ` Randy.Dunlap [this message]
2005-04-06 14:25         ` [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU Greg KH
2005-04-10 16:47         ` Derek Cheung
2005-04-10 23:54           ` Andrew Morton
2005-04-11  3:32           ` Randy.Dunlap
2005-04-11 20:03           ` Greg KH
2005-04-14  1:12             ` Derek Cheung
2005-05-19  6:25               ` Derek Cheung
2005-04-17 22:03               ` Greg KH
2005-05-19  6:25                 ` Greg KH
2005-04-18 21:10               ` Jean Delvare
2005-05-19  6:25                 ` Jean Delvare
2005-04-06  3:27   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42535AF1.5080008@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=akpm@osdl.org \
    --cc=derek.cheung@sympatico.ca \
    --cc=greg@kroah.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.