Commit 3a1eb5cd authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] i2c i2c-i801.c: fix up formatting and whitespace issues.

Also made everything static, no global functions are needed here.
parent e6dffc04
...@@ -49,8 +49,6 @@ ...@@ -49,8 +49,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <asm/io.h> #include <asm/io.h>
MODULE_LICENSE("GPL");
#ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC #ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC
#define HAVE_PEC #define HAVE_PEC
#endif #endif
...@@ -104,10 +102,6 @@ MODULE_PARM_DESC(force_addr, ...@@ -104,10 +102,6 @@ MODULE_PARM_DESC(force_addr,
"Forcibly enable the I801 at the given address. " "Forcibly enable the I801 at the given address. "
"EXTREMELY DANGEROUS!"); "EXTREMELY DANGEROUS!");
static void i801_do_pause(unsigned int amount); static void i801_do_pause(unsigned int amount);
static int i801_transaction(void); static int i801_transaction(void);
static int i801_block_transaction(union i2c_smbus_data *data, static int i801_block_transaction(union i2c_smbus_data *data,
...@@ -132,7 +126,7 @@ static int i801_setup(struct pci_dev *dev) ...@@ -132,7 +126,7 @@ static int i801_setup(struct pci_dev *dev)
else else
isich4 = 0; isich4 = 0;
/* Determine the address of the SMBus areas */ /* Determine the address of the SMBus areas */
if (force_addr) { if (force_addr) {
i801_smba = force_addr & 0xfff0; i801_smba = force_addr & 0xfff0;
} else { } else {
...@@ -155,7 +149,8 @@ static int i801_setup(struct pci_dev *dev) ...@@ -155,7 +149,8 @@ static int i801_setup(struct pci_dev *dev)
pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); pci_read_config_byte(I801_dev, SMBHSTCFG, &temp);
temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */
pci_write_config_byte(I801_dev, SMBHSTCFG, temp); pci_write_config_byte(I801_dev, SMBHSTCFG, temp);
/* If force_addr is set, we program the new address here. Just to make
/* If force_addr is set, we program the new address here. Just to make
sure, we disable the device first. */ sure, we disable the device first. */
if (force_addr) { if (force_addr) {
pci_write_config_byte(I801_dev, SMBHSTCFG, temp & 0xfe); pci_write_config_byte(I801_dev, SMBHSTCFG, temp & 0xfe);
...@@ -177,18 +172,18 @@ static int i801_setup(struct pci_dev *dev) ...@@ -177,18 +172,18 @@ static int i801_setup(struct pci_dev *dev)
dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp); dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp);
dev_dbg(&dev->dev, "I801_smba = 0x%X\n", i801_smba); dev_dbg(&dev->dev, "I801_smba = 0x%X\n", i801_smba);
END: END:
return error_return; return error_return;
} }
void i801_do_pause(unsigned int amount) static void i801_do_pause(unsigned int amount)
{ {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(amount); schedule_timeout(amount);
} }
int i801_transaction(void) static int i801_transaction(void)
{ {
int temp; int temp;
int result = 0; int result = 0;
...@@ -259,7 +254,7 @@ int i801_transaction(void) ...@@ -259,7 +254,7 @@ int i801_transaction(void)
} }
/* All-inclusive block transaction function */ /* All-inclusive block transaction function */
int i801_block_transaction(union i2c_smbus_data *data, char read_write, static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
int command) int command)
{ {
int i, len; int i, len;
...@@ -303,10 +298,6 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write, ...@@ -303,10 +298,6 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write,
smbcmd = I801_BLOCK_LAST; smbcmd = I801_BLOCK_LAST;
else else
smbcmd = I801_BLOCK_DATA; smbcmd = I801_BLOCK_DATA;
#if 0 /* now using HW PEC */
if(isich4 && command == I2C_SMBUS_BLOCK_DATA_PEC)
smbcmd |= I801_PEC_EN;
#endif
outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT); outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT);
dev_dbg(&I801_dev->dev, "Block (pre %d): CNT=%02x, CMD=%02x, " dev_dbg(&I801_dev->dev, "Block (pre %d): CNT=%02x, CMD=%02x, "
...@@ -336,20 +327,14 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write, ...@@ -336,20 +327,14 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write,
goto END; goto END;
} }
if (i != 1) { if (i != 1) {
result = -1; /* if die in middle of block transaction, fail */ /* if die in middle of block transaction, fail */
result = -1;
goto END; goto END;
} }
} }
if (i == 1) { if (i == 1)
#if 0 /* #ifdef HAVE_PEC (now using HW PEC) */
if(isich4 && command == I2C_SMBUS_BLOCK_DATA_PEC) {
if(read_write == I2C_SMBUS_WRITE)
outb_p(data->block[len + 1], SMBPEC);
}
#endif
outb_p(inb(SMBHSTCNT) | I801_START, SMBHSTCNT); outb_p(inb(SMBHSTCNT) | I801_START, SMBHSTCNT);
}
/* We will always wait for a fraction of a second! */ /* We will always wait for a fraction of a second! */
timeout = 0; timeout = 0;
...@@ -422,11 +407,6 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write, ...@@ -422,11 +407,6 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write,
if (timeout >= MAX_TIMEOUT) { if (timeout >= MAX_TIMEOUT) {
dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); dev_dbg(&I801_dev->dev, "PEC Timeout!\n");
} }
#if 0 /* now using HW PEC */
if(read_write == I2C_SMBUS_READ) {
data->block[len + 1] = inb_p(SMBPEC);
}
#endif
outb_p(temp, SMBHSTSTS); outb_p(temp, SMBHSTSTS);
} }
#endif #endif
...@@ -440,9 +420,9 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write, ...@@ -440,9 +420,9 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write,
} }
/* Return -1 on error. */ /* Return -1 on error. */
s32 i801_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, static s32 i801_access(struct i2c_adapter * adap, u16 addr,
char read_write, u8 command, int size, unsigned short flags, char read_write, u8 command,
union i2c_smbus_data * data) int size, union i2c_smbus_data * data)
{ {
int hwpec = 0; int hwpec = 0;
int block = 0; int block = 0;
...@@ -544,7 +524,7 @@ s32 i801_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, ...@@ -544,7 +524,7 @@ s32 i801_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
} }
u32 i801_func(struct i2c_adapter *adapter) static u32 i801_func(struct i2c_adapter *adapter)
{ {
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
...@@ -571,8 +551,6 @@ static struct i2c_adapter i801_adapter = { ...@@ -571,8 +551,6 @@ static struct i2c_adapter i801_adapter = {
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
}; };
static struct pci_device_id i801_ids[] __devinitdata = { static struct pci_device_id i801_ids[] __devinitdata = {
{ {
.vendor = PCI_VENDOR_ID_INTEL, .vendor = PCI_VENDOR_ID_INTEL,
...@@ -642,18 +620,17 @@ static int __init i2c_i801_init(void) ...@@ -642,18 +620,17 @@ static int __init i2c_i801_init(void)
return pci_module_init(&i801_driver); return pci_module_init(&i801_driver);
} }
static void __exit i2c_i801_exit(void) static void __exit i2c_i801_exit(void)
{ {
pci_unregister_driver(&i801_driver); pci_unregister_driver(&i801_driver);
release_region(i801_smba, (isich4 ? 16 : 8)); release_region(i801_smba, (isich4 ? 16 : 8));
} }
MODULE_AUTHOR ("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
MODULE_AUTHOR "and Mark D. Studebaker <mdsxyz123@yahoo.com>");
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("I801 SMBus driver"); MODULE_DESCRIPTION("I801 SMBus driver");
MODULE_LICENSE("GPL");
module_init(i2c_i801_init); module_init(i2c_i801_init);
module_exit(i2c_i801_exit); module_exit(i2c_i801_exit);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment