diff options
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pca-isa.c | 35 |
2 files changed, 29 insertions, 8 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index ece31d2c6c64..d7e6cbb9cbef 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -547,7 +547,7 @@ config I2C_VOODOO3 | |||
547 | 547 | ||
548 | config I2C_PCA_ISA | 548 | config I2C_PCA_ISA |
549 | tristate "PCA9564 on an ISA bus" | 549 | tristate "PCA9564 on an ISA bus" |
550 | depends on I2C | 550 | depends on I2C && ISA |
551 | select I2C_ALGOPCA | 551 | select I2C_ALGOPCA |
552 | default n | 552 | default n |
553 | help | 553 | help |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index cc6536a19eca..5f94e617fe0c 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | 30 | ||
31 | #include <linux/isa.h> | ||
31 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
32 | #include <linux/i2c-algo-pca.h> | 33 | #include <linux/i2c-algo-pca.h> |
33 | 34 | ||
@@ -119,27 +120,26 @@ static struct i2c_adapter pca_isa_ops = { | |||
119 | .name = "PCA9564 ISA Adapter", | 120 | .name = "PCA9564 ISA Adapter", |
120 | }; | 121 | }; |
121 | 122 | ||
122 | static int __init pca_isa_init(void) | 123 | static int __devinit pca_isa_probe(struct device *dev, unsigned int id) |
123 | { | 124 | { |
124 | |||
125 | init_waitqueue_head(&pca_wait); | 125 | init_waitqueue_head(&pca_wait); |
126 | 126 | ||
127 | printk(KERN_INFO "i2c-pca-isa: i/o base %#08lx. irq %d\n", base, irq); | 127 | dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq); |
128 | 128 | ||
129 | if (!request_region(base, IO_SIZE, "i2c-pca-isa")) { | 129 | if (!request_region(base, IO_SIZE, "i2c-pca-isa")) { |
130 | printk(KERN_ERR "i2c-pca-isa: I/O address %#08lx is in use.\n", base); | 130 | dev_err(dev, "I/O address %#08lx is in use\n", base); |
131 | goto out; | 131 | goto out; |
132 | } | 132 | } |
133 | 133 | ||
134 | if (irq > -1) { | 134 | if (irq > -1) { |
135 | if (request_irq(irq, pca_handler, 0, "i2c-pca-isa", &pca_isa_ops) < 0) { | 135 | if (request_irq(irq, pca_handler, 0, "i2c-pca-isa", &pca_isa_ops) < 0) { |
136 | printk(KERN_ERR "i2c-pca-isa: Request irq%d failed\n", irq); | 136 | dev_err(dev, "Request irq%d failed\n", irq); |
137 | goto out_region; | 137 | goto out_region; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | if (i2c_pca_add_bus(&pca_isa_ops) < 0) { | 141 | if (i2c_pca_add_bus(&pca_isa_ops) < 0) { |
142 | printk(KERN_ERR "i2c-pca-isa: Failed to add i2c bus\n"); | 142 | dev_err(dev, "Failed to add i2c bus\n"); |
143 | goto out_irq; | 143 | goto out_irq; |
144 | } | 144 | } |
145 | 145 | ||
@@ -154,7 +154,7 @@ static int __init pca_isa_init(void) | |||
154 | return -ENODEV; | 154 | return -ENODEV; |
155 | } | 155 | } |
156 | 156 | ||
157 | static void pca_isa_exit(void) | 157 | static int __devexit pca_isa_remove(struct device *dev, unsigned int id) |
158 | { | 158 | { |
159 | i2c_del_adapter(&pca_isa_ops); | 159 | i2c_del_adapter(&pca_isa_ops); |
160 | 160 | ||
@@ -163,6 +163,27 @@ static void pca_isa_exit(void) | |||
163 | free_irq(irq, &pca_isa_ops); | 163 | free_irq(irq, &pca_isa_ops); |
164 | } | 164 | } |
165 | release_region(base, IO_SIZE); | 165 | release_region(base, IO_SIZE); |
166 | |||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | static struct isa_driver pca_isa_driver = { | ||
171 | .probe = pca_isa_probe, | ||
172 | .remove = __devexit_p(pca_isa_remove), | ||
173 | .driver = { | ||
174 | .owner = THIS_MODULE, | ||
175 | .name = "i2c-pca-isa", | ||
176 | } | ||
177 | }; | ||
178 | |||
179 | static int __init pca_isa_init(void) | ||
180 | { | ||
181 | return isa_register_driver(&pca_isa_driver, 1); | ||
182 | } | ||
183 | |||
184 | static void __exit pca_isa_exit(void) | ||
185 | { | ||
186 | isa_unregister_driver(&pca_isa_driver); | ||
166 | } | 187 | } |
167 | 188 | ||
168 | MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); | 189 | MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); |