[PATCH] i2c-viapro: Coding style fixes
Before I go on cleaning up and improving the i2c-viapro driver, let's fix all the coding style issues: mostly trailing white space, and spaces used where tabs should be. Signed-off-by: Jean Delvare <khali@linux-fr> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Documentation/i2c/busses/i2c-viapro | 12 ++--- drivers/i2c/busses/i2c-viapro.c | 76 ++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 45 deletions(-)
This commit is contained in:
parent
32c0a520f5
commit
5f49ef8e8c
2 changed files with 43 additions and 45 deletions
|
@ -4,17 +4,17 @@ Supported adapters:
|
||||||
* VIA Technologies, Inc. VT82C596A/B
|
* VIA Technologies, Inc. VT82C596A/B
|
||||||
Datasheet: Sometimes available at the VIA website
|
Datasheet: Sometimes available at the VIA website
|
||||||
|
|
||||||
* VIA Technologies, Inc. VT82C686A/B
|
* VIA Technologies, Inc. VT82C686A/B
|
||||||
Datasheet: Sometimes available at the VIA website
|
Datasheet: Sometimes available at the VIA website
|
||||||
|
|
||||||
* VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237
|
* VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237
|
||||||
Datasheet: available on request from Via
|
Datasheet: available on request from Via
|
||||||
|
|
||||||
Authors:
|
Authors:
|
||||||
Frodo Looijaard <frodol@dds.nl>,
|
Frodo Looijaard <frodol@dds.nl>,
|
||||||
Philip Edelbrock <phil@netroedge.com>,
|
Philip Edelbrock <phil@netroedge.com>,
|
||||||
Kyösti Mälkki <kmalkki@cc.hut.fi>,
|
Kyösti Mälkki <kmalkki@cc.hut.fi>,
|
||||||
Mark D. Studebaker <mdsxyz123@yahoo.com>
|
Mark D. Studebaker <mdsxyz123@yahoo.com>
|
||||||
|
|
||||||
Module Parameters
|
Module Parameters
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -43,5 +43,3 @@ Your lspci -n listing must show one of these :
|
||||||
|
|
||||||
If none of these show up, you should look in the BIOS for settings like
|
If none of these show up, you should look in the BIOS for settings like
|
||||||
enable ACPI / SMBus or even USB.
|
enable ACPI / SMBus or even USB.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware
|
i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware
|
||||||
monitoring
|
monitoring
|
||||||
Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
|
Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
|
||||||
Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>,
|
Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>,
|
||||||
Mark D. Studebaker <mdsxyz123@yahoo.com>
|
Mark D. Studebaker <mdsxyz123@yahoo.com>
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@
|
||||||
|
|
||||||
static struct pci_dev *vt596_pdev;
|
static struct pci_dev *vt596_pdev;
|
||||||
|
|
||||||
#define SMBBA1 0x90
|
#define SMBBA1 0x90
|
||||||
#define SMBBA2 0x80
|
#define SMBBA2 0x80
|
||||||
#define SMBBA3 0xD0
|
#define SMBBA3 0xD0
|
||||||
|
|
||||||
/* SMBus address offsets */
|
/* SMBus address offsets */
|
||||||
static unsigned short vt596_smba;
|
static unsigned short vt596_smba;
|
||||||
|
@ -68,26 +68,26 @@ static unsigned short vt596_smba;
|
||||||
/* PCI Address Constants */
|
/* PCI Address Constants */
|
||||||
|
|
||||||
/* SMBus data in configuration space can be found in two places,
|
/* SMBus data in configuration space can be found in two places,
|
||||||
We try to select the better one*/
|
We try to select the better one */
|
||||||
|
|
||||||
static unsigned short smb_cf_hstcfg = 0xD2;
|
static unsigned short smb_cf_hstcfg = 0xD2;
|
||||||
|
|
||||||
#define SMBHSTCFG (smb_cf_hstcfg)
|
#define SMBHSTCFG (smb_cf_hstcfg)
|
||||||
#define SMBSLVC (smb_cf_hstcfg + 1)
|
#define SMBSLVC (smb_cf_hstcfg + 1)
|
||||||
#define SMBSHDW1 (smb_cf_hstcfg + 2)
|
#define SMBSHDW1 (smb_cf_hstcfg + 2)
|
||||||
#define SMBSHDW2 (smb_cf_hstcfg + 3)
|
#define SMBSHDW2 (smb_cf_hstcfg + 3)
|
||||||
#define SMBREV (smb_cf_hstcfg + 4)
|
#define SMBREV (smb_cf_hstcfg + 4)
|
||||||
|
|
||||||
/* Other settings */
|
/* Other settings */
|
||||||
#define MAX_TIMEOUT 500
|
#define MAX_TIMEOUT 500
|
||||||
#define ENABLE_INT9 0
|
#define ENABLE_INT9 0
|
||||||
|
|
||||||
/* VT82C596 constants */
|
/* VT82C596 constants */
|
||||||
#define VT596_QUICK 0x00
|
#define VT596_QUICK 0x00
|
||||||
#define VT596_BYTE 0x04
|
#define VT596_BYTE 0x04
|
||||||
#define VT596_BYTE_DATA 0x08
|
#define VT596_BYTE_DATA 0x08
|
||||||
#define VT596_WORD_DATA 0x0C
|
#define VT596_WORD_DATA 0x0C
|
||||||
#define VT596_BLOCK_DATA 0x14
|
#define VT596_BLOCK_DATA 0x14
|
||||||
|
|
||||||
|
|
||||||
/* If force is set to anything different from 0, we forcibly enable the
|
/* If force is set to anything different from 0, we forcibly enable the
|
||||||
|
@ -115,19 +115,19 @@ static int vt596_transaction(void)
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
|
|
||||||
dev_dbg(&vt596_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
|
dev_dbg(&vt596_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
|
||||||
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
|
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
|
||||||
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
|
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
|
||||||
inb_p(SMBHSTDAT1));
|
inb_p(SMBHSTDAT1));
|
||||||
|
|
||||||
/* Make sure the SMBus host is ready to start transmitting */
|
/* Make sure the SMBus host is ready to start transmitting */
|
||||||
if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
|
if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
|
||||||
dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). "
|
dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). "
|
||||||
"Resetting...\n", temp);
|
"Resetting...\n", temp);
|
||||||
|
|
||||||
outb_p(temp, SMBHSTSTS);
|
outb_p(temp, SMBHSTSTS);
|
||||||
if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
|
if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
|
||||||
dev_dbg(&vt596_adapter.dev, "Failed! (0x%02x)\n", temp);
|
dev_dbg(&vt596_adapter.dev, "Failed! (0x%02x)\n", temp);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
dev_dbg(&vt596_adapter.dev, "Successfull!\n");
|
dev_dbg(&vt596_adapter.dev, "Successfull!\n");
|
||||||
|
@ -137,7 +137,7 @@ static int vt596_transaction(void)
|
||||||
/* start the transaction by setting bit 6 */
|
/* start the transaction by setting bit 6 */
|
||||||
outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT);
|
outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT);
|
||||||
|
|
||||||
/* We will always wait for a fraction of a second!
|
/* We will always wait for a fraction of a second!
|
||||||
I don't know if VIA needs this, Intel did */
|
I don't know if VIA needs this, Intel did */
|
||||||
do {
|
do {
|
||||||
msleep(1);
|
msleep(1);
|
||||||
|
@ -177,16 +177,16 @@ static int vt596_transaction(void)
|
||||||
|
|
||||||
dev_dbg(&vt596_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, "
|
dev_dbg(&vt596_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, "
|
||||||
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
|
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
|
||||||
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
|
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
|
||||||
inb_p(SMBHSTDAT1));
|
inb_p(SMBHSTDAT1));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return -1 on error. */
|
/* Return -1 on error. */
|
||||||
static s32 vt596_access(struct i2c_adapter *adap, u16 addr,
|
static s32 vt596_access(struct i2c_adapter *adap, u16 addr,
|
||||||
unsigned short flags, char read_write, u8 command,
|
unsigned short flags, char read_write, u8 command,
|
||||||
int size, union i2c_smbus_data *data)
|
int size, union i2c_smbus_data *data)
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr,
|
||||||
case VT596_BYTE:
|
case VT596_BYTE:
|
||||||
/* Where is the result put? I assume here it is in
|
/* Where is the result put? I assume here it is in
|
||||||
* SMBHSTDAT0 but it might just as well be in the
|
* SMBHSTDAT0 but it might just as well be in the
|
||||||
* SMBHSTCMD. No clue in the docs
|
* SMBHSTCMD. No clue in the docs
|
||||||
*/
|
*/
|
||||||
data->byte = inb_p(SMBHSTDAT0);
|
data->byte = inb_p(SMBHSTDAT0);
|
||||||
break;
|
break;
|
||||||
|
@ -302,7 +302,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
|
||||||
{
|
{
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
int error = -ENODEV;
|
int error = -ENODEV;
|
||||||
|
|
||||||
/* Determine the address of the SMBus areas */
|
/* Determine the address of the SMBus areas */
|
||||||
if (force_addr) {
|
if (force_addr) {
|
||||||
vt596_smba = force_addr & 0xfff0;
|
vt596_smba = force_addr & 0xfff0;
|
||||||
|
@ -333,10 +333,10 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
found:
|
found:
|
||||||
if (!request_region(vt596_smba, 8, "viapro-smbus")) {
|
if (!request_region(vt596_smba, 8, "viapro-smbus")) {
|
||||||
dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
|
dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
|
||||||
vt596_smba);
|
vt596_smba);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,13 +348,13 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
|
||||||
pci_write_config_word(pdev, id->driver_data, vt596_smba);
|
pci_write_config_word(pdev, id->driver_data, vt596_smba);
|
||||||
pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01);
|
pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01);
|
||||||
dev_warn(&pdev->dev, "WARNING: SMBus interface set to new "
|
dev_warn(&pdev->dev, "WARNING: SMBus interface set to new "
|
||||||
"address 0x%04x!\n", vt596_smba);
|
"address 0x%04x!\n", vt596_smba);
|
||||||
} else if ((temp & 1) == 0) {
|
} else if ((temp & 1) == 0) {
|
||||||
if (force) {
|
if (force) {
|
||||||
/* NOTE: This assumes I/O space and other allocations
|
/* NOTE: This assumes I/O space and other allocations
|
||||||
* WERE done by the Bios! Don't complain if your
|
* WERE done by the Bios! Don't complain if your
|
||||||
* hardware does weird things after enabling this.
|
* hardware does weird things after enabling this.
|
||||||
* :') Check for Bios updates before resorting to
|
* :') Check for Bios updates before resorting to
|
||||||
* this.
|
* this.
|
||||||
*/
|
*/
|
||||||
pci_write_config_byte(pdev, SMBHSTCFG, temp | 1);
|
pci_write_config_byte(pdev, SMBHSTCFG, temp | 1);
|
||||||
|
@ -381,8 +381,8 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
|
||||||
|
|
||||||
vt596_adapter.dev.parent = &pdev->dev;
|
vt596_adapter.dev.parent = &pdev->dev;
|
||||||
snprintf(vt596_adapter.name, I2C_NAME_SIZE,
|
snprintf(vt596_adapter.name, I2C_NAME_SIZE,
|
||||||
"SMBus Via Pro adapter at %04x", vt596_smba);
|
"SMBus Via Pro adapter at %04x", vt596_smba);
|
||||||
|
|
||||||
vt596_pdev = pci_dev_get(pdev);
|
vt596_pdev = pci_dev_get(pdev);
|
||||||
if (i2c_add_adapter(&vt596_adapter)) {
|
if (i2c_add_adapter(&vt596_adapter)) {
|
||||||
pci_dev_put(vt596_pdev);
|
pci_dev_put(vt596_pdev);
|
||||||
|
@ -395,7 +395,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
|
||||||
*/
|
*/
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
release_region:
|
release_region:
|
||||||
release_region(vt596_smba, 8);
|
release_region(vt596_smba, 8);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ static struct pci_device_id vt596_ids[] = {
|
||||||
{ 0, }
|
{ 0, }
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE (pci, vt596_ids);
|
MODULE_DEVICE_TABLE(pci, vt596_ids);
|
||||||
|
|
||||||
static struct pci_driver vt596_driver = {
|
static struct pci_driver vt596_driver = {
|
||||||
.name = "vt596_smbus",
|
.name = "vt596_smbus",
|
||||||
|
|
Loading…
Add table
Reference in a new issue