aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/phantom.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-05-23 16:57:59 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-23 23:14:14 -0400
commitc8511f94908a92337b80f0c12342b9051232054f (patch)
treee877d0bd7b6b3c786dc8593b2bc7939b85723676 /drivers/misc/phantom.c
parentc15395c0dbdd646ca80945a7578c8c6cd44ce942 (diff)
Misc: phantom, take care of pci posting
phantom, take care of pci posting thanks to akpm for pointing this out Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/phantom.c')
-rw-r--r--drivers/misc/phantom.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 4b5959b2c93..5108b7c576d 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -60,8 +60,11 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat)
60 atomic_set(&dev->counter, 0); 60 atomic_set(&dev->counter, 0);
61 iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL); 61 iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL);
62 iowrite32(0x43, dev->caddr + PHN_IRQCTL); 62 iowrite32(0x43, dev->caddr + PHN_IRQCTL);
63 } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) 63 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
64 } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) {
64 iowrite32(0, dev->caddr + PHN_IRQCTL); 65 iowrite32(0, dev->caddr + PHN_IRQCTL);
66 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
67 }
65 68
66 dev->status = newstat; 69 dev->status = newstat;
67 70
@@ -102,6 +105,7 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
102 105
103 pr_debug("phantom: writing %x to %u\n", r.value, r.reg); 106 pr_debug("phantom: writing %x to %u\n", r.value, r.reg);
104 iowrite32(r.value, dev->iaddr + r.reg); 107 iowrite32(r.value, dev->iaddr + r.reg);
108 ioread32(dev->iaddr); /* PCI posting */
105 109
106 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) 110 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ))
107 phantom_status(dev, dev->status & ~PHB_RUNNING); 111 phantom_status(dev, dev->status & ~PHB_RUNNING);
@@ -116,6 +120,7 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
116 for (i = 0; i < min(rs.count, 8U); i++) 120 for (i = 0; i < min(rs.count, 8U); i++)
117 if ((1 << i) & rs.mask) 121 if ((1 << i) & rs.mask)
118 iowrite32(rs.values[i], dev->oaddr + i); 122 iowrite32(rs.values[i], dev->oaddr + i);
123 ioread32(dev->iaddr); /* PCI posting */
119 spin_unlock(&dev->ioctl_lock); 124 spin_unlock(&dev->ioctl_lock);
120 break; 125 break;
121 case PHN_GET_REG: 126 case PHN_GET_REG:
@@ -221,6 +226,7 @@ static irqreturn_t phantom_isr(int irq, void *data)
221 226
222 iowrite32(0, dev->iaddr); 227 iowrite32(0, dev->iaddr);
223 iowrite32(0xc0, dev->iaddr); 228 iowrite32(0xc0, dev->iaddr);
229 ioread32(dev->iaddr); /* PCI posting */
224 230
225 atomic_inc(&dev->counter); 231 atomic_inc(&dev->counter);
226 wake_up_interruptible(&dev->wait); 232 wake_up_interruptible(&dev->wait);
@@ -297,6 +303,7 @@ static int __devinit phantom_probe(struct pci_dev *pdev,
297 pht->cdev.owner = THIS_MODULE; 303 pht->cdev.owner = THIS_MODULE;
298 304
299 iowrite32(0, pht->caddr + PHN_IRQCTL); 305 iowrite32(0, pht->caddr + PHN_IRQCTL);
306 ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */
300 retval = request_irq(pdev->irq, phantom_isr, 307 retval = request_irq(pdev->irq, phantom_isr,
301 IRQF_SHARED | IRQF_DISABLED, "phantom", pht); 308 IRQF_SHARED | IRQF_DISABLED, "phantom", pht);
302 if (retval) { 309 if (retval) {
@@ -347,6 +354,7 @@ static void __devexit phantom_remove(struct pci_dev *pdev)
347 cdev_del(&pht->cdev); 354 cdev_del(&pht->cdev);
348 355
349 iowrite32(0, pht->caddr + PHN_IRQCTL); 356 iowrite32(0, pht->caddr + PHN_IRQCTL);
357 ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */
350 free_irq(pdev->irq, pht); 358 free_irq(pdev->irq, pht);
351 359
352 pci_iounmap(pdev, pht->oaddr); 360 pci_iounmap(pdev, pht->oaddr);
@@ -368,6 +376,7 @@ static int phantom_suspend(struct pci_dev *pdev, pm_message_t state)
368 struct phantom_device *dev = pci_get_drvdata(pdev); 376 struct phantom_device *dev = pci_get_drvdata(pdev);
369 377
370 iowrite32(0, dev->caddr + PHN_IRQCTL); 378 iowrite32(0, dev->caddr + PHN_IRQCTL);
379 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
371 380
372 return 0; 381 return 0;
373} 382}