rename patch (v2.6.22.24-op1)
[linux-2.6.22.y-op-patches.git] / backport / i2c-i801-smb / 06-i2c-i801-fname.patch
blob101197186c1b4ac2635d29d13d2f5360bcaba3a2
1 From 369f6f4aec5315012ff5d951e0179f860c35c181 Mon Sep 17 00:00:00 2001
2 From: Jean Delvare <khali@linux-fr.org>
3 Date: Sun, 27 Jan 2008 18:14:50 +0100
4 Subject: [PATCH] i2c-i801: More explicit names for chip features
6 Use separate flags with explicit names to describe the features of
7 the ICH chip.
9 Signed-off-by: Jean Delvare <khali@linux-fr.org>
11 diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
12 index 8f16a47..c31699d 100644
13 --- a/drivers/i2c/busses/i2c-i801.c
14 +++ b/drivers/i2c/busses/i2c-i801.c
15 @@ -122,7 +122,12 @@ static unsigned long i801_smba;
16 static unsigned char i801_original_hstcfg;
17 static struct pci_driver i801_driver;
18 static struct pci_dev *I801_dev;
19 -static int isich4;
21 +#define FEATURE_SMBUS_PEC (1 << 0)
22 +#define FEATURE_BLOCK_BUFFER (1 << 1)
23 +#define FEATURE_BLOCK_PROC (1 << 2)
24 +#define FEATURE_I2C_BLOCK_READ (1 << 3)
25 +static unsigned int i801_features;
27 static int i801_transaction(int xact)
29 @@ -409,7 +414,8 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
30 data->block[0] = 32; /* max for reads */
33 - if (isich4 && i801_set_block_buffer_mode() == 0 )
34 + if ((i801_features & FEATURE_BLOCK_BUFFER)
35 + && i801_set_block_buffer_mode() == 0)
36 result = i801_block_transaction_by_block(data, read_write,
37 hwpec);
38 else
39 @@ -435,7 +441,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
40 int block = 0;
41 int ret, xact = 0;
43 - hwpec = isich4 && (flags & I2C_CLIENT_PEC)
44 + hwpec = (i801_features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC)
45 && size != I2C_SMBUS_QUICK
46 && size != I2C_SMBUS_I2C_BLOCK_DATA;
48 @@ -523,9 +529,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
49 static u32 i801_func(struct i2c_adapter *adapter)
51 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
52 - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
53 - I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
54 - | (isich4 ? I2C_FUNC_SMBUS_PEC : 0);
55 + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
56 + I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK |
57 + ((i801_features & FEATURE_SMBUS_PEC) ? I2C_FUNC_SMBUS_PEC : 0);
60 static const struct i2c_algorithm smbus_algorithm = {
61 @@ -565,6 +571,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
62 int err;
64 I801_dev = dev;
65 + i801_features = 0;
66 switch (dev->device) {
67 case PCI_DEVICE_ID_INTEL_82801DB_3:
68 case PCI_DEVICE_ID_INTEL_82801EB_3:
69 @@ -575,10 +582,9 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
70 case PCI_DEVICE_ID_INTEL_ICH8_5:
71 case PCI_DEVICE_ID_INTEL_ICH9_6:
72 case PCI_DEVICE_ID_INTEL_TOLAPAI_1:
73 - isich4 = 1;
74 + i801_features |= FEATURE_SMBUS_PEC;
75 + i801_features |= FEATURE_BLOCK_BUFFER;
76 break;
77 - default:
78 - isich4 = 0;
81 err = pci_enable_device(dev);