Skip to contentSkip to conversation

weekly IDE updates

PATCH In review Bartlomiej Zolnierkiewicz 7 participants 32 messages Feb 1, 2009 – Mar 4, 2009 libata

lore
Share & tools
lore
#0 lore raw

cover weekly IDE updates

The weekly IDE updates on top of pata-2.6 tree... [ What else did you expect? ]

Fix some minor bugs (memleak on device probing failure and incorrect error message on multi-PIO write failure), limit proliferation of <asm/ide.h>, allow host drivers to specify IRQ flags that they want and do a few cleanups...

diffstat:

 drivers/ide/buddha.c        |    1 
 drivers/ide/delkin_cb.c     |    1 
 drivers/ide/dtc2278.c       |    3 -
 drivers/ide/falconide.c     |    1 
 drivers/ide/gayle.c         |    1 
 drivers/ide/ide-4drives.c   |    3 -
 drivers/ide/ide-cs.c        |    1 
 drivers/ide/ide-disk.c      |    3 -
 drivers/ide/ide-disk_proc.c |    4 +
 drivers/ide/ide-eh.c        |   11 ++++-
 drivers/ide/ide-floppy.c    |    2 
 drivers/ide/ide-h8300.c     |    4 -
 drivers/ide/ide-io-std.c    |   13 ++++--
 drivers/ide/ide-io.c        |   95 +++++++++++++-------------------------------
 drivers/ide/ide-park.c      |    2 
 drivers/ide/ide-pm.c        |    9 +++-
 drivers/ide/ide-probe.c     |   56 +++++++++----------------
 drivers/ide/ide-tape.c      |    2 
 drivers/ide/ide-taskfile.c  |   56 ++++++++++++++-----------
 drivers/ide/macide.c        |    1 
 drivers/ide/ns87415.c       |    2 
 drivers/ide/q40ide.c        |    1 
 drivers/ide/scc_pata.c      |   28 +++++-------
 drivers/ide/setup-pci.c     |    4 +
 drivers/ide/sgiioc4.c       |    1 
 drivers/ide/tx4938ide.c     |    6 +-
 drivers/ide/tx4939ide.c     |    6 +-
 include/linux/ide.h         |   93 ++++++++++++++++++++++---------------------
 28 files changed, 202 insertions(+), 208 deletions(-)
#1 lore raw

PATCH 1/15 ide: include <asm/ide.h> only when needed

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: include <asm/ide.h> only when needed

---
 drivers/ide/ide-io-std.c |    7 +++++++
 drivers/ide/tx4938ide.c  |    2 ++
 drivers/ide/tx4939ide.c  |    2 ++
 include/linux/ide.h      |    7 -------
 4 files changed, 11 insertions(+), 7 deletions(-)
drivers/ide/ide-io-std.c +7 -0
Index: b/drivers/ide/ide-io-std.c
===================================================================
@@ -2,6 +2,13 @@
 #include <linux/kernel.h>
 #include <linux/ide.h>
 
+#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
+    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
+#include <asm/ide.h>
+#else
+#include <asm-generic/ide_iops.h>
+#endif
+
 /*
  *	Conventional PIO operations for ATA devices
  */
drivers/ide/tx4938ide.c +2 -0
Index: b/drivers/ide/tx4938ide.c
===================================================================
@@ -15,6 +15,8 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+
+#include <asm/ide.h>
 #include <asm/txx9/tx4938.h>
 
 static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
drivers/ide/tx4939ide.c +2 -0
Index: b/drivers/ide/tx4939ide.c
===================================================================
@@ -18,6 +18,8 @@
 #include <linux/io.h>
 #include <linux/scatterlist.h>
 
+#include <asm/ide.h>
+
 #define MODNAME	"tx4939ide"
 
 /* ATA Shadow Registers (8-bit except for Data which is 16-bit) */
include/linux/ide.h +0 -7
Index: b/include/linux/ide.h
===================================================================
@@ -193,13 +193,6 @@ static inline void ide_std_init_ports(hw
 	hw->io_ports.ctl_addr = ctl_addr;
 }
 
-#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
-    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
-#include <asm/ide.h>
-#else
-#include <asm-generic/ide_iops.h>
-#endif
-
 #define MAX_HWIFS	10
 
 /*
#2 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Quoted 34 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: include <asm/ide.h> only when needed

---
 drivers/ide/ide-io-std.c |    7 +++++++
 drivers/ide/tx4938ide.c  |    2 ++
 drivers/ide/tx4939ide.c  |    2 ++
 include/linux/ide.h      |    7 -------
 4 files changed, 11 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide-io-std.c
===================================================================

drivers/ide/ide-io-std.c +7 -0
@@ -2,6 +2,13 @@
 #include <linux/kernel.h>
 #include <linux/ide.h>
 
+#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
+    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
+#include <asm/ide.h>
+#else
+#include <asm-generic/ide_iops.h>
+#endif
+
 /*
  *	Conventional PIO operations for ATA devices
  */

Index: b/drivers/ide/tx4938ide.c
===================================================================

drivers/ide/tx4938ide.c line 19

Quoted 5 lines
drivers/ide/tx4938ide.c +2 -0
@@ -15,6 +15,8 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+
+#include <asm/ide.h>

Did you try checkpatch.pl?

    [...]
Quoted 8 lines

Index: b/include/linux/ide.h
===================================================================

include/linux/ide.h +0 -0
@@ -193,13 +193,6 @@ static inline void ide_std_init_ports(hw
 	hw->io_ports.ctl_addr = ctl_addr;
 }
 

include/linux/ide.h static inline void ide_std_init_ports(hw · line 198

Quoted 10 lines
include/linux/ide.h +0 -7
-#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
-    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
-#include <asm/ide.h>
-#else
-#include <asm-generic/ide_iops.h>
-#endif
-
 #define MAX_HWIFS	10
 
 /*

As checkpatch.pl complains about any include of asm/*.h where the corresponding linux/*.h exists, this `fix' is incompatible with it.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#3 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Quoted 34 lines · Geert Uytterhoeven
Quoted 33 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: include <asm/ide.h> only when needed

---
 drivers/ide/ide-io-std.c |    7 +++++++
 drivers/ide/tx4938ide.c  |    2 ++
 drivers/ide/tx4939ide.c  |    2 ++
 include/linux/ide.h      |    7 -------
 4 files changed, 11 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide-io-std.c
===================================================================

drivers/ide/ide-io-std.c +7 -0
@@ -2,6 +2,13 @@
 #include <linux/kernel.h>
 #include <linux/ide.h>
 
+#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
+    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
+#include <asm/ide.h>
+#else
+#include <asm-generic/ide_iops.h>
+#endif
+
 /*
  *	Conventional PIO operations for ATA devices
  */

Index: b/drivers/ide/tx4938ide.c
===================================================================

drivers/ide/tx4938ide.c +0 -0
Quoted 8 lines

drivers/ide/tx4938ide.c line 19

Quoted 6 lines
drivers/ide/tx4938ide.c +2 -0
@@ -15,6 +15,8 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+
+#include <asm/ide.h>

Did you try checkpatch.pl?

Sure.

This driver uses stuff from <asm-mips/ide.h>.

[ I guess I could put '-mips' there to silence warnings on tx493{8,9}.c,
however I don't know of the way to get rid of ide-io-std.c's one... ]

Quoted 19 lines
    [...]
Quoted 17 lines

Index: b/include/linux/ide.h
===================================================================

include/linux/ide.h +0 -7
@@ -193,13 +193,6 @@ static inline void ide_std_init_ports(hw
 	hw->io_ports.ctl_addr = ctl_addr;
 }
 
-#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
-    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
-#include <asm/ide.h>
-#else
-#include <asm-generic/ide_iops.h>
-#endif
-
 #define MAX_HWIFS	10
 
Quoted 4 lines

include/linux/ide.h static inline void ide_std_init_ports(hw · line 198

Quoted 1 line
include/linux/ide.h +0 -0
 /*

As checkpatch.pl complains about any include of asm/*.h where the corresponding linux/*.h exists, this `fix' is incompatible with it.

checkpatch.pl gives false positives when it comes to some asm/*.h usages

This fix is such example -- it makes <asm/ide.h> pulled in only when really needed (ide-io-std.c and tx493{8,9}.c) instead of being pulled in indirectly by every file including <linux/ide.h>.

[ Long-term we want <asm/ide.h> removed but this is not possible yet so
I'm trying to limit its scope in the meantime... ]

Thanks,
Bart

#4 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 3 lines
Quoted 1 line

+#include <asm/ide.h>

Did you try checkpatch.pl?

Sure.

This driver uses stuff from <asm-mips/ide.h>.

[ I guess I could put '-mips' there to silence warnings on tx493{8,9}.c,
however I don't know of the way to get rid of ide-io-std.c's one... ]

BTW, tx4939ide_{in,out}put_data_swap and tx4939ide_{in,out}put_data_swap do exactly same thing.

If byte-swapped version of ide_{in,out}put_data() were available by ide core, they can be used instead. The byte-swapped version of default_tp_ops would much helps such queer big-endian platforms. Is it worth to bloat ide core? ;-)

---
Atsushi Nemoto

#5 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Quoted 12 lines · Atsushi Nemoto
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 3 lines
Quoted 1 line

+#include <asm/ide.h>

Did you try checkpatch.pl?

Sure.

This driver uses stuff from <asm-mips/ide.h>.

[ I guess I could put '-mips' there to silence warnings on tx493{8,9}.c,
however I don't know of the way to get rid of ide-io-std.c's one... ]

Quoted 7 lines

BTW, tx4939ide_{in,out}put_data_swap and tx4939ide_{in,out}put_data_swap do exactly same thing.

If byte-swapped version of ide_{in,out}put_data() were available by ide core, they can be used instead. The byte-swapped version of default_tp_ops would much helps such queer big-endian platforms. Is it worth to bloat ide core? ;-)

Seems to be a good idea and it may also help some other host drivers (ide-h8300.c?).

Thanks,
Bart

#6 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Hello.

Quoted 14 lines · Bartlomiej Zolnierkiewicz
Quoted 14 lines
Quoted 11 lines
Quoted 4 lines
Quoted 2 lines

+#include <asm/ide.h>

Did you try checkpatch.pl?

Sure.

This driver uses stuff from <asm-mips/ide.h>.

[ I guess I could put '-mips' there to silence warnings on tx493{8,9}.c,
however I don't know of the way to get rid of ide-io-std.c's one... ]

BTW, tx4939ide_{in,out}put_data_swap and tx4939ide_{in,out}put_data_swap do exactly same thing.

Quoted 9 lines
Quoted 5 lines

If byte-swapped version of ide_{in,out}put_data() were available by ide core, they can be used instead. The byte-swapped version of default_tp_ops would much helps such queer big-endian platforms. Is it worth to bloat ide core? ;-)

Seems to be a good idea and it may also help some other host drivers (ide-h8300.c?).

I'm not sure we need to carry the extra little used code just to help
some exotic driver.

Quoted 2 lines

Thanks,
Bart

MBR, Sergei

#7 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Hi,

Quoted 24 lines · Sergei Shtylyov

Hello.

Quoted 20 lines · Bartlomiej Zolnierkiewicz
Quoted 19 lines
Quoted 11 lines
Quoted 4 lines
Quoted 2 lines

+#include <asm/ide.h>

Did you try checkpatch.pl?

Sure.

This driver uses stuff from <asm-mips/ide.h>.

[ I guess I could put '-mips' there to silence warnings on tx493{8,9}.c,
however I don't know of the way to get rid of ide-io-std.c's one... ]

BTW, tx4939ide_{in,out}put_data_swap and tx4939ide_{in,out}put_data_swap do exactly same thing.

If byte-swapped version of ide_{in,out}put_data() were available by ide core, they can be used instead. The byte-swapped version of default_tp_ops would much helps such queer big-endian platforms. Is it worth to bloat ide core? ;-)

Quoted 6 lines
Quoted 3 lines

Seems to be a good idea and it may also help some other host drivers (ide-h8300.c?).

I'm not sure we need to carry the extra little used code just to help
some exotic driver.

It doesn't seem like we would need to carry any extra extra code for host drivers that don't need it because we have flexible Kconfig language to take care of such cases, i.e.

...
config CONFIG_IDE_BE_IO
bool
...
config BLK_DEV_IDE_TX4938
tristate "TX4938 internal IDE support"
depends on SOC_TX4938
select IDE_TIMINGS
select IDE_BE_IO
...

Thus having be_tp_ops would decrease code duplication [ I now also see that m68k host drivers would benefit from it. I haven't noticed it before because readw()/writew() are redefined in <asm-m68k/ide.h> ] and decrease total IDE subsystem maintainance costs.

Thanks,
Bart

#8 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Quoted 29 lines · Bartlomiej Zolnierkiewicz
Quoted 23 lines

Hello.

Quoted 18 lines · Bartlomiej Zolnierkiewicz
Quoted 18 lines
Quoted 10 lines
Quoted 3 lines
Quoted 1 line

+#include <asm/ide.h>

Did you try checkpatch.pl?

Sure.

This driver uses stuff from <asm-mips/ide.h>.

[ I guess I could put '-mips' there to silence warnings on tx493{8,9}.c,
however I don't know of the way to get rid of ide-io-std.c's one... ]

BTW, tx4939ide_{in,out}put_data_swap and tx4939ide_{in,out}put_data_swap do exactly same thing.

If byte-swapped version of ide_{in,out}put_data() were available by ide core, they can be used instead. The byte-swapped version of default_tp_ops would much helps such queer big-endian platforms. Is it worth to bloat ide core? ;-)

Quoted 5 lines
Quoted 2 lines

Seems to be a good idea and it may also help some other host drivers (ide-h8300.c?).

I'm not sure we need to carry the extra little used code just to help
some exotic driver.

Quoted 7 lines

It doesn't seem like we would need to carry any extra extra code for host drivers that don't need it because we have flexible Kconfig language to take care of such cases, i.e.

...
config CONFIG_IDE_BE_IO
bool

If it was that simple... Normally the BE case gets handled automagically
(moreover, there is MIPS option that additionally controls I/O and memory space byte swapping). The case we have to address for TX493x is actually where the usual magic fails (or actually the code just doesn't want to use that option). So this doesn't look like a good name to me...

Quoted 2 lines

Thanks,
Bart

WBR, Sergei

#9 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Quoted 8 lines · Sergei Shtylyov
Quoted 2 lines

config CONFIG_IDE_BE_IO
bool

If it was that simple... Normally the BE case gets handled automagically
(moreover, there is MIPS option that additionally controls I/O and memory space byte swapping). The case we have to address for TX493x is actually where the usual magic fails (or actually the code just doesn't want to use that option). So this doesn't look like a good name to me...

Well, for TX493x (MIPS), we have CONFIG_SWAP_IO_SPACE for big endian and it works fine for PCI-IDE host controllers. For SoC internal controllers, no swapping is needed for both endian, thus custom tp_ops is needed only for big endian.

So ... IDE_BE_IO looks actually not best name for this case. It is IDE_RAW_IO or something. But IDE_RAW_IO might not fit for other cases. IDE_SWAPPED_IO? Any other good name?

---
Atsushi Nemoto

#10 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

Hello.

Quoted 12 lines · Atsushi Nemoto
Quoted 6 lines
Quoted 3 lines

config CONFIG_IDE_BE_IO
bool

If it was that simple... Normally the BE case gets handled automagically
(moreover, there is MIPS option that additionally controls I/O and memory space byte swapping). The case we have to address for TX493x is actually where the usual magic fails (or actually the code just doesn't want to use that option). So this doesn't look like a good name to me...

Well, for TX493x (MIPS), we have CONFIG_SWAP_IO_SPACE for big endian and it works fine for PCI-IDE host controllers. For SoC internal controllers, no swapping is needed for both endian, thus custom tp_ops is needed only for big endian.

Yeah, SoCs *typically* can handle different endianness for the
integrated devices in a transparent way. TX4939 didn't do that consistently still, and that's where the MIPS address swizzling macros could have helped but Atsushi chose to reserve their usage only to the external bus accesses. I however don't think that TX4938 case should have been handled the same way as TX4939 since in this case the controller is *not* SoC integrated device and the IDE registers are situated on the chip's external bus with their mapping is actually board specific, if I don't mistake (I don't have the datasheet at hand).

Quoted 2 lines

So ... IDE_BE_IO looks actually not best name for this case. It is IDE_RAW_IO or something.

Yes, I was going to suggest exactly that.

Quoted 1 line

But IDE_RAW_IO might not fit for other cases. IDE_SWAPPED_IO?

I'd prefer IDE_RAW_IO because it can be swapped when using the
standard accessors as well. Frankly speaking, I'm not sure why ide-h8300 needs its own accessors while this arch's io.h has an abundance of swapping and not swapping accessors already defined...

Quoted 2 lines

Any other good name?

I'm still not convinced that it's really worth the trouble...

Quoted 3 lines

---
Atsushi Nemoto

MBR, Sergei

#11 lore raw

Re: [PATCH 01/15] ide: include <asm/ide.h> only when needed

In reply to Bartlomiej Zolnierkiewicz
Quoted 18 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: include <asm/ide.h> only when needed

---
 drivers/ide/ide-io-std.c |    7 +++++++
 drivers/ide/tx4938ide.c  |    2 ++
 drivers/ide/tx4939ide.c  |    2 ++
 include/linux/ide.h      |    7 -------
 4 files changed, 11 insertions(+), 7 deletions(-)

Index: b/include/linux/ide.h
===================================================================

include/linux/ide.h +0 -0
@@ -193,13 +193,6 @@ static inline void ide_std_init_ports(hw
 	hw->io_ports.ctl_addr = ctl_addr;
 }

include/linux/ide.h static inline void ide_std_init_ports(hw · line 197

Quoted 10 lines
include/linux/ide.h +0 -7
 
-#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
-    defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
-#include <asm/ide.h>
-#else
-#include <asm-generic/ide_iops.h>
-#endif
-
 #define MAX_HWIFS	10
 

What is the point of removing <asm/ide.h> from <linux/ide.h>

--
JSR

#12 lore raw

PATCH 2/15 scc_pata: remove DECLARE_SCC_DEV() macro

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] scc_pata: remove DECLARE_SCC_DEV() macro

---
 drivers/ide/scc_pata.c |   23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/ide/scc_pata.c +9 -14
Index: b/drivers/ide/scc_pata.c
===================================================================
@@ -882,21 +882,16 @@ static const struct ide_dma_ops scc_dma_
 	.dma_sff_read_status	= scc_dma_sff_read_status,
 };
 
-#define DECLARE_SCC_DEV(name_str)			\
-  {							\
-      .name		= name_str,			\
-      .init_iops	= init_iops_scc,		\
-      .init_dma		= scc_init_dma,			\
-      .init_hwif	= init_hwif_scc,		\
-      .tp_ops		= &scc_tp_ops,		\
-      .port_ops		= &scc_port_ops,		\
-      .dma_ops		= &scc_dma_ops,			\
-      .host_flags	= IDE_HFLAG_SINGLE,		\
-      .pio_mask		= ATA_PIO4,			\
-  }
-
 static const struct ide_port_info scc_chipsets[] __devinitdata = {
-	/* 0 */ DECLARE_SCC_DEV("sccIDE"),
+	.name		= "sccIDE",
+	.init_iops	= init_iops_scc,
+	.init_dma	= scc_init_dma,
+	.init_hwif	= init_hwif_scc,
+	.tp_ops		= &scc_tp_ops,
+	.port_ops	= &scc_port_ops,
+	.dma_ops	= &scc_dma_ops,
+	.host_flags	= IDE_HFLAG_SINGLE,
+	.pio_mask	= ATA_PIO4,
 };
 
 /**
#14 lore raw

Re: [PATCH 02/15] scc_pata: remove DECLARE_SCC_DEV() macro

In reply to Bartlomiej Zolnierkiewicz
Quoted 25 lines · Bartlomiej Zolnierkiewicz

Index: b/drivers/ide/scc_pata.c
===================================================================

drivers/ide/scc_pata.c +2 -14
@@ -882,21 +882,16 @@ static const struct ide_dma_ops scc_dma_
 	.dma_sff_read_status	= scc_dma_sff_read_status,
 };
 
-#define DECLARE_SCC_DEV(name_str)			\
-  {							\
-      .name		= name_str,			\
-      .init_iops	= init_iops_scc,		\
-      .init_dma		= scc_init_dma,			\
-      .init_hwif	= init_hwif_scc,		\
-      .tp_ops		= &scc_tp_ops,		\
-      .port_ops		= &scc_port_ops,		\
-      .dma_ops		= &scc_dma_ops,			\
-      .host_flags	= IDE_HFLAG_SINGLE,		\
-      .pio_mask		= ATA_PIO4,			\
-  }
-
 static const struct ide_port_info scc_chipsets[] __devinitdata = {
-	/* 0 */ DECLARE_SCC_DEV("sccIDE"),
+	.name		= "sccIDE",
+	.init_iops	= init_iops_scc,

drivers/ide/scc_pata.c static const struct ide_dma_ops scc_dma_ · line 897

Quoted 10 lines
drivers/ide/scc_pata.c +7 -0
+	.init_dma	= scc_init_dma,
+	.init_hwif	= init_hwif_scc,
+	.tp_ops		= &scc_tp_ops,
+	.port_ops	= &scc_port_ops,
+	.dma_ops	= &scc_dma_ops,
+	.host_flags	= IDE_HFLAG_SINGLE,
+	.pio_mask	= ATA_PIO4,
 };
 
 /**

You're a few braces short here, aren't you?

The braces in the #define, didn't get carried over in the change.

Daniel K.

#15 lore raw

Re: [PATCH 02/15] scc_pata: remove DECLARE_SCC_DEV() macro

Quoted 35 lines · Daniel K.
Quoted 34 lines · Bartlomiej Zolnierkiewicz

Index: b/drivers/ide/scc_pata.c
===================================================================

drivers/ide/scc_pata.c +9 -14
@@ -882,21 +882,16 @@ static const struct ide_dma_ops scc_dma_
 	.dma_sff_read_status	= scc_dma_sff_read_status,
 };
 
-#define DECLARE_SCC_DEV(name_str)			\
-  {							\
-      .name		= name_str,			\
-      .init_iops	= init_iops_scc,		\
-      .init_dma		= scc_init_dma,			\
-      .init_hwif	= init_hwif_scc,		\
-      .tp_ops		= &scc_tp_ops,		\
-      .port_ops		= &scc_port_ops,		\
-      .dma_ops		= &scc_dma_ops,			\
-      .host_flags	= IDE_HFLAG_SINGLE,		\
-      .pio_mask		= ATA_PIO4,			\
-  }
-
 static const struct ide_port_info scc_chipsets[] __devinitdata = {
-	/* 0 */ DECLARE_SCC_DEV("sccIDE"),
+	.name		= "sccIDE",
+	.init_iops	= init_iops_scc,
+	.init_dma	= scc_init_dma,
+	.init_hwif	= init_hwif_scc,
+	.tp_ops		= &scc_tp_ops,
+	.port_ops	= &scc_port_ops,
+	.dma_ops	= &scc_dma_ops,
+	.host_flags	= IDE_HFLAG_SINGLE,
+	.pio_mask	= ATA_PIO4,
 };
 
Quoted 3 lines

drivers/ide/scc_pata.c static const struct ide_dma_ops scc_dma_ · line 897

Quoted 1 line
drivers/ide/scc_pata.c +0 -0
 /**

You're a few braces short here, aren't you?

Good catch, thanks!

Quoted 1 line

The braces in the #define, didn't get carried over in the change.

Actually we may simplify the whole thing while at it.

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] scc_pata: remove DECLARE_SCC_DEV() macro (v2)

v2:
scc_chipsets[] -> scc_chipset fix (spotted by Daniel K.).

---
 drivers/ide/scc_pata.c |   27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/ide/scc_pata.c +11 -16
Index: b/drivers/ide/scc_pata.c
===================================================================
@@ -882,21 +882,16 @@ static const struct ide_dma_ops scc_dma_
 	.dma_sff_read_status	= scc_dma_sff_read_status,
 };
 
-#define DECLARE_SCC_DEV(name_str)			\
-  {							\
-      .name		= name_str,			\
-      .init_iops	= init_iops_scc,		\
-      .init_dma		= scc_init_dma,			\
-      .init_hwif	= init_hwif_scc,		\
-      .tp_ops		= &scc_tp_ops,		\
-      .port_ops		= &scc_port_ops,		\
-      .dma_ops		= &scc_dma_ops,			\
-      .host_flags	= IDE_HFLAG_SINGLE,		\
-      .pio_mask		= ATA_PIO4,			\
-  }
-
-static const struct ide_port_info scc_chipsets[] __devinitdata = {
-	/* 0 */ DECLARE_SCC_DEV("sccIDE"),
+static const struct ide_port_info scc_chipset __devinitdata = {
+	.name		= "sccIDE",
+	.init_iops	= init_iops_scc,
+	.init_dma	= scc_init_dma,
+	.init_hwif	= init_hwif_scc,
+	.tp_ops		= &scc_tp_ops,
+	.port_ops	= &scc_port_ops,
+	.dma_ops	= &scc_dma_ops,
+	.host_flags	= IDE_HFLAG_SINGLE,
+	.pio_mask	= ATA_PIO4,
 };
 
 /**
@@ -910,7 +905,7 @@ static const struct ide_port_info scc_ch
 
 static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	return init_setup_scc(dev, &scc_chipsets[id->driver_data]);
+	return init_setup_scc(dev, &scc_chipset);
 }
 
 /**
#16 lore raw

PATCH 3/15 ide: fix memleak on failure in probe_for_drive()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: fix memleak on failure in probe_for_drive()

Always free drive->id in probe_for_drive() if device is not present.

While at it:
- remove dead IDE_DFLAG_DEAD flag
- remove superfluous IDE_DFLAG_PRESENT check

---
 drivers/ide/ide-probe.c |   22 +++++++++-------------
 include/linux/ide.h     |    2 --
 2 files changed, 9 insertions(+), 15 deletions(-)
drivers/ide/ide-probe.c +9 -13
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -228,15 +228,9 @@ static void do_identify(ide_drive_t *dri
 	m[ATA_ID_PROD_LEN - 1] = '\0';
 
 	if (strstr(m, "E X A B Y T E N E S T"))
-		goto err_misc;
-
-	drive->dev_flags |= IDE_DFLAG_PRESENT;
-	drive->dev_flags &= ~IDE_DFLAG_DEAD;
-
-	return;
-err_misc:
-	kfree(id);
-	drive->dev_flags &= ~IDE_DFLAG_PRESENT;
+		drive->dev_flags &= ~IDE_DFLAG_PRESENT;
+	else
+		drive->dev_flags |= IDE_DFLAG_PRESENT;
 }
 
 /**
@@ -505,8 +499,7 @@ static u8 probe_for_drive(ide_drive_t *d
 		}
 
 		if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)
-			/* drive not found */
-			return 0;
+			goto out_free;
 
 		/* identification failed? */
 		if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) {
@@ -530,7 +523,7 @@ static u8 probe_for_drive(ide_drive_t *d
 	}
 
 	if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)
-		return 0;
+		goto out_free;
 
 	/* The drive wasn't being helpful. Add generic info only */
 	if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) {
@@ -543,7 +536,10 @@ static u8 probe_for_drive(ide_drive_t *d
 		ide_disk_init_mult_count(drive);
 	}
 
-	return !!(drive->dev_flags & IDE_DFLAG_PRESENT);
+	return 1;
+out_free:
+	kfree(drive->id);
+	return 0;
 }
 
 static void hwif_release_dev(struct device *dev)
include/linux/ide.h +0 -2
Index: b/include/linux/ide.h
===================================================================
@@ -494,8 +494,6 @@ enum {
 	IDE_DFLAG_NICE1			= (1 << 5),
 	/* device is physically present */
 	IDE_DFLAG_PRESENT		= (1 << 6),
-	/* device ejected hint */
-	IDE_DFLAG_DEAD			= (1 << 7),
 	/* id read from device (synthetic if not set) */
 	IDE_DFLAG_ID_READ		= (1 << 8),
 	IDE_DFLAG_NOPROBE		= (1 << 9),
#17 lore raw

PATCH 4/15 ide: fix error message in pre_task_out_intr()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: fix error message in pre_task_out_intr()

---
 drivers/ide/ide-taskfile.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ide/ide-taskfile.c +3 -1
Index: b/drivers/ide/ide-taskfile.c
===================================================================
@@ -419,12 +419,14 @@ static ide_startstop_t task_out_intr (id
 
 static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	ide_startstop_t startstop;
 
 	if (ide_wait_stat(&startstop, drive, ATA_DRQ,
 			  drive->bad_wstat, WAIT_DRQ)) {
 		printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n",
-			drive->name, drive->hwif->data_phase ? "MULT" : "",
+			drive->name,
+			hwif->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "",
 			(drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : "");
 		return startstop;
 	}
#18 lore raw

PATCH 5/15 ide: allow host drivers to specify IRQ flags

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: allow host drivers to specify IRQ flags

* Add ->irq_flags field to struct ide_port_info and struct ide_host.

* Update host drivers and IDE PCI code to use ->irq_flags field.

* Convert init_irq() and ide_intr() to use host->irq_flags.

This fixes handling of shared IRQs for non-PCI hosts and removes ugly ifdeffery from core IDE code.

---
 drivers/ide/buddha.c    |    1 +
 drivers/ide/delkin_cb.c |    1 +
 drivers/ide/falconide.c |    1 +
 drivers/ide/gayle.c     |    1 +
 drivers/ide/ide-cs.c    |    1 +
 drivers/ide/ide-io.c    |   15 ++++-----------
 drivers/ide/ide-probe.c |    9 +--------
 drivers/ide/macide.c    |    1 +
 drivers/ide/q40ide.c    |    1 +
 drivers/ide/scc_pata.c  |    1 +
 drivers/ide/setup-pci.c |    4 ++++
 drivers/ide/sgiioc4.c   |    1 +
 include/linux/ide.h     |    6 ++++++
 13 files changed, 24 insertions(+), 19 deletions(-)
drivers/ide/buddha.c +1 -0
Index: b/drivers/ide/buddha.c
===================================================================
@@ -145,6 +145,7 @@ static void __init buddha_setup_ports(hw
 
 static const struct ide_port_info buddha_port_info = {
 	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 };
 
     /*
drivers/ide/delkin_cb.c +1 -0
Index: b/drivers/ide/delkin_cb.c
===================================================================
@@ -66,6 +66,7 @@ static const struct ide_port_info delkin
 	.port_ops		= &delkin_cb_port_ops,
 	.host_flags		= IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS |
 				  IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 	.init_chipset		= delkin_cb_init_chipset,
 };
 
drivers/ide/falconide.c +1 -0
Index: b/drivers/ide/falconide.c
===================================================================
@@ -105,6 +105,7 @@ static const struct ide_port_info falcon
 	.tp_ops			= &falconide_tp_ops,
 	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
 				  IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 };
 
 static void __init falconide_setup_ports(hw_regs_t *hw)
drivers/ide/gayle.c +1 -0
Index: b/drivers/ide/gayle.c
===================================================================
@@ -120,6 +120,7 @@ static void __init gayle_setup_ports(hw_
 static const struct ide_port_info gayle_port_info = {
 	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
 				  IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 };
 
     /*
drivers/ide/ide-cs.c +1 -0
Index: b/drivers/ide/ide-cs.c
===================================================================
@@ -154,6 +154,7 @@ static const struct ide_port_ops idecs_p
 static const struct ide_port_info idecs_port_info = {
 	.port_ops		= &idecs_port_ops,
 	.host_flags		= IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 };
 
 static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
drivers/ide/ide-io.c +4 -11
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -841,6 +841,7 @@ static void unexpected_intr(int irq, ide
 irqreturn_t ide_intr (int irq, void *dev_id)
 {
 	ide_hwif_t *hwif = (ide_hwif_t *)dev_id;
+	struct ide_host *host = hwif->host;
 	ide_drive_t *uninitialized_var(drive);
 	ide_handler_t *handler;
 	unsigned long flags;
@@ -848,8 +849,8 @@ irqreturn_t ide_intr (int irq, void *dev
 	irqreturn_t irq_ret = IRQ_NONE;
 	int plug_device = 0;
 
-	if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) {
-		if (hwif != hwif->host->cur_port)
+	if (host->host_flags & IDE_HFLAG_SERIALIZE) {
+		if (hwif != host->cur_port)
 			goto out_early;
 	}
 
@@ -872,27 +873,19 @@ irqreturn_t ide_intr (int irq, void *dev
 		 *
 		 * For PCI, we cannot tell the difference,
 		 * so in that case we just ignore it and hope it goes away.
-		 *
-		 * FIXME: unexpected_intr should be hwif-> then we can
-		 * remove all the ifdef PCI crap
 		 */
-#ifdef CONFIG_BLK_DEV_IDEPCI
-		if (hwif->chipset != ide_pci)
-#endif	/* CONFIG_BLK_DEV_IDEPCI */
-		{
+		if ((host->irq_flags & IRQF_SHARED) == 0) {
 			/*
 			 * Probably not a shared PCI interrupt,
 			 * so we can safely try to do something about it:
 			 */
 			unexpected_intr(irq, hwif);
-#ifdef CONFIG_BLK_DEV_IDEPCI
 		} else {
 			/*
 			 * Whack the status register, just in case
 			 * we have a leftover pending IRQ.
 			 */
 			(void)hwif->tp_ops->read_status(hwif);
-#endif /* CONFIG_BLK_DEV_IDEPCI */
 		}
 		goto out;
 	}
drivers/ide/ide-probe.c +1 -8
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -837,14 +837,7 @@ static int ide_port_setup_devices(ide_hw
 static int init_irq (ide_hwif_t *hwif)
 {
 	struct ide_io_ports *io_ports = &hwif->io_ports;
-	int sa = 0;
-
-#if defined(__mc68000__)
-	sa = IRQF_SHARED;
-#endif /* __mc68000__ */
-
-	if (hwif->chipset == ide_pci)
-		sa = IRQF_SHARED;
+	int sa = hwif->host->irq_flags;
 
 	if (io_ports->ctl_addr)
 		hwif->tp_ops->set_irq(hwif, 1);
drivers/ide/macide.c +1 -0
Index: b/drivers/ide/macide.c
===================================================================
@@ -82,6 +82,7 @@ static void __init macide_setup_ports(hw
 
 static const struct ide_port_info macide_port_info = {
 	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 };
 
 static const char *mac_ide_name[] =
drivers/ide/q40ide.c +1 -0
Index: b/drivers/ide/q40ide.c
===================================================================
@@ -112,6 +112,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_MMIO | IDE_HFLAG_NO_DMA,
+	.irq_flags		= IRQF_SHARED,
 };
 
 /* 
drivers/ide/scc_pata.c +1 -0
Index: b/drivers/ide/scc_pata.c
===================================================================
@@ -891,6 +891,7 @@ static const struct ide_port_info scc_ch
 	.port_ops	= &scc_port_ops,
 	.dma_ops	= &scc_dma_ops,
 	.host_flags	= IDE_HFLAG_SINGLE,
+	.irq_flags	= IRQF_SHARED,
 	.pio_mask	= ATA_PIO4,
 };
 
drivers/ide/setup-pci.c +4 -0
Index: b/drivers/ide/setup-pci.c
===================================================================
@@ -558,6 +558,8 @@ int ide_pci_init_one(struct pci_dev *dev
 
 	host->host_priv = priv;
 
+	host->irq_flags = IRQF_SHARED;
+
 	pci_set_drvdata(dev, host);
 
 	ret = do_ide_setup_pci_device(dev, d, 1);
@@ -606,6 +608,8 @@ int ide_pci_init_two(struct pci_dev *dev
 
 	host->host_priv = priv;
 
+	host->irq_flags = IRQF_SHARED;
+
 	pci_set_drvdata(pdev[0], host);
 	pci_set_drvdata(pdev[1], host);
 
drivers/ide/sgiioc4.c +1 -0
Index: b/drivers/ide/sgiioc4.c
===================================================================
@@ -557,6 +557,7 @@ static const struct ide_port_info sgiioc
 	.port_ops		= &sgiioc4_port_ops,
 	.dma_ops		= &sgiioc4_dma_ops,
 	.host_flags		= IDE_HFLAG_MMIO,
+	.irq_flags		= IRQF_SHARED,
 	.mwdma_mask		= ATA_MWDMA2_ONLY,
 };
 
include/linux/ide.h +6 -0
Index: b/include/linux/ide.h
===================================================================
@@ -836,6 +836,9 @@ struct ide_host {
 	void		(*release_lock)(void);
 
 	unsigned long	host_flags;
+
+	int		irq_flags;
+
 	void		*host_priv;
 	ide_hwif_t	*cur_port;	/* for hosts requiring serialization */
 
@@ -1368,6 +1371,9 @@ struct ide_port_info {
 	u16			max_sectors;	/* if < than the default one */
 
 	u32			host_flags;
+
+	int			irq_flags;
+
 	u8			pio_mask;
 	u8			swdma_mask;
 	u8			mwdma_mask;
#19 lore raw

PATCH 6/15 ide: remove now superfluous check from ide_host_register()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove now superfluous check from ide_host_register()

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-probe.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/ide/ide-probe.c +7 -12
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -1333,20 +1333,15 @@ int ide_host_register(struct ide_host *h
 		ide_init_port_hw(hwif, hws[i]);
 		ide_port_apply_params(hwif);
 
-		if (d == NULL) {
-			mate = NULL;
-		} else {
-			if ((i & 1) && mate) {
-				hwif->mate = mate;
-				mate->mate = hwif;
-			}
-
-			mate = (i & 1) ? NULL : hwif;
-
-			ide_init_port(hwif, i & 1, d);
-			ide_port_cable_detect(hwif);
+		if ((i & 1) && mate) {
+			hwif->mate = mate;
+			mate->mate = hwif;
 		}
 
+		mate = (i & 1) ? NULL : hwif;
+
+		ide_init_port(hwif, i & 1, d);
+		ide_port_cable_detect(hwif);
 		ide_port_init_devices(hwif);
 	}
 
#20 lore raw

PATCH 7/15 ide: add IDE_HFLAG_DTC2278 host flag

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add IDE_HFLAG_DTC2278 host flag

Add IDE_HFLAG_DTC2278 host flag and use it instead of ide_dtc2278 chipset type in ide_init_port().

There should be no functional changes caused by this patch.

---
 drivers/ide/dtc2278.c   |    3 ++-
 drivers/ide/ide-probe.c |    2 +-
 include/linux/ide.h     |    2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/ide/dtc2278.c +2 -1
Index: b/drivers/ide/dtc2278.c
===================================================================
@@ -100,7 +100,8 @@ static const struct ide_port_info dtc227
 				  IDE_HFLAG_IO_32BIT |
 				  /* disallow ->io_32bit changes */
 				  IDE_HFLAG_NO_IO_32BIT |
-				  IDE_HFLAG_NO_DMA,
+				  IDE_HFLAG_NO_DMA |
+				  IDE_HFLAG_DTC2278,
 	.pio_mask		= ATA_PIO4,
 };
 
drivers/ide/ide-probe.c +1 -1
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -1056,7 +1056,7 @@ static void ide_init_port(ide_hwif_t *hw
 		hwif->tp_ops = d->tp_ops;
 
 	/* ->set_pio_mode for DTC2278 is currently limited to port 0 */
-	if (hwif->chipset != ide_dtc2278 || hwif->channel == 0)
+	if ((hwif->host_flags & IDE_HFLAG_DTC2278) == 0 || hwif->channel == 0)
 		hwif->port_ops = d->port_ops;
 
 	hwif->swdma_mask = d->swdma_mask;
include/linux/ide.h +2 -0
Index: b/include/linux/ide.h
===================================================================
@@ -1322,6 +1322,8 @@ enum {
 	IDE_HFLAG_ERROR_STOPS_FIFO	= (1 << 19),
 	/* serialize ports */
 	IDE_HFLAG_SERIALIZE		= (1 << 20),
+	/* host is DTC2278 */
+	IDE_HFLAG_DTC2278		= (1 << 21),
 	/* host is TRM290 */
 	IDE_HFLAG_TRM290		= (1 << 23),
 	/* use 32-bit I/O ops */
#21 lore raw

PATCH 8/15 ide: add IDE_HFLAG_4DRIVES host flag

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add IDE_HFLAG_4DRIVES host flag

Add IDE_HFLAG_4DRIVES host flag and use it instead of ide_4drives chipset type in ide_init_port().

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-4drives.c |    3 ++-
 drivers/ide/ide-probe.c   |    4 ++--
 include/linux/ide.h       |    2 ++
 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/ide/ide-4drives.c +2 -1
Index: b/drivers/ide/ide-4drives.c
===================================================================
@@ -23,7 +23,8 @@ static const struct ide_port_ops ide_4dr
 
 static const struct ide_port_info ide_4drives_port_info = {
 	.port_ops		= &ide_4drives_port_ops,
-	.host_flags		= IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA,
+	.host_flags		= IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA |
+				  IDE_HFLAG_4DRIVES,
 };
 
 static int __init ide_4drives_init(void)
drivers/ide/ide-probe.c +2 -2
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -1352,8 +1352,8 @@ int ide_host_register(struct ide_host *h
 		if (ide_probe_port(hwif) == 0)
 			hwif->present = 1;
 
-		if (hwif->chipset != ide_4drives || !hwif->mate ||
-		    !hwif->mate->present)
+		if ((hwif->host_flags & IDE_HFLAG_4DRIVES) == 0 ||
+		    hwif->mate == NULL || hwif->mate->present == 0)
 			ide_register_port(hwif);
 
 		if (hwif->present)
include/linux/ide.h +2 -0
Index: b/include/linux/ide.h
===================================================================
@@ -1324,6 +1324,8 @@ enum {
 	IDE_HFLAG_SERIALIZE		= (1 << 20),
 	/* host is DTC2278 */
 	IDE_HFLAG_DTC2278		= (1 << 21),
+	/* 4 devices on a single set of I/O ports */
+	IDE_HFLAG_4DRIVES		= (1 << 22),
 	/* host is TRM290 */
 	IDE_HFLAG_TRM290		= (1 << 23),
 	/* use 32-bit I/O ops */
#22 lore raw

PATCH 9/15 ide: add "flagged" taskfile flags to struct ide_taskfile

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add "flagged" taskfile flags to struct ide_taskfile

* Add ->ftf_flags field to struct ide_taskfile
and convert flags for TASKFILE ioctl to use it.

* Rename "flagged" taskfile flags:
- IDE_TFLAG_FLAGGED -> IDE_FTFLAG_FLAGGED
- IDE_TFLAG_FLAGGED_SET_IN_FLAGS -> IDE_FTFLAG_SET_IN_FLAGS
- IDE_TFLAG_{OUT,IN}_DATA -> IDE_FTFLAG_{OUT,IN}_DATA

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-h8300.c    |    4 +-
 drivers/ide/ide-io-std.c   |    6 ++--
 drivers/ide/ide-taskfile.c |   12 ++++----
 drivers/ide/ns87415.c      |    2 -
 drivers/ide/scc_pata.c     |    4 +-
 drivers/ide/tx4938ide.c    |    4 +-
 drivers/ide/tx4939ide.c    |    4 +-
 include/linux/ide.h        |   66 +++++++++++++++++++++++----------------------
 8 files changed, 53 insertions(+), 49 deletions(-)
drivers/ide/ide-h8300.c +2 -2
Index: b/drivers/ide/ide-h8300.c
===================================================================
@@ -54,7 +54,7 @@ static void h8300_tf_load(ide_drive_t *d
 	if (task->tf_flags & IDE_TFLAG_FLAGGED)
 		HIHI = 0xFF;
 
-	if (task->tf_flags & IDE_TFLAG_OUT_DATA)
+	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA)
 		mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr);
 
 	if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
@@ -90,7 +90,7 @@ static void h8300_tf_read(ide_drive_t *d
 	struct ide_io_ports *io_ports = &hwif->io_ports;
 	struct ide_taskfile *tf = &task->tf;
 
-	if (task->tf_flags & IDE_TFLAG_IN_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_IN_DATA) {
 		u16 data = mm_inw(io_ports->data_addr);
 
 		tf->data = data & 0xff;
drivers/ide/ide-io-std.c +3 -3
Index: b/drivers/ide/ide-io-std.c
===================================================================
@@ -96,10 +96,10 @@ void ide_tf_load(ide_drive_t *drive, ide
 	else
 		tf_outb = ide_outb;
 
-	if (task->tf_flags & IDE_TFLAG_FLAGGED)
+	if (task->ftf_flags & IDE_FTFLAG_FLAGGED)
 		HIHI = 0xFF;
 
-	if (task->tf_flags & IDE_TFLAG_OUT_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) {
 		u16 data = (tf->hob_data << 8) | tf->data;
 
 		if (mmio)
@@ -153,7 +153,7 @@ void ide_tf_read(ide_drive_t *drive, ide
 		tf_inb  = ide_inb;
 	}
 
-	if (task->tf_flags & IDE_TFLAG_IN_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_IN_DATA) {
 		u16 data;
 
 		if (mmio)
drivers/ide/ide-taskfile.c +6 -6
Index: b/drivers/ide/ide-taskfile.c
===================================================================
@@ -73,8 +73,8 @@ ide_startstop_t do_rw_taskfile (ide_driv
 		}
 	}
 
-	if (task->tf_flags & IDE_TFLAG_FLAGGED)
-		task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS;
+	if (task->ftf_flags & IDE_FTFLAG_FLAGGED)
+		task->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS;
 
 	memcpy(&hwif->task, task, sizeof(*task));
 
@@ -551,10 +551,10 @@ int ide_taskfile_ioctl (ide_drive_t *dri
 		args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB);
 
 	if (req_task->out_flags.all) {
-		args.tf_flags |= IDE_TFLAG_FLAGGED;
+		args.ftf_flags |= IDE_FTFLAG_FLAGGED;
 
 		if (req_task->out_flags.b.data)
-			args.tf_flags |= IDE_TFLAG_OUT_DATA;
+			args.ftf_flags |= IDE_FTFLAG_OUT_DATA;
 
 		if (req_task->out_flags.b.nsector_hob)
 			args.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT;
@@ -582,7 +582,7 @@ int ide_taskfile_ioctl (ide_drive_t *dri
 	}
 
 	if (req_task->in_flags.b.data)
-		args.tf_flags |= IDE_TFLAG_IN_DATA;
+		args.ftf_flags |= IDE_FTFLAG_IN_DATA;
 
 	switch(req_task->data_phase) {
 		case TASKFILE_MULTI_OUT:
@@ -647,7 +647,7 @@ int ide_taskfile_ioctl (ide_drive_t *dri
 	memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2);
 	memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE);
 
-	if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) &&
+	if ((args.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) &&
 	    req_task->in_flags.all == 0) {
 		req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS;
 		if (drive->dev_flags & IDE_DFLAG_LBA48)
drivers/ide/ns87415.c +1 -1
Index: b/drivers/ide/ns87415.c
===================================================================
@@ -66,7 +66,7 @@ static void superio_tf_read(ide_drive_t 
 	struct ide_io_ports *io_ports = &drive->hwif->io_ports;
 	struct ide_taskfile *tf = &task->tf;
 
-	if (task->tf_flags & IDE_TFLAG_IN_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_IN_DATA) {
 		u16 data = inw(io_ports->data_addr);
 
 		tf->data = data & 0xff;
drivers/ide/scc_pata.c +2 -2
Index: b/drivers/ide/scc_pata.c
===================================================================
@@ -675,7 +675,7 @@ static void scc_tf_load(ide_drive_t *dri
 	if (task->tf_flags & IDE_TFLAG_FLAGGED)
 		HIHI = 0xFF;
 
-	if (task->tf_flags & IDE_TFLAG_OUT_DATA)
+	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA)
 		out_be32((void *)io_ports->data_addr,
 			 (tf->hob_data << 8) | tf->data);
 
@@ -711,7 +711,7 @@ static void scc_tf_read(ide_drive_t *dri
 	struct ide_io_ports *io_ports = &drive->hwif->io_ports;
 	struct ide_taskfile *tf = &task->tf;
 
-	if (task->tf_flags & IDE_TFLAG_IN_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_IN_DATA) {
 		u16 data = (u16)in_be32((void *)io_ports->data_addr);
 
 		tf->data = data & 0xff;
drivers/ide/tx4938ide.c +2 -2
Index: b/drivers/ide/tx4938ide.c
===================================================================
@@ -92,7 +92,7 @@ static void tx4938ide_tf_load(ide_drive_
 	if (task->tf_flags & IDE_TFLAG_FLAGGED)
 		HIHI = 0xFF;
 
-	if (task->tf_flags & IDE_TFLAG_OUT_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) {
 		u16 data = (tf->hob_data << 8) | tf->data;
 
 		/* no endian swap */
@@ -132,7 +132,7 @@ static void tx4938ide_tf_read(ide_drive_
 	struct ide_io_ports *io_ports = &hwif->io_ports;
 	struct ide_taskfile *tf = &task->tf;
 
-	if (task->tf_flags & IDE_TFLAG_IN_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_IN_DATA) {
 		u16 data;
 
 		/* no endian swap */
drivers/ide/tx4939ide.c +2 -2
Index: b/drivers/ide/tx4939ide.c
===================================================================
@@ -477,7 +477,7 @@ static void tx4939ide_tf_load(ide_drive_
 	if (task->tf_flags & IDE_TFLAG_FLAGGED)
 		HIHI = 0xFF;
 
-	if (task->tf_flags & IDE_TFLAG_OUT_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) {
 		u16 data = (tf->hob_data << 8) | tf->data;
 
 		/* no endian swap */
@@ -519,7 +519,7 @@ static void tx4939ide_tf_read(ide_drive_
 	struct ide_io_ports *io_ports = &hwif->io_ports;
 	struct ide_taskfile *tf = &task->tf;
 
-	if (task->tf_flags & IDE_TFLAG_IN_DATA) {
+	if (task->ftf_flags & IDE_FTFLAG_IN_DATA) {
 		u16 data;
 
 		/* no endian swap */
include/linux/ide.h +35 -31

106 lines not on this page · raw message

#23 lore raw

Re: [PATCH 09/15] ide: add "flagged" taskfile flags to struct ide_taskfile

Hi Bart,

Quoted 9 lines · On Sun, 01 Feb 2009 18:50:12 +0100 Bartlomiej Zolnierkiewicz…

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add "flagged" taskfile flags to struct ide_taskfile

* Add ->ftf_flags field to struct ide_taskfile
and convert flags for TASKFILE ioctl to use it.

* Rename "flagged" taskfile flags:
- IDE_TFLAG_FLAGGED -> IDE_FTFLAG_FLAGGED

There were several places where this transformation did not take place as shown by today's linux-next build.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#24 lore raw

Re: [PATCH 09/15] ide: add "flagged" taskfile flags to struct ide_taskfile

Hi,

Quoted 7 lines · Stephen Rothwell

Hi Bart,

Quoted 4 lines · On Sun, 01 Feb 2009 18:50:12 +0100 Bartlomiej Zolnierkiewicz…

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add "flagged" taskfile flags to struct ide_taskfile

Quoted 8 lines
Quoted 5 lines

* Add ->ftf_flags field to struct ide_taskfile
and convert flags for TASKFILE ioctl to use it.

* Rename "flagged" taskfile flags:
- IDE_TFLAG_FLAGGED -> IDE_FTFLAG_FLAGGED

There were several places where this transformation did not take place as shown by today's linux-next build.

Thanks, it is now fixed with v2 of the patch, interdiff below:

...
v2:
* Remember to fully update ide-h8300.c, scc_pata.c and tx493{8,9}ide.c (thanks to Stephen Rothwell for noticing).

There should be no functional changes caused by this patch.

...

drivers/ide/ide-h8300.c +1 -1
diff -u b/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
@@ -51,7 +51,7 @@
 	struct ide_taskfile *tf = &task->tf;
 	u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
 
-	if (task->tf_flags & IDE_TFLAG_FLAGGED)
+	if (task->ftf_flags & IDE_FTFLAG_FLAGGED)
 		HIHI = 0xFF;
 
 	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA)
drivers/ide/scc_pata.c +1 -1
diff -u b/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
@@ -672,7 +672,7 @@
 	struct ide_taskfile *tf = &task->tf;
 	u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
 
-	if (task->tf_flags & IDE_TFLAG_FLAGGED)
+	if (task->ftf_flags & IDE_FTFLAG_FLAGGED)
 		HIHI = 0xFF;
 
 	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA)
drivers/ide/tx4938ide.c +1 -1
diff -u b/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
@@ -89,7 +89,7 @@
 	struct ide_taskfile *tf = &task->tf;
 	u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF;
 
-	if (task->tf_flags & IDE_TFLAG_FLAGGED)
+	if (task->ftf_flags & IDE_FTFLAG_FLAGGED)
 		HIHI = 0xFF;
 
 	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) {
drivers/ide/tx4939ide.c +1 -1
diff -u b/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
@@ -474,7 +474,7 @@
 	struct ide_taskfile *tf = &task->tf;
 	u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF;
 
-	if (task->tf_flags & IDE_TFLAG_FLAGGED)
+	if (task->ftf_flags & IDE_FTFLAG_FLAGGED)
 		HIHI = 0xFF;
 
 	if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) {
#25 lore raw

Re: [PATCH 09/15] ide: add "flagged" taskfile flags to struct ide_taskfile

Quoted 19 lines · Bartlomiej Zolnierkiewicz
Quoted 11 lines
Quoted 8 lines

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add "flagged" taskfile flags to struct ide_taskfile

* Add ->ftf_flags field to struct ide_taskfile
and convert flags for TASKFILE ioctl to use it.

* Rename "flagged" taskfile flags:
- IDE_TFLAG_FLAGGED -> IDE_FTFLAG_FLAGGED

There were several places where this transformation did not take place as shown by today's linux-next build.

Thanks, it is now fixed with v2 of the patch, interdiff below:

...
v2:
* Remember to fully update ide-h8300.c, scc_pata.c and tx493{8,9}ide.c (thanks to Stephen Rothwell for noticing).

Quoted 4 lines

There should be no functional changes caused by this patch.

MBR, Sergei

#26 lore raw

PATCH 10/15 ide: complete power step in ide_complete_pm_request()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: complete power step in ide_complete_pm_request()

* Complete power step in ide_complete_pm_request().

* Rename ide_complete_pm_request() to ide_complete_pm_rq().

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-io.c |    8 ++------
 drivers/ide/ide-pm.c |    9 +++++++--
 include/linux/ide.h  |    2 +-
 3 files changed, 10 insertions(+), 9 deletions(-)
drivers/ide/ide-io.c +2 -6
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -178,11 +178,7 @@ void ide_end_drive_cmd (ide_drive_t *dri
 				kfree(task);
 		}
 	} else if (blk_pm_request(rq)) {
-		struct request_pm_state *pm = rq->data;
-
-		ide_complete_power_step(drive, rq);
-		if (pm->pm_step == IDE_PM_COMPLETED)
-			ide_complete_pm_request(drive, rq);
+		ide_complete_pm_rq(drive, rq);
 		return;
 	}
 
@@ -438,7 +434,7 @@ static ide_startstop_t start_request (id
 			startstop = ide_start_power_step(drive, rq);
 			if (startstop == ide_stopped &&
 			    pm->pm_step == IDE_PM_COMPLETED)
-				ide_complete_pm_request(drive, rq);
+				ide_complete_pm_rq(drive, rq);
 			return startstop;
 		} else if (!rq->rq_disk && blk_special_request(rq))
 			/*
drivers/ide/ide-pm.c +7 -2
Index: b/drivers/ide/ide-pm.c
===================================================================
@@ -169,18 +169,23 @@ out_do_tf:
 }
 
 /**
- *	ide_complete_pm_request - end the current Power Management request
+ *	ide_complete_pm_rq - end the current Power Management request
  *	@drive: target drive
  *	@rq: request
  *
  *	This function cleans up the current PM request and stops the queue
  *	if necessary.
  */
-void ide_complete_pm_request(ide_drive_t *drive, struct request *rq)
+void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
 {
 	struct request_queue *q = drive->queue;
+	struct request_pm_state *pm = rq->data;
 	unsigned long flags;
 
+	ide_complete_power_step(drive, rq);
+	if (pm->pm_step != IDE_PM_COMPLETED)
+		return;
+
 #ifdef DEBUG_PM
 	printk("%s: completing PM request, %s\n", drive->name,
 	       blk_pm_suspend_request(rq) ? "suspend" : "resume");
include/linux/ide.h +1 -1
Index: b/include/linux/ide.h
===================================================================
@@ -1078,7 +1078,7 @@ int generic_ide_resume(struct device *);
 
 void ide_complete_power_step(ide_drive_t *, struct request *);
 ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
-void ide_complete_pm_request(ide_drive_t *, struct request *);
+void ide_complete_pm_rq(ide_drive_t *, struct request *);
 void ide_check_pm_state(ide_drive_t *, struct request *);
 
 /*
#27 lore raw

PATCH 11/15 ide: factor out completion of taskfile from ide_end_drive_cmd()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: factor out completion of taskfile from ide_end_drive_cmd()

Factor out completion of taskfile from ide_end_drive_cmd() to ide_complete_task().

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-io.c |   27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/ide/ide-io.c +16 -11
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -144,6 +144,20 @@ int ide_end_dequeued_request(ide_drive_t
 }
 EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
 
+static void ide_complete_task(ide_drive_t *drive, ide_task_t *task,
+			      u8 stat, u8 err)
+{
+	struct ide_taskfile *tf = &task->tf;
+
+	tf->error = err;
+	tf->status = stat;
+
+	drive->hwif->tp_ops->tf_read(drive, task);
+
+	if (task->tf_flags & IDE_TFLAG_DYN)
+		kfree(task);
+}
+
 /**
  *	ide_end_drive_cmd	-	end an explicit drive command
  *	@drive: command 
@@ -166,17 +180,8 @@ void ide_end_drive_cmd (ide_drive_t *dri
 	if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
 		ide_task_t *task = (ide_task_t *)rq->special;
 
-		if (task) {
-			struct ide_taskfile *tf = &task->tf;
-
-			tf->error = err;
-			tf->status = stat;
-
-			drive->hwif->tp_ops->tf_read(drive, task);
-
-			if (task->tf_flags & IDE_TFLAG_DYN)
-				kfree(task);
-		}
+		if (task)
+			ide_complete_task(drive, task, stat, err);
 	} else if (blk_pm_request(rq)) {
 		ide_complete_pm_rq(drive, rq);
 		return;
#28 lore raw

PATCH 12/15 ide: move request type specific code from ide_end_drive_cmd() to callers

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move request type specific code from ide_end_drive_cmd() to callers

* Move request type specific code from ide_end_drive_cmd() to callers.

* Remove stale ide_end_drive_cmd() documentation and drop no longer used 'stat' argument. Then rename the function to ide_complete_rq().

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-eh.c       |   11 ++++++++++-
 drivers/ide/ide-floppy.c   |    2 +-
 drivers/ide/ide-io.c       |   36 ++++++------------------------------
 drivers/ide/ide-tape.c     |    2 +-
 drivers/ide/ide-taskfile.c |   22 +++++++++++++++-------
 include/linux/ide.h        |    3 ++-
 6 files changed, 35 insertions(+), 41 deletions(-)
drivers/ide/ide-eh.c +10 -1
Index: b/drivers/ide/ide-eh.c
===================================================================
@@ -124,7 +124,16 @@ ide_startstop_t ide_error(ide_drive_t *d
 	/* retry only "normal" I/O: */
 	if (!blk_fs_request(rq)) {
 		rq->errors = 1;
-		ide_end_drive_cmd(drive, stat, err);
+		if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
+			ide_task_t *task = rq->special;
+
+			if (task)
+				ide_complete_task(drive, task, stat, err);
+		} else if (blk_pm_request(rq)) {
+			ide_complete_pm_rq(drive, rq);
+			return ide_stopped;
+		}
+		ide_complete_rq(drive, err);
 		return ide_stopped;
 	}
 
drivers/ide/ide-floppy.c +1 -1
Index: b/drivers/ide/ide-floppy.c
===================================================================
@@ -101,7 +101,7 @@ static int ide_floppy_end_request(ide_dr
 	}
 	rq->errors = error;
 	/* fixme: need to move this local also */
-	ide_end_drive_cmd(drive, 0, 0);
+	ide_complete_rq(drive, 0);
 	return 0;
 }
 
drivers/ide/ide-io.c +6 -30
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -144,8 +144,7 @@ int ide_end_dequeued_request(ide_drive_t
 }
 EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
 
-static void ide_complete_task(ide_drive_t *drive, ide_task_t *task,
-			      u8 stat, u8 err)
+void ide_complete_task(ide_drive_t *drive, ide_task_t *task, u8 stat, u8 err)
 {
 	struct ide_taskfile *tf = &task->tf;
 
@@ -158,35 +157,11 @@ static void ide_complete_task(ide_drive_
 		kfree(task);
 }
 
-/**
- *	ide_end_drive_cmd	-	end an explicit drive command
- *	@drive: command 
- *	@stat: status bits
- *	@err: error bits
- *
- *	Clean up after success/failure of an explicit drive command.
- *	These get thrown onto the queue so they are synchronized with
- *	real I/O operations on the drive.
- *
- *	In LBA48 mode we have to read the register set twice to get
- *	all the extra information out.
- */
- 
-void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
+void ide_complete_rq(ide_drive_t *drive, u8 err)
 {
 	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = hwif->rq;
 
-	if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
-		ide_task_t *task = (ide_task_t *)rq->special;
-
-		if (task)
-			ide_complete_task(drive, task, stat, err);
-	} else if (blk_pm_request(rq)) {
-		ide_complete_pm_rq(drive, rq);
-		return;
-	}
-
 	hwif->rq = NULL;
 
 	rq->errors = err;
@@ -195,7 +170,7 @@ void ide_end_drive_cmd (ide_drive_t *dri
 				     blk_rq_bytes(rq))))
 		BUG();
 }
-EXPORT_SYMBOL(ide_end_drive_cmd);
+EXPORT_SYMBOL(ide_complete_rq);
 
 void ide_kill_rq(ide_drive_t *drive, struct request *rq)
 {
@@ -358,8 +333,9 @@ static ide_startstop_t execute_drive_cmd
 #ifdef DEBUG
  	printk("%s: DRIVE_CMD (null)\n", drive->name);
 #endif
-	ide_end_drive_cmd(drive, hwif->tp_ops->read_status(hwif),
-			  ide_read_error(drive));
+	(void)hwif->tp_ops->read_status(hwif);
+
+	ide_complete_rq(drive, ide_read_error(drive));
 
  	return ide_stopped;
 }
drivers/ide/ide-tape.c +1 -1
Index: b/drivers/ide/ide-tape.c
===================================================================
@@ -502,7 +502,7 @@ static int idetape_end_request(ide_drive
 
 	spin_lock_irqsave(&tape->lock, flags);
 
-	ide_end_drive_cmd(drive, 0, 0);
+	ide_complete_rq(drive, 0);
 
 	spin_unlock_irqrestore(&tape->lock, flags);
 	return 0;
drivers/ide/ide-taskfile.c +15 -7
Index: b/drivers/ide/ide-taskfile.c
===================================================================
@@ -147,12 +147,9 @@ static ide_startstop_t task_no_data_intr
 			}
 		}
 		return ide_error(drive, "task_no_data_intr", stat);
-		/* calls ide_end_drive_cmd */
 	}
 
-	if (!custom)
-		ide_end_drive_cmd(drive, stat, ide_read_error(drive));
-	else if (tf->command == ATA_CMD_IDLEIMMEDIATE) {
+	if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) {
 		hwif->tp_ops->tf_read(drive, task);
 		if (tf->lbal != 0xc4) {
 			printk(KERN_ERR "%s: head unload failed!\n",
@@ -160,10 +157,18 @@ static ide_startstop_t task_no_data_intr
 			ide_tf_dump(drive->name, tf);
 		} else
 			drive->dev_flags |= IDE_DFLAG_PARKED;
-		ide_end_drive_cmd(drive, stat, ide_read_error(drive));
-	} else if (tf->command == ATA_CMD_SET_MULTI)
+	} else if (custom && tf->command == ATA_CMD_SET_MULTI)
 		drive->mult_count = drive->mult_req;
 
+	if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) {
+		struct request *rq = hwif->rq;
+		u8 err = ide_read_error(drive);
+
+		if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
+			ide_complete_task(drive, task, stat, err);
+		ide_complete_rq(drive, err);
+	}
+
 	return ide_stopped;
 }
 
@@ -321,9 +326,12 @@ static ide_startstop_t task_error(ide_dr
 void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
 {
 	if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
+		ide_task_t *task = rq->special;
 		u8 err = ide_read_error(drive);
 
-		ide_end_drive_cmd(drive, stat, err);
+		if (task)
+			ide_complete_task(drive, task, stat, err);
+		ide_complete_rq(drive, err);
 		return;
 	}
 
include/linux/ide.h +2 -1
Index: b/include/linux/ide.h
===================================================================
@@ -1155,7 +1155,8 @@ extern ide_startstop_t ide_do_reset (ide
 extern int ide_devset_execute(ide_drive_t *drive,
 			      const struct ide_devset *setting, int arg);
 
-extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
+void ide_complete_task(ide_drive_t *, ide_task_t *, u8, u8);
+void ide_complete_rq(ide_drive_t *, u8);
 
 void ide_tf_dump(const char *, struct ide_taskfile *);
 
#29 lore raw

PATCH 13/15 ide: no need to read Status and Error registers for "empty" taskfile requests

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: no need to read Status and Error registers for "empty" taskfile requests

---
 drivers/ide/ide-io.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/ide/ide-io.c +1 -3
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -333,9 +333,7 @@ static ide_startstop_t execute_drive_cmd
 #ifdef DEBUG
  	printk("%s: DRIVE_CMD (null)\n", drive->name);
 #endif
-	(void)hwif->tp_ops->read_status(hwif);
-
-	ide_complete_rq(drive, ide_read_error(drive));
+	ide_complete_rq(drive, 0);
 
  	return ide_stopped;
 }
#30 lore raw

PATCH 14/15 ide: remove ->data_phase field from ide_hwif_t

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove ->data_phase field from ide_hwif_t

* Always use hwif->task->data_phase and remove ->data_phase field from ide_hwif_t.

* Remove superfluous REQ_TYPE_ATA_TASKFILE check from ide_pio_datablock() while at it.

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-disk.c     |    3 ---
 drivers/ide/ide-io.c       |    5 +----
 drivers/ide/ide-park.c     |    2 +-
 drivers/ide/ide-taskfile.c |   18 ++++++++----------
 include/linux/ide.h        |    3 ---
 5 files changed, 10 insertions(+), 21 deletions(-)
drivers/ide/ide-disk.c +0 -3
Index: b/drivers/ide/ide-disk.c
===================================================================
@@ -160,8 +160,6 @@ static ide_startstop_t __ide_do_rw_disk(
 		task.tf_flags |= IDE_TFLAG_WRITE;
 
 	ide_tf_set_cmd(drive, &task, dma);
-	if (!dma)
-		hwif->data_phase = task.data_phase;
 	task.rq = rq;
 
 	rc = do_rw_taskfile(drive, &task);
@@ -170,7 +168,6 @@ static ide_startstop_t __ide_do_rw_disk(
 		/* fallback to PIO */
 		task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
 		ide_tf_set_cmd(drive, &task, 0);
-		hwif->data_phase = task.data_phase;
 		ide_init_sg_cmd(drive, rq);
 		rc = do_rw_taskfile(drive, &task);
 	}
drivers/ide/ide-io.c +1 -4
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -306,13 +306,10 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
 static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
 		struct request *rq)
 {
-	ide_hwif_t *hwif = drive->hwif;
 	ide_task_t *task = rq->special;
 
 	if (task) {
-		hwif->data_phase = task->data_phase;
-
-		switch (hwif->data_phase) {
+		switch (task->data_phase) {
 		case TASKFILE_MULTI_OUT:
 		case TASKFILE_OUT:
 		case TASKFILE_MULTI_IN:
drivers/ide/ide-park.c +1 -1
Index: b/drivers/ide/ide-park.c
===================================================================
@@ -81,7 +81,7 @@ ide_startstop_t ide_do_park_unpark(ide_d
 
 	task.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
 	task.rq = rq;
-	drive->hwif->data_phase = task.data_phase = TASKFILE_NO_DATA;
+	task.data_phase = TASKFILE_NO_DATA;
 	return do_rw_taskfile(drive, &task);
 }
 
drivers/ide/ide-taskfile.c +8 -10
Index: b/drivers/ide/ide-taskfile.c
===================================================================
@@ -261,21 +261,18 @@ static void ide_pio_multi(ide_drive_t *d
 static void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
 				     unsigned int write)
 {
+	ide_task_t *task = &drive->hwif->task;
 	u8 saved_io_32bit = drive->io_32bit;
 
 	if (rq->bio)	/* fs request */
 		rq->errors = 0;
 
-	if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
-		ide_task_t *task = rq->special;
-
-		if (task->tf_flags & IDE_TFLAG_IO_16BIT)
-			drive->io_32bit = 0;
-	}
+	if (task->tf_flags & IDE_TFLAG_IO_16BIT)
+		drive->io_32bit = 0;
 
 	touch_softlockup_watchdog();
 
-	switch (drive->hwif->data_phase) {
+	switch (task->data_phase) {
 	case TASKFILE_MULTI_IN:
 	case TASKFILE_MULTI_OUT:
 		ide_pio_multi(drive, rq, write);
@@ -293,9 +290,10 @@ static ide_startstop_t task_error(ide_dr
 {
 	if (rq->bio) {
 		ide_hwif_t *hwif = drive->hwif;
+		ide_task_t *task = &hwif->task;
 		int sectors = hwif->nsect - hwif->nleft;
 
-		switch (hwif->data_phase) {
+		switch (task->data_phase) {
 		case TASKFILE_IN:
 			if (hwif->nleft)
 				break;
@@ -427,14 +425,14 @@ static ide_startstop_t task_out_intr (id
 
 static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
 {
-	ide_hwif_t *hwif = drive->hwif;
+	ide_task_t *task = &drive->hwif->task;
 	ide_startstop_t startstop;
 
 	if (ide_wait_stat(&startstop, drive, ATA_DRQ,
 			  drive->bad_wstat, WAIT_DRQ)) {
 		printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n",
 			drive->name,
-			hwif->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "",
+			task->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "",
 			(drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : "");
 		return startstop;
 	}
include/linux/ide.h +0 -3
Index: b/include/linux/ide.h
===================================================================
@@ -767,9 +767,6 @@ typedef struct hwif_s {
 	int sg_nents;			/* Current number of entries in it */
 	int sg_dma_direction;		/* dma transfer direction */
 
-	/* data phase of the active command (currently only valid for PIO/DMA) */
-	int		data_phase;
-
 	struct ide_task_s task;		/* current command */
 
 	unsigned int nsect;
#31 lore raw

PATCH 15/15 ide: move smart_enable() call out from get_smart_data()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move smart_enable() call out from get_smart_data()

Move smart_enable() call out from get_smart_data() to proc_idedisk_read_smart().

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-disk_proc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ide/ide-disk_proc.c +3 -1
Index: b/drivers/ide/ide-disk_proc.c
===================================================================
@@ -31,7 +31,7 @@ static int get_smart_data(ide_drive_t *d
 	tf->command = ATA_CMD_SMART;
 	args.tf_flags	= IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
 	args.data_phase	= TASKFILE_IN;
-	(void) smart_enable(drive);
+
 	return ide_raw_taskfile(drive, &args, buf, 1);
 }
 
@@ -67,6 +67,8 @@ static int proc_idedisk_read_smart(char 
 	ide_drive_t	*drive = (ide_drive_t *)data;
 	int		len = 0, i = 0;
 
+	(void)smart_enable(drive);
+
 	if (get_smart_data(drive, page, sub_cmd) == 0) {
 		unsigned short *val = (unsigned short *) page;
 		char *out = (char *)val + SECTOR_SIZE;