aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/tc86c001.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/tc86c001.c')
-rw-r--r--drivers/ide/pci/tc86c001.c57
1 files changed, 43 insertions, 14 deletions
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 477e19790102..b1cb8a9ce5a9 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -11,6 +11,8 @@
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/ide.h> 12#include <linux/ide.h>
13 13
14#define DRV_NAME "tc86c001"
15
14static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed) 16static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed)
15{ 17{
16 ide_hwif_t *hwif = HWIF(drive); 18 ide_hwif_t *hwif = HWIF(drive);
@@ -173,16 +175,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
173 hwif->rqsize = 0xffff; 175 hwif->rqsize = 0xffff;
174} 176}
175 177
176static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
177 const char *name)
178{
179 int err = pci_request_region(dev, 5, name);
180
181 if (err)
182 printk(KERN_ERR "%s: system control regs already in use", name);
183 return err;
184}
185
186static const struct ide_port_ops tc86c001_port_ops = { 178static const struct ide_port_ops tc86c001_port_ops = {
187 .set_pio_mode = tc86c001_set_pio_mode, 179 .set_pio_mode = tc86c001_set_pio_mode,
188 .set_dma_mode = tc86c001_set_mode, 180 .set_dma_mode = tc86c001_set_mode,
@@ -201,8 +193,7 @@ static const struct ide_dma_ops tc86c001_dma_ops = {
201}; 193};
202 194
203static const struct ide_port_info tc86c001_chipset __devinitdata = { 195static const struct ide_port_info tc86c001_chipset __devinitdata = {
204 .name = "TC86C001", 196 .name = DRV_NAME,
205 .init_chipset = init_chipset_tc86c001,
206 .init_hwif = init_hwif_tc86c001, 197 .init_hwif = init_hwif_tc86c001,
207 .port_ops = &tc86c001_port_ops, 198 .port_ops = &tc86c001_port_ops,
208 .dma_ops = &tc86c001_dma_ops, 199 .dma_ops = &tc86c001_dma_ops,
@@ -215,7 +206,37 @@ static const struct ide_port_info tc86c001_chipset __devinitdata = {
215static int __devinit tc86c001_init_one(struct pci_dev *dev, 206static int __devinit tc86c001_init_one(struct pci_dev *dev,
216 const struct pci_device_id *id) 207 const struct pci_device_id *id)
217{ 208{
218 return ide_setup_pci_device(dev, &tc86c001_chipset); 209 int rc;
210
211 rc = pci_enable_device(dev);
212 if (rc)
213 goto out;
214
215 rc = pci_request_region(dev, 5, DRV_NAME);
216 if (rc) {
217 printk(KERN_ERR DRV_NAME ": system control regs already in use");
218 goto out_disable;
219 }
220
221 rc = ide_pci_init_one(dev, &tc86c001_chipset, NULL);
222 if (rc)
223 goto out_release;
224
225 goto out;
226
227out_release:
228 pci_release_region(dev, 5);
229out_disable:
230 pci_disable_device(dev);
231out:
232 return rc;
233}
234
235static void __devexit tc86c001_remove(struct pci_dev *dev)
236{
237 ide_pci_remove(dev);
238 pci_release_region(dev, 5);
239 pci_disable_device(dev);
219} 240}
220 241
221static const struct pci_device_id tc86c001_pci_tbl[] = { 242static const struct pci_device_id tc86c001_pci_tbl[] = {
@@ -227,14 +248,22 @@ MODULE_DEVICE_TABLE(pci, tc86c001_pci_tbl);
227static struct pci_driver driver = { 248static struct pci_driver driver = {
228 .name = "TC86C001", 249 .name = "TC86C001",
229 .id_table = tc86c001_pci_tbl, 250 .id_table = tc86c001_pci_tbl,
230 .probe = tc86c001_init_one 251 .probe = tc86c001_init_one,
252 .remove = tc86c001_remove,
231}; 253};
232 254
233static int __init tc86c001_ide_init(void) 255static int __init tc86c001_ide_init(void)
234{ 256{
235 return ide_pci_register_driver(&driver); 257 return ide_pci_register_driver(&driver);
236} 258}
259
260static void __exit tc86c001_ide_exit(void)
261{
262 pci_unregister_driver(&driver);
263}
264
237module_init(tc86c001_ide_init); 265module_init(tc86c001_ide_init);
266module_exit(tc86c001_ide_exit);
238 267
239MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 268MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>");
240MODULE_DESCRIPTION("PCI driver module for TC86C001 IDE"); 269MODULE_DESCRIPTION("PCI driver module for TC86C001 IDE");