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