aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c23
-rw-r--r--drivers/ata/libata-sff.c23
-rw-r--r--drivers/ata/libata.h10
3 files changed, 50 insertions, 6 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index cc49a0d3089f..200f49d09228 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5670,6 +5670,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
5670 ap->stats.unhandled_irq = 1; 5670 ap->stats.unhandled_irq = 1;
5671 ap->stats.idle_irq = 1; 5671 ap->stats.idle_irq = 1;
5672#endif 5672#endif
5673 ata_sff_port_init(ap);
5674
5673 return ap; 5675 return ap;
5674} 5676}
5675 5677
@@ -6584,6 +6586,8 @@ static void __init ata_parse_force_param(void)
6584 6586
6585static int __init ata_init(void) 6587static int __init ata_init(void)
6586{ 6588{
6589 int rc = -ENOMEM;
6590
6587 ata_parse_force_param(); 6591 ata_parse_force_param();
6588 6592
6589 /* 6593 /*
@@ -6595,24 +6599,31 @@ static int __init ata_init(void)
6595 */ 6599 */
6596 ata_wq = create_workqueue("ata"); 6600 ata_wq = create_workqueue("ata");
6597 if (!ata_wq) 6601 if (!ata_wq)
6598 goto free_force_tbl; 6602 goto fail;
6599 6603
6600 ata_aux_wq = create_singlethread_workqueue("ata_aux"); 6604 ata_aux_wq = create_singlethread_workqueue("ata_aux");
6601 if (!ata_aux_wq) 6605 if (!ata_aux_wq)
6602 goto free_wq; 6606 goto fail;
6607
6608 rc = ata_sff_init();
6609 if (rc)
6610 goto fail;
6603 6611
6604 printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n"); 6612 printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
6605 return 0; 6613 return 0;
6606 6614
6607free_wq: 6615fail:
6608 destroy_workqueue(ata_wq);
6609free_force_tbl:
6610 kfree(ata_force_tbl); 6616 kfree(ata_force_tbl);
6611 return -ENOMEM; 6617 if (ata_wq)
6618 destroy_workqueue(ata_wq);
6619 if (ata_aux_wq)
6620 destroy_workqueue(ata_aux_wq);
6621 return rc;
6612} 6622}
6613 6623
6614static void __exit ata_exit(void) 6624static void __exit ata_exit(void)
6615{ 6625{
6626 ata_sff_exit();
6616 kfree(ata_force_tbl); 6627 kfree(ata_force_tbl);
6617 destroy_workqueue(ata_wq); 6628 destroy_workqueue(ata_wq);
6618 destroy_workqueue(ata_aux_wq); 6629 destroy_workqueue(ata_aux_wq);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index f1c99a3e8b2c..4a3d1f214457 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -3061,3 +3061,26 @@ void ata_pci_bmdma_init(struct ata_host *host)
3061EXPORT_SYMBOL_GPL(ata_pci_bmdma_init); 3061EXPORT_SYMBOL_GPL(ata_pci_bmdma_init);
3062 3062
3063#endif /* CONFIG_PCI */ 3063#endif /* CONFIG_PCI */
3064
3065/**
3066 * ata_sff_port_init - Initialize SFF/BMDMA ATA port
3067 * @ap: Port to initialize
3068 *
3069 * Called on port allocation to initialize SFF/BMDMA specific
3070 * fields.
3071 *
3072 * LOCKING:
3073 * None.
3074 */
3075void ata_sff_port_init(struct ata_port *ap)
3076{
3077}
3078
3079int __init ata_sff_init(void)
3080{
3081 return 0;
3082}
3083
3084void __exit ata_sff_exit(void)
3085{
3086}
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 132da80aa23a..d89502f3123a 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -203,6 +203,16 @@ static inline int sata_pmp_attach(struct ata_device *dev)
203/* libata-sff.c */ 203/* libata-sff.c */
204#ifdef CONFIG_ATA_SFF 204#ifdef CONFIG_ATA_SFF
205extern void ata_pio_task(struct work_struct *work); 205extern void ata_pio_task(struct work_struct *work);
206extern void ata_sff_port_init(struct ata_port *ap);
207extern int ata_sff_init(void);
208extern void ata_sff_exit(void);
209#else /* CONFIG_ATA_SFF */
210static inline void ata_sff_port_init(struct ata_port *ap)
211{ }
212static inline int ata_sff_init(void)
213{ return 0; }
214static inline void ata_sff_exit(void)
215{ }
206#endif /* CONFIG_ATA_SFF */ 216#endif /* CONFIG_ATA_SFF */
207 217
208#endif /* __LIBATA_H__ */ 218#endif /* __LIBATA_H__ */