[PATCH] sun3 __iomem annotations
[linux-2.6.git] / drivers / media / common / saa7146_core.c
index 2899d34..86cbdbc 100644 (file)
@@ -21,7 +21,7 @@
 #include <media/saa7146.h>
 
 LIST_HEAD(saa7146_devices);
-DECLARE_MUTEX(saa7146_devices_lock);
+DEFINE_MUTEX(saa7146_devices_lock);
 
 static int saa7146_num;
 
@@ -109,16 +109,14 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
        struct page *pg;
        int i;
 
-       sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
+       sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
        if (NULL == sglist)
                return NULL;
-       memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
        for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
                pg = vmalloc_to_page(virt);
                if (NULL == pg)
                        goto err;
-               if (PageHighMem(pg))
-                       BUG();
+               BUG_ON(PageHighMem(pg));
                sglist[i].page   = pg;
                sglist[i].length = PAGE_SIZE;
        }
@@ -232,7 +230,7 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt
 
 /********************************************************************************/
 /* interrupt handler */
-static irqreturn_t interrupt_hw(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t interrupt_hw(int irq, void *dev_id)
 {
        struct saa7146_dev *dev = dev_id;
        u32 isr = 0;
@@ -306,15 +304,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
        struct saa7146_dev *dev;
        int err = -ENOMEM;
 
-       dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
+       /* clear out mem for sure */
+       dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
        if (!dev) {
                ERR(("out of memory.\n"));
                goto out;
        }
 
-       /* clear out mem for sure */
-       memset(dev, 0x0, sizeof(struct saa7146_dev));
-
        DEB_EE(("pci:%p\n",pci));
 
        err = pci_enable_device(pci);
@@ -367,7 +363,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
        saa7146_write(dev, MC2, 0xf8000000);
 
        /* request an interrupt for the saa7146 */
-       err = request_irq(pci->irq, interrupt_hw, SA_SHIRQ | SA_INTERRUPT,
+       err = request_irq(pci->irq, interrupt_hw, IRQF_SHARED | IRQF_DISABLED,
                          dev->name, dev);
        if (err < 0) {
                ERR(("request_irq() failed.\n"));
@@ -405,11 +401,11 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
 
        pci_set_drvdata(pci, dev);
 
-       init_MUTEX(&dev->lock);
+       mutex_init(&dev->lock);
        spin_lock_init(&dev->int_slock);
        spin_lock_init(&dev->slock);
 
-       init_MUTEX(&dev->i2c_lock);
+       mutex_init(&dev->i2c_lock);
 
        dev->module = THIS_MODULE;
        init_waitqueue_head(&dev->i2c_wq);