linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] m68k related IDE cleanups
@ 2009-01-27 18:02 Bartlomiej Zolnierkiewicz
  2009-01-27 18:02 ` [PATCH 1/4] ide: remove IDE_ARCH_INTR Bartlomiej Zolnierkiewicz
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-01-27 18:02 UTC (permalink / raw)
  To: linux-ide
  Cc: Geert Uytterhoeven, Michael Schmitz, Bartlomiej Zolnierkiewicz,
	linux-m68k


Based on top of pata-2.6 tree (& hopefully tomorrow's linux-next).

This removes m68k-specific IDE_ARCH_{INTR,LOCK}, switches m68k host drivers
to use core code's MMIO support and cleanups <asm-m68k/ide.h> significantly.

Geert/Michael: please take a look when possible.

diffstat:
 drivers/ide/buddha.c    |    6 ---
 drivers/ide/falconide.c |   32 +++++++++++++++++----
 drivers/ide/gayle.c     |    6 +--
 drivers/ide/ide-io.c    |   13 ++++----
 drivers/ide/ide-probe.c |    2 +
 drivers/ide/macide.c    |    2 -
 drivers/ide/q40ide.c    |    6 +--
 include/asm-m68k/ide.h  |   73 ------------------------------------------------
 include/linux/ide.h     |   21 ++++++-------
 9 files changed, 53 insertions(+), 108 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] ide: remove IDE_ARCH_INTR
  2009-01-27 18:02 [PATCH 0/4] m68k related IDE cleanups Bartlomiej Zolnierkiewicz
@ 2009-01-27 18:02 ` Bartlomiej Zolnierkiewicz
  2009-01-27 19:42   ` David D. Kilzer
  2009-01-27 18:02 ` [PATCH 2/4] ide: remove IDE_ARCH_LOCK Bartlomiej Zolnierkiewicz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-01-27 18:02 UTC (permalink / raw)
  To: linux-ide
  Cc: Geert Uytterhoeven, Michael Schmitz, Bartlomiej Zolnierkiewicz,
	linux-m68k

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: remove IDE_ARCH_INTR

This micro-optimization is not worth it.  Just always check for
existence of ->ack_intr method in ide_intr() and ide_timer_expiry().

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-io.c   |    5 +++--
 include/asm-m68k/ide.h |    3 ---
 include/linux/ide.h    |    5 -----
 3 files changed, 3 insertions(+), 10 deletions(-)

Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -736,7 +736,8 @@ void ide_timer_expiry (unsigned long dat
 		} else if (drive_is_ready(drive)) {
 			if (drive->waiting_for_dma)
 				hwif->dma_ops->dma_lost_irq(drive);
-			(void)ide_ack_intr(hwif);
+			if (hwif->ack_intr(hwif))
+				hwif->ack_intr(hwif);
 			printk(KERN_WARNING "%s: lost interrupt\n",
 				drive->name);
 			startstop = handler(drive);
@@ -851,7 +852,7 @@ irqreturn_t ide_intr (int irq, void *dev
 
 	spin_lock_irqsave(&hwif->lock, flags);
 
-	if (!ide_ack_intr(hwif))
+	if (hwif->ack_intr && hwif->ack_intr(hwif) == 0)
 		goto out;
 
 	handler = hwif->handler;
Index: b/include/asm-m68k/ide.h
===================================================================
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -123,8 +123,5 @@ ide_get_lock(irq_handler_t handler, void
 }
 #endif /* CONFIG_BLK_DEV_FALCON_IDE */
 
-#define IDE_ARCH_ACK_INTR
-#define ide_ack_intr(hwif)	((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
-
 #endif /* __KERNEL__ */
 #endif /* _M68K_IDE_H */
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -202,11 +202,6 @@ static inline void ide_std_init_ports(hw
 
 #define MAX_HWIFS	10
 
-/* Currently only m68k, apus and m8xx need it */
-#ifndef IDE_ARCH_ACK_INTR
-# define ide_ack_intr(hwif) (1)
-#endif
-
 /* Currently only Atari needs it */
 #ifndef IDE_ARCH_LOCK
 # define ide_release_lock()			do {} while (0)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/4] ide: remove IDE_ARCH_LOCK
  2009-01-27 18:02 [PATCH 0/4] m68k related IDE cleanups Bartlomiej Zolnierkiewicz
  2009-01-27 18:02 ` [PATCH 1/4] ide: remove IDE_ARCH_INTR Bartlomiej Zolnierkiewicz
@ 2009-01-27 18:02 ` Bartlomiej Zolnierkiewicz
  2009-02-04 21:27   ` Geert Uytterhoeven
  2009-01-27 18:03 ` [PATCH 3/4] ide: make m68k host drivers use IDE_HFLAG_MMIO Bartlomiej Zolnierkiewicz
  2009-01-27 18:03 ` [PATCH 4/4] m68k: cleanup <asm/ide.h> Bartlomiej Zolnierkiewicz
  3 siblings, 1 reply; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-01-27 18:02 UTC (permalink / raw)
  To: linux-ide
  Cc: Geert Uytterhoeven, Michael Schmitz, Bartlomiej Zolnierkiewicz,
	linux-m68k

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: remove IDE_ARCH_LOCK

* 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.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
We may also consider adding struct ide_host_ops later...

 drivers/ide/falconide.c |   25 +++++++++++++++++++++++--
 drivers/ide/ide-io.c    |    8 ++++----
 drivers/ide/ide-probe.c |    2 ++
 include/asm-m68k/ide.h  |   36 ------------------------------------
 include/linux/ide.h     |   16 ++++++++++------
 5 files changed, 39 insertions(+), 48 deletions(-)

Index: b/drivers/ide/falconide.c
===================================================================
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -40,8 +40,27 @@
      *  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
 };
 
 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,
 };
Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -498,8 +498,8 @@ static inline int ide_lock_host(struct i
 	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;
@@ -508,8 +508,8 @@ static inline int ide_lock_host(struct i
 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: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1320,6 +1320,8 @@ struct ide_host *ide_host_alloc(const st
 
 	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: b/include/asm-m68k/ide.h
===================================================================
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -36,11 +36,6 @@
 #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
@@ -92,36 +87,5 @@
 #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: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -202,12 +202,6 @@ static inline void ide_std_init_ports(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
  */
@@ -844,7 +838,12 @@ 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);
+
 	unsigned long	host_flags;
 	void		*host_priv;
 	ide_hwif_t	*cur_port;	/* for hosts requiring serialization */
@@ -1355,7 +1354,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 *,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/4] ide: make m68k host drivers use IDE_HFLAG_MMIO
  2009-01-27 18:02 [PATCH 0/4] m68k related IDE cleanups Bartlomiej Zolnierkiewicz
  2009-01-27 18:02 ` [PATCH 1/4] ide: remove IDE_ARCH_INTR Bartlomiej Zolnierkiewicz
  2009-01-27 18:02 ` [PATCH 2/4] ide: remove IDE_ARCH_LOCK Bartlomiej Zolnierkiewicz
@ 2009-01-27 18:03 ` Bartlomiej Zolnierkiewicz
  2009-01-27 18:03 ` [PATCH 4/4] m68k: cleanup <asm/ide.h> Bartlomiej Zolnierkiewicz
  3 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-01-27 18:03 UTC (permalink / raw)
  To: linux-ide
  Cc: Geert Uytterhoeven, Michael Schmitz, Bartlomiej Zolnierkiewicz,
	linux-m68k

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: make m68k host drivers use IDE_HFLAG_MMIO

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/buddha.c    |    6 +-----
 drivers/ide/falconide.c |    3 ++-
 drivers/ide/gayle.c     |    6 ++----
 drivers/ide/macide.c    |    2 +-
 drivers/ide/q40ide.c    |    2 +-
 5 files changed, 7 insertions(+), 12 deletions(-)

Index: b/drivers/ide/buddha.c
===================================================================
--- a/drivers/ide/buddha.c
+++ b/drivers/ide/buddha.c
@@ -144,7 +144,7 @@ static void __init buddha_setup_ports(hw
 }
 
 static const struct ide_port_info buddha_port_info = {
-	.host_flags		= IDE_HFLAG_NO_DMA,
+	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
 };
 
     /*
@@ -176,10 +176,6 @@ static int __init buddha_init(void)
 		
 		board = z->resource.start;
 
-/*
- * FIXME: we now have selectable mmio v/s iomio transports.
- */
-
 		if(type != BOARD_XSURF) {
 			if (!request_mem_region(board+BUDDHA_BASE1, 0x800, "IDE"))
 				continue;
Index: b/drivers/ide/falconide.c
===================================================================
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -103,7 +103,8 @@ static const struct ide_port_info falcon
 	.get_lock		= falconide_get_lock,
 	.release_lock		= falconide_release_lock,
 	.tp_ops			= &falconide_tp_ops,
-	.host_flags		= IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE,
+	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
+				  IDE_HFLAG_NO_DMA,
 };
 
 static void __init falconide_setup_ports(hw_regs_t *hw)
Index: b/drivers/ide/gayle.c
===================================================================
--- a/drivers/ide/gayle.c
+++ b/drivers/ide/gayle.c
@@ -118,7 +118,8 @@ static void __init gayle_setup_ports(hw_
 }
 
 static const struct ide_port_info gayle_port_info = {
-	.host_flags		= IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA,
+	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
+				  IDE_HFLAG_NO_DMA,
 };
 
     /*
@@ -163,9 +164,6 @@ found:
 	    irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
 	    ack_intr = gayle_ack_intr_a1200;
 	}
-/*
- * FIXME: we now have selectable modes between mmio v/s iomio
- */
 
 	res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
 	res_n = GAYLE_IDEREG_SIZE;
Index: b/drivers/ide/macide.c
===================================================================
--- a/drivers/ide/macide.c
+++ b/drivers/ide/macide.c
@@ -81,7 +81,7 @@ static void __init macide_setup_ports(hw
 }
 
 static const struct ide_port_info macide_port_info = {
-	.host_flags		= IDE_HFLAG_NO_DMA,
+	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
 };
 
 static const char *mac_ide_name[] =
Index: b/drivers/ide/q40ide.c
===================================================================
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -111,7 +111,7 @@ static const struct ide_tp_ops q40ide_tp
 
 static const struct ide_port_info q40ide_port_info = {
 	.tp_ops			= &q40ide_tp_ops,
-	.host_flags		= IDE_HFLAG_NO_DMA,
+	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
 };
 
 /* 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/4] m68k: cleanup <asm/ide.h>
  2009-01-27 18:02 [PATCH 0/4] m68k related IDE cleanups Bartlomiej Zolnierkiewicz
                   ` (2 preceding siblings ...)
  2009-01-27 18:03 ` [PATCH 3/4] ide: make m68k host drivers use IDE_HFLAG_MMIO Bartlomiej Zolnierkiewicz
@ 2009-01-27 18:03 ` Bartlomiej Zolnierkiewicz
  3 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-01-27 18:03 UTC (permalink / raw)
  To: linux-ide
  Cc: Geert Uytterhoeven, Michael Schmitz, Bartlomiej Zolnierkiewicz,
	linux-m68k

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: cleanup <asm-m68k/ide.h>

* Remove superfluous <asm/macints.h> include.

* No need to re-define in/out*() macros as they are no longer used
  by m68k host drivers.

* readl() and writel() are not used by core IDE code.

* Use raw_*_swapw() directly in {falcon,q40}ide.c and remove
  {in,out}sw_swapw() macros.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/falconide.c |    4 ++--
 drivers/ide/q40ide.c    |    4 ++--
 include/asm-m68k/ide.h  |   34 ----------------------------------
 3 files changed, 4 insertions(+), 38 deletions(-)

Index: b/drivers/ide/falconide.c
===================================================================
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -70,7 +70,7 @@ static void falconide_input_data(ide_dri
 	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 		return insw(data_addr, buf, (len + 1) / 2);
 
-	insw_swapw(data_addr, buf, (len + 1) / 2);
+	raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 }
 
 static void falconide_output_data(ide_drive_t *drive, struct request *rq,
@@ -81,7 +81,7 @@ static void falconide_output_data(ide_dr
 	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 		return outsw(data_addr, buf, (len + 1) / 2);
 
-	outsw_swapw(data_addr, buf, (len + 1) / 2);
+	raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 }
 
 /* Atari has a byte-swapped IDE interface */
Index: b/drivers/ide/q40ide.c
===================================================================
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -80,7 +80,7 @@ static void q40ide_input_data(ide_drive_
 	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 		return insw(data_addr, buf, (len + 1) / 2);
 
-	insw_swapw(data_addr, buf, (len + 1) / 2);
+	raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 }
 
 static void q40ide_output_data(ide_drive_t *drive, struct request *rq,
@@ -91,7 +91,7 @@ static void q40ide_output_data(ide_drive
 	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 		return outsw(data_addr, buf, (len + 1) / 2);
 
-	outsw_swapw(data_addr, buf, (len + 1) / 2);
+	raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 }
 
 /* Q40 has a byte-swapped IDE interface */
Index: b/include/asm-m68k/ide.h
===================================================================
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -30,62 +30,28 @@
 #define _M68K_IDE_H
 
 #ifdef __KERNEL__
-
-
 #include <asm/setup.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#ifdef CONFIG_MAC
-#include <asm/macints.h>
-#endif
-
 /*
  * Get rid of defs from io.h - ide has its private and conflicting versions
  * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
  * always use the `raw' MMIO versions
  */
-#undef inb
-#undef inw
-#undef insw
-#undef inl
-#undef insl
-#undef outb
-#undef outw
-#undef outsw
-#undef outl
-#undef outsl
 #undef readb
 #undef readw
-#undef readl
 #undef writeb
 #undef writew
-#undef writel
 
-#define inb				in_8
-#define inw				in_be16
-#define insw(port, addr, n)		raw_insw((u16 *)port, addr, n)
-#define inl				in_be32
-#define insl(port, addr, n)		raw_insl((u32 *)port, addr, n)
-#define outb(val, port)			out_8(port, val)
-#define outw(val, port)			out_be16(port, val)
-#define outsw(port, addr, n)		raw_outsw((u16 *)port, addr, n)
-#define outl(val, port)			out_be32(port, val)
-#define outsl(port, addr, n)		raw_outsl((u32 *)port, addr, n)
 #define readb				in_8
 #define readw				in_be16
 #define __ide_mm_insw(port, addr, n)	raw_insw((u16 *)port, addr, n)
-#define readl				in_be32
 #define __ide_mm_insl(port, addr, n)	raw_insl((u32 *)port, addr, n)
 #define writeb(val, port)		out_8(port, val)
 #define writew(val, port)		out_be16(port, val)
 #define __ide_mm_outsw(port, addr, n)	raw_outsw((u16 *)port, addr, n)
-#define writel(val, port)		out_be32(port, val)
 #define __ide_mm_outsl(port, addr, n)	raw_outsl((u32 *)port, addr, n)
-#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
-#define insw_swapw(port, addr, n)	raw_insw_swapw((u16 *)port, addr, n)
-#define outsw_swapw(port, addr, n)	raw_outsw_swapw((u16 *)port, addr, n)
-#endif
 
 #endif /* __KERNEL__ */
 #endif /* _M68K_IDE_H */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] ide: remove IDE_ARCH_INTR
  2009-01-27 18:02 ` [PATCH 1/4] ide: remove IDE_ARCH_INTR Bartlomiej Zolnierkiewicz
@ 2009-01-27 19:42   ` David D. Kilzer
  2009-01-29  4:22     ` Michael Schmitz
  0 siblings, 1 reply; 10+ messages in thread
From: David D. Kilzer @ 2009-01-27 19:42 UTC (permalink / raw)
  To: linux-ide
  Cc: Geert Uytterhoeven, Michael Schmitz, Bartlomiej Zolnierkiewicz,
	linux-m68k

[Apologies for resending. The mailing lists on vger freaked out over MIME content in the last message.]

-            (void)ide_ack_intr(hwif);
+            if (hwif->ack_intr(hwif))
+                hwif->ack_intr(hwif);

Shouldn't that be:

-            (void)ide_ack_intr(hwif);
+            if (hwif->ack_intr)
+                hwif->ack_intr(hwif);

Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] ide: remove IDE_ARCH_INTR
  2009-01-27 19:42   ` David D. Kilzer
@ 2009-01-29  4:22     ` Michael Schmitz
  2009-02-01 15:53       ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Schmitz @ 2009-01-29  4:22 UTC (permalink / raw)
  To: David D. Kilzer
  Cc: Bartlomiej Zolnierkiewicz, linux-ide, Geert Uytterhoeven,
	Michael Schmitz, linux-m68k

Hi,

> 
> -            (void)ide_ack_intr(hwif);
> +            if (hwif->ack_intr(hwif))
> +                hwif->ack_intr(hwif);
> 
> Shouldn't that be:
> 
> -            (void)ide_ack_intr(hwif);
> +            if (hwif->ack_intr)
> +                hwif->ack_intr(hwif);

Seconded. No point in ack'ing the int twice (not to mention the other side 
effects).

	Michael


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] ide: remove IDE_ARCH_INTR
  2009-01-29  4:22     ` Michael Schmitz
@ 2009-02-01 15:53       ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 15:53 UTC (permalink / raw)
  To: Michael Schmitz
  Cc: David D. Kilzer, linux-ide, Geert Uytterhoeven, Michael Schmitz,
	linux-m68k


On Thursday 29 January 2009, Michael Schmitz wrote:
> Hi,
> 
> > 
> > -            (void)ide_ack_intr(hwif);
> > +            if (hwif->ack_intr(hwif))
> > +                hwif->ack_intr(hwif);
> > 
> > Shouldn't that be:
> > 
> > -            (void)ide_ack_intr(hwif);
> > +            if (hwif->ack_intr)
> > +                hwif->ack_intr(hwif);
> 
> Seconded. No point in ack'ing the int twice (not to mention the other side 
> effects).

Brown paper bag time and another proof that having helpful people looking
over your patches really matters...

Thanks guys, I fixed it in v2.

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: remove IDE_ARCH_INTR (v2)

This micro-optimization is not worth it.  Just always check for
existence of ->ack_intr method in ide_intr() and ide_timer_expiry().

v2:
Fix brown-paper-bag bug spotted by David D. Kilzer.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Cc: "David D. Kilzer" <ddkilzer@kilzer.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-io.c   |    5 +++--
 include/asm-m68k/ide.h |    3 ---
 include/linux/ide.h    |    5 -----
 3 files changed, 3 insertions(+), 10 deletions(-)

Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -736,7 +736,8 @@ void ide_timer_expiry (unsigned long dat
 		} else if (drive_is_ready(drive)) {
 			if (drive->waiting_for_dma)
 				hwif->dma_ops->dma_lost_irq(drive);
-			(void)ide_ack_intr(hwif);
+			if (hwif->ack_intr)
+				hwif->ack_intr(hwif);
 			printk(KERN_WARNING "%s: lost interrupt\n",
 				drive->name);
 			startstop = handler(drive);
@@ -851,7 +852,7 @@ irqreturn_t ide_intr (int irq, void *dev
 
 	spin_lock_irqsave(&hwif->lock, flags);
 
-	if (!ide_ack_intr(hwif))
+	if (hwif->ack_intr && hwif->ack_intr(hwif) == 0)
 		goto out;
 
 	handler = hwif->handler;
Index: b/include/asm-m68k/ide.h
===================================================================
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -123,8 +123,5 @@ ide_get_lock(irq_handler_t handler, void
 }
 #endif /* CONFIG_BLK_DEV_FALCON_IDE */
 
-#define IDE_ARCH_ACK_INTR
-#define ide_ack_intr(hwif)	((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
-
 #endif /* __KERNEL__ */
 #endif /* _M68K_IDE_H */
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -202,11 +202,6 @@ static inline void ide_std_init_ports(hw
 
 #define MAX_HWIFS	10
 
-/* Currently only m68k, apus and m8xx need it */
-#ifndef IDE_ARCH_ACK_INTR
-# define ide_ack_intr(hwif) (1)
-#endif
-
 /* Currently only Atari needs it */
 #ifndef IDE_ARCH_LOCK
 # define ide_release_lock()			do {} while (0)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] ide: remove IDE_ARCH_LOCK
  2009-01-27 18:02 ` [PATCH 2/4] ide: remove IDE_ARCH_LOCK Bartlomiej Zolnierkiewicz
@ 2009-02-04 21:27   ` Geert Uytterhoeven
  2009-02-05 20:14     ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2009-02-04 21:27 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, Michael Schmitz, linux-m68k

On Tue, 27 Jan 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] ide: remove IDE_ARCH_LOCK
> 
> * 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.
> 
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Michael Schmitz <schmitz@debian.org>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> We may also consider adding struct ide_host_ops later...
> 
>  drivers/ide/falconide.c |   25 +++++++++++++++++++++++--
>  drivers/ide/ide-io.c    |    8 ++++----
>  drivers/ide/ide-probe.c |    2 ++
>  include/asm-m68k/ide.h  |   36 ------------------------------------
>  include/linux/ide.h     |   16 ++++++++++------
>  5 files changed, 39 insertions(+), 48 deletions(-)
> 
> Index: b/drivers/ide/falconide.c
> ===================================================================
> --- a/drivers/ide/falconide.c
> +++ b/drivers/ide/falconide.c
> @@ -40,8 +40,27 @@
>       *  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
>  };
>  
>  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,
>  };

http://kisskb.ellerman.id.au/kisskb/buildresult/71775/

drivers/ide/falconide.c:157: error: implicit declaration of function 'ide_get_lock'
drivers/ide/falconide.c:159: error: implicit declaration of function 'ide_release_lock'

Seems like you forgot to update two callers?

diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index 1203796..bb0c86e 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -154,9 +154,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;

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] ide: remove IDE_ARCH_LOCK
  2009-02-04 21:27   ` Geert Uytterhoeven
@ 2009-02-05 20:14     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-05 20:14 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-ide, Michael Schmitz, linux-m68k

On Wednesday 04 February 2009, Geert Uytterhoeven wrote:
> On Tue, 27 Jan 2009, Bartlomiej Zolnierkiewicz wrote:
> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > Subject: [PATCH] ide: remove IDE_ARCH_LOCK
> > 
> > * 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.
> > 
> > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: Michael Schmitz <schmitz@debian.org>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > We may also consider adding struct ide_host_ops later...
> > 
> >  drivers/ide/falconide.c |   25 +++++++++++++++++++++++--
> >  drivers/ide/ide-io.c    |    8 ++++----
> >  drivers/ide/ide-probe.c |    2 ++
> >  include/asm-m68k/ide.h  |   36 ------------------------------------
> >  include/linux/ide.h     |   16 ++++++++++------
> >  5 files changed, 39 insertions(+), 48 deletions(-)
> > 
> > Index: b/drivers/ide/falconide.c
> > ===================================================================
> > --- a/drivers/ide/falconide.c
> > +++ b/drivers/ide/falconide.c
> > @@ -40,8 +40,27 @@
> >       *  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
> >  };
> >  
> >  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,
> >  };
> 
> http://kisskb.ellerman.id.au/kisskb/buildresult/71775/
> 
> drivers/ide/falconide.c:157: error: implicit declaration of function 'ide_get_lock'
> drivers/ide/falconide.c:159: error: implicit declaration of function 'ide_release_lock'
> 
> Seems like you forgot to update two callers?
> 
> diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
> index 1203796..bb0c86e 100644
> --- a/drivers/ide/falconide.c
> +++ b/drivers/ide/falconide.c
> @@ -154,9 +154,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();

Thanks, I integrated above fix into the original patch.

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

Bart

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-02-05 20:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-27 18:02 [PATCH 0/4] m68k related IDE cleanups Bartlomiej Zolnierkiewicz
2009-01-27 18:02 ` [PATCH 1/4] ide: remove IDE_ARCH_INTR Bartlomiej Zolnierkiewicz
2009-01-27 19:42   ` David D. Kilzer
2009-01-29  4:22     ` Michael Schmitz
2009-02-01 15:53       ` Bartlomiej Zolnierkiewicz
2009-01-27 18:02 ` [PATCH 2/4] ide: remove IDE_ARCH_LOCK Bartlomiej Zolnierkiewicz
2009-02-04 21:27   ` Geert Uytterhoeven
2009-02-05 20:14     ` Bartlomiej Zolnierkiewicz
2009-01-27 18:03 ` [PATCH 3/4] ide: make m68k host drivers use IDE_HFLAG_MMIO Bartlomiej Zolnierkiewicz
2009-01-27 18:03 ` [PATCH 4/4] m68k: cleanup <asm/ide.h> Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).