[PATCH] mac_esp: remove redundant mutual exclusion

2011-09-11 Thread Finn Thain

Mutual exclusion is redundant here because all the paths in the call graph 
leading to esp_driver_ops.send_dma_cmd() happen under spin_lock_irqsave/ 
spin_lock_irqrestore. Remove it.

Tested on a Mac Quadra 660av and a Mac LC 630.

Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

Part of this patch relates to Geert's m68k generic hard irq conversion 
work. Under genirq, the disable_irq() in mac_esp leads to deadlock. It 
wasn't a problem before because the m68k disable_irq() implementation is 
equivalent to genirq's disable_irq_nosync().

I initially sent this to the wrong list by mistake... this is the same 
patch.

Index: linux-m68k/drivers/scsi/mac_esp.c
===
--- linux-m68k.orig/drivers/scsi/mac_esp.c  2011-08-28 00:33:13.0 
+1000
+++ linux-m68k/drivers/scsi/mac_esp.c   2011-08-28 00:35:48.0 +1000
@@ -230,9 +230,6 @@ static void mac_esp_send_pdma_cmd(struct
  u32 dma_count, int write, u8 cmd)
 {
struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
-   unsigned long flags;
-
-   local_irq_save(flags);
 
mep-error = 0;
 
@@ -270,8 +267,6 @@ static void mac_esp_send_pdma_cmd(struct
esp_count = n;
}
} while (esp_count);
-
-   local_irq_restore(flags);
 }
 
 /*
@@ -353,8 +348,6 @@ static void mac_esp_send_pio_cmd(struct
struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
u8 *fifo = esp-regs + ESP_FDATA * 16;
 
-   disable_irq(esp-host-irq);
-
cmd = ~ESP_CMD_DMA;
mep-error = 0;
 
@@ -431,8 +424,6 @@ static void mac_esp_send_pio_cmd(struct
scsi_esp_cmd(esp, ESP_CMD_TI);
}
}
-
-   enable_irq(esp-host-irq);
 }
 
 static int mac_esp_irq_pending(struct esp *esp)
--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac_esp: remove redundant mutual exclusion

2011-09-10 Thread Finn Thain
Mutual exclusion is redundant here because all the paths in the call graph 
leading to esp_driver_ops.send_dma_cmd() happen under spin_lock_irqsave/ 
spin_lock_irqrestore. Remove it.

Tested on a Mac Quadra 660av and a Mac LC 630.

Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

Part of this patch relates to Geert's m68k generic hard irq conversion 
work. Under genirq, the disable_irq() in mac_esp leads to deadlock. It 
wasn't a problem before because the m68k disable_irq() implementation is 
equivalent to genirq's disable_irq_nosync().

Index: linux-m68k/drivers/scsi/mac_esp.c
===
--- linux-m68k.orig/drivers/scsi/mac_esp.c  2011-08-28 00:33:13.0 
+1000
+++ linux-m68k/drivers/scsi/mac_esp.c   2011-08-28 00:35:48.0 +1000
@@ -230,9 +230,6 @@ static void mac_esp_send_pdma_cmd(struct
  u32 dma_count, int write, u8 cmd)
 {
struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
-   unsigned long flags;
-
-   local_irq_save(flags);
 
mep-error = 0;
 
@@ -270,8 +267,6 @@ static void mac_esp_send_pdma_cmd(struct
esp_count = n;
}
} while (esp_count);
-
-   local_irq_restore(flags);
 }
 
 /*
@@ -353,8 +348,6 @@ static void mac_esp_send_pio_cmd(struct
struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
u8 *fifo = esp-regs + ESP_FDATA * 16;
 
-   disable_irq(esp-host-irq);
-
cmd = ~ESP_CMD_DMA;
mep-error = 0;
 
@@ -431,8 +424,6 @@ static void mac_esp_send_pio_cmd(struct
scsi_esp_cmd(esp, ESP_CMD_TI);
}
}
-
-   enable_irq(esp-host-irq);
 }
 
 static int mac_esp_irq_pending(struct esp *esp)
--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac_esp: remove redundant mutual exclusion

2011-09-10 Thread David Miller
From: Finn Thain fth...@telegraphics.com.au
Date: Sun, 11 Sep 2011 01:01:34 +1000 (EST)

 Mutual exclusion is redundant here because all the paths in the call graph 
 leading to esp_driver_ops.send_dma_cmd() happen under spin_lock_irqsave/ 
 spin_lock_irqrestore. Remove it.
 
 Tested on a Mac Quadra 660av and a Mac LC 630.
 
 Signed-off-by: Finn Thain fth...@telegraphics.com.au

This patch should be CC:'d to linux-scsi not netdev

I understand how the networking maintainer is very responsive
and the SCSI maintainer generally takes forever, so your
Freudian slip will go unjudged :-)
--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html