]> Pileus Git - ~andy/linux/commitdiff
ide: remove IDE_ARCH_LOCK (v2)
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:22 +0000 (12:46 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:22 +0000 (12:46 +0100)
* Add ->{get,release}_lock methods to struct ide_port_info
  and struct ide_host.

* Convert core IDE code, m68k IDE code and falconide support to use
  ->{get,release}_lock methods instead of ide_{get,release}_lock().

* Remove IDE_ARCH_LOCK.

v2:
* Build fix from Geert updating ide_{get,release}_lock() callers in
  falconide.c.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
arch/m68k/include/asm/ide.h
drivers/ide/falconide.c
drivers/ide/ide-io.c
drivers/ide/ide-probe.c
include/linux/ide.h

index 9f95f06eebe2ede4b3a396f1caa28e22d8ae4822..4e6e77759f8841c174cb590b86391cc4e6453cf4 100644 (file)
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#ifdef CONFIG_ATARI
-#include <linux/interrupt.h>
-#include <asm/atari_stdma.h>
-#endif
-
 #ifdef CONFIG_MAC
 #include <asm/macints.h>
 #endif
 #define outsw_swapw(port, addr, n)     raw_outsw_swapw((u16 *)port, addr, n)
 #endif
 
-#ifdef CONFIG_BLK_DEV_FALCON_IDE
-#define IDE_ARCH_LOCK
-
-extern int falconide_intr_lock;
-
-static __inline__ void ide_release_lock (void)
-{
-       if (MACH_IS_ATARI) {
-               if (falconide_intr_lock == 0) {
-                       printk("ide_release_lock: bug\n");
-                       return;
-               }
-               falconide_intr_lock = 0;
-               stdma_release();
-       }
-}
-
-static __inline__ void
-ide_get_lock(irq_handler_t handler, void *data)
-{
-       if (MACH_IS_ATARI) {
-               if (falconide_intr_lock == 0) {
-                       if (in_interrupt() > 0)
-                               panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
-                       stdma_lock(handler, data);
-                       falconide_intr_lock = 1;
-               }
-       }
-}
-#endif /* CONFIG_BLK_DEV_FALCON_IDE */
-
 #endif /* __KERNEL__ */
 #endif /* _M68K_IDE_H */
index a638e952d67a4b847ec94b4e7c324ef859382850..d4d7ff1a3516739ad9732cee5f59a2e9db46674a 100644 (file)
      *  which is shared between several drivers.
      */
 
-int falconide_intr_lock;
-EXPORT_SYMBOL(falconide_intr_lock);
+static int falconide_intr_lock;
+
+static void falconide_release_lock(void)
+{
+       if (falconide_intr_lock == 0) {
+               printk(KERN_ERR "%s: bug\n", __func__);
+               return;
+       }
+       falconide_intr_lock = 0;
+       stdma_release();
+}
+
+static void falconide_get_lock(irq_handler_t handler, void *data)
+{
+       if (falconide_intr_lock == 0) {
+               if (in_interrupt() > 0)
+                       panic("Falcon IDE hasn't ST-DMA lock in interrupt");
+               stdma_lock(handler, data);
+               falconide_intr_lock = 1;
+       }
+}
 
 static void falconide_input_data(ide_drive_t *drive, struct request *rq,
                                 void *buf, unsigned int len)
@@ -81,6 +100,8 @@ static const struct ide_tp_ops falconide_tp_ops = {
 };
 
 static const struct ide_port_info falconide_port_info = {
+       .get_lock               = falconide_get_lock,
+       .release_lock           = falconide_release_lock,
        .tp_ops                 = &falconide_tp_ops,
        .host_flags             = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE,
 };
@@ -132,9 +153,9 @@ static int __init falconide_init(void)
                goto err;
        }
 
-       ide_get_lock(NULL, NULL);
+       falconide_get_lock(NULL, NULL);
        rc = ide_host_register(host, &falconide_port_info, hws);
-       ide_release_lock();
+       falconide_release_lock();
 
        if (rc)
                goto err_free;
index e85060164203f9468e6d02c6bc8011ff298e821b..030b0ea1a1e1c98f42386149432d1fd820054f86 100644 (file)
@@ -501,8 +501,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif)
        if (host->host_flags & IDE_HFLAG_SERIALIZE) {
                rc = test_and_set_bit_lock(IDE_HOST_BUSY, &host->host_busy);
                if (rc == 0) {
-                       /* for atari only */
-                       ide_get_lock(ide_intr, hwif);
+                       if (host->get_lock)
+                               host->get_lock(ide_intr, hwif);
                }
        }
        return rc;
@@ -511,8 +511,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif)
 static inline void ide_unlock_host(struct ide_host *host)
 {
        if (host->host_flags & IDE_HFLAG_SERIALIZE) {
-               /* for atari only */
-               ide_release_lock();
+               if (host->release_lock)
+                       host->release_lock();
                clear_bit_unlock(IDE_HOST_BUSY, &host->host_busy);
        }
 }
index b0510b033d7835e337a12ad1e25e51e1cdd5514a..a3edbb5d0452bd6ea466beccc0274a0bf3d60734 100644 (file)
@@ -1325,6 +1325,8 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws)
 
        if (d) {
                host->init_chipset = d->init_chipset;
+               host->get_lock     = d->get_lock;
+               host->release_lock = d->release_lock;
                host->host_flags = d->host_flags;
        }
 
index cda80b5779a46ec5db8e1fd39b9eecf1e0e77bc2..b7d95f09cc2ec59194ef50d2538c2c8de3abd210 100644 (file)
@@ -202,12 +202,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
 
 #define MAX_HWIFS      10
 
-/* Currently only Atari needs it */
-#ifndef IDE_ARCH_LOCK
-# define ide_release_lock()                    do {} while (0)
-# define ide_get_lock(hdlr, data)              do {} while (0)
-#endif /* IDE_ARCH_LOCK */
-
 /*
  * Now for the data we need to maintain per-drive:  ide_drive_t
  */
@@ -845,8 +839,14 @@ struct ide_host {
        ide_hwif_t      *ports[MAX_HOST_PORTS + 1];
        unsigned int    n_ports;
        struct device   *dev[2];
+
        int             (*init_chipset)(struct pci_dev *);
+
+       void            (*get_lock)(irq_handler_t, void *);
+       void            (*release_lock)(void);
+
        irq_handler_t   irq_handler;
+
        unsigned long   host_flags;
        void            *host_priv;
        ide_hwif_t      *cur_port;      /* for hosts requiring serialization */
@@ -1358,7 +1358,12 @@ enum {
 
 struct ide_port_info {
        char                    *name;
+
        int                     (*init_chipset)(struct pci_dev *);
+
+       void                    (*get_lock)(irq_handler_t, void *);
+       void                    (*release_lock)(void);
+
        void                    (*init_iops)(ide_hwif_t *);
        void                    (*init_hwif)(ide_hwif_t *);
        int                     (*init_dma)(ide_hwif_t *,