aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-11 17:12:35 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:47 -0400
commit2855568b1ee4f58ef2c0a13ddfceb4b0b216b7ed (patch)
tree79262af301c2386c2c391942991742653bc7935e
parentb06ce3e51e3df4394a584c234f11240b1c6f8d5b (diff)
[libata] struct pci_dev related cleanups
* remove pointless pci_dev_to_dev() wrapper. Just directly reference the embedded struct device like everyone else does. * pata_cs5520: delete cs5520_remove_one(), it was a duplicate of ata_pci_remove_one() * linux/libata.h: don't bother including linux/pci.h, we don't need it. Simply declare 'struct pci_dev' and assume interested parties will include the header, as they should be doing anyway. * linux/libata.h: consolidate all CONFIG_PCI declarations into a single location in the header. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/ata/libata-core.c2
-rw-r--r--drivers/ata/libata-eh.c1
-rw-r--r--drivers/ata/pata_cs5520.c20
-rw-r--r--include/linux/libata.h33
4 files changed, 17 insertions, 39 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ce8ccb434aff..b05384a8c326 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -7007,7 +7007,7 @@ void ata_std_ports(struct ata_ioports *ioaddr)
7007 */ 7007 */
7008void ata_pci_remove_one(struct pci_dev *pdev) 7008void ata_pci_remove_one(struct pci_dev *pdev)
7009{ 7009{
7010 struct device *dev = pci_dev_to_dev(pdev); 7010 struct device *dev = &pdev->dev;
7011 struct ata_host *host = dev_get_drvdata(dev); 7011 struct ata_host *host = dev_get_drvdata(dev);
7012 7012
7013 ata_host_detach(host); 7013 ata_host_detach(host);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5a2b2af4d0c1..2eaa39fc65d0 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -33,6 +33,7 @@
33 */ 33 */
34 34
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/pci.h>
36#include <scsi/scsi.h> 37#include <scsi/scsi.h>
37#include <scsi/scsi_host.h> 38#include <scsi/scsi_host.h>
38#include <scsi/scsi_eh.h> 39#include <scsi/scsi_eh.h>
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index ff1eb84c7d22..33f7f0843f4f 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -299,24 +299,6 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
299 return ata_host_register(host, &cs5520_sht); 299 return ata_host_register(host, &cs5520_sht);
300} 300}
301 301
302/**
303 * cs5520_remove_one - device unload
304 * @pdev: PCI device being removed
305 *
306 * Handle an unplug/unload event for a PCI device. Unload the
307 * PCI driver but do not use the default handler as we manage
308 * resources ourself and *MUST NOT* disable the device as it has
309 * other functions.
310 */
311
312static void __devexit cs5520_remove_one(struct pci_dev *pdev)
313{
314 struct device *dev = pci_dev_to_dev(pdev);
315 struct ata_host *host = dev_get_drvdata(dev);
316
317 ata_host_detach(host);
318}
319
320#ifdef CONFIG_PM 302#ifdef CONFIG_PM
321/** 303/**
322 * cs5520_reinit_one - device resume 304 * cs5520_reinit_one - device resume
@@ -373,7 +355,7 @@ static struct pci_driver cs5520_pci_driver = {
373 .name = DRV_NAME, 355 .name = DRV_NAME,
374 .id_table = pata_cs5520, 356 .id_table = pata_cs5520,
375 .probe = cs5520_init_one, 357 .probe = cs5520_init_one,
376 .remove = cs5520_remove_one, 358 .remove = ata_pci_remove_one,
377#ifdef CONFIG_PM 359#ifdef CONFIG_PM
378 .suspend = cs5520_pci_device_suspend, 360 .suspend = cs5520_pci_device_suspend,
379 .resume = cs5520_reinit_one, 361 .resume = cs5520_reinit_one,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 2439f1fa47a1..229a9ff9f924 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -28,7 +28,6 @@
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/pci.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
33#include <asm/scatterlist.h> 32#include <asm/scatterlist.h>
34#include <linux/io.h> 33#include <linux/io.h>
@@ -107,12 +106,6 @@ static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
107/* defines only for the constants which don't work well as enums */ 106/* defines only for the constants which don't work well as enums */
108#define ATA_TAG_POISON 0xfafbfcfdU 107#define ATA_TAG_POISON 0xfafbfcfdU
109 108
110/* move to PCI layer? */
111static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
112{
113 return &pdev->dev;
114}
115
116enum { 109enum {
117 /* various global constants */ 110 /* various global constants */
118 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 111 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
@@ -766,18 +759,7 @@ extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
766extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 759extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
767extern void ata_port_disable(struct ata_port *); 760extern void ata_port_disable(struct ata_port *);
768extern void ata_std_ports(struct ata_ioports *ioaddr); 761extern void ata_std_ports(struct ata_ioports *ioaddr);
769#ifdef CONFIG_PCI 762
770extern int ata_pci_init_one (struct pci_dev *pdev,
771 const struct ata_port_info * const * ppi);
772extern void ata_pci_remove_one (struct pci_dev *pdev);
773#ifdef CONFIG_PM
774extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
775extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
776extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
777extern int ata_pci_device_resume(struct pci_dev *pdev);
778#endif
779extern int ata_pci_clear_simplex(struct pci_dev *pdev);
780#endif /* CONFIG_PCI */
781extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 763extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
782extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 764extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
783 const struct ata_port_info * const * ppi, int n_ports); 765 const struct ata_port_info * const * ppi, int n_ports);
@@ -935,6 +917,19 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
935#endif 917#endif
936 918
937#ifdef CONFIG_PCI 919#ifdef CONFIG_PCI
920struct pci_dev;
921
922extern int ata_pci_init_one (struct pci_dev *pdev,
923 const struct ata_port_info * const * ppi);
924extern void ata_pci_remove_one (struct pci_dev *pdev);
925#ifdef CONFIG_PM
926extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
927extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
928extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
929extern int ata_pci_device_resume(struct pci_dev *pdev);
930#endif
931extern int ata_pci_clear_simplex(struct pci_dev *pdev);
932
938struct pci_bits { 933struct pci_bits {
939 unsigned int reg; /* PCI config register to read */ 934 unsigned int reg; /* PCI config register to read */
940 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ 935 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */