Commit 0472fea5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] check_region remove for drivers/i2c/

Trying to get the i2c code in shape at some point..
parent f66a7c41
......@@ -160,19 +160,17 @@ static void iic_ite_handler(int this_irq, void *dev_id, struct pt_regs *regs)
*/
static int iic_hw_resrc_init(void)
{
if (check_region(gpi.iic_base, ITE_IIC_IO_SIZE) < 0 ) {
return -ENODEV;
} else {
request_region(gpi.iic_base, ITE_IIC_IO_SIZE,
"i2c (i2c bus adapter)");
}
if (gpi.iic_irq > 0) {
if (request_irq(gpi.iic_irq, iic_ite_handler, 0, "ITE IIC", 0) < 0) {
gpi.iic_irq = 0;
} else
DEB3(printk("Enabled IIC IRQ %d\n", gpi.iic_irq));
enable_irq(gpi.iic_irq);
}
if (!request_region(gpi.iic_base, ITE_IIC_IO_SIZE, "i2c"))
return -ENODEV;
if (gpi.iic_irq <= 0)
return 0;
if (request_irq(gpi.iic_irq, iic_ite_handler, 0, "ITE IIC", 0) < 0)
gpi.iic_irq = 0;
else
enable_irq(gpi.iic_irq);
return 0;
}
......
......@@ -142,11 +142,11 @@ static void pcf_isa_handler(int this_irq, void *dev_id, struct pt_regs *regs) {
static int pcf_isa_init(void)
{
if (!mmapped) {
if (check_region(base, 2) < 0 ) {
printk(KERN_ERR "i2c-elektor.o: requested I/O region (0x%X:2) is in use.\n", base);
if (!request_region(base, 2, "i2c (isa bus adapter)"))
printk(KERN_ERR
"i2c-elektor.o: requested I/O region (0x%X:2) "
"is in use.\n", base);
return -ENODEV;
} else {
request_region(base, 2, "i2c (isa bus adapter)");
}
}
if (irq > 0) {
......
......@@ -88,34 +88,31 @@ static int bit_elv_getsda(void *data)
static int bit_elv_init(void)
{
if (check_region(base,(base == 0x3bc)? 3 : 8) < 0 ) {
return -ENODEV;
} else {
/* test for ELV adap. */
if (inb(base+1) & 0x80) { /* BUSY should be high */
DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Busy was low.\n"));
return -ENODEV;
} else {
outb(0x0c,base+2); /* SLCT auf low */
udelay(400);
if ( !(inb(base+1) && 0x10) ) {
outb(0x04,base+2);
DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n"));
return -ENODEV;
}
}
request_region(base,(base == 0x3bc)? 3 : 8,
"i2c (ELV adapter)");
PortData = 0;
bit_elv_setsda((void*)base,1);
bit_elv_setscl((void*)base,1);
if (!request_region(base, (base == 0x3bc) ? 3 : 8,
"i2c (ELV adapter)"))
return -ENODEV;
if (inb(base+1) & 0x80) { /* BUSY should be high */
DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Busy was low.\n"));
goto fail;
}
outb(0x0c,base+2); /* SLCT auf low */
udelay(400);
if (!(inb(base+1) && 0x10)) {
outb(0x04,base+2);
DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n"));
goto fail;
}
PortData = 0;
bit_elv_setsda((void*)base,1);
bit_elv_setscl((void*)base,1);
return 0;
}
static void __exit bit_elv_exit(void)
{
release_region( base , (base == 0x3bc)? 3 : 8 );
fail:
release_region(base , (base == 0x3bc) ? 3 : 8);
return -ENODEV;
}
static int bit_elv_reg(struct i2c_client *client)
......
......@@ -96,8 +96,6 @@ static int __init i2c_frodo_init (void)
return (i2c_bit_add_bus (&frodo_ops));
}
EXPORT_NO_SYMBOLS;
static void __exit i2c_frodo_exit (void)
{
i2c_bit_del_bus (&frodo_ops);
......@@ -105,12 +103,7 @@ static void __exit i2c_frodo_exit (void)
MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
MODULE_DESCRIPTION ("I2C-Bus adapter routines for Frodo");
#ifdef MODULE_LICENSE
MODULE_LICENSE ("GPL");
#endif /* #ifdef MODULE_LICENSE */
EXPORT_NO_SYMBOLS;
module_init (i2c_frodo_init);
module_exit (i2c_frodo_exit);
......
......@@ -297,14 +297,5 @@ MODULE_LICENSE("GPL");
MODULE_PARM(type, "i");
#ifdef MODULE
int init_module(void)
{
return i2c_bitlp_init();
}
void cleanup_module(void)
{
i2c_bitlp_exit();
}
#endif
module_init(i2c_bitlp_init);
module_exit(i2c_bitlp_exit);
......@@ -648,6 +648,7 @@ int i2c_detect(struct i2c_adapter *adapter,
I2C_FUNC_SMBUS_QUICK)) return -1;
for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) {
/* XXX: WTF is going on here??? */
if ((is_isa && check_region(addr, 1)) ||
(!is_isa && i2c_check_addr(adapter, addr)))
continue;
......
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