I2C: sis630: sis964 bus
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1346204115-30293-2-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Hi Amaury,
I'm stripping the Cc list, this was really too much for such a driver-specific patch. You shouldn't trust scripts/get_maintainer.pl blindly. Most names it listed were for tree-wide cleanups, the authors of which have no personal interest in the i2c-sis630 driver.
Quoted 14 lines · Amaury Decrême
This patch add sis964 bus support to i2c-sis630.
Signed-off-by Amaury Decrême <[email protected]>--- Documentation/i2c/busses/i2c-sis630 | 17 +++- drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 148 ++++++++++++++++++++++------------- 3 files changed, 107 insertions(+), 62 deletions(-)Documentation/i2c/busses/i2c-sis630 +0
-0
Documentation/i2c/busses/i2c-sis630 Supported adapters: · line 11
Quoted 8 lines
Documentation/i2c/busses/i2c-sis630 +2
-0@@ -4,20 +4,23 @@ Supported adapters: * Silicon Integrated Systems Corp (SiS) 630 chipset (Datasheet: available at http://www.sfr-fresh.com/linux) 730 chipset + 964 chipset * Possible other SiS chipsets ? Author: Alexander Malysh <amalysh-S0/[email protected]> + Amaury Decrême <[email protected]> - SiS964 patch
s/patch/support/
Documentation/i2c/busses/i2c-sis630 Supported adapters: · line 15
Quoted 6 lines
Documentation/i2c/busses/i2c-sis630 +1
-1Module Parameters ----------------- -* force = [1|0] Forcibly enable the SIS630. DANGEROUS! +* force = [1|0] Forcibly enable the driver. DANGEROUS!
"SIS630" here and in many other places really means "SIS630 and compatible" i.e. "any chip supported by the driver." So you don't really have to change it.
Documentation/i2c/busses/i2c-sis630 Supported adapters: · line 22
Quoted 10 lines
Documentation/i2c/busses/i2c-sis630 +4
-3This can be interesting for chipsets not named above to check if it works for you chipset, but DANGEROUS! -* high_clock = [1|0] Forcibly set Host Master Clock to 56KHz (default, - what your BIOS use). DANGEROUS! This should be a bit - faster, but freeze some systems (i.e. my Laptop). +* clock_sel = [1|0] Forcibly set Host Master Clock. + SiS630/730 56kHz instead of 14kHz + SiS964 27.78kHz instead of 55.56 kHz + DANGEROUS! It can freeze some systems.
You are changing a public interface here, this should be avoided. The change may break existing systems on kernel upgrade.
Your new description is not correct. The forced frequency is really "instead of whatever the BIOS set, or failing that, the default value", as the original description correctly mentioned.
Given that the SiS964 defaults to the high speed, this option has actually very little value for that chip. I suppose you did not even test it. IMHO it would be better to simply mark it as SIS630/730-only and ignore, conceal or reject it if a SIS964 is detected. I vote for concealing it, as this option as the lowest cost AFAICS.
Quoted 39 lines
Documentation/i2c/busses/i2c-sis630 +6
-0Description@@ -36,6 +39,12 @@ or like this: 00:00.0 Host bridge: Silicon Integrated Systems [SiS] 730 Host (rev 02) 00:01.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 +or like this: + +00:00.0 Host bridge: Silicon Integrated Systems [SiS] 760/M760 Host (rev 02) +00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS964 [MuTIOL Media IO] + LPC Controller (rev 36) + in your 'lspci' output , then this driver is for your chipset. Thank Youdrivers/i2c/busses/Kconfig +2
-2@@ -184,11 +184,11 @@ config I2C_SIS5595 will be called i2c-sis5595. config I2C_SIS630 - tristate "SiS 630/730" + tristate "SiS 630/730/964" depends on PCI help If you say yes to this option, support will be included for the - SiS630 and SiS730 SMBus (a subset of I2C) interface. + SiS630, SiS730 and SiS964 SMBus (a subset of I2C) interface. This driver can also be built as a module. If so, the module will be called i2c-sis630.drivers/i2c/busses/i2c-sis630.c +0
-0
drivers/i2c/busses/i2c-sis630.c line 27
Quoted 5 lines
drivers/i2c/busses/i2c-sis630.c +1
-1@@ -24,7 +24,7 @@ 18.09.2002 Added SIS730 as supported. 21.09.2002 - Added high_clock module option.If this option is set + Added clock_sel module option.If this option is set
You can't change history!
drivers/i2c/busses/i2c-sis630.c line 38
Quoted 12 lines
drivers/i2c/busses/i2c-sis630.c +3
-1used Host Master Clock 56KHz (default 14KHz).For now we save old Host Master Clock and after transaction completed restore (otherwise it's confuse BIOS and hung Machine).@@ -32,7 +32,9 @@Fixed typo in sis630_access Fixed logical error by restoring of Host Master Clock 31.07.2003 -Added block data read/write support. +Added block data read/write support. +03.08.2012 +Added support of SiS964 - Amaury Decrême <[email protected]> */
These days we have git to track these changes. I'd rather drop this section from the driver altogether (e.g. in your cleanup patch), it is of very limited interest these days.
Quoted 5 lines
drivers/i2c/busses/i2c-sis630.c +0
-0/* @@ -41,6 +43,18 @@ Supports: SIS 630
drivers/i2c/busses/i2c-sis630.c line 54
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +9
-0SIS 730 + SIS 964 + + Notable differences between chips: + +------------------------+--------------------+-------------------+ + | | SIS630/730 | SIS964 | + +------------------------+--------------------+-------------------+ + | Clock | 14kHz/56kHz | 55.56kHz/27.78kHz | + | SMBus registers offset | 0x80 | 0xE0 | + | SMB_CNT | Bit 1 = Slave Busy | Bit 1 = Bus probe |
I also see a difference for bit 3 in this register: reserved on SIS630, Last Byte on SIS964. This doesn't matter right now because the driver doesn't support I2C block reads, but this means the SIS964 does support them and you may want to add support for this in the future (it makes reading SPD EEPROMs a lot faster.)
drivers/i2c/busses/i2c-sis630.c line 57
Quoted 3 lines
drivers/i2c/busses/i2c-sis630.c +3
-0+ | SMB_COUNT | 4:0 bits | 5:0 bits | + +------------------------+--------------------+-------------------+ + (Other differences doesn't affect the functions provided by the driver)
Spelling: don't
Quoted 25 lines
drivers/i2c/busses/i2c-sis630.c +2
-16Note: we assume there can only be one device, with one SMBus interface. */ @@ -55,22 +69,22 @@#include <linux/acpi.h> #include <linux/io.h> -/* SIS630 SMBus registers */ -#define SMB_STS 0x80/* status */ -#define SMB_EN 0x81/* status enable */ -#define SMB_CNT 0x82 -#define SMBHOST_CNT 0x83 -#define SMB_ADDR 0x84 -#define SMB_CMD 0x85 -#define SMB_PCOUNT 0x86/* processed count */ -#define SMB_COUNT 0x87 -#define SMB_BYTE 0x88/* ~0x8F data byte field */ -#define SMBDEV_ADDR 0x90 -#define SMB_DB0 0x91 -#define SMB_DB1 0x92 -#define SMB_SAA 0x93 - -/* register count for request_region */ +/* SIS964 id, defined here as we are the only file using it */ +#define PCI_DEVICE_ID_SI_964 0x0964
drivers/i2c/busses/i2c-sis630.c line 83
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +10
-0+ +/* SIS630/730/964 SMBus registers */ +#define SMB_STS 0x00/* status */ +#define SMB_CNT 0x02/* control */ +#define SMBHOST_CNT 0x03/* host control */ +#define SMB_ADDR 0x04/* address */ +#define SMB_CMD 0x05/* command */ +#define SMB_COUNT 0x07/* byte count */ +#define SMB_BYTE 0x08/* ~0x8F data byte field */ +#define SMB_SAA 0x13/* host slave alias address */
This register isn't used by the driver per se, only to compute the address range end in an error message. As you removed all unused registers from the list, you should remove it too.
drivers/i2c/busses/i2c-sis630.c line 86
Quoted 3 lines
drivers/i2c/busses/i2c-sis630.c +3
-0+ +/* register count for request_region +* As we don't use SMB_PCOUNT, 20 is ok for SiS630 and SiS964
You forgot to mention in the array listing the differences between the chips, that register at offset 0x06 has a different meaning. It's SMB_PCOUNT on the SIS630 but SMBus Packet Error Check on the SIS964, where SMB_PCOUNT was moved to offset 0x14. Without this explanation, your comment above is unclear.
Quoted 21 lines
drivers/i2c/busses/i2c-sis630.c +6
-5+*/ #define SIS630_SMB_IOREGION 20/* PCI address constants */ @@ -93,31 +107,33 @@static struct pci_driver sis630_driver;/* insmod parameters */ -static bool high_clock; +static bool clock_sel;static bool force; -module_param (high_clock, bool,0 ); -MODULE_PARM_DESC (high_clock,"Set Host Master Clock to 56KHz (default 14KHz)." ); +module_param (clock_sel, bool,0 ); +MODULE_PARM_DESC (clock_sel, +"Set Host Master Clock to 56kHz for SIS630/730 and to 27.78kHz for SIS964." );module_param (force, bool,0 ); -MODULE_PARM_DESC (force,"Forcibly enable the SIS630. DANGEROUS!" ); +MODULE_PARM_DESC (force,"Forcibly enable the driver. DANGEROUS!" ); -/* acpi base address */
drivers/i2c/busses/i2c-sis630.c line 126
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +3
-1-static unsigned short acpi_base; +/* SMBus base adress */ +static unsigned short smbus_base;/* supported chips */ static int supported[] = {PCI_DEVICE_ID_SI_630 ,PCI_DEVICE_ID_SI_730 , +PCI_DEVICE_ID_SI_964 ,0 /* terminates the list */
If you follow the logic of the two other chips, what should be listed here is PCI_DEVICE_ID_SI_760 == 0x0760. I have no idea why it is implemented that way, but at least for this patch I'd rather stick to it.
Quoted 34 lines
drivers/i2c/busses/i2c-sis630.c +3
-9};static inline u8 sis630_read (u8 reg) { -return inb (acpi_base + reg); +return inb (smbus_base + reg); }static inline void sis630_write (u8 reg,u8 data) { -outb (data, acpi_base + reg); +outb (data, smbus_base + reg); }static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock)@@ -143,8 +159,7 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcdev_dbg (&adap->dev,"saved clock 0x%02x\n" , *oldclock); -/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ -if (high_clock) +if (clock_sel)sis630_write (SMB_CNT ,0x20 );else sis630_write (SMB_CNT , (*oldclock & ~0x40 ));@@ -185,12 +200,14 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)if (temp &0x04 ) {dev_err (&adap->dev,"Bus collision!\n" ); - result = -EIO ; -/* -TBD: Datasheet say: -the software should clear this bit and restart SMBUS operation. -Should we do it or user start request again?
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_wait(struct i2c_adapter *adap, int size) · line 211
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +8
-1-*/ +/* Datasheet: +* SMBus Collision (SMBCOL_STS) +* This bit is set when a SMBus Collision condition occurs and +* SMBus Host loses in the bus arbitration. The software should +* clear this bit and re-start SMBus operation. +*/ +sis630_write (SMB_STS , temp & ~0x04 ); +return -EAGAIN ; }
This is a nice bug fix, which would deserve a patch on its own.
Quoted 7 lines
drivers/i2c/busses/i2c-sis630.c +0
-1return result;@@ -198,18 +215,17 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)static void sis630_transaction_end (struct i2c_adapter *adap,u8 oldclock) { -int temp =0 ;
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_wait(struct i2c_adapter *adap, int size) · line 224
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +7
-3- -/* clear all status "sticky" bits */ -sis630_write (SMB_STS , temp); +/* clear all status "sticky" bits +* Datasheet: +* SMBus Status (SMB_STS) +* The following registers are all sticky bits and only can be +* cleared by writing a one to their corresponding fields. +*/ +sis630_write (SMB_STS ,0xFF );
This look like a bug fix as well, not sure how we missed that so far. This should be a separate patch too.
Quoted 26 lines
drivers/i2c/busses/i2c-sis630.c +5
-9dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); -/* -* restore old Host Master Clock if high_clock is set -* and oldclock was not 56KHz -*/ -if (high_clock && !(oldclock &0x20 )) +if (clock_sel && !(oldclock &0x20 ))sis630_write (SMB_CNT ,(sis630_read (SMB_CNT ) & ~0x20 ));dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT ));@@ -218,12 +234,21 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)static int sis630_transaction (struct i2c_adapter *adap,int size) {int result =0 ; +int timeout =0 ;u8 oldclock =0 ; - result =sis630_transaction_start (adap, size, &oldclock); -if (!result) { - result =sis630_transaction_wait (adap, size); -sis630_transaction_end (adap, oldclock); +/* We loop in case of collisions */ + do { + result = sis630_transaction_start(adap, size, &oldclock);
drivers/i2c/busses/i2c-sis630.c static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock) · line 252
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +9
-0+if (!result) { + result =sis630_transaction_wait (adap, size); +sis630_transaction_end (adap, oldclock); + } + }while (result == -EAGAIN && timeout++ <MAX_TIMEOUT ); + +if (timeout >MAX_TIMEOUT ) { +dev_dbg (&adap->dev,"Too many collisions !\n" ); +return -ETIMEDOUT ; }
You shouldn't do that. Returning -EAGAIN is enough, i2c-core will do the retries if you properly set i2c_adapter->retries (which the driver doesn't do yet.) Retrying 500 times in a row would be way too much anyway.
drivers/i2c/busses/i2c-sis630.c static int __devinit sis630_setup(struct pci_dev *sis630_dev) · line 423
Quoted 8 lines
drivers/i2c/busses/i2c-sis630.c +2
-0return result;@@ -394,6 +419,8 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)unsigned char b;struct pci_dev *dummy =NULL ;int retval, i; +/* acpi base address */ +static unsigned short acpi_base;
No good reason to make it static.
Quoted 4 lines
drivers/i2c/busses/i2c-sis630.c +0
-0/* check for supported SiS devices */ for (i=0 ; supported[i] >0 ; i++) {
drivers/i2c/busses/i2c-sis630.c static int __devinit sis630_setup(struct pci_dev *sis630_dev) · line 473
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +6
-1@@ -438,16 +465,24 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04x\n" , acpi_base); - retval = acpi_check_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, +if (supported[i] ==PCI_DEVICE_ID_SI_964 ) + smbus_base = acpi_base +0xE0 ; +else + smbus_base = acpi_base +0x80 ; + +dev_dbg (&sis630_dev->dev,"SMBus base at 0x%04x\n" , smbus_base);
Should be 0x%04hx, as this is an unsigned short. Something that could be cleaned up in other places BTW.
Quoted 5 lines
drivers/i2c/busses/i2c-sis630.c +2
-0+ + retval =acpi_check_region (smbus_base +SMB_STS ,SIS630_SMB_IOREGION , sis630_driver.name);if (retval) goto exit;
drivers/i2c/busses/i2c-sis630.c static int __devinit sis630_setup(struct pci_dev *sis630_dev) · line 485
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +4
-3/* Everything is happy, let's grab the memory and set things up. */ -if (!request_region (acpi_base +SMB_STS ,SIS630_SMB_IOREGION , +if (!request_region (smbus_base +SMB_STS ,SIS630_SMB_IOREGION , sis630_driver.name)) { -dev_err (&sis630_dev->dev,"SMBus registers 0x%04x-0x%04x already " -"in use!\n" , acpi_base +SMB_STS , acpi_base +SMB_SAA ); +dev_err (&sis630_dev->dev, +"SMBus registers 0x%04x-0x%04x already in use!\n" , + smbus_base +SMB_STS , smbus_base +SMB_SAA );
"smbus_base + SMB_SAA" is better written "smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1", as this is how the region is requested.
Quoted 13 lines
drivers/i2c/busses/i2c-sis630.c +1
-1retval = -EBUSY ; goto exit; }@@ -456,7 +491,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev) exit:if (retval) - acpi_base =0 ; + smbus_base =0 ;return retval; }
drivers/i2c/busses/i2c-sis630.c static struct i2c_adapter sis630_adapter = { · line 512
Quoted 4 lines
drivers/i2c/busses/i2c-sis630.c +1
-0@@ -474,6 +509,7 @@ static struct i2c_adapter sis630_adapter = {static DEFINE_PCI_DEVICE_TABLE (sis630_ids) = { {PCI_DEVICE (PCI_VENDOR_ID_SI ,PCI_DEVICE_ID_SI_503 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_SI ,PCI_DEVICE_ID_SI_964 ) },
Logic would suggest adding it at the end of the list.
Quoted 25 lines
drivers/i2c/busses/i2c-sis630.c +4
-4{ PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC) }, { 0, } };@@ -491,17 +527,17 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i sis630_adapter.dev.parent = &dev->dev;snprintf (sis630_adapter.name,sizeof (sis630_adapter.name), -"SMBus SIS630 adapter at %04x" , acpi_base +SMB_STS ); +"SMBus SIS630 adapter at %04x" , smbus_base +SMB_STS );return i2c_add_adapter (&sis630_adapter); } static void __devexit sis630_remove(struct pci_dev *dev) { -if (acpi_base) { +if (smbus_base) {i2c_del_adapter (&sis630_adapter); -release_region (acpi_base +SMB_STS ,SIS630_SMB_IOREGION ); - acpi_base =0 ; +release_region (smbus_base +SMB_STS ,SIS630_SMB_IOREGION ); + smbus_base =0 ; } }
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Jean,
Quoted 7 lines · Jean Delvare
Review
Quoted 2 lines
(quoted diff) +1
-1-* force = [1|0] Forcibly enable the SIS630. DANGEROUS! +* force = [1|0] Forcibly enable the driver. DANGEROUS!"SIS630" here and in many other places really means "SIS630 and compatible" i.e. "any chip supported by the driver." So you don't really have to change it.
Ok, removed.
Quoted 6 lines
Given that the SiS964 defaults to the high speed, this option has actually very little value for that chip. I suppose you did not even test it. IMHO it would be better to simply mark it as SIS630/730-only and ignore, conceal or reject it if a SIS964 is detected. I vote for concealing it, as this option as the lowest cost AFAICS.
Ok, I removed the modification on the clock and marked it as SIS630/730 only.
Quoted 5 lines
These days we have git to track these changes. I'd rather drop this section from the driver altogether (e.g. in your cleanup patch), it is of very limited interest these days.
The change list will be removed by the cleanup patch.
Quoted 8 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ | SMB_CNT | Bit 1 = Slave Busy | Bit 1 = Bus probe |I also see a difference for bit 3 in this register: reserved on SIS630, Last Byte on SIS964. This doesn't matter right now because the driver doesn't support I2C block reads, but this means the SIS964 does support them and you may want to add support for this in the future (it makes reading SPD EEPROMs a lot faster.)
Ok added. I omitted it as it wasn't used by this version of the driver.
Quoted 6 lines
Quoted 1 line
+#define
SMB_SAA0x13/* host slave alias address */This register isn't used by the driver per se, only to compute the address range end in an error message. As you removed all unused registers from the list, you should remove it too.
Right, removed.
Quoted 7 lines
You forgot to mention in the array listing the differences between the chips, that register at offset
0x06has a different meaning. It'sSMB_PCOUNTon the SIS630 but SMBus Packet Error Check on the SIS964, whereSMB_PCOUNTwas moved to offset0x14. Without this explanation, your comment above is unclear.
OK, I added this in the differences array.
Quoted 6 lines
If you follow the logic of the two other chips, what should be listed here is
PCI_DEVICE_ID_SI_760==0x0760. I have no idea why it is implemented that way, but at least for this patch I'd rather stick to it.
My fault. It's indeed 0x0760 here.
Quoted 7 lines
This is a nice bug fix, which would deserve a patch on its own.
This look like a bug fix as well, not sure how we missed that so far. This should be a separate patch too.
Ok, splitted to separates patchs.
Quoted 7 lines
Quoted 1 line
}
You shouldn't do that. Returning
-EAGAINis enough, i2c-core will do the retries if you properly seti2c_adapter->retries(which the driver doesn't do yet.) Retrying 500 times in a row would be way too much anyway.
Thanks. I now use the genuine i2c_adapter->retries.
Quoted 4 lines
Should be 0x%04hx, as this is an unsigned short. Something that could be cleaned up in other places BTW.
Ok, I made a separate patch.
Best regards.
Signature · 1 line
Amaury Decrême
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1346204115-30293-3-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH resend 2/2] I2C: sis630: Cleaning and cosmetics
Hi Amaury,
Quoted 3 lines · Amaury Decrême
This patch:
- Correct checkpatch errors
- Replaces hexadecimal values by constants
Two patches ;)
Quoted 11 lines
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 311 ++++++++++++++++++++++----------------- 1 files changed, 178 insertions(+), 133 deletions(-)drivers/i2c/busses/i2c-sis630.c +0
-0
drivers/i2c/busses/i2c-sis630.c line 25
Quoted 8 lines
drivers/i2c/busses/i2c-sis630.c +1
-1@@ -19,7 +19,7 @@/* Changes: 24.08.2002 -Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) +Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) Changed sis630_transaction.(Thanks to Mark M. Hoffman) 18.09.2002 Added SIS730 as supported.
I'd rather drop the changelog altogether, we have revision control systems (svn and git) for that.
Quoted 5 lines
drivers/i2c/busses/i2c-sis630.c +1
-0@@ -82,6 +82,32 @@#define SMB_BYTE 0x08/* ~0x8F data byte field */ #define SMB_SAA 0x13/* host slave alias address */ +/* SMB_STS register */
drivers/i2c/busses/i2c-sis630.c line 95
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +10
-0+#define SMBALT_STS 0x80/* Slave alert */ +#define BYTE_DONE_STS 0x10/* Byte Done Status / Block Array */ +#define SMBMAS_STS 0x08/* Host Master */ +#define SMBCOL_STS 0x04/* Collision */ +#define SMBERR_STS 0x02/* Device error */ + +/* SMB_CNT register */ +#define MSTO_EN 0x40/* Host Master Timeout Enable */ +#define SMBCLK_SEL 0x20/* Host master clock selection */ +#define SMB_PROBE 0x02/* Bus Probe */
Or Slave Busy, depending on the chip.
drivers/i2c/busses/i2c-sis630.c line 101
Quoted 6 lines
drivers/i2c/busses/i2c-sis630.c +6
-0+#define SMB_HOSTBUSY 0x01/* Host Busy */ + +/* SMBHOST_CNT register */ +#define SMB_KILL 0x20/* Kill */ +#define SMB_START 0x10/* Start */ +#define SMB_PTL 0x07/* Command Protocol */
This is a mask, would be good to make it visible in the name. OTOH the masking is a no-op in practice so I'm not sure it's worth defining.
drivers/i2c/busses/i2c-sis630.c line 104
Quoted 3 lines
drivers/i2c/busses/i2c-sis630.c +3
-0+ +/* SMB_ADDR register */ +#define SMB_ADDRESS 0xFE/* Adress */
Spelling: Address
drivers/i2c/busses/i2c-sis630.c line 105
Quoted 1 line
drivers/i2c/busses/i2c-sis630.c +1
-0+#define SMB_RW 0x01/* Read/Write */
Both of these are no-op in the code anyway so you might as well just drop them.
drivers/i2c/busses/i2c-sis630.c line 109
Quoted 4 lines
drivers/i2c/busses/i2c-sis630.c +4
-0+ +/* SMB_BYTE register */ +#define SMB_BYTE0 0xFF/* Byte 0 */ +#define SMB_BYTE1 0xFF00/* Byte 1 */
These are self-explanatory, I don't think you have to define constants. They are not even hardware-related, and I find the code harder to read now.
Quoted 5 lines
drivers/i2c/busses/i2c-sis630.c +1
-0+/* register count for request_region * As we don't use SMB_PCOUNT, 20 is ok for SiS630 and SiS964 */
drivers/i2c/busses/i2c-sis630.c static inline void sis630_write(u8 reg, u8 data) · line 168
Quoted 9 lines
drivers/i2c/busses/i2c-sis630.c +3
-2@@ -136,23 +162,26 @@ static inline void sis630_write(u8 reg, u8 data)outb (data, smbus_base + reg); } -static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) +static int sis630_transaction_start (struct i2c_adapter *adap,int size, +u8 *oldclock) { -int temp; +int tmp;
I can't see the rationale for changing this variable name. temp was just fine. Changing it makes the patch larger for no good reason. Same later below.
Quoted 57 lines
drivers/i2c/busses/i2c-sis630.c +16
-13/* Make sure the SMBus host is ready to start transmitting. */ -if ((temp =sis630_read (SMB_CNT ) &0x03 ) !=0x00 ) { -dev_dbg (&adap->dev,"SMBus busy (%02x).Resetting...\n" ,temp); + tmp =sis630_read (SMB_CNT ); +if ((tmp & (SMB_PROBE |SMB_HOSTBUSY )) !=0x00 ) { +dev_dbg (&adap->dev,"SMBus busy (%02x). Resetting...\n" , tmp);/* kill smbus transaction */ -sis630_write (SMBHOST_CNT ,0x20 ); +sis630_write (SMBHOST_CNT ,SMB_KILL ); -if ((temp =sis630_read (SMB_CNT ) &0x03 ) !=0x00 ) { -dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp); + tmp =sis630_read (SMB_CNT ); +if (tmp & (SMB_PROBE |SMB_HOSTBUSY )) { +dev_dbg (&adap->dev,"Failed! (%02x)\n" , tmp);return -EBUSY ; - }else { + }else {dev_dbg (&adap->dev,"Successful!\n" ); } - } + }/* save old clock, so we can prevent machine for hung */ *oldclock =sis630_read (SMB_CNT );@@ -160,45 +189,46 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcdev_dbg (&adap->dev,"saved clock 0x%02x\n" , *oldclock);if (clock_sel) -sis630_write (SMB_CNT ,0x20 ); +sis630_write (SMB_CNT ,SMBCLK_SEL );else -sis630_write (SMB_CNT , (*oldclock & ~0x40 )); +sis630_write (SMB_CNT , (*oldclock & ~MSTO_EN ));/* clear all sticky bits */ - temp =sis630_read (SMB_STS ); -sis630_write (SMB_STS , temp &0x1e ); + tmp =sis630_read (SMB_STS ); +sis630_write (SMB_STS , tmp & (BYTE_DONE_STS |SMBMAS_STS + |SMBCOL_STS |SMBERR_STS ));/* start the transaction by setting bit 4 and size */ -sis630_write (SMBHOST_CNT ,0x10 | (size &0x07 )); +sis630_write (SMBHOST_CNT ,SMB_START | (size &SMB_PTL ));return 0 ; }static int sis630_transaction_wait (struct i2c_adapter *adap,int size) { -int temp, result =0 , timeout =0 ; +int tmp, timeout =0 ;/* We will always wait for a fraction of a second! */ do {
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc · line 218
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +4
-4msleep (1 ); - temp =sis630_read (SMB_STS ); + tmp =sis630_read (SMB_STS );/* check if block transmitted */ -if (size ==SIS630_BLOCK_DATA && (temp &0x10 )) -break ; - }while (!(temp &0x0e ) && (timeout++ <MAX_TIMEOUT )); + }while (!(size ==SIS630_BLOCK_DATA && (tmp &BYTE_DONE_STS )) + && !(tmp & (SMBMAS_STS |SMBCOL_STS |SMBERR_STS )) + && (timeout++ <MAX_TIMEOUT ));
This is an actual code change. You just can't do that in a cleanup patch, sorry. I don't even see the benefit, this makes the logic harder to understand.
Quoted 4 lines
drivers/i2c/busses/i2c-sis630.c +0
-0/* If the SMBus is still busy, we give up */ if (timeout >MAX_TIMEOUT ) {dev_dbg (&adap->dev,"SMBus Timeout!\n" );
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc · line 228
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +3
-3- result = -ETIMEDOUT ; +return -ETIMEDOUT ; } -if (temp &0x02 ) { +if (tmp &SMBERR_STS ) {dev_dbg (&adap->dev,"Error: Failed bus transaction\n" ); - result = -ENXIO ; +return -ENXIO ; }
This again is a code change. It subtly changes the behavior of the driver if several errors are reported at the same time. You can't do that in a cleanup patch! If you really want to do it, make it a separate patch, so that you can properly describe the change and the reasons why you think it is good.
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_wait(struct i2c_adapter *adap, int size) · line 239
Quoted 12 lines
drivers/i2c/busses/i2c-sis630.c +2
-2-if (temp &0x04 ) { +if (tmp &SMBCOL_STS ) {dev_err (&adap->dev,"Bus collision!\n" );/* Datasheet: * SMBus Collision (SMBCOL_STS) @@ -206,11 +236,11 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)* SMBus Host loses in the bus arbitration. The software should * clear this bit and re-start SMBus operation. */ -sis630_write (SMB_STS , temp & ~0x04 ); +sis630_write (SMB_STS , tmp & ~SMBCOL_STS );
Unrelated with this patch, but I think the above is wrong. The datasheet says to write 1 to clear bits in the SMB_STS register, so the above is clearing all bits _except_ SMBCOL_STS. Not good. OTOH we will end up clearing all bits in sis630_transaction_end() anyway, so there's no point in doing it already here.
Quoted 20 lines
drivers/i2c/busses/i2c-sis630.c +5
-4return -EAGAIN ; } -return result; +return 0 ; }static void sis630_transaction_end (struct i2c_adapter *adap,u8 oldclock)@@ -223,38 +253,41 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)*/ sis630_write (SMB_STS ,0xFF ); -dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" , +sis630_read (SMB_CNT )); -if (clock_sel && !(oldclock &0x20 )) -sis630_write (SMB_CNT ,(sis630_read (SMB_CNT ) & ~0x20 )); +if (clock_sel && !(oldclock &SMBCLK_SEL )) +sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL );
drivers/i2c/busses/i2c-sis630.c static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock) · line 268
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +3
-2-dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" , +sis630_read (SMB_CNT )); }static int sis630_transaction (struct i2c_adapter *adap,int size) { -int result =0 ; +int tmp;
Another gratuitous variable change, which I do not like. "result" was the right name for what it is used for. The only thing that can be cleaned up is the useless initialization.
Quoted 48 lines
drivers/i2c/busses/i2c-sis630.c +13
-10int timeout =0 ;u8 oldclock =0 ;/* We loop in case of collisions */ do { - result =sis630_transaction_start (adap, size, &oldclock); -if (!result) { - result =sis630_transaction_wait (adap, size); + tmp =sis630_transaction_start (adap, size, &oldclock); +if (!tmp) { + tmp =sis630_transaction_wait (adap, size);sis630_transaction_end (adap, oldclock); } - }while (result == -EAGAIN && timeout++ <MAX_TIMEOUT ); + }while (tmp == -EAGAIN && timeout++ <MAX_TIMEOUT );if (timeout >MAX_TIMEOUT ) {dev_dbg (&adap->dev,"Too many collisions !\n" );return -ETIMEDOUT ; } -return result; +return 0 ; } -static int sis630_block_data (struct i2c_adapter *adap,union i2c_smbus_data *data,int read_write) +static int sis630_block_data (struct i2c_adapter *adap, +union i2c_smbus_data *data,int read_write) {int i, len =0 , rc =0 ;u8 oldclock =0 ;@@ -266,39 +299,43 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datelse if (len >32 ) len =32 ;sis630_write (SMB_COUNT , len); -for (i=1 ; i <= len; i++) { -dev_dbg (&adap->dev,"set data 0x%02x\n" , data->block[i]); +for (i =1 ; i <= len; i++) { +dev_dbg (&adap->dev,"set data 0x%02x\n" , + data->block[i]);/* set data */ sis630_write (SMB_BYTE +(i-1 )%8 , data->block[i]); -if (i==8 || (len<8 && i==len)) { -dev_dbg (&adap->dev,"start trans len=%d i=%d\n" ,len ,i); +if (i ==8 || (len <8 && i == len)) { +dev_dbg (&adap->dev,"start trans len=%d i=%d\n" , + len, i);/* first transaction */
drivers/i2c/busses/i2c-sis630.c static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat · line 315
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +1
-5rc =sis630_transaction_start (adap,SIS630_BLOCK_DATA , &oldclock);if (rc)return rc; - } -else if ((i-1 )%8 ==7 || i==len) { -dev_dbg (&adap->dev,"trans_wait len=%d i=%d\n" ,len,i); -if (i>8 ) { -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); + }else if ((i-1 )%8 ==7 || i == len) {
Spaces around "-" and "%" would be appreciated.
drivers/i2c/busses/i2c-sis630.c static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat · line 320
Quoted 5 lines
drivers/i2c/busses/i2c-sis630.c +5
-0+dev_dbg (&adap->dev,"trans_wait len=%d i=%d\n" , + len, i); +if (i >8 ) { + dev_dbg(&adap->dev, + "clr smbary_sts len=%d i=%d\n",
Please leave "clear" as it was, it is much more readable. Remember you do not have to care about the 80 column limit for strings.
Quoted 29 lines
drivers/i2c/busses/i2c-sis630.c +5
-4+ len, i);/* If this is not first transaction, we must clear sticky bit. clear SMBARY_STS */ -sis630_write (SMB_STS ,0x10 ); +sis630_write (SMB_STS ,BYTE_DONE_STS ); } rc =sis630_transaction_wait (adap,SIS630_BLOCK_DATA );if (rc) { -dev_dbg (&adap->dev,"trans_wait failed\n" ); +dev_dbg (&adap->dev, +"trans_wait failed\n" );break ; } } } - } -else { + }else {/* read request */ data->block[0 ] = len =0 ; rc = sis630_transaction_start(adap,@@ -319,18 +356,21 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datif (data->block[0 ] >32 ) data->block[0 ] =32 ;
drivers/i2c/busses/i2c-sis630.c static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat · line 365
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +5
-3-dev_dbg (&adap->dev,"block data read len=0x%x\n" , data->block[0 ]); +dev_dbg (&adap->dev,"block data read len=0x%x\n" , + data->block[0 ]); -for (i=0 ; i <8 && len < data->block[0 ]; i++,len++) { -dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, len); +for (i =0 ; i <8 && len < data->block[0 ]; i++, len++) { +dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, + len); data->block[len+1 ] =sis630_read (SMB_BYTE +i);
Spaces can be added around "+"s too.
Quoted 40 lines
drivers/i2c/busses/i2c-sis630.c +4
-25} -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); +dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" , + len, i);/* clear SMBARY_STS */ -sis630_write (SMB_STS ,0x10 ); - }while (len < data->block[0 ]); +sis630_write (SMB_STS ,BYTE_DONE_STS ); + }while (len < data->block[0 ]); }sis630_transaction_end (adap, oldclock);@@ -346,42 +386,48 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,int status;switch (size) { -case I2C_SMBUS_QUICK : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); - size =SIS630_QUICK ; -break ; -case I2C_SMBUS_BYTE : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_CMD , command); - size =SIS630_BYTE ; -break ; -case I2C_SMBUS_BYTE_DATA : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_BYTE , data->byte); - size =SIS630_BYTE_DATA ; -break ; -case I2C_SMBUS_PROC_CALL : -case I2C_SMBUS_WORD_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) {
drivers/i2c/busses/i2c-sis630.c static s32 sis630_access(struct i2c_adapter *adap, u16 addr, · line 391
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +3
-7-sis630_write (SMB_BYTE , data->word &0xff ); -sis630_write (SMB_BYTE +1 ,(data->word &0xff00 ) >>8 ); - } - size = (size ==I2C_SMBUS_PROC_CALL ?SIS630_PCALL :SIS630_WORD_DATA ); -break ; -case I2C_SMBUS_BLOCK_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); +case I2C_SMBUS_QUICK : +sis630_write (SMB_ADDR , ((addr <<1 ) &SMB_ADDRESS ) | + (read_write &SMB_RW ));
As said earlier, the masks can go away, they are no-ops.
Quoted 116 lines
drivers/i2c/busses/i2c-sis630.c +58
-25+ size =SIS630_QUICK ; +break ; +case I2C_SMBUS_BYTE : +sis630_write (SMB_ADDR , ((addr <<1 ) &SMB_ADDRESS ) | + (read_write &SMB_RW )); +if (read_write ==I2C_SMBUS_WRITE )sis630_write (SMB_CMD , command); - size =SIS630_BLOCK_DATA ; -return sis630_block_data (adap, data, read_write); -default : -dev_warn (&adap->dev,"Unsupported transaction %d\n" , - size); -return -EOPNOTSUPP ; + size =SIS630_BYTE ; +break ; +case I2C_SMBUS_BYTE_DATA : +sis630_write (SMB_ADDR , ((addr <<1 ) &SMB_ADDRESS ) | + (read_write &SMB_RW )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) +sis630_write (SMB_BYTE , data->byte); + size =SIS630_BYTE_DATA ; +break ; +case I2C_SMBUS_PROC_CALL : +case I2C_SMBUS_WORD_DATA : +sis630_write (SMB_ADDR , ((addr <<1 ) &SMB_ADDRESS ) | + (read_write &SMB_RW )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) { +sis630_write (SMB_BYTE , data->word &SMB_BYTE0 ); +sis630_write (SMB_BYTE +1 , + (data->word &SMB_BYTE1 ) >>8 ); + } + size = (size ==I2C_SMBUS_PROC_CALL ? +SIS630_PCALL :SIS630_WORD_DATA ); +break ; +case I2C_SMBUS_BLOCK_DATA : +sis630_write (SMB_ADDR , ((addr <<1 ) &SMB_ADDRESS ) | + (read_write &SMB_RW )); +sis630_write (SMB_CMD , command); + size =SIS630_BLOCK_DATA ; +return sis630_block_data (adap, data, read_write); +default : +dev_warn (&adap->dev,"Unsupported transaction %d\n" , size); +return -EOPNOTSUPP ; } status =sis630_transaction (adap, size);@@ -393,15 +439,16 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,return 0 ; } -switch (size) { -case SIS630_BYTE : -case SIS630_BYTE_DATA : - data->byte =sis630_read (SMB_BYTE ); -break ; -case SIS630_PCALL : -case SIS630_WORD_DATA : - data->word =sis630_read (SMB_BYTE ) + (sis630_read (SMB_BYTE +1 ) <<8 ); -break ; +switch (size) { +case SIS630_BYTE : +case SIS630_BYTE_DATA : + data->byte =sis630_read (SMB_BYTE ); +break ; +case SIS630_PCALL : +case SIS630_WORD_DATA : + data->word =sis630_read (SMB_BYTE ) + + (sis630_read (SMB_BYTE +1 ) <<8 ); +break ; }return 0 ;@@ -409,9 +456,9 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,static u32 sis630_func (struct i2c_adapter *adapter) { -return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE |I2C_FUNC_SMBUS_BYTE_DATA | -I2C_FUNC_SMBUS_WORD_DATA |I2C_FUNC_SMBUS_PROC_CALL | -I2C_FUNC_SMBUS_BLOCK_DATA ; +return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE | +I2C_FUNC_SMBUS_BYTE_DATA |I2C_FUNC_SMBUS_WORD_DATA | +I2C_FUNC_SMBUS_PROC_CALL |I2C_FUNC_SMBUS_BLOCK_DATA ; }static int __devinit sis630_setup (struct pci_dev *sis630_dev)@@ -423,19 +470,19 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)static unsigned short acpi_base;/* check for supported SiS devices */ -for (i=0 ; supported[i] >0 ; i++) { -if ((dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy))) +for (i =0 ; supported[i] >0 ; i++) { + dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy); +if (dummy)break ;/* found */ }if (dummy) {pci_dev_put (dummy); - } -else if (force) { -dev_err (&sis630_dev->dev,"WARNING: Can't detect SIS630 compatible device, but " + }else if (force) { +dev_err (&sis630_dev->dev, +"WARNING: Can't detect SIS630 compatible device, but " "loading because of force option enabled\n" ); - } -else { + }else {return -ENODEV ; }@@ -443,24 +490,23 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev) Enable ACPI first , so we can accsess reg 74-75
drivers/i2c/busses/i2c-sis630.c static int __devinit sis630_setup(struct pci_dev *sis630_dev) · line 497
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +2
-3in acpi io space and read acpi base addr */ -if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG ,&b)) { +if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG , &b)) {dev_err (&sis630_dev->dev,"Error: Can't read bios ctl reg\n" ); - retval = -ENODEV ; - goto exit; +return -ENODEV ; }/* if ACPI already enabled , do nothing */
Space before comma could be removed.
Quoted 63 lines
drivers/i2c/busses/i2c-sis630.c +14
-18if (!(b &0x80 ) &&pci_write_config_byte (sis630_dev,SIS630_BIOS_CTL_REG , b |0x80 )) {dev_err (&sis630_dev->dev,"Error: Can't enable ACPI\n" ); - retval = -ENODEV ; - goto exit; +return -ENODEV ; }/* Determine the ACPI base address */ -if (pci_read_config_word (sis630_dev,SIS630_ACPI_BASE_REG ,&acpi_base)) { -dev_err (&sis630_dev->dev,"Error: Can't determine ACPI base address\n" ); - retval = -ENODEV ; - goto exit; +if (pci_read_config_word (sis630_dev,SIS630_ACPI_BASE_REG , + &acpi_base)) { +dev_err (&sis630_dev->dev, +"Error: Can't determine ACPI base address\n" ); +return -ENODEV ; }dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04x\n" , acpi_base);@@ -474,8 +520,10 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev) retval =acpi_check_region (smbus_base +SMB_STS ,SIS630_SMB_IOREGION , sis630_driver.name); -if (retval) - goto exit; +if (retval) { + smbus_base =0 ; +return retval; + }/* Everything is happy, let's grab the memory and set things up. */ if (!request_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION,@@ -483,16 +531,10 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)dev_err (&sis630_dev->dev,"SMBus registers 0x%04x-0x%04x already in use!\n" , smbus_base +SMB_STS , smbus_base +SMB_SAA ); - retval = -EBUSY ; - goto exit; +return -EBUSY ; } - retval =0 ; - -exit: -if (retval) - smbus_base =0 ; -return retval; +return 0 ; }@@ -511,15 +553,18 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = { { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_964) }, { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC) }, - { 0, } + { 0 } }; -MODULE_DEVICE_TABLE (pci, sis630_ids); +MODULE_DEVICE_TABLE (pci, sis630_ids);
drivers/i2c/busses/i2c-sis630.c static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = { · line 567
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +5
-2-static int __devinit sis630_probe (struct pci_dev *dev,const struct pci_device_id *id) +static int __devinit sis630_probe (struct pci_dev *dev, +const struct pci_device_id *id) {if (sis630_setup (dev)) { -dev_err (&dev->dev,"SIS630 comp. bus not detected, module not inserted.\n" ); +dev_err (&dev->dev, +"SIS630 compatible bus not detected, " +"module not inserted.\n" );
You can keep the string on a single line.
Quoted 3 lines
drivers/i2c/busses/i2c-sis630.c +0
-0return -ENODEV ; }
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH resend 2/2] I2C: sis630: Cleaning and cosmetics
Hi Jean,
Quoted 4 lines · Jean Delvare
I'd rather drop the changelog altogether, we have revision control systems (svn and git) for that.
Changelog dropped.
Quoted 4 lines
This is a mask, would be good to make it visible in the name. OTOH the masking is a no-op in practice so I'm not sure it's worth defining.
I removed it. I understand that byte mask shouldn't be keeped but bit mask is ok. Is it the right logic ?
Quoted 4 lines
I can't see the rationale for changing this variable name. temp was just fine. Changing it makes the patch larger for no good reason. Same later below.
The variable was changed to normalizing purpose. To keep things clear, I removed that diff.
Quoted 5 lines
This is an actual code change. You just can't do that in a cleanup patch, sorry. I don't even see the benefit, this makes the logic harder to understand.
Indeed, it shouldn't be here.
Quoted 6 lines
This again is a code change. It subtly changes the behavior of the driver if several errors are reported at the same time. You can't do that in a cleanup patch! If you really want to do it, make it a separate patch, so that you can properly describe the change and the reasons why you think it is good.
Removed it.
Quoted 6 lines
Unrelated with this patch, but I think the above is wrong. The datasheet says to write 1 to clear bits in the
SMB_STSregister, so the above is clearing all bits _except_SMBCOL_STS. Not good. OTOH we will end up clearing all bits insis630_transaction_end()anyway, so there's no point in doing it already here.
Modified and splitted to a separate patch.
Quoted 6 lines
Please leave "clear" as it was, it is much more readable. Remember you do not have to care about the 80 column limit for strings.
You can keep the string on a single line.
Good note taken.
Quoted 6 lines
Spaces can be added around "+"s too.
Space before comma could be removed.
--> Cleanup patch v2 :)
Best regards.
Signature · 1 line
Amaury Decrême
Re: [PATCH resend 2/2] I2C: sis630: Cleaning and cosmetics
Hi Amaury,
Quoted 6 lines · Amaury Decrême
Quoted 2 lines · Jean Delvare
This is a mask, would be good to make it visible in the name. OTOH the masking is a no-op in practice so I'm not sure it's worth defining.
I removed it. I understand that byte mask shouldn't be keeped but bit mask is ok. Is it the right logic ?
No, my point is that masking operations which will always resolve to no-ops by construct should be avoided. The compiler may not always be able to optimize these out. This hold for both single and multi-bit masking.
Signature · 1 line
Jean Delvare
Re: [PATCH resend 0/2] I2C: sis630: add sis964 support
In reply to a message not in the archiveHi Amaury,
Quoted 21 lines · Amaury Decrême
This serie of patches brings SIS964 support to i2c-sis630.
The SiS datasheets have been used.
The SIS964 isn't part of the SIS96X family and behaves differently. For i2c, this array show the differences between sis630 and sis964.
+------------------------+--------------------+-------------------+ | | SIS630/730 | SIS964 | +------------------------+--------------------+-------------------+ | Clock | 14kHz/56kHz | 55.56kHz/27.78kHz | | SMBus registers offset | 0x80 | 0xE0 | | SMB_CNT | Bit 1 = Slave Busy | Bit 1 = Bus probe | | SMB_COUNT | 4:0 bits | 5:0 bits | +------------------------+--------------------+-------------------+The other differences doesn't affect the functions provided by the original i2c-sis630 driver.
The first patch is mandatory as it adds supports for SIS964 bus. The second patch is optional. It depends on the first patch.
Quoted 8 lines
Amaury Decrême (2):
I2C: sis630: sis964 bus
I2C: sis630: Cleaning and cosmeticsDocumentation/i2c/busses/i2c-sis630 | 17 +- drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 445 +++++++++++++++++++++-------------- 3 files changed, 278 insertions(+), 188 deletions(-)
I reviewed these two patches 2 months ago, but did not hear back from you since then. Do you plan to resubmit these patches with the improvements I suggested? I would hate to see your work time and mine wasted.
Thanks,
Signature · 1 line
Jean Delvare
Re: [PATCH resend 0/2] I2C: sis630: add sis964 support
Quoted 12 lines · Jean Delvare
Hi Amaury,
On Wed, 29 Aug 2012 03:35:13 +0200, Amaury Decrême wrote:
I reviewed these two patches 2 months ago, but did not hear back from you since then. Do you plan to resubmit these patches with the improvements I suggested? I would hate to see your work time and mine wasted.
Thanks,
Signature · 1 line
Jean Delvare
Hi Jean,
I'm sorry I gave no news. I read your improvments with interests when you sent it.
I changed my job at the very same moment and didn't have a minute until xmas season..
It's getting a bit better and I hope to send a working solution in early 2013 if the schedule is still ok.
Best regards, season greetings.
Signature · 1 line
Amaury Decrême
Re: [PATCH resend 0/2] I2C: sis630: add sis964 support
Quoted 8 lines · Amaury Decrême
Quoted 6 lines · Jean Delvare
On Wed, 29 Aug 2012 03:35:13 +0200, Amaury Decrême wrote:
I reviewed these two patches 2 months ago, but did not hear back from you since then. Do you plan to resubmit these patches with the improvements I suggested? I would hate to see your work time and mine wasted.
Quoted 7 lines
I'm sorry I gave no news. I read your improvments with interests when you sent it.
I changed my job at the very same moment and didn't have a minute until xmas season..
It's getting a bit better and I hope to send a working solution in early 2013 if the schedule is still ok.
Yes, that would be OK.
Thanks,
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): 1346204115-30293-1-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
v2 cover I2C: sis630: add sis964 support
Those patches add sis964 support to i2c-sis630.
The SiS datasheets have been used.
The SiS964 isn't part of the SIS96X family and behaves like the SiS630 chip family.
For I2C, this array show the differences between a SiS630 and a SiS964.
+------------------------+--------------------+-------------------+ | | SIS630/730 | SIS964 | +------------------------+--------------------+-------------------+ | Clock | 14kHz/56kHz | 55.56kHz/27.78kHz | | SMBus registers offset | 0x80 | 0xE0 | | SMB_CNT | Bit 1 = Slave Busy | Bit 1 = Bus probe | | (not used yet) | Bit 3 is reserved | Bit 3 = Last byte | | SMB_PCOUNT | Offset + 0x06 | Offset + 0x14 | | SMB_COUNT | 4:0 bits | 5:0 bits | +------------------------+--------------------+-------------------+
Other differences don't affect the functions provided by the original driver.
Amaury Decrême (6):
Add SIS964 bus support to i2c-sis630.
Bugfix: clear sticky bits
Bugfix: behavior after collision
Cosmetics: hex to constants for SMBus commands
Misc: display unsigned hex
Cleanup
Documentation/i2c/busses/i2c-sis630 | 9 + drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 340 +++++++++++++++++++---------------- 3 files changed, 196 insertions(+), 157 deletions(-)
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-1-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v2 1/6 Add SIS964 bus support to i2c-sis630.
--- Documentation/i2c/busses/i2c-sis630 | 9 ++++ drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 88 +++++++++++++++++++++++------------ 3 files changed, 69 insertions(+), 32 deletions(-)
Documentation/i2c/busses/i2c-sis630 +9 -0
@@ -4,9 +4,11 @@ Supported adapters: * Silicon Integrated Systems Corp (SiS) 630 chipset (Datasheet: available at http://www.sfr-fresh.com/linux) 730 chipset + 964 chipset * Possible other SiS chipsets ? Author: Alexander Malysh <amalysh-S0/[email protected]> + Amaury Decrême <[email protected]> - SiS964 support Module Parameters -----------------
@@ -18,6 +20,7 @@ Module Parameters * high_clock = [1|0] Forcibly set Host Master Clock to 56KHz (default, what your BIOS use). DANGEROUS! This should be a bit faster, but freeze some systems (i.e. my Laptop). + SIS630/730 chip only. Description
@@ -36,6 +39,12 @@ or like this: 00:00.0 Host bridge: Silicon Integrated Systems [SiS] 730 Host (rev 02) 00:01.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 +or like this: + +00:00.0 Host bridge: Silicon Integrated Systems [SiS] 760/M760 Host (rev 02) +00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS964 [MuTIOL Media IO] + LPC Controller (rev 36) + in your 'lspci' output , then this driver is for your chipset. Thank You
drivers/i2c/busses/Kconfig +2 -2
@@ -186,11 +186,11 @@ config I2C_SIS5595 will be called i2c-sis5595. config I2C_SIS630 - tristate "SiS 630/730" + tristate "SiS 630/730/964" depends on PCI help If you say yes to this option, support will be included for the - SiS630 and SiS730 SMBus (a subset of I2C) interface. + SiS630, SiS730 and SiS964 SMBus (a subset of I2C) interface. This driver can also be built as a module. If so, the module will be called i2c-sis630.
drivers/i2c/busses/i2c-sis630.c +58 -30
171 lines not on this page · raw message
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-2-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Jean Delvare
Reviewed-byRe: [PATCH v2 1/6] Add SIS964 bus support to i2c-sis630.
Quoted 7 lines · Amaury Decrême
Signed-off-by Amaury Decrême <[email protected]>--- Documentation/i2c/busses/i2c-sis630 | 9 ++++ drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 88 +++++++++++++++++++++++------------ 3 files changed, 69 insertions(+), 32 deletions(-)(...)
Signature · 1 line
Jean Delvare
PATCH v2 2/6 Bugfix: clear sticky bits
In reply to a message not in the archiveThe sticky bits must be cleared at the end of the transaction by writing a 1 to all fields.
Datasheet:
SMBus Status (SMB_STS)
The following registers are all sticky bits and only can be cleared by writing a one to their corresponding fields.
--- drivers/i2c/busses/i2c-sis630.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-sis630.c +1 -3
@@ -213,10 +213,8 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)static void sis630_transaction_end (struct i2c_adapter *adap,u8 oldclock) { -int temp =0 ; -/* clear all status "sticky" bits */ -sis630_write (SMB_STS , temp); +sis630_write (SMB_STS ,0xFF );dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT ));
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-3-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Jean Delvare
Reviewed-byRe: [PATCH v2 2/6] Bugfix: clear sticky bits
Quoted 19 lines · Amaury Decrême
The sticky bits must be cleared at the end of the transaction by writing a 1 to all fields.
Datasheet:
SMBus Status (SMB_STS)
The following registers are all sticky bits and only can be cleared by writing a one to their corresponding fields.Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)drivers/i2c/busses/i2c-sis630.c +0
-0@@ -213,10 +213,8 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_wait(struct i2c_adapter *adap, int size) · line 220
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +1
-3static void sis630_transaction_end (struct i2c_adapter *adap,u8 oldclock) { -int temp =0 ; -/* clear all status "sticky" bits */ -sis630_write (SMB_STS , temp); +sis630_write (SMB_STS ,0xFF );dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT ));
Signature · 1 line
Jean Delvare
PATCH v2 3/6 Bugfix: behavior after collision
In reply to a message not in the archiveDatasheet on collision:
SMBus Collision (SMBCOL_STS)
This bit is set when a SMBus Collision condition occurs and SMBus Host loses in the bus arbitration. The software should clear this bit and re-start SMBus operation.
As the status will be cleared in transaction_end, we can remove the sis630_write and prepare to return -EAGAIN to retry.
--- drivers/i2c/busses/i2c-sis630.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-sis630.c +1 -6
@@ -200,12 +200,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)if (temp &0x04 ) {dev_err (&adap->dev,"Bus collision!\n" ); - result = -EIO ; -/* -TBD: Datasheet say: -the software should clear this bit and restart SMBUS operation. -Should we do it or user start request again? -*/ + result = -EAGAIN ; }return result;
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-4-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Jean Delvare
Reviewed-byRe: [PATCH v2 3/6] Bugfix: behavior after collision
Quoted 22 lines · Amaury Decrême
Datasheet on collision:
SMBus Collision (SMBCOL_STS)
This bit is set when a SMBus Collision condition occurs and SMBus Host loses in the bus arbitration. The software should clear this bit and re-start SMBus operation.As the status will be cleared in
transaction_end, we can remove thesis630_writeand prepare to return-EAGAINto retry.Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)drivers/i2c/busses/i2c-sis630.c +0
-0@@ -200,12 +200,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)if (temp &0x04 ) {dev_err (&adap->dev,"Bus collision!\n" );
drivers/i2c/busses/i2c-sis630.c static int sis630_transaction_wait(struct i2c_adapter *adap, int size) · line 206
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +1
-6- result = -EIO ; -/* -TBD: Datasheet say: -the software should clear this bit and restart SMBUS operation. -Should we do it or user start request again? -*/ + result = -EAGAIN ; }return result;
Signature · 1 line
Jean Delvare
PATCH v2 4/6 Cosmetics: hex to constants for SMBus commands
In reply to a message not in the archiveThis patch replaces hexadecimal values by constants for SMBus commands and bit masks.
--- drivers/i2c/busses/i2c-sis630.c | 45 ++++++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 14 deletions(-)
drivers/i2c/busses/i2c-sis630.c +31 -14
@@ -81,6 +81,21 @@#define SMB_COUNT 0x07/* byte count */ #define SMB_BYTE 0x08/* ~0x8F data byte field */ +/* SMB_STS register */ +#define BYTE_DONE_STS 0x10/* Byte Done Status / Block Array */ +#define SMBCOL_STS 0x04/* Collision */ +#define SMBERR_STS 0x02/* Device error */ + +/* SMB_CNT register */ +#define MSTO_EN 0x40/* Host Master Timeout Enable */ +#define SMBCLK_SEL 0x20/* Host master clock selection */ +#define SMB_PROBE 0x02/* Bus Probe/Slave busy */ +#define SMB_HOSTBUSY 0x01/* Host Busy */ + +/* SMBHOST_CNT register */ +#define SMB_KILL 0x20/* Kill */ +#define SMB_START 0x10/* Start */ +/* register count for request_region * As we don't use SMB_PCOUNT, 20 is ok for SiS630 and SiS964 */
@@ -140,12 +155,14 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcint temp;/* Make sure the SMBus host is ready to start transmitting. */ -if ((temp =sis630_read (SMB_CNT ) &0x03 ) !=0x00 ) { -dev_dbg (&adap->dev,"SMBus busy (%02x).Resetting...\n" ,temp); + temp =sis630_read (SMB_CNT ); +if ((temp & (SMB_PROBE |SMB_HOSTBUSY )) !=0x00 ) { +dev_dbg (&adap->dev,"SMBus busy (%02x). Resetting...\n" , temp);/* kill smbus transaction */ -sis630_write (SMBHOST_CNT ,0x20 ); +sis630_write (SMBHOST_CNT ,SMB_KILL ); -if ((temp =sis630_read (SMB_CNT ) &0x03 ) !=0x00 ) { + temp =sis630_read (SMB_CNT ); +if (temp & (SMB_PROBE |SMB_HOSTBUSY )) {dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp);return -EBUSY ; }else {
@@ -160,16 +177,16 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ if (high_clock) -sis630_write (SMB_CNT ,0x20 ); +sis630_write (SMB_CNT ,SMBCLK_SEL );else -sis630_write (SMB_CNT , (*oldclock & ~0x40 )); +sis630_write (SMB_CNT , (*oldclock & ~MSTO_EN ));/* clear all sticky bits */ temp =sis630_read (SMB_STS );sis630_write (SMB_STS , temp &0x1e );/* start the transaction by setting bit 4 and size */ -sis630_write (SMBHOST_CNT ,0x10 | (size &0x07 )); +sis630_write (SMBHOST_CNT ,SMB_START | (size &0x07 ));return 0 ; }
@@ -193,12 +210,12 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size) result = -ETIMEDOUT ; } -if (temp &0x02 ) { +if (temp &SMBERR_STS ) {dev_dbg (&adap->dev,"Error: Failed bus transaction\n" ); result = -ENXIO ; } -if (temp &0x04 ) { +if (temp &SMBCOL_STS ) {dev_err (&adap->dev,"Bus collision!\n" ); result = -EAGAIN ; }
@@ -217,8 +234,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)* restore old Host Master Clock if high_clock is set * and oldclock was not 56KHz */ -if (high_clock && !(oldclock &0x20 )) -sis630_write (SMB_CNT ,(sis630_read (SMB_CNT ) & ~0x20 )); +if (high_clock && !(oldclock &SMBCLK_SEL )) +sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL );dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); }
@@ -270,7 +287,7 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datwe must clear sticky bit. clear SMBARY_STS */ -sis630_write (SMB_STS ,0x10 ); +sis630_write (SMB_STS ,BYTE_DONE_STS ); } rc =sis630_transaction_wait (adap,SIS630_BLOCK_DATA );
@@ -312,8 +329,8 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datdev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i);/* clear SMBARY_STS */ -sis630_write (SMB_STS ,0x10 ); - }while (len < data->block[0 ]); +sis630_write (SMB_STS ,BYTE_DONE_STS ); + }while (len < data->block[0 ]); }sis630_transaction_end (adap, oldclock);
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-5-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v2 4/6] Cosmetics: hex to constants for SMBus commands
Quoted 8 lines · Amaury Decrême
This patch replaces hexadecimal values by constants for SMBus commands and bit masks.
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 45 ++++++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 14 deletions(-)(...)
Good idea, however you missed one occurrence of BYTE_DONE_STS in sis630_transaction_wait().
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 4/6] Cosmetics: hex to constants for SMBus commands
Quoted 4 lines · Jean Delvare
Good idea, however you missed one occurrence of
BYTE_DONE_STSinsis630_transaction_wait().
Thanks, corrected.
Signature · 1 line
Amaury Decrême
PATCH v2 5/6 Misc: display unsigned hex
In reply to a message not in the archiveThis patch corrects the display of unsigned hex values.
--- drivers/i2c/busses/i2c-sis630.c | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-)
drivers/i2c/busses/i2c-sis630.c +14 -11
@@ -152,18 +152,18 @@ static inline void sis630_write(u8 reg, u8 data)static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) { -int temp; +u8 temp;/* Make sure the SMBus host is ready to start transmitting. */ temp =sis630_read (SMB_CNT );if ((temp & (SMB_PROBE |SMB_HOSTBUSY )) !=0x00 ) { -dev_dbg (&adap->dev,"SMBus busy (%02x). Resetting...\n" , temp); +dev_dbg (&adap->dev,"SMBus busy (%02hx). Resetting...\n" , temp);/* kill smbus transaction */ sis630_write (SMBHOST_CNT ,SMB_KILL ); temp =sis630_read (SMB_CNT );if (temp & (SMB_PROBE |SMB_HOSTBUSY )) { -dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp); +dev_dbg (&adap->dev,"Failed! (%02hx)\n" , temp);return -EBUSY ; }else {dev_dbg (&adap->dev,"Successful!\n" );
@@ -173,7 +173,7 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc/* save old clock, so we can prevent machine for hung */ *oldclock =sis630_read (SMB_CNT ); -dev_dbg (&adap->dev,"saved clock 0x%02x\n" , *oldclock); +dev_dbg (&adap->dev,"saved clock 0x%02hx\n" , *oldclock);/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ if (high_clock)
@@ -193,7 +193,8 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcstatic int sis630_transaction_wait (struct i2c_adapter *adap,int size) { -int temp, result =0 , timeout =0 ; +u8 temp; +int result =0 , timeout =0 ;/* We will always wait for a fraction of a second! */ do {
@@ -228,7 +229,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)/* clear all status "sticky" bits */ sis630_write (SMB_STS ,0xFF ); -dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02hx\n" , +sis630_read (SMB_CNT ));/* * restore old Host Master Clock if high_clock is set
@@ -237,7 +239,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)if (high_clock && !(oldclock &SMBCLK_SEL ))sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL ); -dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02hx\n" , +sis630_read (SMB_CNT )); }static int sis630_transaction (struct i2c_adapter *adap,int size)
@@ -266,8 +269,8 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datelse if (len >32 ) len =32 ;sis630_write (SMB_COUNT , len); -for (i=1 ; i <= len; i++) { -dev_dbg (&adap->dev,"set data 0x%02x\n" , data->block[i]); +for (i =1 ; i <= len; i++) { +dev_dbg (&adap->dev,"set data 0x%02hx\n" , data->block[i]);/* set data */ sis630_write (SMB_BYTE +(i-1 )%8 , data->block[i]);if (i==8 || (len<8 && i==len)) {
@@ -319,7 +322,7 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datif (data->block[0 ] >32 ) data->block[0 ] =32 ; -dev_dbg (&adap->dev,"block data read len=0x%x\n" , data->block[0 ]); +dev_dbg (&adap->dev,"block data read len=0x%hx\n" , data->block[0 ]);for (i=0 ; i <8 && len < data->block[0 ]; i++,len++) {dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, len);
@@ -463,7 +466,7 @@ static int sis630_setup(struct pci_dev *sis630_dev) goto exit; } -dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04x\n" , acpi_base); +dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04hx\n" , acpi_base);if (supported[i] ==PCI_DEVICE_ID_SI_760 ) smbus_base = acpi_base +0xE0 ;
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-6-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v2 5/6] Misc: display unsigned hex
Quoted 13 lines · Amaury Decrême
This patch corrects the display of unsigned hex values.
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-)drivers/i2c/busses/i2c-sis630.c +0
-0@@ -152,18 +152,18 @@ static inline void sis630_write(u8 reg, u8 data)
drivers/i2c/busses/i2c-sis630.c static inline void sis630_write(u8 reg, u8 data) · line 160
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +2
-2static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) { -int temp; +u8 temp;/* Make sure the SMBus host is ready to start transmitting. */ temp =sis630_read (SMB_CNT );if ((temp & (SMB_PROBE |SMB_HOSTBUSY )) !=0x00 ) { -dev_dbg (&adap->dev,"SMBus busy (%02x). Resetting...\n" , temp); +dev_dbg (&adap->dev,"SMBus busy (%02hx). Resetting...\n" , temp);
%hx is for shorts, not bytes. There is no format specifier for shorts, so a cast is always needed for these if you want to be strictly compliant. In practice gcc is smart enough to do the cast automatically. Same for most cases below.
My suggestion to use %hx was really only for the cases where the variable is an unsigned short or u16, you can leave all the rest as is.
Quoted 78 lines
drivers/i2c/busses/i2c-sis630.c +12
-9/* kill smbus transaction */ sis630_write (SMBHOST_CNT ,SMB_KILL ); temp =sis630_read (SMB_CNT );if (temp & (SMB_PROBE |SMB_HOSTBUSY )) { -dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp); +dev_dbg (&adap->dev,"Failed! (%02hx)\n" , temp);return -EBUSY ; }else {dev_dbg (&adap->dev,"Successful!\n" );@@ -173,7 +173,7 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc/* save old clock, so we can prevent machine for hung */ *oldclock =sis630_read (SMB_CNT ); -dev_dbg (&adap->dev,"saved clock 0x%02x\n" , *oldclock); +dev_dbg (&adap->dev,"saved clock 0x%02hx\n" , *oldclock);/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ if (high_clock)@@ -193,7 +193,8 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcstatic int sis630_transaction_wait (struct i2c_adapter *adap,int size) { -int temp, result =0 , timeout =0 ; +u8 temp; +int result =0 , timeout =0 ;/* We will always wait for a fraction of a second! */ do {@@ -228,7 +229,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)/* clear all status "sticky" bits */ sis630_write (SMB_STS ,0xFF ); -dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02hx\n" , +sis630_read (SMB_CNT ));/* * restore old Host Master Clock if high_clock is set @@ -237,7 +239,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)if (high_clock && !(oldclock &SMBCLK_SEL ))sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL ); -dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02hx\n" , +sis630_read (SMB_CNT )); }static int sis630_transaction (struct i2c_adapter *adap,int size)@@ -266,8 +269,8 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datelse if (len >32 ) len =32 ;sis630_write (SMB_COUNT , len); -for (i=1 ; i <= len; i++) { -dev_dbg (&adap->dev,"set data 0x%02x\n" , data->block[i]); +for (i =1 ; i <= len; i++) { +dev_dbg (&adap->dev,"set data 0x%02hx\n" , data->block[i]);/* set data */ sis630_write (SMB_BYTE +(i-1 )%8 , data->block[i]);if (i==8 || (len<8 && i==len)) {@@ -319,7 +322,7 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datif (data->block[0 ] >32 ) data->block[0 ] =32 ; -dev_dbg (&adap->dev,"block data read len=0x%x\n" , data->block[0 ]); +dev_dbg (&adap->dev,"block data read len=0x%hx\n" , data->block[0 ]);for (i=0 ; i <8 && len < data->block[0 ]; i++,len++) {dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, len);@@ -463,7 +466,7 @@ static int sis630_setup(struct pci_dev *sis630_dev) goto exit; } -dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04x\n" , acpi_base); +dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04hx\n" , acpi_base);if (supported[i] ==PCI_DEVICE_ID_SI_760 ) smbus_base = acpi_base +0xE0 ;
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 5/6] Misc: display unsigned hex
Quoted 11 lines · Jean Delvare
drivers/i2c/busses/i2c-sis630.c static inline void sis630_write(u8 reg, u8 data) · line 160
Quoted 2 lines
drivers/i2c/busses/i2c-sis630.c +1
-1-dev_dbg (&adap->dev,"SMBus busy (%02x). Resetting...\n" , temp); +dev_dbg (&adap->dev,"SMBus busy (%02hx). Resetting...\n" , temp);%hx is for shorts, not bytes. There is no format specifier for shorts, so a cast is always needed for these if you want to be strictly compliant. In practice gcc is smart enough to do the cast automatically. Same for most cases below.
My suggestion to use %hx was really only for the cases where the variable is an unsigned short or u16, you can leave all the rest as is.
I indeed missed that point. Corrected.
Signature · 1 line
Amaury Decrême
PATCH v2 6/6 Cleanup
In reply to a message not in the archiveThis patch corrects checkpatch errors.
Some "80 columns" warnings have been expressly omitted to keep reading easy.
The changes has also been removed as it has less meaning with version control tools.
--- drivers/i2c/busses/i2c-sis630.c | 175 ++++++++++++++++++--------------------- 1 files changed, 82 insertions(+), 93 deletions(-)
drivers/i2c/busses/i2c-sis630.c +82 -93
@@ -16,24 +16,6 @@Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* -Changes: -24.08.2002 -Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) -Changed sis630_transaction.(Thanks to Mark M. Hoffman) -18.09.2002 -Added SIS730 as supported. -21.09.2002 -Added high_clock module option.If this option is set -used Host Master Clock 56KHz (default 14KHz).For now we save old Host -Master Clock and after transaction completed restore (otherwise -it's confuse BIOS and hung Machine). -24.09.2002 -Fixed typo in sis630_access -Fixed logical error by restoring of Host Master Clock -31.07.2003 -Added block data read/write support. -*/ /* Status: beta
@@ -150,9 +132,10 @@ static inline void sis630_write(u8 reg, u8 data)outb (data, smbus_base + reg); } -static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) +static int sis630_transaction_start (struct i2c_adapter *adap,int size, +u8 *oldclock) { -u8 temp; +u8 temp;/* Make sure the SMBus host is ready to start transmitting. */ temp =sis630_read (SMB_CNT );
@@ -165,17 +148,18 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcif (temp & (SMB_PROBE |SMB_HOSTBUSY )) {dev_dbg (&adap->dev,"Failed! (%02hx)\n" , temp);return -EBUSY ; - }else { + }else {dev_dbg (&adap->dev,"Successful!\n" ); } - } + }/* save old clock, so we can prevent machine for hung */ *oldclock =sis630_read (SMB_CNT );dev_dbg (&adap->dev,"saved clock 0x%02hx\n" , *oldclock); -/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ +/* disable timeout interrupt, +* set Host Master Clock to 56KHz if requested */ if (high_clock)sis630_write (SMB_CNT ,SMBCLK_SEL );else
@@ -257,7 +241,8 @@ static int sis630_transaction(struct i2c_adapter *adap, int size)return result; } -static int sis630_block_data (struct i2c_adapter *adap,union i2c_smbus_data *data,int read_write) +static int sis630_block_data (struct i2c_adapter *adap, +union i2c_smbus_data *data,int read_write) {int i, len =0 , rc =0 ;u8 oldclock =0 ;
@@ -272,19 +257,18 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datfor (i =1 ; i <= len; i++) {dev_dbg (&adap->dev,"set data 0x%02hx\n" , data->block[i]);/* set data */ -sis630_write (SMB_BYTE +(i-1 )%8 , data->block[i]); -if (i==8 || (len<8 && i==len)) { -dev_dbg (&adap->dev,"start trans len=%d i=%d\n" ,len ,i); +sis630_write (SMB_BYTE + (i -1 ) %8 , data->block[i]); +if (i ==8 || (len <8 && i == len)) { +dev_dbg (&adap->dev,"start trans len=%d i=%d\n" , len, i);/* first transaction */ rc =sis630_transaction_start (adap,SIS630_BLOCK_DATA , &oldclock);if (rc)return rc; - } -else if ((i-1 )%8 ==7 || i==len) { -dev_dbg (&adap->dev,"trans_wait len=%d i=%d\n" ,len,i); -if (i>8 ) { -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); + }else if ((i -1 ) %8 ==7 || i == len) { +dev_dbg (&adap->dev,"trans_wait len=%d i=%d\n" , len, i); +if (i >8 ) { +dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" , len, i);/* If this is not first transaction, we must clear sticky bit.
@@ -300,8 +284,7 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat } } } - } -else { + }else {/* read request */ data->block[0 ] = len =0 ; rc = sis630_transaction_start(adap,
@@ -324,12 +307,12 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datdev_dbg (&adap->dev,"block data read len=0x%hx\n" , data->block[0 ]); -for (i=0 ; i <8 && len < data->block[0 ]; i++,len++) { +for (i =0 ; i <8 && len < data->block[0 ]; i++, len++) {dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, len); - data->block[len+1 ] =sis630_read (SMB_BYTE +i); + data->block[len +1 ] =sis630_read (SMB_BYTE + i); } -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); +dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" , len, i);/* clear SMBARY_STS */ sis630_write (SMB_STS ,BYTE_DONE_STS );
@@ -349,42 +332,47 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,int status;switch (size) { -case I2C_SMBUS_QUICK : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); - size =SIS630_QUICK ; -break ; -case I2C_SMBUS_BYTE : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_CMD , command); - size =SIS630_BYTE ; -break ; -case I2C_SMBUS_BYTE_DATA : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_BYTE , data->byte); - size =SIS630_BYTE_DATA ; -break ; -case I2C_SMBUS_PROC_CALL : -case I2C_SMBUS_WORD_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); +case I2C_SMBUS_QUICK : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); + size =SIS630_QUICK ; +break ; +case I2C_SMBUS_BYTE : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +if (read_write ==I2C_SMBUS_WRITE )sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) { -sis630_write (SMB_BYTE , data->word &0xff ); -sis630_write (SMB_BYTE +1 ,(data->word &0xff00 ) >>8 ); - } - size = (size ==I2C_SMBUS_PROC_CALL ?SIS630_PCALL :SIS630_WORD_DATA ); -break ; -case I2C_SMBUS_BLOCK_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); - size =SIS630_BLOCK_DATA ; -return sis630_block_data (adap, data, read_write); -default : -dev_warn (&adap->dev,"Unsupported transaction %d\n" , - size); -return -EOPNOTSUPP ; + size =SIS630_BYTE ; +break ; +case I2C_SMBUS_BYTE_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) +sis630_write (SMB_BYTE , data->byte); + size =SIS630_BYTE_DATA ; +break ; +case I2C_SMBUS_PROC_CALL : +case I2C_SMBUS_WORD_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) { +sis630_write (SMB_BYTE , data->word &0xff ); +sis630_write (SMB_BYTE +1 , (data->word &0xff00 ) >>8 ); + } + size = (size ==I2C_SMBUS_PROC_CALL ?SIS630_PCALL : +SIS630_WORD_DATA ); +break ; +case I2C_SMBUS_BLOCK_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); + size =SIS630_BLOCK_DATA ; +return sis630_block_data (adap, data, read_write); +default : +dev_warn (&adap->dev,"Unsupported transaction %d\n" , size); +return -EOPNOTSUPP ; } status =sis630_transaction (adap, size);
@@ -396,15 +384,16 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,return 0 ; } -switch (size) { -case SIS630_BYTE : -case SIS630_BYTE_DATA : - data->byte =sis630_read (SMB_BYTE ); -break ; -case SIS630_PCALL : -case SIS630_WORD_DATA : - data->word =sis630_read (SMB_BYTE ) + (sis630_read (SMB_BYTE +1 ) <<8 ); -break ; +switch (size) { +case SIS630_BYTE : +case SIS630_BYTE_DATA : + data->byte =sis630_read (SMB_BYTE ); +break ; +case SIS630_PCALL : +case SIS630_WORD_DATA : + data->word =sis630_read (SMB_BYTE ) + + (sis630_read (SMB_BYTE +1 ) <<8 ); +break ; }return 0 ;
@@ -412,9 +401,9 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,static u32 sis630_func (struct i2c_adapter *adapter) { -return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE |I2C_FUNC_SMBUS_BYTE_DATA | -I2C_FUNC_SMBUS_WORD_DATA |I2C_FUNC_SMBUS_PROC_CALL | -I2C_FUNC_SMBUS_BLOCK_DATA ; +return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE | +I2C_FUNC_SMBUS_BYTE_DATA |I2C_FUNC_SMBUS_WORD_DATA | +I2C_FUNC_SMBUS_PROC_CALL |I2C_FUNC_SMBUS_BLOCK_DATA ; }static int sis630_setup (struct pci_dev *sis630_dev)
@@ -426,19 +415,18 @@ static int sis630_setup(struct pci_dev *sis630_dev)unsigned short acpi_base;/* check for supported SiS devices */ -for (i=0 ; supported[i] >0 ; i++) { -if ((dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy))) +for (i =0 ; supported[i] >0 ; i++) { + dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy); +if (dummy)break ;/* found */ }if (dummy) {pci_dev_put (dummy); - } -else if (force) { + }else if (force) {dev_err (&sis630_dev->dev,"WARNING: Can't detect SIS630 compatible device, but " "loading because of force option enabled\n" ); - } -else { + }else {return -ENODEV ; }
@@ -446,7 +434,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)Enable ACPI first , so we can accsess reg 74-75 in acpi io space and read acpi base addr */ -if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG ,&b)) { +if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG , &b)) {dev_err (&sis630_dev->dev,"Error: Can't read bios ctl reg\n" ); retval = -ENODEV ; goto exit;
@@ -460,7 +448,8 @@ static int sis630_setup(struct pci_dev *sis630_dev) }/* Determine the ACPI base address */ -if (pci_read_config_word (sis630_dev,SIS630_ACPI_BASE_REG ,&acpi_base)) { +if (pci_read_config_word (sis630_dev, +SIS630_ACPI_BASE_REG , &acpi_base)) {dev_err (&sis630_dev->dev,"Error: Can't determine ACPI base address\n" ); retval = -ENODEV ; goto exit;
@@ -519,7 +508,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = { { 0, } }; -MODULE_DEVICE_TABLE (pci, sis630_ids); +MODULE_DEVICE_TABLE (pci, sis630_ids);static int sis630_probe (struct pci_dev *dev,const struct pci_device_id *id) {
Signature · 1 line
1.7.8.6
A message that is not in the archive (sent off-list or not yet received): 1357305215-17643-7-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v2 6/6] Cleanup
Quoted 3 lines · Amaury Decrême
This patch corrects checkpatch errors.
Some "80 columns" warnings have been expressly omitted to keep reading easy.
You can get rid of these too by splitting the affected lines. You do not have to split the strings themselves, but the other parameters can be on different lines. checkpatch.pl will be silent once you get this right.
Quoted 25 lines
The changes has also been removed as it has less meaning with version control tools.
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 175 ++++++++++++++++++--------------------- 1 files changed, 82 insertions(+), 93 deletions(-)drivers/i2c/busses/i2c-sis630.c +0
-9@@ -16,24 +16,6 @@Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* -Changes: -24.08.2002 -Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) -Changed sis630_transaction.(Thanks to Mark M. Hoffman) -18.09.2002 -Added SIS730 as supported. -21.09.2002 -Added high_clock module option.If this option is set
drivers/i2c/busses/i2c-sis630.c line 19
Quoted 10 lines
drivers/i2c/busses/i2c-sis630.c +0
-9-used Host Master Clock 56KHz (default 14KHz).For now we save old Host -Master Clock and after transaction completed restore (otherwise -it's confuse BIOS and hung Machine). -24.09.2002 -Fixed typo in sis630_access -Fixed logical error by restoring of Host Master Clock -31.07.2003 -Added block data read/write support. -*/
You can delete one more blank line.
drivers/i2c/busses/i2c-sis630.c static inline void sis630_write(u8 reg, u8 data) · line 138
Quoted 12 lines
drivers/i2c/busses/i2c-sis630.c +3
-2/* Status: beta @@ -150,9 +132,10 @@ static inline void sis630_write(u8 reg, u8 data)outb (data, smbus_base + reg); } -static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) +static int sis630_transaction_start (struct i2c_adapter *adap,int size, +u8 *oldclock) { -u8 temp; +u8 temp;
This doesn't apply as the change is already present in a previous patch.
drivers/i2c/busses/i2c-sis630.c static inline void sis630_write(u8 reg, u8 data) · line 141
Quoted 4 lines
drivers/i2c/busses/i2c-sis630.c +0
-0/* Make sure the SMBus host is ready to start transmitting. */ temp =sis630_read (SMB_CNT );
All the rest looks good, thanks for doing that.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 6/6] Cleanup
Quoted 8 lines · Jean Delvare
Quoted 2 lines
Some "80 columns" warnings have been expressly omitted to keep reading easy.
You can get rid of these too by splitting the affected lines. You do not have to split the strings themselves, but the other parameters can be on different lines. checkpatch.pl will be silent once you get this right.
Thanks for the review.
"80 columns" warn removed without string splitting in v3.
Signature · 1 line
Amaury Decrême
Re: [PATCH v2 0/6] I2C: sis630: add sis964 support
In reply to a message not in the archiveQuoted 1 line · Amaury Decrême
Those patches add sis964 support to i2c-sis630.
Jean, if you have some free time, I'd appreciate your insight here.
Thanks,
Wolfram
A message that is not in the archive (sent off-list or not yet received): 20130124072818.GM8364-8EAEigeeuNG034pCzgS/[email protected]
Re: [PATCH v2 0/6] I2C: sis630: add sis964 support
Quoted 4 lines · Wolfram Sang
Quoted 1 line · Amaury Decrême
Those patches add sis964 support to i2c-sis630.
Jean, if you have some free time, I'd appreciate your insight here.
Yes, reviewing this patch set has been on my to-do list for a while but I have a hard time freeing some time to actually do it. I'll make my best to achieve this today.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
v3 cover I2C: sis630: add sis964 support
Those patches add sis964 support to i2c-sis630.
The SiS datasheets have been used.
The SiS964 isn't part of the SIS96X family and behaves like the SiS630 chip family.
For I2C, this array show the differences between a SiS630 and a SiS964.
+------------------------+--------------------+-------------------+ | | SIS630/730 | SIS964 | +------------------------+--------------------+-------------------+ | Clock | 14kHz/56kHz | 55.56kHz/27.78kHz | | SMBus registers offset | 0x80 | 0xE0 | | SMB_CNT | Bit 1 = Slave Busy | Bit 1 = Bus probe | | (not used yet) | Bit 3 is reserved | Bit 3 = Last byte | | SMB_PCOUNT | Offset + 0x06 | Offset + 0x14 | | SMB_COUNT | 4:0 bits | 5:0 bits | +------------------------+--------------------+-------------------+
Other differences don't affect the functions provided by the original driver.
Changes v2 -> v3:
Added a missing BYTE_DONE_STS in cosmetics patch Unsigned hex patch corrected
Checkpatch patch improved
Amaury Decrême (6):
Add SIS964 bus support to i2c-sis630.
Bugfix: clear sticky bits
Bugfix: behavior after collision
Cosmetics: hex to constants for SMBus commands
Misc: display unsigned hex
Cleanup
Documentation/i2c/busses/i2c-sis630 | 9 + drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 356 ++++++++++++++++++++---------------- 3 files changed, 209 insertions(+), 160 deletions(-)
Signature · 1 line
1.7.12.4
A message that is not in the archive (sent off-list or not yet received): 1359408070-31832-1-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v3 1/6 Add SIS964 bus support to i2c-sis630.
--- Documentation/i2c/busses/i2c-sis630 | 9 ++++ drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-sis630.c | 88 ++++++++++++++++++++++++------------- 3 files changed, 69 insertions(+), 32 deletions(-)
Documentation/i2c/busses/i2c-sis630 +9 -0
@@ -4,9 +4,11 @@ Supported adapters: * Silicon Integrated Systems Corp (SiS) 630 chipset (Datasheet: available at http://www.sfr-fresh.com/linux) 730 chipset + 964 chipset * Possible other SiS chipsets ? Author: Alexander Malysh <amalysh-S0/[email protected]> + Amaury Decrême <[email protected]> - SiS964 support Module Parameters -----------------
@@ -18,6 +20,7 @@ Module Parameters * high_clock = [1|0] Forcibly set Host Master Clock to 56KHz (default, what your BIOS use). DANGEROUS! This should be a bit faster, but freeze some systems (i.e. my Laptop). + SIS630/730 chip only. Description
@@ -36,6 +39,12 @@ or like this: 00:00.0 Host bridge: Silicon Integrated Systems [SiS] 730 Host (rev 02) 00:01.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 +or like this: + +00:00.0 Host bridge: Silicon Integrated Systems [SiS] 760/M760 Host (rev 02) +00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS964 [MuTIOL Media IO] + LPC Controller (rev 36) + in your 'lspci' output , then this driver is for your chipset. Thank You
drivers/i2c/busses/Kconfig +2 -2
@@ -186,11 +186,11 @@ config I2C_SIS5595 will be called i2c-sis5595. config I2C_SIS630 - tristate "SiS 630/730" + tristate "SiS 630/730/964" depends on PCI help If you say yes to this option, support will be included for the - SiS630 and SiS730 SMBus (a subset of I2C) interface. + SiS630, SiS730 and SiS964 SMBus (a subset of I2C) interface. This driver can also be built as a module. If so, the module will be called i2c-sis630.
drivers/i2c/busses/i2c-sis630.c +58 -30
171 lines not on this page · raw message
Signature · 1 line
1.7.12.4
PATCH v3 2/6 Bugfix: clear sticky bits
In reply to a message not in the archiveThe sticky bits must be cleared at the end of the transaction by writing a 1 to all fields.
Datasheet:
SMBus Status (SMB_STS)
The following registers are all sticky bits and only can be cleared by writing a one to their corresponding fields.
--- drivers/i2c/busses/i2c-sis630.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/i2c/busses/i2c-sis630.c +1 -3
@@ -213,10 +213,8 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)static void sis630_transaction_end (struct i2c_adapter *adap,u8 oldclock) { -int temp =0 ; -/* clear all status "sticky" bits */ -sis630_write (SMB_STS , temp); +sis630_write (SMB_STS ,0xFF );dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT ));
Signature · 1 line
1.7.12.4
PATCH v3 3/6 Bugfix: behavior after collision
In reply to a message not in the archiveDatasheet on collision:
SMBus Collision (SMBCOL_STS)
This bit is set when a SMBus Collision condition occurs and SMBus Host loses in the bus arbitration. The software should clear this bit and re-start SMBus operation.
As the status will be cleared in transaction_end, we can remove the sis630_write and prepare to return -EAGAIN to retry.
--- drivers/i2c/busses/i2c-sis630.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/i2c/busses/i2c-sis630.c +1 -6
@@ -200,12 +200,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)if (temp &0x04 ) {dev_err (&adap->dev,"Bus collision!\n" ); - result = -EIO ; -/* -TBD: Datasheet say: -the software should clear this bit and restart SMBUS operation. -Should we do it or user start request again? -*/ + result = -EAGAIN ; }return result;
Signature · 1 line
1.7.12.4
PATCH v3 4/6 Cosmetics: hex to constants for SMBus commands
In reply to a message not in the archiveThis patch replaces hexadecimal values by constants for SMBus commands.
--- drivers/i2c/busses/i2c-sis630.c | 45 ++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-)
drivers/i2c/busses/i2c-sis630.c +31 -14
@@ -81,6 +81,21 @@#define SMB_COUNT 0x07/* byte count */ #define SMB_BYTE 0x08/* ~0x8F data byte field */ +/* SMB_STS register */ +#define BYTE_DONE_STS 0x10/* Byte Done Status / Block Array */ +#define SMBCOL_STS 0x04/* Collision */ +#define SMBERR_STS 0x02/* Device error */ + +/* SMB_CNT register */ +#define MSTO_EN 0x40/* Host Master Timeout Enable */ +#define SMBCLK_SEL 0x20/* Host master clock selection */ +#define SMB_PROBE 0x02/* Bus Probe/Slave busy */ +#define SMB_HOSTBUSY 0x01/* Host Busy */ + +/* SMBHOST_CNT register */ +#define SMB_KILL 0x20/* Kill */ +#define SMB_START 0x10/* Start */ +/* register count for request_region * As we don't use SMB_PCOUNT, 20 is ok for SiS630 and SiS964 */
@@ -140,12 +155,14 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcint temp;/* Make sure the SMBus host is ready to start transmitting. */ -if ((temp =sis630_read (SMB_CNT ) &0x03 ) !=0x00 ) { -dev_dbg (&adap->dev,"SMBus busy (%02x).Resetting...\n" ,temp); + temp =sis630_read (SMB_CNT ); +if ((temp & (SMB_PROBE |SMB_HOSTBUSY )) !=0x00 ) { +dev_dbg (&adap->dev,"SMBus busy (%02x). Resetting...\n" , temp);/* kill smbus transaction */ -sis630_write (SMBHOST_CNT ,0x20 ); +sis630_write (SMBHOST_CNT ,SMB_KILL ); -if ((temp =sis630_read (SMB_CNT ) &0x03 ) !=0x00 ) { + temp =sis630_read (SMB_CNT ); +if (temp & (SMB_PROBE |SMB_HOSTBUSY )) {dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp);return -EBUSY ; }else {
@@ -160,16 +177,16 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ if (high_clock) -sis630_write (SMB_CNT ,0x20 ); +sis630_write (SMB_CNT ,SMBCLK_SEL );else -sis630_write (SMB_CNT , (*oldclock & ~0x40 )); +sis630_write (SMB_CNT , (*oldclock & ~MSTO_EN ));/* clear all sticky bits */ temp =sis630_read (SMB_STS );sis630_write (SMB_STS , temp &0x1e );/* start the transaction by setting bit 4 and size */ -sis630_write (SMBHOST_CNT ,0x10 | (size &0x07 )); +sis630_write (SMBHOST_CNT ,SMB_START | (size &0x07 ));return 0 ; }
@@ -183,7 +200,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)msleep (1 ); temp =sis630_read (SMB_STS );/* check if block transmitted */ -if (size ==SIS630_BLOCK_DATA && (temp &0x10 )) +if (size ==SIS630_BLOCK_DATA && (temp &BYTE_DONE_STS ))break ; }while (!(temp &0x0e ) && (timeout++ <MAX_TIMEOUT ));
@@ -193,12 +210,12 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size) result = -ETIMEDOUT ; } -if (temp &0x02 ) { +if (temp &SMBERR_STS ) {dev_dbg (&adap->dev,"Error: Failed bus transaction\n" ); result = -ENXIO ; } -if (temp &0x04 ) { +if (temp &SMBCOL_STS ) {dev_err (&adap->dev,"Bus collision!\n" ); result = -EAGAIN ; }
@@ -217,8 +234,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)* restore old Host Master Clock if high_clock is set * and oldclock was not 56KHz */ -if (high_clock && !(oldclock &0x20 )) -sis630_write (SMB_CNT ,(sis630_read (SMB_CNT ) & ~0x20 )); +if (high_clock && !(oldclock &SMBCLK_SEL )) +sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL );dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); }
@@ -270,7 +287,7 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datwe must clear sticky bit. clear SMBARY_STS */ -sis630_write (SMB_STS ,0x10 ); +sis630_write (SMB_STS ,BYTE_DONE_STS ); } rc =sis630_transaction_wait (adap,SIS630_BLOCK_DATA );
@@ -312,7 +329,7 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datdev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i);/* clear SMBARY_STS */ -sis630_write (SMB_STS ,0x10 ); +sis630_write (SMB_STS ,BYTE_DONE_STS ); }while (len < data->block[0 ]); }
Signature · 1 line
1.7.12.4
A message that is not in the archive (sent off-list or not yet received): 1359408070-31832-5-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Jean Delvare
Reviewed-byRe: [PATCH v3 4/6] Cosmetics: hex to constants for SMBus commands
Quoted 7 lines · Amaury Decrême
This patch replaces hexadecimal values by constants for SMBus commands.
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 45 ++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-)(...)
Signature · 1 line
Jean Delvare
PATCH v3 5/6 Misc: display unsigned hex
In reply to a message not in the archiveThis patch corrects the display of the acpi_base unsigned hex value.
--- drivers/i2c/busses/i2c-sis630.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-sis630.c +1 -1
@@ -463,7 +463,7 @@ static int sis630_setup(struct pci_dev *sis630_dev) goto exit; } -dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04x\n" , acpi_base); +dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04hx\n" , acpi_base);if (supported[i] ==PCI_DEVICE_ID_SI_760 ) smbus_base = acpi_base +0xE0 ;
Signature · 1 line
1.7.12.4
A message that is not in the archive (sent off-list or not yet received): 1359408070-31832-6-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Jean Delvare
Reviewed-byRe: [PATCH v3 5/6] Misc: display unsigned hex
Quoted 12 lines · Amaury Decrême
This patch corrects the display of the
acpi_baseunsigned hex value.Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-sis630.c +0
-0
drivers/i2c/busses/i2c-sis630.c static int sis630_setup(struct pci_dev *sis630_dev) · line 469
Quoted 8 lines
drivers/i2c/busses/i2c-sis630.c +1
-1@@ -463,7 +463,7 @@ static int sis630_setup(struct pci_dev *sis630_dev) goto exit; } -dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04x\n" , acpi_base); +dev_dbg (&sis630_dev->dev,"ACPI base at 0x%04hx\n" , acpi_base);if (supported[i] ==PCI_DEVICE_ID_SI_760 ) smbus_base = acpi_base +0xE0 ;
Signature · 1 line
Jean Delvare
PATCH v3 6/6 Cleanup
In reply to a message not in the archiveThis patch corrects checkpatch errors.
The changes has also been removed as it has less meaning with version control tools.
--- drivers/i2c/busses/i2c-sis630.c | 210 ++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 104 deletions(-)
drivers/i2c/busses/i2c-sis630.c +106 -104
@@ -17,25 +17,6 @@*/ /* -Changes: -24.08.2002 -Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) -Changed sis630_transaction.(Thanks to Mark M. Hoffman) -18.09.2002 -Added SIS730 as supported. -21.09.2002 -Added high_clock module option.If this option is set -used Host Master Clock 56KHz (default 14KHz).For now we save old Host -Master Clock and after transaction completed restore (otherwise -it's confuse BIOS and hung Machine). -24.09.2002 -Fixed typo in sis630_access -Fixed logical error by restoring of Host Master Clock -31.07.2003 -Added block data read/write support. -*/ - -/* Status: beta Supports:
@@ -150,9 +131,10 @@ static inline void sis630_write(u8 reg, u8 data)outb (data, smbus_base + reg); } -static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) +static int sis630_transaction_start (struct i2c_adapter *adap,int size, +u8 *oldclock) { -int temp; +int temp;/* Make sure the SMBus host is ready to start transmitting. */ temp =sis630_read (SMB_CNT );
@@ -165,17 +147,18 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcif (temp & (SMB_PROBE |SMB_HOSTBUSY )) {dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp);return -EBUSY ; - }else { + }else {dev_dbg (&adap->dev,"Successful!\n" ); } - } + }/* save old clock, so we can prevent machine for hung */ *oldclock =sis630_read (SMB_CNT );dev_dbg (&adap->dev,"saved clock 0x%02x\n" , *oldclock); -/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ +/* disable timeout interrupt, +* set Host Master Clock to 56KHz if requested */ if (high_clock)sis630_write (SMB_CNT ,SMBCLK_SEL );else
@@ -228,7 +211,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)/* clear all status "sticky" bits */ sis630_write (SMB_STS ,0xFF ); -dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev, +"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT ));/* * restore old Host Master Clock if high_clock is set
@@ -237,7 +221,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)if (high_clock && !(oldclock &SMBCLK_SEL ))sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL ); -dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev, +"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); }static int sis630_transaction (struct i2c_adapter *adap,int size)
@@ -254,7 +239,8 @@ static int sis630_transaction(struct i2c_adapter *adap, int size)return result; } -static int sis630_block_data (struct i2c_adapter *adap,union i2c_smbus_data *data,int read_write) +static int sis630_block_data (struct i2c_adapter *adap, +union i2c_smbus_data *data,int read_write) {int i, len =0 , rc =0 ;u8 oldclock =0 ;
@@ -266,22 +252,26 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datelse if (len >32 ) len =32 ;sis630_write (SMB_COUNT , len); -for (i=1 ; i <= len; i++) { -dev_dbg (&adap->dev,"set data 0x%02x\n" , data->block[i]); +for (i =1 ; i <= len; i++) { +dev_dbg (&adap->dev, +"set data 0x%02x\n" , data->block[i]);/* set data */ -sis630_write (SMB_BYTE +(i-1 )%8 , data->block[i]); -if (i==8 || (len<8 && i==len)) { -dev_dbg (&adap->dev,"start trans len=%d i=%d\n" ,len ,i); +sis630_write (SMB_BYTE + (i -1 ) %8 , data->block[i]); +if (i ==8 || (len <8 && i == len)) { +dev_dbg (&adap->dev, +"start trans len=%d i=%d\n" , len, i);/* first transaction */ rc =sis630_transaction_start (adap,SIS630_BLOCK_DATA , &oldclock);if (rc)return rc; - } -else if ((i-1 )%8 ==7 || i==len) { -dev_dbg (&adap->dev,"trans_wait len=%d i=%d\n" ,len,i); -if (i>8 ) { -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); + }else if ((i -1 ) %8 ==7 || i == len) { +dev_dbg (&adap->dev, +"trans_wait len=%d i=%d\n" , len, i); +if (i >8 ) { +dev_dbg (&adap->dev, +"clear smbary_sts len=%d i=%d\n" , len, + i);/* If this is not first transaction, we must clear sticky bit.
@@ -292,13 +282,13 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat rc =sis630_transaction_wait (adap,SIS630_BLOCK_DATA );if (rc) { -dev_dbg (&adap->dev,"trans_wait failed\n" ); +dev_dbg (&adap->dev, +"trans_wait failed\n" );break ; } } } - } -else { + }else {/* read request */ data->block[0 ] = len =0 ; rc = sis630_transaction_start(adap,
@@ -319,18 +309,22 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datif (data->block[0 ] >32 ) data->block[0 ] =32 ; -dev_dbg (&adap->dev,"block data read len=0x%x\n" , data->block[0 ]); +dev_dbg (&adap->dev, +"block data read len=0x%x\n" , data->block[0 ]); -for (i=0 ; i <8 && len < data->block[0 ]; i++,len++) { -dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, len); - data->block[len+1 ] =sis630_read (SMB_BYTE +i); +for (i =0 ; i <8 && len < data->block[0 ]; i++, len++) { +dev_dbg (&adap->dev, +"read i=%d len=%d\n" , i, len); + data->block[len +1 ] = +sis630_read (SMB_BYTE + i); } -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); +dev_dbg (&adap->dev, +"clear smbary_sts len=%d i=%d\n" , len, i);/* clear SMBARY_STS */ sis630_write (SMB_STS ,BYTE_DONE_STS ); - }while (len < data->block[0 ]); + }while (len < data->block[0 ]); }sis630_transaction_end (adap, oldclock);
@@ -346,42 +340,47 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,int status;switch (size) { -case I2C_SMBUS_QUICK : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); - size =SIS630_QUICK ; -break ; -case I2C_SMBUS_BYTE : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_CMD , command); - size =SIS630_BYTE ; -break ; -case I2C_SMBUS_BYTE_DATA : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_BYTE , data->byte); - size =SIS630_BYTE_DATA ; -break ; -case I2C_SMBUS_PROC_CALL : -case I2C_SMBUS_WORD_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); +case I2C_SMBUS_QUICK : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); + size =SIS630_QUICK ; +break ; +case I2C_SMBUS_BYTE : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +if (read_write ==I2C_SMBUS_WRITE )sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) { -sis630_write (SMB_BYTE , data->word &0xff ); -sis630_write (SMB_BYTE +1 ,(data->word &0xff00 ) >>8 ); - } - size = (size ==I2C_SMBUS_PROC_CALL ?SIS630_PCALL :SIS630_WORD_DATA ); -break ; -case I2C_SMBUS_BLOCK_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); - size =SIS630_BLOCK_DATA ; -return sis630_block_data (adap, data, read_write); -default : -dev_warn (&adap->dev,"Unsupported transaction %d\n" , - size); -return -EOPNOTSUPP ; + size =SIS630_BYTE ; +break ; +case I2C_SMBUS_BYTE_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) +sis630_write (SMB_BYTE , data->byte); + size =SIS630_BYTE_DATA ; +break ; +case I2C_SMBUS_PROC_CALL : +case I2C_SMBUS_WORD_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) { +sis630_write (SMB_BYTE , data->word &0xff ); +sis630_write (SMB_BYTE +1 , (data->word &0xff00 ) >>8 ); + } + size = (size ==I2C_SMBUS_PROC_CALL ?SIS630_PCALL : +SIS630_WORD_DATA ); +break ; +case I2C_SMBUS_BLOCK_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); + size =SIS630_BLOCK_DATA ; +return sis630_block_data (adap, data, read_write); +default : +dev_warn (&adap->dev,"Unsupported transaction %d\n" , size); +return -EOPNOTSUPP ; } status =sis630_transaction (adap, size);
@@ -393,15 +392,16 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,return 0 ; } -switch (size) { -case SIS630_BYTE : -case SIS630_BYTE_DATA : - data->byte =sis630_read (SMB_BYTE ); -break ; -case SIS630_PCALL : -case SIS630_WORD_DATA : - data->word =sis630_read (SMB_BYTE ) + (sis630_read (SMB_BYTE +1 ) <<8 ); -break ; +switch (size) { +case SIS630_BYTE : +case SIS630_BYTE_DATA : + data->byte =sis630_read (SMB_BYTE ); +break ; +case SIS630_PCALL : +case SIS630_WORD_DATA : + data->word =sis630_read (SMB_BYTE ) + + (sis630_read (SMB_BYTE +1 ) <<8 ); +break ; }return 0 ;
@@ -409,9 +409,9 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,static u32 sis630_func (struct i2c_adapter *adapter) { -return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE |I2C_FUNC_SMBUS_BYTE_DATA | -I2C_FUNC_SMBUS_WORD_DATA |I2C_FUNC_SMBUS_PROC_CALL | -I2C_FUNC_SMBUS_BLOCK_DATA ; +return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE | +I2C_FUNC_SMBUS_BYTE_DATA |I2C_FUNC_SMBUS_WORD_DATA | +I2C_FUNC_SMBUS_PROC_CALL |I2C_FUNC_SMBUS_BLOCK_DATA ; }static int sis630_setup (struct pci_dev *sis630_dev)
@@ -423,19 +423,19 @@ static int sis630_setup(struct pci_dev *sis630_dev)unsigned short acpi_base;/* check for supported SiS devices */ -for (i=0 ; supported[i] >0 ; i++) { -if ((dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy))) +for (i =0 ; supported[i] >0 ; i++) { + dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy); +if (dummy)break ;/* found */ }if (dummy) {pci_dev_put (dummy); - } -else if (force) { -dev_err (&sis630_dev->dev,"WARNING: Can't detect SIS630 compatible device, but " + }else if (force) { +dev_err (&sis630_dev->dev, +"WARNING: Can't detect SIS630 compatible device, but " "loading because of force option enabled\n" ); - } -else { + }else {return -ENODEV ; }
@@ -443,7 +443,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)Enable ACPI first , so we can accsess reg 74-75 in acpi io space and read acpi base addr */ -if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG ,&b)) { +if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG , &b)) {dev_err (&sis630_dev->dev,"Error: Can't read bios ctl reg\n" ); retval = -ENODEV ; goto exit;
@@ -457,8 +457,10 @@ static int sis630_setup(struct pci_dev *sis630_dev) }/* Determine the ACPI base address */ -if (pci_read_config_word (sis630_dev,SIS630_ACPI_BASE_REG ,&acpi_base)) { -dev_err (&sis630_dev->dev,"Error: Can't determine ACPI base address\n" ); +if (pci_read_config_word (sis630_dev, +SIS630_ACPI_BASE_REG , &acpi_base)) { +dev_err (&sis630_dev->dev, +"Error: Can't determine ACPI base address\n" ); retval = -ENODEV ; goto exit; }
@@ -516,7 +518,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = { { 0, } }; -MODULE_DEVICE_TABLE (pci, sis630_ids); +MODULE_DEVICE_TABLE (pci, sis630_ids);static int sis630_probe (struct pci_dev *dev,const struct pci_device_id *id) {
Signature · 1 line
1.7.12.4
A message that is not in the archive (sent off-list or not yet received): 1359408070-31832-7-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v3 6/6] Cleanup
Quoted 9 lines · Amaury Decrême
This patch corrects checkpatch errors.
The changes has also been removed as it has less meaning with version control tools.
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 210 ++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 104 deletions(-)
OK, this one needs a little more work to preserve code readability, see below. As the 5 other patches are OK, please do not resend them, only resend this one.
drivers/i2c/busses/i2c-sis630.c static inline void sis630_write(u8 reg, u8 data) · line 135
Quoted 12 lines
drivers/i2c/busses/i2c-sis630.c +2
-1@@ -150,9 +131,10 @@ static inline void sis630_write(u8 reg, u8 data)outb (data, smbus_base + reg); } -static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) +static int sis630_transaction_start (struct i2c_adapter *adap,int size, +u8 *oldclock)
The most common practice is to align the beginning of the second line with the opening parenthesis of the first. Like this:
static int sis630_transaction_start(struct i2c_adapter *adap, int size,
u8 *oldclock)
This is believed to be easier to read. Please do that everywhere it applies and your patch will be good to go.
drivers/i2c/busses/i2c-sis630.c static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat · line 273
Quoted 7 lines
drivers/i2c/busses/i2c-sis630.c +6
-0+ }else if ((i -1 ) %8 ==7 || i == len) { +dev_dbg (&adap->dev, +"trans_wait len=%d i=%d\n" , len, i); +if (i >8 ) { + dev_dbg(&adap->dev, + "clear smbary_sts len=%d i=%d\n", len,
Indentation is wrong here.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v4 1/1 Cleanup
This patch corrects checkpatch errors.
The changes has also been removed as it has less meaning with version control tools.
--- drivers/i2c/busses/i2c-sis630.c | 214 ++++++++++++++++++++-------------------- 1 file changed, 109 insertions(+), 105 deletions(-)
drivers/i2c/busses/i2c-sis630.c +109 -105
@@ -17,25 +17,6 @@*/ /* -Changes: -24.08.2002 -Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) -Changed sis630_transaction.(Thanks to Mark M. Hoffman) -18.09.2002 -Added SIS730 as supported. -21.09.2002 -Added high_clock module option.If this option is set -used Host Master Clock 56KHz (default 14KHz).For now we save old Host -Master Clock and after transaction completed restore (otherwise -it's confuse BIOS and hung Machine). -24.09.2002 -Fixed typo in sis630_access -Fixed logical error by restoring of Host Master Clock -31.07.2003 -Added block data read/write support. -*/ - -/* Status: beta Supports:
@@ -150,9 +131,10 @@ static inline void sis630_write(u8 reg, u8 data)outb (data, smbus_base + reg); } -static int sis630_transaction_start (struct i2c_adapter *adap,int size,u8 *oldclock) +static int sis630_transaction_start (struct i2c_adapter *adap,int size, +u8 *oldclock) { -int temp; +int temp;/* Make sure the SMBus host is ready to start transmitting. */ temp =sis630_read (SMB_CNT );
@@ -165,17 +147,18 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldcif (temp & (SMB_PROBE |SMB_HOSTBUSY )) {dev_dbg (&adap->dev,"Failed! (%02x)\n" , temp);return -EBUSY ; - }else { + }else {dev_dbg (&adap->dev,"Successful!\n" ); } - } + }/* save old clock, so we can prevent machine for hung */ *oldclock =sis630_read (SMB_CNT );dev_dbg (&adap->dev,"saved clock 0x%02x\n" , *oldclock); -/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ +/* disable timeout interrupt, +* set Host Master Clock to 56KHz if requested */ if (high_clock)sis630_write (SMB_CNT ,SMBCLK_SEL );else
@@ -228,7 +211,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)/* clear all status "sticky" bits */ sis630_write (SMB_STS ,0xFF ); -dev_dbg (&adap->dev,"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev, +"SMB_CNT before clock restore 0x%02x\n" ,sis630_read (SMB_CNT ));/* * restore old Host Master Clock if high_clock is set
@@ -237,7 +221,8 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock)if (high_clock && !(oldclock &SMBCLK_SEL ))sis630_write (SMB_CNT ,sis630_read (SMB_CNT ) & ~SMBCLK_SEL ); -dev_dbg (&adap->dev,"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); +dev_dbg (&adap->dev, +"SMB_CNT after clock restore 0x%02x\n" ,sis630_read (SMB_CNT )); }static int sis630_transaction (struct i2c_adapter *adap,int size)
@@ -254,7 +239,8 @@ static int sis630_transaction(struct i2c_adapter *adap, int size)return result; } -static int sis630_block_data (struct i2c_adapter *adap,union i2c_smbus_data *data,int read_write) +static int sis630_block_data (struct i2c_adapter *adap, +union i2c_smbus_data *data,int read_write) {int i, len =0 , rc =0 ;u8 oldclock =0 ;
@@ -266,22 +252,26 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datelse if (len >32 ) len =32 ;sis630_write (SMB_COUNT , len); -for (i=1 ; i <= len; i++) { -dev_dbg (&adap->dev,"set data 0x%02x\n" , data->block[i]); +for (i =1 ; i <= len; i++) { +dev_dbg (&adap->dev, +"set data 0x%02x\n" , data->block[i]);/* set data */ -sis630_write (SMB_BYTE +(i-1 )%8 , data->block[i]); -if (i==8 || (len<8 && i==len)) { -dev_dbg (&adap->dev,"start trans len=%d i=%d\n" ,len ,i); +sis630_write (SMB_BYTE + (i -1 ) %8 , data->block[i]); +if (i ==8 || (len <8 && i == len)) { +dev_dbg (&adap->dev, +"start trans len=%d i=%d\n" , len, i);/* first transaction */ rc =sis630_transaction_start (adap,SIS630_BLOCK_DATA , &oldclock);if (rc)return rc; - } -else if ((i-1 )%8 ==7 || i==len) { -dev_dbg (&adap->dev,"trans_wait len=%d i=%d\n" ,len,i); -if (i>8 ) { -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); + }else if ((i -1 ) %8 ==7 || i == len) { +dev_dbg (&adap->dev, +"trans_wait len=%d i=%d\n" , len, i); +if (i >8 ) { +dev_dbg (&adap->dev, +"clear smbary_sts" +" len=%d i=%d\n" , len, i);/* If this is not first transaction, we must clear sticky bit.
@@ -292,13 +282,13 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *dat rc =sis630_transaction_wait (adap,SIS630_BLOCK_DATA );if (rc) { -dev_dbg (&adap->dev,"trans_wait failed\n" ); +dev_dbg (&adap->dev, +"trans_wait failed\n" );break ; } } } - } -else { + }else {/* read request */ data->block[0 ] = len =0 ; rc = sis630_transaction_start(adap,
@@ -319,18 +309,22 @@ static int sis630_block_data(struct i2c_adapter *adap, union i2c_smbus_data *datif (data->block[0 ] >32 ) data->block[0 ] =32 ; -dev_dbg (&adap->dev,"block data read len=0x%x\n" , data->block[0 ]); +dev_dbg (&adap->dev, +"block data read len=0x%x\n" , data->block[0 ]); -for (i=0 ; i <8 && len < data->block[0 ]; i++,len++) { -dev_dbg (&adap->dev,"read i=%d len=%d\n" , i, len); - data->block[len+1 ] =sis630_read (SMB_BYTE +i); +for (i =0 ; i <8 && len < data->block[0 ]; i++, len++) { +dev_dbg (&adap->dev, +"read i=%d len=%d\n" , i, len); + data->block[len +1 ] =sis630_read (SMB_BYTE + + i); } -dev_dbg (&adap->dev,"clear smbary_sts len=%d i=%d\n" ,len,i); +dev_dbg (&adap->dev, +"clear smbary_sts len=%d i=%d\n" , len, i);/* clear SMBARY_STS */ sis630_write (SMB_STS ,BYTE_DONE_STS ); - }while (len < data->block[0 ]); + }while (len < data->block[0 ]); }sis630_transaction_end (adap, oldclock);
@@ -346,42 +340,47 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,int status;switch (size) { -case I2C_SMBUS_QUICK : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); - size =SIS630_QUICK ; -break ; -case I2C_SMBUS_BYTE : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_CMD , command); - size =SIS630_BYTE ; -break ; -case I2C_SMBUS_BYTE_DATA : -sis630_write (SMB_ADDR , ((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) -sis630_write (SMB_BYTE , data->byte); - size =SIS630_BYTE_DATA ; -break ; -case I2C_SMBUS_PROC_CALL : -case I2C_SMBUS_WORD_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); +case I2C_SMBUS_QUICK : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); + size =SIS630_QUICK ; +break ; +case I2C_SMBUS_BYTE : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +if (read_write ==I2C_SMBUS_WRITE )sis630_write (SMB_CMD , command); -if (read_write ==I2C_SMBUS_WRITE ) { -sis630_write (SMB_BYTE , data->word &0xff ); -sis630_write (SMB_BYTE +1 ,(data->word &0xff00 ) >>8 ); - } - size = (size ==I2C_SMBUS_PROC_CALL ?SIS630_PCALL :SIS630_WORD_DATA ); -break ; -case I2C_SMBUS_BLOCK_DATA : -sis630_write (SMB_ADDR ,((addr &0x7f ) <<1 ) | (read_write &0x01 )); -sis630_write (SMB_CMD , command); - size =SIS630_BLOCK_DATA ; -return sis630_block_data (adap, data, read_write); -default : -dev_warn (&adap->dev,"Unsupported transaction %d\n" , - size); -return -EOPNOTSUPP ; + size =SIS630_BYTE ; +break ; +case I2C_SMBUS_BYTE_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) +sis630_write (SMB_BYTE , data->byte); + size =SIS630_BYTE_DATA ; +break ; +case I2C_SMBUS_PROC_CALL : +case I2C_SMBUS_WORD_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); +if (read_write ==I2C_SMBUS_WRITE ) { +sis630_write (SMB_BYTE , data->word &0xff ); +sis630_write (SMB_BYTE +1 , (data->word &0xff00 ) >>8 ); + } + size = (size ==I2C_SMBUS_PROC_CALL ? +SIS630_PCALL :SIS630_WORD_DATA ); +break ; +case I2C_SMBUS_BLOCK_DATA : +sis630_write (SMB_ADDR , + ((addr &0x7f ) <<1 ) | (read_write &0x01 )); +sis630_write (SMB_CMD , command); + size =SIS630_BLOCK_DATA ; +return sis630_block_data (adap, data, read_write); +default : +dev_warn (&adap->dev,"Unsupported transaction %d\n" , size); +return -EOPNOTSUPP ; } status =sis630_transaction (adap, size);
@@ -393,15 +392,16 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,return 0 ; } -switch (size) { -case SIS630_BYTE : -case SIS630_BYTE_DATA : - data->byte =sis630_read (SMB_BYTE ); -break ; -case SIS630_PCALL : -case SIS630_WORD_DATA : - data->word =sis630_read (SMB_BYTE ) + (sis630_read (SMB_BYTE +1 ) <<8 ); -break ; +switch (size) { +case SIS630_BYTE : +case SIS630_BYTE_DATA : + data->byte =sis630_read (SMB_BYTE ); +break ; +case SIS630_PCALL : +case SIS630_WORD_DATA : + data->word =sis630_read (SMB_BYTE ) + + (sis630_read (SMB_BYTE +1 ) <<8 ); +break ; }return 0 ;
@@ -409,9 +409,9 @@ static s32 sis630_access(struct i2c_adapter *adap, u16 addr,static u32 sis630_func (struct i2c_adapter *adapter) { -return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE |I2C_FUNC_SMBUS_BYTE_DATA | -I2C_FUNC_SMBUS_WORD_DATA |I2C_FUNC_SMBUS_PROC_CALL | -I2C_FUNC_SMBUS_BLOCK_DATA ; +return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE | +I2C_FUNC_SMBUS_BYTE_DATA |I2C_FUNC_SMBUS_WORD_DATA | +I2C_FUNC_SMBUS_PROC_CALL |I2C_FUNC_SMBUS_BLOCK_DATA ; }static int sis630_setup (struct pci_dev *sis630_dev)
@@ -423,19 +423,19 @@ static int sis630_setup(struct pci_dev *sis630_dev)unsigned short acpi_base;/* check for supported SiS devices */ -for (i=0 ; supported[i] >0 ; i++) { -if ((dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy))) +for (i =0 ; supported[i] >0 ; i++) { + dummy =pci_get_device (PCI_VENDOR_ID_SI , supported[i], dummy); +if (dummy)break ;/* found */ }if (dummy) {pci_dev_put (dummy); - } -else if (force) { -dev_err (&sis630_dev->dev,"WARNING: Can't detect SIS630 compatible device, but " + }else if (force) { +dev_err (&sis630_dev->dev, +"WARNING: Can't detect SIS630 compatible device, but " "loading because of force option enabled\n" ); - } -else { + }else {return -ENODEV ; }
@@ -443,7 +443,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)Enable ACPI first , so we can accsess reg 74-75 in acpi io space and read acpi base addr */ -if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG ,&b)) { +if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG , &b)) {dev_err (&sis630_dev->dev,"Error: Can't read bios ctl reg\n" ); retval = -ENODEV ; goto exit;
@@ -457,8 +457,10 @@ static int sis630_setup(struct pci_dev *sis630_dev) }/* Determine the ACPI base address */ -if (pci_read_config_word (sis630_dev,SIS630_ACPI_BASE_REG ,&acpi_base)) { -dev_err (&sis630_dev->dev,"Error: Can't determine ACPI base address\n" ); +if (pci_read_config_word (sis630_dev, +SIS630_ACPI_BASE_REG , &acpi_base)) { +dev_err (&sis630_dev->dev, +"Error: Can't determine ACPI base address\n" ); retval = -ENODEV ; goto exit; }
@@ -516,12 +518,14 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = { { 0, } }; -MODULE_DEVICE_TABLE (pci, sis630_ids); +MODULE_DEVICE_TABLE (pci, sis630_ids);static int sis630_probe (struct pci_dev *dev,const struct pci_device_id *id) {if (sis630_setup (dev)) { -dev_err (&dev->dev,"SIS630 comp. bus not detected, module not inserted.\n" ); +dev_err (&dev->dev, +"SIS630 compatible bus not detected, " +"module not inserted.\n" );return -ENODEV ; }
Signature · 1 line
1.7.12.4
A message that is not in the archive (sent off-list or not yet received): 1359490946-24005-1-git-send-email-amaury.decreme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Jean Delvare
Reviewed-byRe: [PATCH v4] Cleanup
Quoted 10 lines · Amaury Decrême
This patch corrects checkpatch errors.
The changes has also been removed as it has less meaning with version control tools.
Signed-off-by Amaury Decrême <[email protected]>--- drivers/i2c/busses/i2c-sis630.c | 214 ++++++++++++++++++++-------------------- 1 file changed, 109 insertions(+), 105 deletions(-)(...)
Yes, that's good enough this time. Thanks!
Wolfram, you can apply the full series now.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v4] Cleanup
Quoted 8 lines · Jean Delvare
Yes, that's good enough this time. Thanks!
Reviewed-by Jean Delvare <[email protected]>Wolfram, you can apply the full series now.
Signature · 1 line
Jean Delvare
Thanks for your time and your reviews.
Signature · 1 line
Amaury Decrême