]> err.no Git - linux-2.6/blobdiff - include/asm-sparc64/parport.h
[SPARC]: Implement fb_is_primary_device().
[linux-2.6] / include / asm-sparc64 / parport.h
index d3895873e4c715775c90346e06935c4384c0694d..23cc63f049a896769f4ed62e8d6ef8044f57d817 100644 (file)
  */
 #define HAS_DMA
 
+static DEFINE_SPINLOCK(dma_spin_lock);
+
+#define claim_dma_lock() \
+({     unsigned long flags; \
+       spin_lock_irqsave(&dma_spin_lock, flags); \
+       flags; \
+})
+
+#define release_dma_lock(__flags) \
+       spin_unlock_irqrestore(&dma_spin_lock, __flags);
+
 static struct sparc_ebus_info {
        struct ebus_dma_info info;
        unsigned int addr;
        unsigned int count;
+       int lock;
 } sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
 
+static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
+{
+       if (dmanr >= PARPORT_PC_MAX_PORTS)
+               return -EINVAL;
+       if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0)
+               return -EBUSY;
+       return 0;
+}
+
+static __inline__ void free_dma(unsigned int dmanr)
+{
+       if (dmanr >= PARPORT_PC_MAX_PORTS) {
+               printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
+               return;
+       }
+       if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) {
+               printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
+               return;
+       }       
+}
+
 static __inline__ void enable_dma(unsigned int dmanr)
 {
        ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
@@ -70,7 +103,7 @@ static int ebus_ecpp_p(struct linux_ebus_device *edev)
        if (!strcmp(edev->prom_node->name, "ecpp"))
                return 1;
        if (!strcmp(edev->prom_node->name, "parallel")) {
-               char *compat;
+               const char *compat;
 
                compat = of_get_property(edev->prom_node,
                                         "compatible", NULL);
@@ -112,7 +145,7 @@ static int parport_isa_probe(int count)
                         */
                        if (parport_pc_probe_port(base, base + 0x400,
                                                  child->irq, PARPORT_DMA_NOFIFO,
-                                                 child->bus->self))
+                                                 &child->bus->self->dev))
                                count++;
                }
        }
@@ -166,7 +199,8 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
 
                                if (parport_pc_probe_port(base, base + 0x400,
                                                          edev->irqs[0],
-                                                         count, ebus->self))
+                                                         count,
+                                                         &ebus->self->dev))
                                        count++;
                        }
                }