diff options
author | Shannon Nelson <shannon.nelson@intel.com> | 2007-10-18 06:07:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:32 -0400 |
commit | 7df7cf0676060d778486359676734447347e1caf (patch) | |
tree | 1a452993706602ea26b2ec4040fae4818c8e22bb /drivers/dma | |
parent | d8c98618f4bb8161cc0c14e110b07ba37249332b (diff) |
I/OAT: cleanup pci issues
Reorder the pci release actions
Letting go of the resources in the right order helps get rid of
occasional kernel complaints.
Fix the pci_driver object name [Randy Dunlap]
Rename the struct pci_driver data so that false section mismatch
warnings won't be produced.
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ioat.c | 23 | ||||
-rw-r--r-- | drivers/dma/ioat_dma.c | 5 |
2 files changed, 10 insertions, 18 deletions
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index f7276bf2fe7e..54fdeb7c4945 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c | |||
@@ -55,9 +55,7 @@ struct ioat_device { | |||
55 | 55 | ||
56 | static int __devinit ioat_probe(struct pci_dev *pdev, | 56 | static int __devinit ioat_probe(struct pci_dev *pdev, |
57 | const struct pci_device_id *id); | 57 | const struct pci_device_id *id); |
58 | #ifdef IOAT_DMA_REMOVE | ||
59 | static void __devexit ioat_remove(struct pci_dev *pdev); | 58 | static void __devexit ioat_remove(struct pci_dev *pdev); |
60 | #endif | ||
61 | 59 | ||
62 | static int ioat_dca_enabled = 1; | 60 | static int ioat_dca_enabled = 1; |
63 | module_param(ioat_dca_enabled, int, 0644); | 61 | module_param(ioat_dca_enabled, int, 0644); |
@@ -100,14 +98,12 @@ static void ioat_shutdown_functionality(struct pci_dev *pdev) | |||
100 | 98 | ||
101 | } | 99 | } |
102 | 100 | ||
103 | static struct pci_driver ioat_pci_drv = { | 101 | static struct pci_driver ioat_pci_driver = { |
104 | .name = "ioatdma", | 102 | .name = "ioatdma", |
105 | .id_table = ioat_pci_tbl, | 103 | .id_table = ioat_pci_tbl, |
106 | .probe = ioat_probe, | 104 | .probe = ioat_probe, |
107 | .shutdown = ioat_shutdown_functionality, | 105 | .shutdown = ioat_shutdown_functionality, |
108 | #ifdef IOAT_DMA_REMOVE | ||
109 | .remove = __devexit_p(ioat_remove), | 106 | .remove = __devexit_p(ioat_remove), |
110 | #endif | ||
111 | }; | 107 | }; |
112 | 108 | ||
113 | static int __devinit ioat_probe(struct pci_dev *pdev, | 109 | static int __devinit ioat_probe(struct pci_dev *pdev, |
@@ -122,7 +118,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev, | |||
122 | if (err) | 118 | if (err) |
123 | goto err_enable_device; | 119 | goto err_enable_device; |
124 | 120 | ||
125 | err = pci_request_regions(pdev, ioat_pci_drv.name); | 121 | err = pci_request_regions(pdev, ioat_pci_driver.name); |
126 | if (err) | 122 | if (err) |
127 | goto err_request_regions; | 123 | goto err_request_regions; |
128 | 124 | ||
@@ -176,13 +172,11 @@ err_enable_device: | |||
176 | return err; | 172 | return err; |
177 | } | 173 | } |
178 | 174 | ||
179 | #ifdef IOAT_DMA_REMOVE | ||
180 | /* | 175 | /* |
181 | * It is unsafe to remove this module: if removed while a requested | 176 | * It is unsafe to remove this module: if removed while a requested |
182 | * dma is outstanding, esp. from tcp, it is possible to hang while | 177 | * dma is outstanding, esp. from tcp, it is possible to hang while |
183 | * waiting for something that will never finish, thus hanging at | 178 | * waiting for something that will never finish. However, if you're |
184 | * least one cpu. However, if you're feeling lucky and need to do | 179 | * feeling lucky, this usually works just fine. |
185 | * some testing, this usually works just fine. | ||
186 | */ | 180 | */ |
187 | static void __devexit ioat_remove(struct pci_dev *pdev) | 181 | static void __devexit ioat_remove(struct pci_dev *pdev) |
188 | { | 182 | { |
@@ -191,21 +185,16 @@ static void __devexit ioat_remove(struct pci_dev *pdev) | |||
191 | ioat_shutdown_functionality(pdev); | 185 | ioat_shutdown_functionality(pdev); |
192 | 186 | ||
193 | kfree(device); | 187 | kfree(device); |
194 | |||
195 | iounmap(device->iobase); | ||
196 | pci_release_regions(pdev); | ||
197 | pci_disable_device(pdev); | ||
198 | } | 188 | } |
199 | #endif | ||
200 | 189 | ||
201 | static int __init ioat_init_module(void) | 190 | static int __init ioat_init_module(void) |
202 | { | 191 | { |
203 | return pci_register_driver(&ioat_pci_drv); | 192 | return pci_register_driver(&ioat_pci_driver); |
204 | } | 193 | } |
205 | module_init(ioat_init_module); | 194 | module_init(ioat_init_module); |
206 | 195 | ||
207 | static void __exit ioat_exit_module(void) | 196 | static void __exit ioat_exit_module(void) |
208 | { | 197 | { |
209 | pci_unregister_driver(&ioat_pci_drv); | 198 | pci_unregister_driver(&ioat_pci_driver); |
210 | } | 199 | } |
211 | module_exit(ioat_exit_module); | 200 | module_exit(ioat_exit_module); |
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 66c5bb53211b..59d4344db005 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c | |||
@@ -931,7 +931,6 @@ err_completion_pool: | |||
931 | err_dma_pool: | 931 | err_dma_pool: |
932 | kfree(device); | 932 | kfree(device); |
933 | err_kzalloc: | 933 | err_kzalloc: |
934 | iounmap(iobase); | ||
935 | dev_err(&device->pdev->dev, | 934 | dev_err(&device->pdev->dev, |
936 | "ioatdma: Intel(R) I/OAT DMA Engine initialization failed\n"); | 935 | "ioatdma: Intel(R) I/OAT DMA Engine initialization failed\n"); |
937 | return NULL; | 936 | return NULL; |
@@ -949,6 +948,10 @@ void ioat_dma_remove(struct ioatdma_device *device) | |||
949 | pci_pool_destroy(device->dma_pool); | 948 | pci_pool_destroy(device->dma_pool); |
950 | pci_pool_destroy(device->completion_pool); | 949 | pci_pool_destroy(device->completion_pool); |
951 | 950 | ||
951 | iounmap(device->reg_base); | ||
952 | pci_release_regions(device->pdev); | ||
953 | pci_disable_device(device->pdev); | ||
954 | |||
952 | list_for_each_entry_safe(chan, _chan, | 955 | list_for_each_entry_safe(chan, _chan, |
953 | &device->common.channels, device_node) { | 956 | &device->common.channels, device_node) { |
954 | ioat_chan = to_ioat_chan(chan); | 957 | ioat_chan = to_ioat_chan(chan); |