git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
i2c
/
busses
/
i2c-amd8111.c
diff --git
a/drivers/i2c/busses/i2c-amd8111.c
b/drivers/i2c/busses/i2c-amd8111.c
index
c0ea19e
..
0fbc718
100644
(file)
--- a/
drivers/i2c/busses/i2c-amd8111.c
+++ b/
drivers/i2c/busses/i2c-amd8111.c
@@
-8,7
+8,6
@@
* the Free Software Foundation version 2.
*/
* the Free Software Foundation version 2.
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
@@
-31,6
+30,8
@@
struct amd_smbus {
int size;
};
int size;
};
+static struct pci_driver amd8111_driver;
+
/*
* AMD PCI control registers definitions.
*/
/*
* AMD PCI control registers definitions.
*/
@@
-67,7
+68,7
@@
struct amd_smbus {
* ACPI 2.0 chapter 13 access of registers of the EC
*/
* ACPI 2.0 chapter 13 access of registers of the EC
*/
-unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
+
static
unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
{
int timeout = 500;
{
int timeout = 500;
@@
-82,7
+83,7
@@
unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
return 0;
}
return 0;
}
-unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
+
static
unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
{
int timeout = 500;
{
int timeout = 500;
@@
-97,7
+98,7
@@
unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
return 0;
}
return 0;
}
-unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, unsigned char *data)
+
static
unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, unsigned char *data)
{
if (amd_ec_wait_write(smbus))
return -1;
{
if (amd_ec_wait_write(smbus))
return -1;
@@
-114,7
+115,7
@@
unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, unsigne
return 0;
}
return 0;
}
-unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, unsigned char data)
+
static
unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, unsigned char data)
{
if (amd_ec_wait_write(smbus))
return -1;
{
if (amd_ec_wait_write(smbus))
return -1;
@@
-174,7
+175,7
@@
unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, unsign
#define AMD_SMB_PRTCL_PEC 0x80
#define AMD_SMB_PRTCL_PEC 0x80
-s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
+s
tatic s
32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
char read_write, u8 command, int size, union i2c_smbus_data * data)
{
struct amd_smbus *smbus = adap->algo_data;
char read_write, u8 command, int size, union i2c_smbus_data * data)
{
struct amd_smbus *smbus = adap->algo_data;
@@
-243,7
+244,6
@@
s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
break;
case I2C_SMBUS_BLOCK_PROC_CALL:
break;
case I2C_SMBUS_BLOCK_PROC_CALL:
- protocol |= pec;
len = min_t(u8, data->block[0], 31);
amd_ec_write(smbus, AMD_SMB_CMD, command);
amd_ec_write(smbus, AMD_SMB_BCNT, len);
len = min_t(u8, data->block[0], 31);
amd_ec_write(smbus, AMD_SMB_CMD, command);
amd_ec_write(smbus, AMD_SMB_BCNT, len);
@@
-253,13
+253,6
@@
s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
read_write = I2C_SMBUS_READ;
break;
read_write = I2C_SMBUS_READ;
break;
- case I2C_SMBUS_WORD_DATA_PEC:
- case I2C_SMBUS_BLOCK_DATA_PEC:
- case I2C_SMBUS_PROC_CALL_PEC:
- case I2C_SMBUS_BLOCK_PROC_CALL_PEC:
- dev_warn(&adap->dev, "Unexpected software PEC transaction %d\n.", size);
- return -1;
-
default:
dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
return -1;
default:
dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
return -1;
@@
-315,7
+308,7
@@
s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
}
}
-u32 amd8111_func(struct i2c_adapter *adapter)
+
static
u32 amd8111_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_BLOCK_DATA |
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA |
@@
-323,19
+316,19
@@
u32 amd8111_func(struct i2c_adapter *adapter)
I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC;
}
I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC;
}
-static struct i2c_algorithm smbus_algorithm = {
- .name = "Non-I2C SMBus 2.0 adapter",
- .id = I2C_ALGO_SMBUS,
+static const struct i2c_algorithm smbus_algorithm = {
.smbus_xfer = amd8111_access,
.functionality = amd8111_func,
};
static struct pci_device_id amd8111_ids[] = {
.smbus_xfer = amd8111_access,
.functionality = amd8111_func,
};
static struct pci_device_id amd8111_ids[] = {
- {
0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
},
+ {
PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS2)
},
{ 0, }
};
{ 0, }
};
+MODULE_DEVICE_TABLE (pci, amd8111_ids);
+
static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
struct amd_smbus *smbus;
static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
struct amd_smbus *smbus;
@@
-344,16
+337,15
@@
static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
if (~pci_resource_flags(dev, 0) & IORESOURCE_IO)
return -ENODEV;
if (~pci_resource_flags(dev, 0) & IORESOURCE_IO)
return -ENODEV;
- smbus = k
m
alloc(sizeof(struct amd_smbus), GFP_KERNEL);
+ smbus = k
z
alloc(sizeof(struct amd_smbus), GFP_KERNEL);
if (!smbus)
return -ENOMEM;
if (!smbus)
return -ENOMEM;
- memset(smbus, 0, sizeof(struct amd_smbus));
smbus->dev = dev;
smbus->base = pci_resource_start(dev, 0);
smbus->size = pci_resource_len(dev, 0);
smbus->dev = dev;
smbus->base = pci_resource_start(dev, 0);
smbus->size = pci_resource_len(dev, 0);
- if (!request_region(smbus->base, smbus->size,
"amd8111 SMBus 2.0"
))
+ if (!request_region(smbus->base, smbus->size,
amd8111_driver.name
))
goto out_kfree;
smbus->adapter.owner = THIS_MODULE;
goto out_kfree;
smbus->adapter.owner = THIS_MODULE;
@@
-400,7
+392,7
@@
static struct pci_driver amd8111_driver = {
static int __init i2c_amd8111_init(void)
{
static int __init i2c_amd8111_init(void)
{
- return pci_
module_init
(&amd8111_driver);
+ return pci_
register_driver
(&amd8111_driver);
}
}