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-ali1535.c
diff --git
a/drivers/i2c/busses/i2c-ali1535.c
b/drivers/i2c/busses/i2c-ali1535.c
index
6715b0d
..
e75d339
100644
(file)
--- a/
drivers/i2c/busses/i2c-ali1535.c
+++ b/
drivers/i2c/busses/i2c-ali1535.c
@@
-53,17
+53,16
@@
/* Note: we assume there can only be one ALI1535, with one SMBus interface */
/* Note: we assume there can only be one ALI1535, with one SMBus interface */
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
+#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <asm/io.h>
-#include <asm/semaphore.h>
/* ALI1535 SMBus address offsets */
/* ALI1535 SMBus address offsets */
@@
-134,9
+133,8
@@
/* -> Read = 1 */
#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */
/* -> Read = 1 */
#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */
-
+static struct pci_driver ali1535_driver;
static unsigned short ali1535_smba;
static unsigned short ali1535_smba;
-DECLARE_MUTEX(i2c_ali1535_sem);
/* Detect whether a ALI1535 can be found, and initialize it, where necessary.
Note the differences between kernels with the old PCI BIOS interface and
/* Detect whether a ALI1535 can be found, and initialize it, where necessary.
Note the differences between kernels with the old PCI BIOS interface and
@@
-162,7
+160,8
@@
static int ali1535_setup(struct pci_dev *dev)
goto exit;
}
goto exit;
}
- if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, "ali1535-smb")) {
+ if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE,
+ ali1535_driver.name)) {
dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
ali1535_smba);
goto exit;
dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
ali1535_smba);
goto exit;
@@
-276,7
+275,7
@@
static int ali1535_transaction(struct i2c_adapter *adap)
/* We will always wait for a fraction of a second! */
timeout = 0;
do {
/* We will always wait for a fraction of a second! */
timeout = 0;
do {
-
i2c_delay
(1);
+
msleep
(1);
temp = inb_p(SMBHSTSTS);
} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
&& (timeout++ < MAX_TIMEOUT));
temp = inb_p(SMBHSTSTS);
} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
&& (timeout++ < MAX_TIMEOUT));
@@
-344,13
+343,12
@@
static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
int timeout;
s32 result = 0;
int timeout;
s32 result = 0;
- down(&i2c_ali1535_sem);
/* make sure SMBus is idle */
temp = inb_p(SMBHSTSTS);
for (timeout = 0;
(timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
timeout++) {
/* make sure SMBus is idle */
temp = inb_p(SMBHSTSTS);
for (timeout = 0;
(timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
timeout++) {
-
i2c_delay
(1);
+
msleep
(1);
temp = inb_p(SMBHSTSTS);
}
if (timeout >= MAX_TIMEOUT)
temp = inb_p(SMBHSTSTS);
}
if (timeout >= MAX_TIMEOUT)
@@
-459,42
+457,35
@@
static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
break;
}
EXIT:
break;
}
EXIT:
- up(&i2c_ali1535_sem);
return result;
}
return result;
}
-u32 ali1535_func(struct i2c_adapter *adapter)
+
static
u32 ali1535_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;
}
-static struct i2c_algorithm smbus_algorithm = {
- .name = "Non-i2c SMBus adapter",
- .id = I2C_ALGO_SMBUS,
+static const struct i2c_algorithm smbus_algorithm = {
.smbus_xfer = ali1535_access,
.functionality = ali1535_func,
};
static struct i2c_adapter ali1535_adapter = {
.owner = THIS_MODULE,
.smbus_xfer = ali1535_access,
.functionality = ali1535_func,
};
static struct i2c_adapter ali1535_adapter = {
.owner = THIS_MODULE,
- .class = I2C_
ADAP_CLASS_SMBUS
,
+ .class = I2C_
CLASS_HWMON
,
.algo = &smbus_algorithm,
.algo = &smbus_algorithm,
- .name = "unset",
};
static struct pci_device_id ali1535_ids[] = {
};
static struct pci_device_id ali1535_ids[] = {
- {
- .vendor = PCI_VENDOR_ID_AL,
- .device = PCI_DEVICE_ID_AL_M7101,
- .subvendor = PCI_ANY_ID,
- .subdevice = PCI_ANY_ID,
- },
+ { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
{ },
};
{ },
};
+MODULE_DEVICE_TABLE (pci, ali1535_ids);
+
static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
if (ali1535_setup(dev)) {
static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
if (ali1535_setup(dev)) {
@@
-526,7
+517,7
@@
static struct pci_driver ali1535_driver = {
static int __init i2c_ali1535_init(void)
{
static int __init i2c_ali1535_init(void)
{
- return pci_
module_init
(&ali1535_driver);
+ return pci_
register_driver
(&ali1535_driver);
}
static void __exit i2c_ali1535_exit(void)
}
static void __exit i2c_ali1535_exit(void)