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