[patch 3/5] drivers/scsi/dmx3191d.c: convert to module_pci_driver

2013-09-13 Thread akpm
From: Libo Chen clbchenlibo.c...@huawei.com
Subject: drivers/scsi/dmx3191d.c: convert to module_pci_driver

Signed-off-by: Libo Chen libo.c...@huawei.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/scsi/dmx3191d.c |   13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff -puN 
drivers/scsi/dmx3191d.c~drivers-scsi-dmx3191d-convert-to-module_pci_driver 
drivers/scsi/dmx3191d.c
--- a/drivers/scsi/dmx3191d.c~drivers-scsi-dmx3191d-convert-to-module_pci_driver
+++ a/drivers/scsi/dmx3191d.c
@@ -153,18 +153,7 @@ static struct pci_driver dmx3191d_pci_dr
.remove = dmx3191d_remove_one,
 };
 
-static int __init dmx3191d_init(void)
-{
-   return pci_register_driver(dmx3191d_pci_driver);
-}
-
-static void __exit dmx3191d_exit(void)
-{
-   pci_unregister_driver(dmx3191d_pci_driver);
-}
-
-module_init(dmx3191d_init);
-module_exit(dmx3191d_exit);
+module_pci_driver(dmx3191d_pci_driver);
 
 MODULE_AUTHOR(Massimo Piccioni dafasti...@libero.it);
 MODULE_DESCRIPTION(Domex DMX3191D SCSI driver);
_
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 1/5] drivers/scsi/a100u2w.c: convert to module_pci_driver

2013-09-13 Thread akpm
From: Libo Chen clbchenlibo.c...@huawei.com
Subject: drivers/scsi/a100u2w.c: convert to module_pci_driver

Use module_pci_driver instead of init/exit, make code clean.

Signed-off-by: Libo Chen libo.c...@huawei.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/scsi/a100u2w.c |   12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff -puN 
drivers/scsi/a100u2w.c~drivers-scsi-a100u2w-convert-to-module_pci_driver 
drivers/scsi/a100u2w.c
--- a/drivers/scsi/a100u2w.c~drivers-scsi-a100u2w-convert-to-module_pci_driver
+++ a/drivers/scsi/a100u2w.c
@@ -1227,19 +1227,9 @@ static struct pci_driver inia100_pci_dri
.remove = inia100_remove_one,
 };
 
-static int __init inia100_init(void)
-{
-   return pci_register_driver(inia100_pci_driver);
-}
-
-static void __exit inia100_exit(void)
-{
-   pci_unregister_driver(inia100_pci_driver);
-}
+module_pci_driver(inia100_pci_driver);
 
 MODULE_DESCRIPTION(Initio A100U2W SCSI driver);
 MODULE_AUTHOR(Initio Corporation);
 MODULE_LICENSE(Dual BSD/GPL);
 
-module_init(inia100_init);
-module_exit(inia100_exit);
_
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 5/5] drivers/scsi/mvumi.c: convert to module_pci_driver

2013-09-13 Thread akpm
From: Libo Chen clbchenlibo.c...@huawei.com
Subject: drivers/scsi/mvumi.c: convert to module_pci_driver

Signed-off-by: Libo Chen libo.c...@huawei.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/scsi/mvumi.c |   20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff -puN drivers/scsi/mvumi.c~drivers-scsi-mvumi-convert-to-module_pci_driver 
drivers/scsi/mvumi.c
--- a/drivers/scsi/mvumi.c~drivers-scsi-mvumi-convert-to-module_pci_driver
+++ a/drivers/scsi/mvumi.c
@@ -2735,22 +2735,4 @@ static struct pci_driver mvumi_pci_drive
 #endif
 };
 
-/**
- * mvumi_init - Driver load entry point
- */
-static int __init mvumi_init(void)
-{
-   return pci_register_driver(mvumi_pci_driver);
-}
-
-/**
- * mvumi_exit - Driver unload entry point
- */
-static void __exit mvumi_exit(void)
-{
-
-   pci_unregister_driver(mvumi_pci_driver);
-}
-
-module_init(mvumi_init);
-module_exit(mvumi_exit);
+module_pci_driver(mvumi_pci_driver);
_
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 4/5] drivers/scsi/initio.c: convert to module_pci_driver

2013-09-13 Thread akpm
From: Libo Chen clbchenlibo.c...@huawei.com
Subject: drivers/scsi/initio.c: convert to module_pci_driver

Signed-off-by: Libo Chen libo.c...@huawei.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/scsi/initio.c |   13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff -puN 
drivers/scsi/initio.c~drivers-scsi-initio-convert-to-module_pci_driver 
drivers/scsi/initio.c
--- a/drivers/scsi/initio.c~drivers-scsi-initio-convert-to-module_pci_driver
+++ a/drivers/scsi/initio.c
@@ -2995,19 +2995,8 @@ static struct pci_driver initio_pci_driv
.remove = initio_remove_one,
 };
 
-static int __init initio_init_driver(void)
-{
-   return pci_register_driver(initio_pci_driver);
-}
-
-static void __exit initio_exit_driver(void)
-{
-   pci_unregister_driver(initio_pci_driver);
-}
+module_pci_driver(initio_pci_driver);
 
 MODULE_DESCRIPTION(Initio INI-9X00U/UW SCSI device driver);
 MODULE_AUTHOR(Initio Corporation);
 MODULE_LICENSE(GPL);
-
-module_init(initio_init_driver);
-module_exit(initio_exit_driver);
_
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 2/5] drivers/scsi/dc395x.c: convert to module_pci_driver

2013-09-13 Thread akpm
From: Libo Chen clbchenlibo.c...@huawei.com
Subject: drivers/scsi/dc395x.c: convert to module_pci_driver

Signed-off-by: Libo Chen libo.c...@huawei.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/scsi/dc395x.c |   24 +---
 1 file changed, 1 insertion(+), 23 deletions(-)

diff -puN 
drivers/scsi/dc395x.c~drivers-scsi-dc395x-convert-to-module_pci_driver 
drivers/scsi/dc395x.c
--- a/drivers/scsi/dc395x.c~drivers-scsi-dc395x-convert-to-module_pci_driver
+++ a/drivers/scsi/dc395x.c
@@ -4882,29 +4882,7 @@ static struct pci_driver dc395x_driver =
.remove = dc395x_remove_one,
 };
 
-
-/**
- * dc395x_module_init - Module initialization function
- *
- * Used by both module and built-in driver to initialise this driver.
- **/
-static int __init dc395x_module_init(void)
-{
-   return pci_register_driver(dc395x_driver);
-}
-
-
-/**
- * dc395x_module_exit - Module cleanup function.
- **/
-static void __exit dc395x_module_exit(void)
-{
-   pci_unregister_driver(dc395x_driver);
-}
-
-
-module_init(dc395x_module_init);
-module_exit(dc395x_module_exit);
+module_pci_driver(dc395x_driver);
 
 MODULE_AUTHOR(C.L. Huang / Erich Chen / Kurt Garloff);
 MODULE_DESCRIPTION(SCSI host adapter driver for Tekram TRM-S1040 based 
adapters: Tekram DC395 and DC315 series);
_
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 1/2] drivers/message/fusion/mptscsih.c: missing break

2012-11-08 Thread akpm
From: Alan Cox a...@linux.intel.com
Subject: drivers/message/fusion/mptscsih.c: missing break

This happens to do the right thing in all cases on fibre channel but not on
other media types

Signed-off-by: Alan Cox a...@linux.intel.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Kashyap Desai kashyap.de...@lsi.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/message/fusion/mptscsih.c |1 +
 1 file changed, 1 insertion(+)

diff -puN 
drivers/message/fusion/mptscsih.c~drivers-message-fusion-mptscsihc-missing-break
 drivers/message/fusion/mptscsih.c
--- 
a/drivers/message/fusion/mptscsih.c~drivers-message-fusion-mptscsihc-missing-break
+++ a/drivers/message/fusion/mptscsih.c
@@ -792,6 +792,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
 * than an unsolicited DID_ABORT.
 */
sc-result = DID_RESET  16;
+   break;
 
case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
if (ioc-bus_type == FC)
_
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 2/2] drivers/scsi/hptiop: support HighPoint RR4520/RR4522 HBA

2012-11-08 Thread akpm
From: HighPoint Linux Team li...@highpoint-tech.com
Subject: drivers/scsi/hptiop: support HighPoint RR4520/RR4522 HBA

Support IOP RR4520/RR4522 which are based on Marvell frey.

Signed-off-by: HighPoint Linux Team li...@highpoint-tech.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 Documentation/scsi/hptiop.txt |   69 +
 drivers/scsi/hptiop.c |  413 ++--
 drivers/scsi/hptiop.h |   72 +
 3 files changed, 530 insertions(+), 24 deletions(-)

diff -puN 
Documentation/scsi/hptiop.txt~hptiop-support-highpoint-rr4520-rr4522-hba 
Documentation/scsi/hptiop.txt
--- a/Documentation/scsi/hptiop.txt~hptiop-support-highpoint-rr4520-rr4522-hba
+++ a/Documentation/scsi/hptiop.txt
@@ -37,7 +37,7 @@ For Intel IOP based adapters, the contro
 0x40Inbound Queue Port
 0x44Outbound Queue Port
 
-For Marvell IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1:
+For Marvell not Frey IOP based adapters, the IOP is accessed via PCI BAR0 and 
BAR1:
 
  BAR0 offsetRegister
  0x20400Inbound Doorbell Register
@@ -55,9 +55,31 @@ For Marvell IOP based adapters, the IOP 
  0x40-0x1040Inbound Queue
0x1040-0x2040Outbound Queue
 
+For Marvell Frey IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1:
 
-I/O Request Workflow
---
+ BAR0 offsetRegister
+ 0x0IOP configuration information.
+
+ BAR1 offsetRegister
+  0x4000Inbound List Base Address Low
+  0x4004Inbound List Base Address High
+  0x4018Inbound List Write Pointer
+  0x402CInbound List Configuration and Control
+  0x4050Outbound List Base Address Low
+  0x4054Outbound List Base Address High
+  0x4058Outbound List Copy Pointer Shadow Base Address Low
+  0x405COutbound List Copy Pointer Shadow Base Address High
+  0x4088Outbound List Interrupt Cause
+  0x408COutbound List Interrupt Enable
+ 0x1020CPCIe Function 0 Interrupt Enable
+ 0x10400PCIe Function 0 to CPU Message A
+ 0x10420CPU to PCIe Function 0 Message A
+ 0x10480CPU to PCIe Function 0 Doorbell
+ 0x10484CPU to PCIe Function 0 Doorbell Enable
+
+
+I/O Request Workflow of Not Marvell Frey
+--
 
 All queued requests are handled via inbound/outbound queue port.
 A request packet can be allocated in either IOP or host memory.
@@ -101,6 +123,45 @@ register 0. An outbound message with the
 of an inbound message.
 
 
+I/O Request Workflow of Marvell Frey
+--
+
+All queued requests are handled via inbound/outbound list.
+
+To send a request to the controller:
+
+- Allocate a free request in host DMA coherent memory.
+
+  Requests allocated in host memory must be aligned on 32-bytes boundary.
+
+- Fill the request with index of the request in the flag.
+
+  Fill a free inbound list unit with the physical address and the size of
+  the request.
+
+  Set up the inbound list write pointer with the index of previous unit,
+  round to 0 if the index reaches the supported count of requests.
+
+- Post the inbound list writer pointer to IOP.
+
+- The IOP process the request. When the request is completed, the flag of
+  the request with or-ed IOPMU_QUEUE_MASK_HOST_BITS will be put into a
+  free outbound list unit and the index of the outbound list unit will be
+  put into the copy pointer shadow register. An outbound interrupt will be
+  generated.
+
+- The host read the outbound list copy pointer shadow register and compare
+  with previous saved read ponter N. If they are different, the host will
+  read the (N+1)th outbound list unit.
+
+  The host get the index of the request from the (N+1)th outbound list
+  unit and complete the request.
+
+Non-queued requests (reset communication/reset/flush etc) can be sent via PCIe
+Function 0 to CPU Message A register. The CPU to PCIe Function 0 Message 
register
+with the same value indicates the completion of message.
+
+
 User-level Interface
 -
 
@@ -112,7 +173,7 @@ The driver exposes following sysfs attri
 
 
 -
-Copyright (C) 2006-2009 HighPoint Technologies, Inc. All Rights Reserved.
+Copyright (C) 2006-2012 HighPoint Technologies, Inc. All Rights Reserved.
 
   This file is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -puN drivers/scsi/hptiop.c~hptiop-support-highpoint-rr4520-rr4522-hba 
drivers/scsi/hptiop.c
--- a/drivers/scsi/hptiop.c~hptiop-support-highpoint-rr4520-rr4522-hba
+++ a/drivers/scsi/hptiop.c
@@ -1,6 +1,6 @@
 /*
  * HighPoint RR3xxx/4xxx controller driver for Linux
- * Copyright (C) 

[patch 02/13] git-scsi-misc gdth fix

2008-02-04 Thread akpm
From: James Bottomley [EMAIL PROTECTED]

On Sun, 2007-10-14 at 12:21 -0700, Andrew Morton wrote:
 On Sun, 14 Oct 2007 22:45:47 +0400 Dave Milter [EMAIL PROTECTED] wrote:

  I build linux-2.6.23-mm1 and try to boot it using qemu,
  and it crashed with trace like this:
  do_page_fault
  error_code
  lock_acquire
  _spin_lock_irqsave
  gdth_timeout
  run_timer_softirq
  __do_softirq
  do_softirq
 
  I have screenshot, but have no idea, is it legal to include it, if I
  sent copy to lkml.
  config of kernel in attachment,
  I apply all three patches from hot-fixes.
 

 The screenshot is here:  http://userweb.kernel.org/~akpm/crash.png

 It would appear that gdth_timeout() is passing a bad pointer into
 spin_lock_irqsave().

There's a bug in the gdth rework in that the instance can be deleted
from the list before the actual timer is stopped.  This can be worked
around I think by the following patch; although we really should be
stopping the timer from firing when the list goes empty.


James said:

This is almost certainly the wrong fix for real hardware.  Although it
kills the timer when the list goes empty, nothing will ever restart it
when the list fills again.

Boaz, since you touched all of this, you get to fix it.  The correct fix
will be to control the timer along with the actual list instead of at
entry/exit time.  If you're not going to add this empty check to the
timer routine, make sure you use del_timer_sync() before removing the
last element from the list.


Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |3 +++
 1 file changed, 3 insertions(+)

diff -puN drivers/scsi/gdth.c~git-scsi-misc-gdth-fix drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~git-scsi-misc-gdth-fix
+++ a/drivers/scsi/gdth.c
@@ -3791,6 +3791,9 @@ static void gdth_timeout(ulong data)
 gdth_ha_str *ha;
 ulong flags;
 
+if (list_empty(gdth_instances))
+   return;
+
 ha = list_first_entry(gdth_instances, gdth_ha_str, list);
 spin_lock_irqsave(ha-smp_lock, flags);
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 01/13] git-scsi-misc: fix isa/pcmcia compile problem

2008-02-04 Thread akpm
From: Tejun Heo [EMAIL PROTECTED]

aha152x.c and fdomain are built twice - once for the isa driver and once
for the PCMCIA one.  Through #ifdefs, the compiled codes are slightly
different; thus, global symbols need to be given different names depending
on which flavor is being built.  This patch adds GLOBAL() macro to
aha152x.h and fdomain.h which change the symbol depending on PCMCIA.

This bug has always existed but has been masked by the fact the
drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus avoided
the duplicate symbols during compilation.

[EMAIL PROTECTED]: coding-style fixes]
Signed-off-by: Tejun Heo [EMAIL PROTECTED]
Tested-by: Kamalesh Babulal [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aha152x.c |   12 ++--
 drivers/scsi/aha152x.h |   20 +---
 drivers/scsi/fdomain.c |   20 ++--
 drivers/scsi/fdomain.h |   21 +
 drivers/scsi/pcmcia/aha152x_stub.c |   10 ++
 drivers/scsi/pcmcia/fdomain_stub.c |   10 ++
 6 files changed, 62 insertions(+), 31 deletions(-)

diff -puN drivers/scsi/aha152x.c~scsi-fix-isa-pcmcia-compile-problem 
drivers/scsi/aha152x.c
--- a/drivers/scsi/aha152x.c~scsi-fix-isa-pcmcia-compile-problem
+++ a/drivers/scsi/aha152x.c
@@ -768,7 +768,7 @@ static irqreturn_t swintr(int irqno, voi
return IRQ_HANDLED;
 }
 
-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *setup)
 {
struct Scsi_Host *shpnt;
 
@@ -904,7 +904,7 @@ out_host_put:
return NULL;
 }
 
-void aha152x_release(struct Scsi_Host *shpnt)
+void GLOBAL(aha152x_release)(struct Scsi_Host *shpnt)
 {
if (!shpnt)
return;
@@ -1320,7 +1320,7 @@ static void reset_ports(struct Scsi_Host
  * Reset the host (bus and controller)
  *
  */
-int aha152x_host_reset_host(struct Scsi_Host *shpnt)
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *shpnt)
 {
DPRINTK(debug_eh, KERN_DEBUG scsi%d: host reset\n, shpnt-host_no);
 
@@ -1338,7 +1338,7 @@ int aha152x_host_reset_host(struct Scsi_
  */
 static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
 {
-   return aha152x_host_reset_host(SCpnt-device-host);
+   return GLOBAL(aha152x_host_reset_host)(SCpnt-device-host);
 }
 
 /*
@@ -3894,7 +3894,7 @@ static int __init aha152x_init(void)
 
for (i=0; isetup_count; i++) {
if ( request_region(setup[i].io_port, IO_RANGE, aha152x) ) {
-   struct Scsi_Host *shpnt = aha152x_probe_one(setup[i]);
+   struct Scsi_Host *shpnt = 
GLOBAL(aha152x_probe_one)(setup[i]);
 
if( !shpnt ) {
release_region(setup[i].io_port, IO_RANGE);
@@ -3924,7 +3924,7 @@ static void __exit aha152x_exit(void)
list_for_each_entry(hd, aha152x_host_list, host_list) {
struct Scsi_Host *shost = container_of((void *)hd, struct 
Scsi_Host, hostdata);
 
-   aha152x_release(shost);
+   GLOBAL(aha152x_release)(shost);
}
 }
 
diff -puN drivers/scsi/aha152x.h~scsi-fix-isa-pcmcia-compile-problem 
drivers/scsi/aha152x.h
--- a/drivers/scsi/aha152x.h~scsi-fix-isa-pcmcia-compile-problem
+++ a/drivers/scsi/aha152x.h
@@ -330,8 +330,22 @@ struct aha152x_setup {
char *conf;
 };
 
-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
-void aha152x_release(struct Scsi_Host *);
-int aha152x_host_reset_host(struct Scsi_Host *);
+/*
+ * This file and aha152x.c are compiled in two different ways - for
+ * the isa driver and pcmcia one.  When building the pcmcia one, the
+ * file is slightly modified, so they can't share the same object
+ * file.  The following macro alters a symbol depending on whether
+ * pcmcia driver is being built or not and should be used for any
+ * global symbol.
+ */
+#if defined(PCMCIA)
+#define GLOBAL(x)  CS_##x
+#else
+#define GLOBAL(x)  ISA_##x
+#endif
+
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *);
+void GLOBAL(aha152x_release)(struct Scsi_Host *);
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *);
 
 #endif /* _AHA152X_H */
diff -puN drivers/scsi/fdomain.c~scsi-fix-isa-pcmcia-compile-problem 
drivers/scsi/fdomain.c
--- a/drivers/scsi/fdomain.c~scsi-fix-isa-pcmcia-compile-problem
+++ a/drivers/scsi/fdomain.c
@@ -550,7 +550,7 @@ static void print_banner( struct Scsi_Ho
printk( \n );
 }
 
-int fdomain_setup(char *str)
+int GLOBAL(fdomain_setup)(char *str)
 {
int ints[4];
 
@@ -571,7 +571,7 @@ int fdomain_setup(char *str)
return 1;
 }
 
-__setup(fdomain=, fdomain_setup);
+__setup(fdomain=, GLOBAL(fdomain_setup));
 
 
 static void do_pause(unsigned amount)  /* Pause for amount*10 milliseconds */
@@ -890,7 +890,7 @@ 

[patch 04/13] kill warnings in mptbase.h on parisc64

2008-02-04 Thread akpm
From: Kyle McMartin [EMAIL PROTECTED]

Verified all the arches necessary select the CONFIG_64BIT symbol.  This
also kills the warning (since it was using the 32-bit case) on parisc64 and
mips64.

Signed-off-by: Kyle McMartin [EMAIL PROTECTED]
Cc: Moore, Eric Dean [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/message/fusion/mptbase.h~kill-warnings-in-mptbaseh-on-parisc64 
drivers/message/fusion/mptbase.h
--- a/drivers/message/fusion/mptbase.h~kill-warnings-in-mptbaseh-on-parisc64
+++ a/drivers/message/fusion/mptbase.h
@@ -922,7 +922,7 @@ extern struct proc_dir_entry*mpt_proc_r
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 #endif /* } __KERNEL__ */
 
-#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || 
defined(__x86_64__) || defined(__powerpc__)
+#ifdef CONFIG_64BIT
 #define CAST_U32_TO_PTR(x) ((void *)(u64)x)
 #define CAST_PTR_TO_U32(x) ((u32)(u64)x)
 #else
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 12/13] scsi: arcmsr updates (1.20.00.15)

2008-02-04 Thread akpm
From: Nick Cheng [EMAIL PROTECTED]

- add arcmsr_enable_eoi_mode()and readl(reg-iop2drv_doorbell_reg) in
  arcmsr_handle_hbb_isr() on adapter Type B in case of the doorbell
  interrupt clearance is cached

- add conditional declaration for arcmsr_pci_error_detected() and
  arcmsr_pci_slot_reset

- check if the sg list member number exceeds arcmsr default limit in
  arcmsr_build_ccb()

- change the returned value type of arcmsr_build_ccb()from void to
  int returns FAILED in arcmsr_queue_command()

- modify arcmsr_drain_donequeue() to ignore unknown command and let
  kernel process command timeout.  This could handle IO request violating
  maximum segments, i.e.  Linux XFS over DM-CRYPT.  Thanks to Milan Broz's
  comments [EMAIL PROTECTED]

- fix the release of dma memory for type B in arcmsr_free_ccb_pool()

- fix the arcmsr_polling_hbb_ccbdone()

Signed-off-by: Nick Cheng [EMAIL PROTECTED]
Cc: Milan Broz [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 Documentation/scsi/ChangeLog.arcmsr |   41 
 drivers/scsi/arcmsr/arcmsr.h|4 -
 drivers/scsi/arcmsr/arcmsr_hba.c|   87 ++
 3 files changed, 105 insertions(+), 27 deletions(-)

diff -puN Documentation/scsi/ChangeLog.arcmsr~scsi-arcmsr-updates-1200015 
Documentation/scsi/ChangeLog.arcmsr
--- a/Documentation/scsi/ChangeLog.arcmsr~scsi-arcmsr-updates-1200015
+++ a/Documentation/scsi/ChangeLog.arcmsr
@@ -68,4 +68,45 @@
 ** 2. modify the 
arcmsr_pci_slot_reset function
 ** 3. modify the 
arcmsr_pci_ers_disconnect_forepart function
 ** 4. modify the 
arcmsr_pci_ers_need_reset_forepart function
+** 1.20.00.15   09/27/2007  Erich Chen  Nick Cheng
+** 1. add arcmsr_enable_eoi_mode() 
on adapter Type B
+** 2. add 
readl(reg-iop2drv_doorbell_reg) in arcmsr_handle_hbb_isr()
+** in case of the doorbell 
interrupt clearance is cached
+** 1.20.00.15   10/01/2007  Erich Chen  Nick Cheng
+** 1. modify acb-devstate[i][j]
+** as ARECA_RAID_GOOD instead of
+** ARECA_RAID_GONE in 
arcmsr_alloc_ccb_pool
+** 1.20.00.15   11/06/2007   Erich Chen  Nick Cheng
+** 1. add conditional declaration 
for
+** arcmsr_pci_error_detected() and
+** arcmsr_pci_slot_reset
+** 1.20.00.15  11/23/2007   Erich Chen  Nick Cheng
+** 1.check if the sg list member 
number
+** exceeds arcmsr default limit in 
arcmsr_build_ccb()
+** 2.change the returned value 
type of arcmsr_build_ccb()
+** from void to int
+** 3.add the conditional check if 
arcmsr_build_ccb()
+** returns FAILED
+** 1.20.00.15  12/04/2007   Erich Chen  Nick Cheng
+** 1. modify 
arcmsr_drain_donequeue() to ignore unknown
+** command and let kernel process 
command timeout.
+** This could handle IO request 
violating max. segments
+** while Linux XFS over DM-CRYPT.
+** Thanks to Milan Broz's comments 
[EMAIL PROTECTED]
+** 1.20.00.15  12/24/2007   Erich Chen  Nick Cheng
+** 1.fix the portability problems
+** 2.fix type B where we should 
_not_ iounmap() acb-pmu;
+** it's not ioremapped.
+** 3.add return -ENOMEM if 
ioremap() fails
+** 4.transfer IS_SG64_ADDR w/ 
cpu_to_le32()
+** in arcmsr_build_ccb
+** 5. modify acb-devstate[i][j] 
as ARECA_RAID_GONE instead of
+** ARECA_RAID_GOOD in 
arcmsr_alloc_ccb_pool()
+** 6.fix arcmsr_cdb-Context as 
(unsigned long)arcmsr_cdb
+** 7.add the checking state of
+** (outbound_intstatus  
ARCMSR_MU_OUTBOUND_HANDLE_INT) == 0
+** in 

[patch 10/13] scsi/aic94xx/: cleanups

2008-02-04 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

- static functions in .c files shouldn't be marked inline
- make needlessly global code static
- remove the unused aic94xx_seq.c:asd_unpause_lseq()
- #if 0 other unused code

[EMAIL PROTECTED]: coding-style fixes]
Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: Darrick J. Wong [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aic94xx/aic94xx_dev.c  |8 +--
 drivers/scsi/aic94xx/aic94xx_dump.c |   10 
 drivers/scsi/aic94xx/aic94xx_dump.h |9 
 drivers/scsi/aic94xx/aic94xx_hwi.c  |   24 +-
 drivers/scsi/aic94xx/aic94xx_hwi.h  |2 
 drivers/scsi/aic94xx/aic94xx_init.c |8 +--
 drivers/scsi/aic94xx/aic94xx_reg.c  |   57 --
 drivers/scsi/aic94xx/aic94xx_scb.c  |   33 ---
 drivers/scsi/aic94xx/aic94xx_sds.c  |4 -
 drivers/scsi/aic94xx/aic94xx_seq.c  |   31 ++
 drivers/scsi/aic94xx/aic94xx_seq.h  |4 -
 drivers/scsi/aic94xx/aic94xx_task.c |   12 ++---
 drivers/scsi/aic94xx/aic94xx_tmf.c  |4 -
 13 files changed, 90 insertions(+), 116 deletions(-)

diff -puN drivers/scsi/aic94xx/aic94xx_dev.c~scsi-aic94xx-cleanups 
drivers/scsi/aic94xx/aic94xx_dev.c
--- a/drivers/scsi/aic94xx/aic94xx_dev.c~scsi-aic94xx-cleanups
+++ a/drivers/scsi/aic94xx/aic94xx_dev.c
@@ -35,7 +35,7 @@
 #define SET_DDB(_ddb, _ha) set_bit(_ddb, (_ha)-hw_prof.ddb_bitmap)
 #define CLEAR_DDB(_ddb, _ha) clear_bit(_ddb, (_ha)-hw_prof.ddb_bitmap)
 
-static inline int asd_get_ddb(struct asd_ha_struct *asd_ha)
+static int asd_get_ddb(struct asd_ha_struct *asd_ha)
 {
int ddb, i;
 
@@ -71,7 +71,7 @@ out:
 #define NCQ_DATA_SCB_PTR offsetof(struct asd_ddb_stp_sata_target_port, 
ncq_data_scb_ptr)
 #define ITNL_TIMEOUToffsetof(struct asd_ddb_ssp_smp_target_port, 
itnl_timeout)
 
-static inline void asd_free_ddb(struct asd_ha_struct *asd_ha, int ddb)
+static void asd_free_ddb(struct asd_ha_struct *asd_ha, int ddb)
 {
if (!ddb || ddb = 0x)
return;
@@ -79,7 +79,7 @@ static inline void asd_free_ddb(struct a
CLEAR_DDB(ddb, asd_ha);
 }
 
-static inline void asd_set_ddb_type(struct domain_device *dev)
+static void asd_set_ddb_type(struct domain_device *dev)
 {
struct asd_ha_struct *asd_ha = dev-port-ha-lldd_ha;
int ddb = (int) (unsigned long) dev-lldd_dev;
@@ -109,7 +109,7 @@ static int asd_init_sata_tag_ddb(struct 
return 0;
 }
 
-static inline int asd_init_sata(struct domain_device *dev)
+static int asd_init_sata(struct domain_device *dev)
 {
struct asd_ha_struct *asd_ha = dev-port-ha-lldd_ha;
int ddb = (int) (unsigned long) dev-lldd_dev;
diff -puN drivers/scsi/aic94xx/aic94xx_dump.c~scsi-aic94xx-cleanups 
drivers/scsi/aic94xx/aic94xx_dump.c
--- a/drivers/scsi/aic94xx/aic94xx_dump.c~scsi-aic94xx-cleanups
+++ a/drivers/scsi/aic94xx/aic94xx_dump.c
@@ -738,6 +738,8 @@ static void asd_dump_lseq_state(struct a
PRINT_LMIP_dword(asd_ha, lseq, DEV_PRES_TIMER_TERM_TS);
 }
 
+#if 0
+
 /**
  * asd_dump_ddb_site -- dump a CSEQ DDB site
  * @asd_ha: pointer to host adapter structure
@@ -880,6 +882,8 @@ void asd_dump_scb_sites(struct asd_ha_st
}
 }
 
+#endif  /*  0  */
+
 /**
  * ads_dump_seq_state -- dump CSEQ and LSEQ states
  * @asd_ha: pointer to host adapter structure
@@ -922,7 +926,9 @@ void asd_dump_frame_rcvd(struct asd_phy 
spin_unlock_irqrestore(phy-sas_phy.frame_rcvd_lock, flags);
 }
 
-static inline void asd_dump_scb(struct asd_ascb *ascb, int ind)
+#if 0
+
+static void asd_dump_scb(struct asd_ascb *ascb, int ind)
 {
asd_printk(scb%d: vaddr: 0x%p, dma_handle: 0x%llx, next: 0x%llx, 
   index:%d, opcode:0x%02x\n,
@@ -956,4 +962,6 @@ void asd_dump_scb_list(struct asd_ascb *
}
 }
 
+#endif  /*  0  */
+
 #endif /* ASD_DEBUG */
diff -puN drivers/scsi/aic94xx/aic94xx_dump.h~scsi-aic94xx-cleanups 
drivers/scsi/aic94xx/aic94xx_dump.h
--- a/drivers/scsi/aic94xx/aic94xx_dump.h~scsi-aic94xx-cleanups
+++ a/drivers/scsi/aic94xx/aic94xx_dump.h
@@ -29,24 +29,15 @@
 
 #ifdef ASD_DEBUG
 
-void asd_dump_ddb_0(struct asd_ha_struct *asd_ha);
-void asd_dump_target_ddb(struct asd_ha_struct *asd_ha, u16 site_no);
-void asd_dump_scb_sites(struct asd_ha_struct *asd_ha);
 void asd_dump_seq_state(struct asd_ha_struct *asd_ha, u8 lseq_mask);
 void asd_dump_frame_rcvd(struct asd_phy *phy,
 struct done_list_struct *dl);
-void asd_dump_scb_list(struct asd_ascb *ascb, int num);
 #else /* ASD_DEBUG */
 
-static inline void asd_dump_ddb_0(struct asd_ha_struct *asd_ha) { }
-static inline void asd_dump_target_ddb(struct asd_ha_struct *asd_ha,
-u16 site_no) { }
-static inline void asd_dump_scb_sites(struct asd_ha_struct *asd_ha) { }
 static inline void asd_dump_seq_state(struct asd_ha_struct *asd_ha,
  u8 lseq_mask) { }
 static inline void asd_dump_frame_rcvd(struct asd_phy 

[patch 06/13] scsi/advansys.c: make 3 functions static

2008-02-04 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/advansys.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/advansys.c~scsi-advansysc-make-3-functions-static 
drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c~scsi-advansysc-make-3-functions-static
+++ a/drivers/scsi/advansys.c
@@ -12261,7 +12261,7 @@ static ushort __devinit AdvReadEEPWord(A
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
-void __devinit
+static void __devinit
 AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
 {
ushort *wbuf;
@@ -12328,7 +12328,7 @@ AdvSet3550EEPConfig(AdvPortAddr iop_base
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
-void __devinit
+static void __devinit
 AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf)
 {
ushort *wbuf;
@@ -12395,7 +12395,7 @@ AdvSet38C0800EEPConfig(AdvPortAddr iop_b
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
-void __devinit
+static void __devinit
 AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf)
 {
ushort *wbuf;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 13/13] drivers/scsi/dc395x.c: fix uninitialized var warning

2008-02-04 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

drivers/scsi/dc395x.c: In function 'dc395x_init_one':
drivers/scsi/dc395x.c:4270: warning: 'ptr' may be used uninitialized in this 
function

Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/dc395x.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/dc395x.c~drivers-scsi-dc395xc-fix-uninitialized-var-warning 
drivers/scsi/dc395x.c
--- a/drivers/scsi/dc395x.c~drivers-scsi-dc395xc-fix-uninitialized-var-warning
+++ a/drivers/scsi/dc395x.c
@@ -4267,7 +4267,7 @@ static int __devinit adapter_sg_tables_a
const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN;
int srb_idx = 0;
unsigned i = 0;
-   struct SGentry *ptr;
+   struct SGentry *uninitialized_var(ptr);
 
for (i = 0; i  DC395x_MAX_SRB_CNT; i++)
acb-srb_array[i].segment_x = NULL;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 07/13] Dell CERC support for megaraid_mbox

2008-02-04 Thread akpm
From: Hannes Reinecke [EMAIL PROTECTED]

Newer Dell CERC firmware (= 6.62) implement a random deletion handling
compatible with the legacy megaraid driver.  The legacy handling shifted
the target ID by 0x80 only for I/O commands (READ/WRITE/etc), whereas
megaraid_mbox shifts the target ID always if random deletion is supported. 
The resulted in megaraid_mbox sending an INQUIRY to the wrong channel, and
not finding any devices, obviously.

So we disable the random deletion support if the offending firmware is
found.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=6695

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
Cc: Patro, Sumant [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_mbox.c |   17 +
 drivers/scsi/megaraid/megaraid_mbox.h |1 +
 2 files changed, 18 insertions(+)

diff -puN 
drivers/scsi/megaraid/megaraid_mbox.c~dell-cerc-support-for-megaraid_mbox 
drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c~dell-cerc-support-for-megaraid_mbox
+++ a/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3168,6 +3168,23 @@ megaraid_mbox_support_random_del(adapter
uint8_t raw_mbox[sizeof(mbox_t)];
int rval;
 
+   /*
+* Newer firmware on Dell CERC expect a different
+* random deletion handling, so disable it.
+*/
+   if (adapter-pdev-vendor == PCI_VENDOR_ID_AMI 
+   adapter-pdev-device == PCI_DEVICE_ID_AMI_MEGARAID3 
+   adapter-pdev-subsystem_vendor == PCI_VENDOR_ID_DELL 
+   adapter-pdev-subsystem_device == PCI_SUBSYS_ID_CERC_ATA100_4CH 
+   (adapter-fw_version[0]  '6' ||
+(adapter-fw_version[0] == '6' 
+ adapter-fw_version[2]  '6') ||
+(adapter-fw_version[0] == '6'
+  adapter-fw_version[2] == '6'
+  adapter-fw_version[3]  '1'))) {
+   con_log(CL_DLEVEL1, (megaraid: disable random deletion\n));
+   return 0;
+   }
 
mbox = (mbox_t *)raw_mbox;
 
diff -puN 
drivers/scsi/megaraid/megaraid_mbox.h~dell-cerc-support-for-megaraid_mbox 
drivers/scsi/megaraid/megaraid_mbox.h
--- a/drivers/scsi/megaraid/megaraid_mbox.h~dell-cerc-support-for-megaraid_mbox
+++ a/drivers/scsi/megaraid/megaraid_mbox.h
@@ -88,6 +88,7 @@
 #define PCI_SUBSYS_ID_PERC3_QC 0x0471
 #define PCI_SUBSYS_ID_PERC3_DC 0x0493
 #define PCI_SUBSYS_ID_PERC3_SC 0x0475
+#define PCI_SUBSYS_ID_CERC_ATA100_4CH  0x0511
 
 
 #define MBOX_MAX_SCSI_CMDS 128 // number of cmds reserved for kernel
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 03/13] mptbase: reset ioc initiator during PCI resume

2008-02-04 Thread akpm
From: Darrick J. Wong [EMAIL PROTECTED]

It appears that the LSI SAS 1064E chip needs to be reset after a
suspend/resume cycle before the driver attempts further communications with
the chip.  Without this patch, resuming the chip results in this error
message being printed repeatedly and no more disk I/O.

mptbase: ioc0: ERROR - Invalid IOC facts reply, msgLength=0 offsetof=6!

So far it seems to fix suspend/resume on all the MPT Fusion cards I have
(SAS and U320 SCSI) but since I don't know the internals of that chip I
can't say for sure if this is a proper fix.

Signed-off-by: Darrick J. Wong [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.c |6 ++
 1 file changed, 6 insertions(+)

diff -puN 
drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume 
drivers/message/fusion/mptbase.c
--- 
a/drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume
+++ a/drivers/message/fusion/mptbase.c
@@ -1829,6 +1829,12 @@ mpt_resume(struct pci_dev *pdev)
(mpt_GetIocState(ioc, 1)  MPI_IOC_STATE_SHIFT),
CHIPREG_READ32(ioc-chip-Doorbell));
 
+   /* put ioc into READY_STATE */
+   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   printk(MYIOC_s_ERR_FMT
+   pci-resume:  IOC msg unit reset failed!\n, ioc-name);
+   }
+
/* bring ioc to operational state */
if ((recovery_state = mpt_do_ioc_recovery(ioc,
MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) {
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 05/13] MegaRAID driver management char device moved to misc

2008-02-04 Thread akpm
From: Thomas Horsten [EMAIL PROTECTED]

The MegaRAID driver's common management module (megaraid_mm.c) creates a
char device used by the management tool megarc from LSI Logic (and
possibly other management tools).

In 2.6 with udev, this device doesn't get created because it is not
registered in sysfs.

I first fixed this by registering a class megaraid_mm, but realized that
this should probably be moved to misc devices, instead of taking up a char
major.  This is because only 1 device is used, even if there are multiple
adapters - the minor is never used (the adapter info is in the ioctl block
sent to the driver, not detected based on the minor number as one might
think).  So it is a complete waste to have an entire major taken by this.

So it now uses a misc device which I named megadev0 (the name that megarc
expects), and has a dynamic minor (previoulsy a dynamic major was used).

I have tested this on my own system with the megarc tool, and it works just
as fine as before (only now the device gets created correctly by udev).

Cc: [EMAIL PROTECTED]
Cc: Neela Syam Kolli [EMAIL PROTECTED]
Cc: Ju, Seokmann [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_mm.c |   20 +---
 drivers/scsi/megaraid/megaraid_mm.h |1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff -puN 
drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
 drivers/scsi/megaraid/megaraid_mm.c
--- 
a/drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.c
@@ -59,7 +59,6 @@ EXPORT_SYMBOL(mraid_mm_register_adp);
 EXPORT_SYMBOL(mraid_mm_unregister_adp);
 EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
 
-static int majorno;
 static uint32_t drvr_ver   = 0x02200207;
 
 static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_
.owner  = THIS_MODULE,
 };
 
+static struct miscdevice megaraid_mm_dev = {
+   .minor  = MISC_DYNAMIC_MINOR,
+   .name   = megadev0,
+   .fops   = lsi_fops,
+};
+
 /**
  * mraid_mm_open - open routine for char node interface
  * @inode  : unused
@@ -1184,15 +1189,16 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_
 static int __init
 mraid_mm_init(void)
 {
+   int err;
+
// Announce the driver version
con_log(CL_ANN, (KERN_INFO megaraid cmm: %s %s\n,
LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION));
 
-   majorno = register_chrdev(0, megadev, lsi_fops);
-
-   if (majorno  0) {
-   con_log(CL_ANN, (megaraid cmm: cannot get major\n));
-   return majorno;
+   err = misc_register(megaraid_mm_dev);
+   if (err  0) {
+   con_log(CL_ANN, (megaraid cmm: cannot register misc 
device\n));
+   return err;
}
 
init_waitqueue_head(wait_q);
@@ -1230,7 +1236,7 @@ mraid_mm_exit(void)
 {
con_log(CL_DLEVEL1 , (exiting common mod\n));
 
-   unregister_chrdev(majorno, megadev);
+   misc_deregister(megaraid_mm_dev);
 }
 
 module_init(mraid_mm_init);
diff -puN 
drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
 drivers/scsi/megaraid/megaraid_mm.h
--- 
a/drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.h
@@ -22,6 +22,7 @@
 #include linux/moduleparam.h
 #include linux/pci.h
 #include linux/list.h
+#include linux/miscdevice.h
 
 #include mbox_defs.h
 #include megaraid_ioctl.h
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 08/13] sg: nopage

2008-02-04 Thread akpm
From: Nick Piggin [EMAIL PROTECTED]

Convert SG from nopage to fault.

Signed-off-by: Nick Piggin [EMAIL PROTECTED]
Cc: Douglas Gilbert [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sg.c |   23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff -puN drivers/scsi/sg.c~sg-nopage drivers/scsi/sg.c
--- a/drivers/scsi/sg.c~sg-nopage
+++ a/drivers/scsi/sg.c
@@ -1160,23 +1160,22 @@ sg_fasync(int fd, struct file *filp, int
return (retval  0) ? retval : 0;
 }
 
-static struct page *
-sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
+static int
+sg_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
Sg_fd *sfp;
-   struct page *page = NOPAGE_SIGBUS;
unsigned long offset, len, sa;
Sg_scatter_hold *rsv_schp;
struct scatterlist *sg;
int k;
 
if ((NULL == vma) || (!(sfp = (Sg_fd *) vma-vm_private_data)))
-   return page;
+   return VM_FAULT_SIGBUS;
rsv_schp = sfp-reserve;
-   offset = addr - vma-vm_start;
+   offset = vmf-pgoff  PAGE_SHIFT;
if (offset = rsv_schp-bufflen)
-   return page;
-   SCSI_LOG_TIMEOUT(3, printk(sg_vma_nopage: offset=%lu, scatg=%d\n,
+   return VM_FAULT_SIGBUS;
+   SCSI_LOG_TIMEOUT(3, printk(sg_vma_fault: offset=%lu, scatg=%d\n,
   offset, rsv_schp-k_use_sg));
sg = rsv_schp-buffer;
sa = vma-vm_start;
@@ -1185,21 +1184,21 @@ sg_vma_nopage(struct vm_area_struct *vma
len = vma-vm_end - sa;
len = (len  sg-length) ? len : sg-length;
if (offset  len) {
+   struct page *page;
page = virt_to_page(page_address(sg_page(sg)) + offset);
get_page(page); /* increment page count */
-   break;
+   vmf-page = page;
+   return 0; /* success */
}
sa += len;
offset -= len;
}
 
-   if (type)
-   *type = VM_FAULT_MINOR;
-   return page;
+   return VM_FAULT_SIGBUS;
 }
 
 static struct vm_operations_struct sg_mmap_vm_ops = {
-   .nopage = sg_vma_nopage,
+   .fault = sg_vma_fault,
 };
 
 static int
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 11/13] Small cleanups for scsi_host.h

2008-02-04 Thread akpm
From: Pavel Machek [EMAIL PROTECTED]

Small cleanups in scsi_host.h. Few #defines make me wonder if their
description is still up to date..?

Signed-off-by: Pavel Machek [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 include/scsi/scsi_host.h |   44 +
 1 file changed, 25 insertions(+), 19 deletions(-)

diff -puN include/scsi/scsi_host.h~small-cleanups-for-scsi_hosth 
include/scsi/scsi_host.h
--- a/include/scsi/scsi_host.h~small-cleanups-for-scsi_hosth
+++ a/include/scsi/scsi_host.h
@@ -280,39 +280,45 @@ struct scsi_host_template {
 * If the host wants to be called before the scan starts, but
 * after the midlayer has set up ready for the scan, it can fill
 * in this function.
+*
+* Status: OPTIONAL
 */
void (* scan_start)(struct Scsi_Host *);
 
/*
-* fill in this function to allow the queue depth of this host
-* to be changeable (on a per device basis).  returns either
+* Fill in this function to allow the queue depth of this host
+* to be changeable (on a per device basis).  Returns either
 * the current queue depth setting (may be different from what
 * was passed in) or an error.  An error should only be
 * returned if the requested depth is legal but the driver was
 * unable to set it.  If the requested depth is illegal, the
 * driver should set and return the closest legal queue depth.
 *
+* Status: OPTIONAL
 */
int (* change_queue_depth)(struct scsi_device *, int);
 
/*
-* fill in this function to allow the changing of tag types
+* Fill in this function to allow the changing of tag types
 * (this also allows the enabling/disabling of tag command
 * queueing).  An error should only be returned if something
 * went wrong in the driver while trying to set the tag type.
 * If the driver doesn't support the requested tag type, then
 * it should set the closest type it does support without
 * returning an error.  Returns the actual tag type set.
+*
+* Status: OPTIONAL
 */
int (* change_queue_type)(struct scsi_device *, int);
 
/*
-* This function determines the bios parameters for a given
+* This function determines the BIOS parameters for a given
 * harddisk.  These tend to be numbers that are made up by
 * the host adapter.  Parameters:
 * size, device, list (heads, sectors, cylinders)
 *
-* Status: OPTIONAL */
+* Status: OPTIONAL
+*/
int (* bios_param)(struct scsi_device *, struct block_device *,
sector_t, int []);
 
@@ -351,7 +357,7 @@ struct scsi_host_template {
 
/*
 * This determines if we will use a non-interrupt driven
-* or an interrupt driven scheme,  It is set to the maximum number
+* or an interrupt driven scheme.  It is set to the maximum number
 * of simultaneous commands a given host adapter will accept.
 */
int can_queue;
@@ -372,12 +378,12 @@ struct scsi_host_template {
unsigned short sg_tablesize;
 
/*
-* If the host adapter has limitations beside segment count
+* Set this if the host adapter has limitations beside segment count.
 */
unsigned short max_sectors;
 
/*
-* dma scatter gather segment boundary limit. a segment crossing this
+* DMA scatter gather segment boundary limit. A segment crossing this
 * boundary will be split in two.
 */
unsigned long dma_boundary;
@@ -386,7 +392,7 @@ struct scsi_host_template {
 * This specifies machine infinity for host templates which don't
 * limit the transfer size.  Note this limit represents an absolute
 * maximum, and may be over the transfer limits allowed for
-* individual devices (e.g. 256 for SCSI-1)
+* individual devices (e.g. 256 for SCSI-1).
 */
 #define SCSI_DEFAULT_MAX_SECTORS   1024
 
@@ -413,12 +419,12 @@ struct scsi_host_template {
unsigned supported_mode:2;
 
/*
-* true if this host adapter uses unchecked DMA onto an ISA bus.
+* True if this host adapter uses unchecked DMA onto an ISA bus.
 */
unsigned unchecked_isa_dma:1;
 
/*
-* true if this host adapter can make good use of clustering.
+* True if this host adapter can make good use of clustering.
 * I originally thought that if the tablesize was large that it
 * was a waste of CPU cycles to prepare a cluster list, but
 * it works out that the Buslogic is faster if you use a smaller
@@ -428,7 +434,7 @@ struct scsi_host_template {
unsigned use_clustering:1;
 
/*
-* True for emulated SCSI 

[patch 09/13] 3W RAID drivers: memset not needed in probe

2008-02-04 Thread akpm
From: Denis Cheng [EMAIL PROTECTED]

The memory return from scsi_host_alloc is alloced by kzalloc, which is
already zero initilized, so memset not needed.

Signed-off-by: Denis Cheng [EMAIL PROTECTED]
Cc: Adam Radford [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/3w-9xxx.c |2 --
 drivers/scsi/3w-.c |2 --
 2 files changed, 4 deletions(-)

diff -puN drivers/scsi/3w-9xxx.c~3w-raid-drivers-memset-not-needed-in-probe 
drivers/scsi/3w-9xxx.c
--- a/drivers/scsi/3w-9xxx.c~3w-raid-drivers-memset-not-needed-in-probe
+++ a/drivers/scsi/3w-9xxx.c
@@ -2028,8 +2028,6 @@ static int __devinit twa_probe(struct pc
}
tw_dev = (TW_Device_Extension *)host-hostdata;
 
-   memset(tw_dev, 0, sizeof(TW_Device_Extension));
-
/* Save values to device extension */
tw_dev-host = host;
tw_dev-tw_pci_dev = pdev;
diff -puN drivers/scsi/3w-.c~3w-raid-drivers-memset-not-needed-in-probe 
drivers/scsi/3w-.c
--- a/drivers/scsi/3w-.c~3w-raid-drivers-memset-not-needed-in-probe
+++ a/drivers/scsi/3w-.c
@@ -2294,8 +2294,6 @@ static int __devinit tw_probe(struct pci
}
tw_dev = (TW_Device_Extension *)host-hostdata;
 
-   memset(tw_dev, 0, sizeof(TW_Device_Extension));
-
/* Save values to device extension */
tw_dev-host = host;
tw_dev-tw_pci_dev = pdev;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 01/30] git-scsi-misc gdth fix

2007-12-13 Thread akpm
From: James Bottomley [EMAIL PROTECTED]

On Sun, 2007-10-14 at 12:21 -0700, Andrew Morton wrote:
 On Sun, 14 Oct 2007 22:45:47 +0400 Dave Milter [EMAIL PROTECTED] wrote:

  I build linux-2.6.23-mm1 and try to boot it using qemu,
  and it crashed with trace like this:
  do_page_fault
  error_code
  lock_acquire
  _spin_lock_irqsave
  gdth_timeout
  run_timer_softirq
  __do_softirq
  do_softirq
 
  I have screenshot, but have no idea, is it legal to include it, if I
  sent copy to lkml.
  config of kernel in attachment,
  I apply all three patches from hot-fixes.
 

 The screenshot is here:  http://userweb.kernel.org/~akpm/crash.png

 It would appear that gdth_timeout() is passing a bad pointer into
 spin_lock_irqsave().

There's a bug in the gdth rework in that the instance can be deleted
from the list before the actual timer is stopped.  This can be worked
around I think by the following patch; although we really should be
stopping the timer from firing when the list goes empty.


James said:

This is almost certainly the wrong fix for real hardware.  Although it
kills the timer when the list goes empty, nothing will ever restart it
when the list fills again.

Boaz, since you touched all of this, you get to fix it.  The correct fix
will be to control the timer along with the actual list instead of at
entry/exit time.  If you're not going to add this empty check to the
timer routine, make sure you use del_timer_sync() before removing the
last element from the list.


Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |3 +++
 1 file changed, 3 insertions(+)

diff -puN drivers/scsi/gdth.c~git-scsi-misc-gdth-fix drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~git-scsi-misc-gdth-fix
+++ a/drivers/scsi/gdth.c
@@ -3793,6 +3793,9 @@ static void gdth_timeout(ulong data)
 gdth_ha_str *ha;
 ulong flags;
 
+if (list_empty(gdth_instances))
+   return;
+
 ha = list_first_entry(gdth_instances, gdth_ha_str, list);
 spin_lock_irqsave(ha-smp_lock, flags);
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 04/30] kill warnings in mptbase.h on parisc64

2007-12-13 Thread akpm
From: Kyle McMartin [EMAIL PROTECTED]

Verified all the arches necessary select the CONFIG_64BIT symbol.  This
also kills the warning (since it was using the 32-bit case) on parisc64 and
mips64.

Signed-off-by: Kyle McMartin [EMAIL PROTECTED]
Cc: Moore, Eric Dean [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/message/fusion/mptbase.h~kill-warnings-in-mptbaseh-on-parisc64 
drivers/message/fusion/mptbase.h
--- a/drivers/message/fusion/mptbase.h~kill-warnings-in-mptbaseh-on-parisc64
+++ a/drivers/message/fusion/mptbase.h
@@ -922,7 +922,7 @@ extern struct proc_dir_entry*mpt_proc_r
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 #endif /* } __KERNEL__ */
 
-#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || 
defined(__x86_64__) || defined(__powerpc__)
+#ifdef CONFIG_64BIT
 #define CAST_U32_TO_PTR(x) ((void *)(u64)x)
 #define CAST_PTR_TO_U32(x) ((u32)(u64)x)
 #else
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 02/30] mptbase: reset ioc initiator during PCI resume

2007-12-13 Thread akpm
From: Darrick J. Wong [EMAIL PROTECTED]

It appears that the LSI SAS 1064E chip needs to be reset after a
suspend/resume cycle before the driver attempts further communications with
the chip.  Without this patch, resuming the chip results in this error
message being printed repeatedly and no more disk I/O.

mptbase: ioc0: ERROR - Invalid IOC facts reply, msgLength=0 offsetof=6!

So far it seems to fix suspend/resume on all the MPT Fusion cards I have
(SAS and U320 SCSI) but since I don't know the internals of that chip I
can't say for sure if this is a proper fix.

Signed-off-by: Darrick J. Wong [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.c |6 ++
 1 file changed, 6 insertions(+)

diff -puN 
drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume 
drivers/message/fusion/mptbase.c
--- 
a/drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume
+++ a/drivers/message/fusion/mptbase.c
@@ -1829,6 +1829,12 @@ mpt_resume(struct pci_dev *pdev)
(mpt_GetIocState(ioc, 1)  MPI_IOC_STATE_SHIFT),
CHIPREG_READ32(ioc-chip-Doorbell));
 
+   /* put ioc into READY_STATE */
+   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   printk(MYIOC_s_ERR_FMT
+   pci-resume:  IOC msg unit reset failed!\n, ioc-name);
+   }
+
/* bring ioc to operational state */
if ((recovery_state = mpt_do_ioc_recovery(ioc,
MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) {
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 03/30] initio: fix conflict when loading driver

2007-12-13 Thread akpm
From: Alan Cox [EMAIL PROTECTED]

 I have a scanner connected to a Initio INI-950 SCSI card and I recently
 upgraded from SuSE 10.2 to 10.3.  The new kernel doesn't see any of my
 devices.  I get the following in /var/log/messages:

 ACPI: PCI Interrupt :00:0a.0[A] - GSI 17 (level, low) - IRQ 16
 initio: I/O port range 0x0 is busy.
 ACPI: PCI interrupt for device :00:0a.0 disabled

Humm not a collision - thats a bug in the driver updating.  Looks like the
changes I made and combined with Christoph's lost a line somewhere when I
was merging it all.  Try the following

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Cc: Scott Simpson [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/initio.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/scsi/initio.c~initio-fix-conflict-when-loading-driver 
drivers/scsi/initio.c
--- a/drivers/scsi/initio.c~initio-fix-conflict-when-loading-driver
+++ a/drivers/scsi/initio.c
@@ -2867,6 +2867,7 @@ static int initio_probe_one(struct pci_d
}
host = (struct initio_host *)shost-hostdata;
memset(host, 0, sizeof(struct initio_host));
+   host-addr = pci_resource_start(pdev, 0);
 
if (!request_region(host-addr, 256, i91u)) {
printk(KERN_WARNING initio: I/O port range 0x%x is busy.\n, 
host-addr);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 14/30] aic94: fix section mismatches

2007-12-13 Thread akpm
From: Randy Dunlap [EMAIL PROTECTED]

Fix section mismatch warning:

WARNING: vmlinux.o(.init.text+0x23be6): Section mismatch: reference to 
.exit.text:asd_unmap_ha (between 'asd_pci_probe' and 'qla4xxx_module_init')
+
WARNING: vmlinux.o(.text+0x1ec8a8): Section mismatch: reference to .exit.text:as
d_unmap_ioport (between 'asd_unmap_ha' and 'asd_remove_dev_attrs')
WARNING: vmlinux.o(.text+0x1ec8b1): Section mismatch: reference to .exit.text:as
d_unmap_memio (between 'asd_unmap_ha' and 'asd_remove_dev_attrs')

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aic94xx/aic94xx_init.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/aic94xx/aic94xx_init.c~aic94-fix-section-mismatches 
drivers/scsi/aic94xx/aic94xx_init.c
--- a/drivers/scsi/aic94xx/aic94xx_init.c~aic94-fix-section-mismatches
+++ a/drivers/scsi/aic94xx/aic94xx_init.c
@@ -136,7 +136,7 @@ Err:
return err;
 }
 
-static void __devexit asd_unmap_memio(struct asd_ha_struct *asd_ha)
+static void asd_unmap_memio(struct asd_ha_struct *asd_ha)
 {
struct asd_ha_addrspace *io_handle;
 
@@ -173,7 +173,7 @@ static int __devinit asd_map_ioport(stru
return err;
 }
 
-static void __devexit asd_unmap_ioport(struct asd_ha_struct *asd_ha)
+static void asd_unmap_ioport(struct asd_ha_struct *asd_ha)
 {
pci_release_region(asd_ha-pcidev, PCI_IOBAR_OFFSET);
 }
@@ -210,7 +210,7 @@ Err:
return err;
 }
 
-static void __devexit asd_unmap_ha(struct asd_ha_struct *asd_ha)
+static void asd_unmap_ha(struct asd_ha_struct *asd_ha)
 {
if (asd_ha-iospace)
asd_unmap_ioport(asd_ha);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 07/30] ips: PCI API cleanups

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

* pass Scsi_Host to ips_remove_device() via pci_set_drvdata(),
  allowing us to eliminate the ips_ha[] search loop and call
  ips_release() directly.

* call pci_{request,release}_regions() and eliminate individual
  request/release_[mem_]region() calls

* call pci_disable_device(), paired with pci_enable_device()

* s/0/NULL/ in a few places

* check ioremap() return value

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |   72 ++-
 1 file changed, 31 insertions(+), 41 deletions(-)

diff -puN drivers/scsi/ips.c~ips-pci-api-cleanups drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~ips-pci-api-cleanups
+++ a/drivers/scsi/ips.c
@@ -702,10 +702,6 @@ ips_release(struct Scsi_Host *sh)
/* free extra memory */
ips_free(ha);
 
-   /* Free I/O Region */
-   if (ha-io_addr)
-   release_region(ha-io_addr, ha-io_len);
-
/* free IRQ */
free_irq(ha-pcidev-irq, ha);
 
@@ -4394,8 +4390,6 @@ ips_free(ips_ha_t * ha)
ha-mem_ptr = NULL;
}
 
-   if (ha-mem_addr)
-   release_mem_region(ha-mem_addr, ha-mem_len);
ha-mem_addr = 0;
 
}
@@ -6880,20 +6874,14 @@ ips_register_scsi(int index)
 static void __devexit
 ips_remove_device(struct pci_dev *pci_dev)
 {
-   int i;
-   struct Scsi_Host *sh;
-   ips_ha_t *ha;
+   struct Scsi_Host *sh = pci_get_drvdata(pci_dev);
 
-   for (i = 0; i  IPS_MAX_ADAPTERS; i++) {
-   ha = ips_ha[i];
-   if (ha) {
-   if ((pci_dev-bus-number == ha-pcidev-bus-number) 
-   (pci_dev-devfn == ha-pcidev-devfn)) {
-   sh = ips_sh[i];
-   ips_release(sh);
-   }
-   }
-   }
+   pci_set_drvdata(pci_dev, NULL);
+
+   ips_release(sh);
+
+   pci_release_regions(pci_dev);
+   pci_disable_device(pci_dev);
 }
 
 //
@@ -6947,12 +6935,17 @@ module_exit(ips_module_exit);
 static int __devinit
 ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent)
 {
-   int uninitialized_var(index);
+   int index = -1;
int rc;
 
METHOD_TRACE(ips_insert_device, 1);
-   if (pci_enable_device(pci_dev))
-   return -1;
+   rc = pci_enable_device(pci_dev);
+   if (rc)
+   return rc;
+
+   rc = pci_request_regions(pci_dev, ips);
+   if (rc)
+   goto err_out;
 
rc = ips_init_phase1(pci_dev, index);
if (rc == SUCCESS)
@@ -6968,6 +6961,19 @@ ips_insert_device(struct pci_dev *pci_de
ips_num_controllers++;
 
ips_next_controller = ips_num_controllers;
+
+   if (rc  0) {
+   rc = -ENODEV;
+   goto err_out_regions;
+   }
+
+   pci_set_drvdata(pci_dev, ips_sh[index]);
+   return 0;
+
+err_out_regions:
+   pci_release_regions(pci_dev);
+err_out:
+   pci_disable_device(pci_dev);
return rc;
 }
 
@@ -7000,7 +7006,7 @@ ips_init_phase1(struct pci_dev *pci_dev,
METHOD_TRACE(ips_init_phase1, 1);
index = IPS_MAX_ADAPTERS;
for (j = 0; j  IPS_MAX_ADAPTERS; j++) {
-   if (ips_ha[j] == 0) {
+   if (ips_ha[j] == NULL) {
index = j;
break;
}
@@ -7037,32 +7043,17 @@ ips_init_phase1(struct pci_dev *pci_dev,
uint32_t base;
uint32_t offs;
 
-   if (!request_mem_region(mem_addr, mem_len, ips)) {
-   IPS_PRINTK(KERN_WARNING, pci_dev,
-  Couldn't allocate IO Memory space %x len 
%d.\n,
-  mem_addr, mem_len);
-   return -1;
-   }
-
base = mem_addr  PAGE_MASK;
offs = mem_addr - base;
ioremap_ptr = ioremap(base, PAGE_SIZE);
+   if (!ioremap_ptr)
+   return -1;
mem_ptr = ioremap_ptr + offs;
} else {
ioremap_ptr = NULL;
mem_ptr = NULL;
}
 
-   /* setup I/O mapped area (if applicable) */
-   if (io_addr) {
-   if (!request_region(io_addr, io_len, ips)) {
-   IPS_PRINTK(KERN_WARNING, pci_dev,
-  Couldn't allocate IO space %x len %d.\n,
-  io_addr, io_len);
-   return -1;
-   }
-   }
-
/* found a controller */
ha = kzalloc(sizeof (ips_ha_t), GFP_KERNEL);
if (ha == NULL) {
@@ -7071,7 +7062,6 @@ 

[patch 09/30] MegaRAID driver management char device moved to misc

2007-12-13 Thread akpm
From: Thomas Horsten [EMAIL PROTECTED]

The MegaRAID driver's common management module (megaraid_mm.c) creates a
char device used by the management tool megarc from LSI Logic (and
possibly other management tools).

In 2.6 with udev, this device doesn't get created because it is not
registered in sysfs.

I first fixed this by registering a class megaraid_mm, but realized that
this should probably be moved to misc devices, instead of taking up a char
major.  This is because only 1 device is used, even if there are multiple
adapters - the minor is never used (the adapter info is in the ioctl block
sent to the driver, not detected based on the minor number as one might
think).  So it is a complete waste to have an entire major taken by this.

So it now uses a misc device which I named megadev0 (the name that megarc
expects), and has a dynamic minor (previoulsy a dynamic major was used).

I have tested this on my own system with the megarc tool, and it works just
as fine as before (only now the device gets created correctly by udev).

Cc: [EMAIL PROTECTED]
Cc: Neela Syam Kolli [EMAIL PROTECTED]
Cc: Ju, Seokmann [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_mm.c |   20 +---
 drivers/scsi/megaraid/megaraid_mm.h |1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff -puN 
drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
 drivers/scsi/megaraid/megaraid_mm.c
--- 
a/drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.c
@@ -59,7 +59,6 @@ EXPORT_SYMBOL(mraid_mm_register_adp);
 EXPORT_SYMBOL(mraid_mm_unregister_adp);
 EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
 
-static int majorno;
 static uint32_t drvr_ver   = 0x02200207;
 
 static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_
.owner  = THIS_MODULE,
 };
 
+static struct miscdevice megaraid_mm_dev = {
+   .minor  = MISC_DYNAMIC_MINOR,
+   .name   = megadev0,
+   .fops   = lsi_fops,
+};
+
 /**
  * mraid_mm_open - open routine for char node interface
  * @inode  : unused
@@ -1184,15 +1189,16 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_
 static int __init
 mraid_mm_init(void)
 {
+   int err;
+
// Announce the driver version
con_log(CL_ANN, (KERN_INFO megaraid cmm: %s %s\n,
LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION));
 
-   majorno = register_chrdev(0, megadev, lsi_fops);
-
-   if (majorno  0) {
-   con_log(CL_ANN, (megaraid cmm: cannot get major\n));
-   return majorno;
+   err = misc_register(megaraid_mm_dev);
+   if (err  0) {
+   con_log(CL_ANN, (megaraid cmm: cannot register misc 
device\n));
+   return err;
}
 
init_waitqueue_head(wait_q);
@@ -1230,7 +1236,7 @@ mraid_mm_exit(void)
 {
con_log(CL_DLEVEL1 , (exiting common mod\n));
 
-   unregister_chrdev(majorno, megadev);
+   misc_deregister(megaraid_mm_dev);
 }
 
 module_init(mraid_mm_init);
diff -puN 
drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
 drivers/scsi/megaraid/megaraid_mm.h
--- 
a/drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.h
@@ -22,6 +22,7 @@
 #include linux/moduleparam.h
 #include linux/pci.h
 #include linux/list.h
+#include linux/miscdevice.h
 
 #include mbox_defs.h
 #include megaraid_ioctl.h
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 13/30] advansys: fix section mismatch warning

2007-12-13 Thread akpm
From: Randy Dunlap [EMAIL PROTECTED]

Fix section mismatch warning:

WARNING: vmlinux.o(.exit.text+0x152a): Section mismatch: reference to 
.init.data:_asc_def_iop_base (between 'advansys_isa_remove' and 'advansys_exit')

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/advansys.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/advansys.c~advansys-fix-section-mismatch-warning 
drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c~advansys-fix-section-mismatch-warning
+++ a/drivers/scsi/advansys.c
@@ -13906,7 +13906,7 @@ static int advansys_release(struct Scsi_
 
 #define ASC_IOADR_TABLE_MAX_IX  11
 
-static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = {
+static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
0x0210, 0x0230, 0x0250, 0x0330
 };
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 12/30] SCSI/NCR5380: minor irq handler cleanups

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

* remove unnecessary cast

* remove unnecessary use of 'irq' function arg

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/NCR5380.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/NCR5380.c~scsi-ncr5380-minor-irq-handler-cleanups 
drivers/scsi/NCR5380.c
--- a/drivers/scsi/NCR5380.c~scsi-ncr5380-minor-irq-handler-cleanups
+++ a/drivers/scsi/NCR5380.c
@@ -1157,16 +1157,17 @@ static void NCR5380_main(struct work_str
  * Locks: takes the needed instance locks
  */
 
-static irqreturn_t NCR5380_intr(int irq, void *dev_id) 
+static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
 {
NCR5380_local_declare();
-   struct Scsi_Host *instance = (struct Scsi_Host *)dev_id;
+   struct Scsi_Host *instance = dev_id;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) 
instance-hostdata;
int done;
unsigned char basr;
unsigned long flags;
 
-   dprintk(NDEBUG_INTR, (scsi : NCR5380 irq %d triggered\n, irq));
+   dprintk(NDEBUG_INTR, (scsi : NCR5380 irq %d triggered\n,
+   instance-irq));
 
do {
done = 1;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 11/30] SCSI/sym53c416: kill pointless irq handler loop and test

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

- kill pointless irq handler loop to find base address, it is already
  passed to irq handler via Scsi_Host.

- kill now-pointless !base test.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c416.c |   16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff -puN 
drivers/scsi/sym53c416.c~scsi-sym53c416-kill-pointless-irq-handler-loop-and-test
 drivers/scsi/sym53c416.c
--- 
a/drivers/scsi/sym53c416.c~scsi-sym53c416-kill-pointless-irq-handler-loop-and-test
+++ a/drivers/scsi/sym53c416.c
@@ -328,27 +328,13 @@ static __inline__ unsigned int sym53c416
 static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id)
 {
struct Scsi_Host *dev = dev_id;
-   int base = 0;
+   int base = dev-io_port;
int i;
unsigned long flags = 0;
unsigned char status_reg, pio_int_reg, int_reg;
struct scatterlist *sg;
unsigned int tot_trans = 0;
 
-   /* We search the base address of the host adapter which caused the 
interrupt */
-   /* FIXME: should pass dev_id sensibly as hosts[i] */
-   for(i = 0; i  host_index  !base; i++)
-   if(irq == hosts[i].irq)
-   base = hosts[i].base;
-   /* If no adapter found, we cannot handle the interrupt. Leave a message 
*/
-   /* and continue. This should never happen...
*/
-   if(!base)
-   {
-   printk(KERN_ERR sym53c416: No host adapter defined for 
interrupt %d\n, irq);
-   return IRQ_NONE;
-   }
-   /* Now we have the base address and we can start handling the interrupt 
*/
-
spin_lock_irqsave(dev-host_lock,flags);
status_reg = inb(base + STATUS_REG);
pio_int_reg = inb(base + PIO_INT_REG);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 15/30] sym2: fix section mismatch warning

2007-12-13 Thread akpm
From: Randy Dunlap [EMAIL PROTECTED]

Fix section mismatch warning:

WARNING: vmlinux.o(.text+0x1ff3a2): Section mismatch: reference to 
.exit.text:sym2_remove (between 'sym2_io_error_detected' and 'sym_xpt_done')

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/sym53c8xx_2/sym_glue.c~sym2-fix-section-mismatch-warning 
drivers/scsi/sym53c8xx_2/sym_glue.c
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c~sym2-fix-section-mismatch-warning
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1744,7 +1744,7 @@ static int __devinit sym2_probe(struct p
return -ENODEV;
 }
 
-static void __devexit sym2_remove(struct pci_dev *pdev)
+static void sym2_remove(struct pci_dev *pdev)
 {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
 
@@ -2056,7 +2056,7 @@ static struct pci_driver sym2_driver = {
.name   = NAME53C8XX,
.id_table   = sym2_id_table,
.probe  = sym2_probe,
-   .remove = __devexit_p(sym2_remove),
+   .remove = sym2_remove,
.err_handler= sym2_err_handler,
 };
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 10/30] SCSI/gdth: kill unneeded 'irq' argument

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Neither gdth_get_status() nor __gdth_interrupt() need their 'irq' argument,
so remove it.

[EMAIL PROTECTED]: coding style fixes]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Acked-by: Boaz Harrosh [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff -puN drivers/scsi/gdth.c~scsi-gdth-kill-unneeded-irq-argument 
drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~scsi-gdth-kill-unneeded-irq-argument
+++ a/drivers/scsi/gdth.c
@@ -141,7 +141,7 @@
 static void gdth_delay(int milliseconds);
 static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int 
*secs);
 static irqreturn_t gdth_interrupt(int irq, void *dev_id);
-static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq,
+static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
 int gdth_from_wait, int* pIndex);
 static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
Scsi_Cmnd *scp);
@@ -165,7 +165,6 @@ static int gdth_internal_cache_cmd(gdth_
 static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
 
 static void gdth_enable_int(gdth_ha_str *ha);
-static unchar gdth_get_status(gdth_ha_str *ha, int irq);
 static int gdth_test_busy(gdth_ha_str *ha);
 static int gdth_get_cmd_index(gdth_ha_str *ha);
 static void gdth_release_event(gdth_ha_str *ha);
@@ -1334,14 +1333,12 @@ static void __init gdth_enable_int(gdth_
 }
 
 /* return IStatus if interrupt was from this card else 0 */
-static unchar gdth_get_status(gdth_ha_str *ha, int irq)
+static unchar gdth_get_status(gdth_ha_str *ha)
 {
 unchar IStatus = 0;
 
-TRACE((gdth_get_status() irq %d ctr_count %d\n, irq, gdth_ctr_count));
+TRACE((gdth_get_status() irq %d ctr_count %d\n, ha-irq, 
gdth_ctr_count));
 
-if (ha-irq != (unchar)irq) /* check IRQ */
-return false;
 if (ha-type == GDT_EISA)
 IStatus = inb((ushort)ha-bmic + EDOORREG);
 else if (ha-type == GDT_ISA)
@@ -1523,7 +1520,7 @@ static int gdth_wait(gdth_ha_str *ha, in
 return 1;   /* no wait required */
 
 do {
-__gdth_interrupt(ha, (int)ha-irq, true, wait_index);
+   __gdth_interrupt(ha, true, wait_index);
 if (wait_index == index) {
 answer_found = TRUE;
 break;
@@ -3036,7 +3033,7 @@ static void gdth_clear_events(void)
 
 /* SCSI interface functions */
 
-static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq,
+static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
 int gdth_from_wait, int* pIndex)
 {
 gdt6m_dpram_str __iomem *dp6m_ptr = NULL;
@@ -3054,7 +3051,7 @@ static irqreturn_t __gdth_interrupt(gdth
 int act_int_coal = 0;   
 #endif
 
-TRACE((gdth_interrupt() IRQ %d\n,irq));
+TRACE((gdth_interrupt() IRQ %d\n, ha-irq));
 
 /* if polling and not from gdth_wait() - return */
 if (gdth_polling) {
@@ -3067,7 +3064,8 @@ static irqreturn_t __gdth_interrupt(gdth
 spin_lock_irqsave(ha-smp_lock, flags);
 
 /* search controller */
-if (0 == (IStatus = gdth_get_status(ha, irq))) {
+IStatus = gdth_get_status(ha);
+if (IStatus == 0) {
 /* spurious interrupt */
 if (!gdth_polling)
 spin_unlock_irqrestore(ha-smp_lock, flags);
@@ -3294,9 +3292,9 @@ static irqreturn_t __gdth_interrupt(gdth
 
 static irqreturn_t gdth_interrupt(int irq, void *dev_id)
 {
-   gdth_ha_str *ha = (gdth_ha_str *)dev_id;
+   gdth_ha_str *ha = dev_id;
 
-   return __gdth_interrupt(ha, irq, false, NULL);
+   return __gdth_interrupt(ha, false, NULL);
 }
 
 static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 06/30] ips: trim trailing whitespace

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

[EMAIL PROTECTED]: coding style fixes]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |   49 +--
 drivers/scsi/ips.h |   12 +-
 2 files changed, 31 insertions(+), 30 deletions(-)

diff -puN drivers/scsi/ips.c~ips-trim-trailing-whitespace drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~ips-trim-trailing-whitespace
+++ a/drivers/scsi/ips.c
@@ -389,17 +389,17 @@ static struct  pci_device_id  ips_pci_ta
 MODULE_DEVICE_TABLE( pci, ips_pci_table );
 
 static char ips_hot_plug_name[] = ips;
-   
+
 static int __devinit  ips_insert_device(struct pci_dev *pci_dev, const struct 
pci_device_id *ent);
 static void __devexit ips_remove_device(struct pci_dev *pci_dev);
-   
+
 static struct pci_driver ips_pci_driver = {
.name   = ips_hot_plug_name,
.id_table   = ips_pci_table,
.probe  = ips_insert_device,
.remove = __devexit_p(ips_remove_device),
 };
-   
+
 
 /*
  * Necessary forward function protoypes
@@ -587,7 +587,7 @@ static void
 ips_setup_funclist(ips_ha_t * ha)
 {
 
-   /*
+   /*
 * Setup Functions
 */
if (IPS_IS_MORPHEUS(ha) || IPS_IS_MARCO(ha)) {
@@ -2081,7 +2081,7 @@ ips_host_info(ips_ha_t * ha, char *ptr, 
 /* That keeps everything happy for text operations on the proc file. 
   */
 
if (le32_to_cpu(ha-nvram-signature) == IPS_NVRAM_P5_SIG) {
-if (ha-nvram-bios_low[3] == 0) { 
+   if (ha-nvram-bios_low[3] == 0) {
 copy_info(info,
  \tBIOS Version  : 
%c%c%c%c%c%c%c\n,
  ha-nvram-bios_high[0], 
ha-nvram-bios_high[1],
@@ -2780,10 +2780,11 @@ ips_next(ips_ha_t * ha, int intr)
scb-dcdb.cmd_attribute =
ips_command_direction[scb-scsi_cmd-cmnd[0]];
 
-/* Allow a WRITE BUFFER Command to Have no Data */
-/* This is Used by Tape Flash Utilites  */
-if ((scb-scsi_cmd-cmnd[0] == WRITE_BUFFER)  (scb-data_len == 0)) 
-scb-dcdb.cmd_attribute = 0;  
+   /* Allow a WRITE BUFFER Command to Have no Data */
+   /* This is Used by Tape Flash Utilites  */
+   if ((scb-scsi_cmd-cmnd[0] == WRITE_BUFFER) 
+   (scb-data_len == 0))
+   scb-dcdb.cmd_attribute = 0;
 
if (!(scb-dcdb.cmd_attribute  0x3))
scb-dcdb.transfer_length = 0;
@@ -3404,7 +3405,7 @@ ips_map_status(ips_ha_t * ha, ips_scb_t 
 
/* Restrict access to physical DASD */
if (scb-scsi_cmd-cmnd[0] == INQUIRY) {
-   ips_scmd_buf_read(scb-scsi_cmd, 
+   ips_scmd_buf_read(scb-scsi_cmd,
   inquiryData, sizeof (inquiryData));
if ((inquiryData.DeviceType  0x1f) == 
TYPE_DISK) {
errcode = DID_TIME_OUT;
@@ -4090,10 +4091,10 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS 
scb-scsi_cmd-result = errcode  16;
} else {/* bus == 0 */
/* restrict access to physical drives */
-   if (scb-scsi_cmd-cmnd[0] == INQUIRY) { 
-   ips_scmd_buf_read(scb-scsi_cmd, 
+   if (scb-scsi_cmd-cmnd[0] == INQUIRY) {
+   ips_scmd_buf_read(scb-scsi_cmd,
   inquiryData, sizeof (inquiryData));
-   if ((inquiryData.DeviceType  0x1f) == TYPE_DISK) 
+   if ((inquiryData.DeviceType  0x1f) == TYPE_DISK)
scb-scsi_cmd-result = DID_TIME_OUT  16;
}
}   /* else */
@@ -4661,8 +4662,8 @@ ips_isinit_morpheus(ips_ha_t * ha)
uint32_t bits;
 
METHOD_TRACE(ips_is_init_morpheus, 1);
-   
-   if (ips_isintr_morpheus(ha)) 
+
+   if (ips_isintr_morpheus(ha))
ips_flush_and_reset(ha);
 
post = readl(ha-mem_ptr + IPS_REG_I960_MSG0);
@@ -4686,7 +4687,7 @@ ips_isinit_morpheus(ips_ha_t * ha)
 /*   state ( was trying to INIT and an interrupt was already pending ) ...  */
 /*  */
 //
-static void 
+static void
 ips_flush_and_reset(ips_ha_t *ha)
 {
ips_scb_t *scb;
@@ -4718,9 +4719,9 @@ ips_flush_and_reset(ips_ha_t *ha)
if (ret == IPS_SUCCESS) {
time = 60 * 

[patch 08/30] ips: handle scsi_add_host() failure, and other err cleanups

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |   18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff -puN 
drivers/scsi/ips.c~ips-handle-scsi_add_host-failure-and-other-err-cleanups 
drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~ips-handle-scsi_add_host-failure-and-other-err-cleanups
+++ a/drivers/scsi/ips.c
@@ -6837,13 +6837,10 @@ ips_register_scsi(int index)
if (request_irq(ha-pcidev-irq, do_ipsintr, IRQF_SHARED, ips_name, 
ha)) {
IPS_PRINTK(KERN_WARNING, ha-pcidev,
   Unable to install interrupt handler\n);
-   scsi_host_put(sh);
-   return -1;
+   goto err_out_sh;
}
 
kfree(oldha);
-   ips_sh[index] = sh;
-   ips_ha[index] = ha;
 
/* Store away needed values for later use */
sh-unique_id = (ha-io_addr) ? ha-io_addr : ha-mem_addr;
@@ -6859,10 +6856,21 @@ ips_register_scsi(int index)
sh-max_channel = ha-nbus - 1;
sh-can_queue = ha-max_cmds - 1;
 
-   scsi_add_host(sh, NULL);
+   if (scsi_add_host(sh, ha-pcidev-dev))
+   goto err_out;
+
+   ips_sh[index] = sh;
+   ips_ha[index] = ha;
+
scsi_scan_host(sh);
 
return 0;
+
+err_out:
+   free_irq(ha-pcidev-irq, ha);
+err_out_sh:
+   scsi_host_put(sh);
+   return -1;
 }
 
 /*---*/
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 05/30] ips: remove ips_ha members that duplicate struct pci_dev members

2007-12-13 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |  178 ---
 drivers/scsi/ips.h |   20 +---
 2 files changed, 91 insertions(+), 107 deletions(-)

diff -puN 
drivers/scsi/ips.c~ips-remove-ips_ha-members-that-duplicate-struct-pci_dev-members
 drivers/scsi/ips.c
--- 
a/drivers/scsi/ips.c~ips-remove-ips_ha-members-that-duplicate-struct-pci_dev-members
+++ a/drivers/scsi/ips.c
@@ -707,7 +707,7 @@ ips_release(struct Scsi_Host *sh)
release_region(ha-io_addr, ha-io_len);
 
/* free IRQ */
-   free_irq(ha-irq, ha);
+   free_irq(ha-pcidev-irq, ha);
 
scsi_host_put(sh);
 
@@ -1637,7 +1637,7 @@ ips_make_passthru(ips_ha_t *ha, struct s
return (IPS_FAILURE);
}
 
-   if (ha-device_id == IPS_DEVICEID_COPPERHEAD 
+   if (ha-pcidev-device == IPS_DEVICEID_COPPERHEAD 
pt-CoppCP.cmd.flashfw.op_code ==
IPS_CMD_RW_BIOSFW) {
ret = ips_flash_copperhead(ha, pt, scb);
@@ -2021,7 +2021,7 @@ ips_cleanup_passthru(ips_ha_t * ha, ips_
pt-ExtendedStatus = scb-extended_status;
pt-AdapterType = ha-ad_type;
 
-   if (ha-device_id == IPS_DEVICEID_COPPERHEAD 
+   if (ha-pcidev-device == IPS_DEVICEID_COPPERHEAD 
(scb-cmd.flashfw.op_code == IPS_CMD_DOWNLOAD ||
 scb-cmd.flashfw.op_code == IPS_CMD_RW_BIOSFW))
ips_free_flash_copperhead(ha);
@@ -2075,7 +2075,7 @@ ips_host_info(ips_ha_t * ha, char *ptr, 
  ha-mem_ptr);
}
 
-   copy_info(info, \tIRQ number: %d\n, ha-irq);
+   copy_info(info, \tIRQ number: %d\n, 
ha-pcidev-irq);
 
 /* For the Next 3 lines Check for Binary 0 at the end and don't include it 
if it's there. */
 /* That keeps everything happy for text operations on the proc file. 
   */
@@ -2232,31 +2232,31 @@ ips_identify_controller(ips_ha_t * ha)
 {
METHOD_TRACE(ips_identify_controller, 1);
 
-   switch (ha-device_id) {
+   switch (ha-pcidev-device) {
case IPS_DEVICEID_COPPERHEAD:
-   if (ha-revision_id = IPS_REVID_SERVERAID) {
+   if (ha-pcidev-revision = IPS_REVID_SERVERAID) {
ha-ad_type = IPS_ADTYPE_SERVERAID;
-   } else if (ha-revision_id == IPS_REVID_SERVERAID2) {
+   } else if (ha-pcidev-revision == IPS_REVID_SERVERAID2) {
ha-ad_type = IPS_ADTYPE_SERVERAID2;
-   } else if (ha-revision_id == IPS_REVID_NAVAJO) {
+   } else if (ha-pcidev-revision == IPS_REVID_NAVAJO) {
ha-ad_type = IPS_ADTYPE_NAVAJO;
-   } else if ((ha-revision_id == IPS_REVID_SERVERAID2)
+   } else if ((ha-pcidev-revision == IPS_REVID_SERVERAID2)
(ha-slot_num == 0)) {
ha-ad_type = IPS_ADTYPE_KIOWA;
-   } else if ((ha-revision_id = IPS_REVID_CLARINETP1) 
-  (ha-revision_id = IPS_REVID_CLARINETP3)) {
+   } else if ((ha-pcidev-revision = IPS_REVID_CLARINETP1) 
+  (ha-pcidev-revision = IPS_REVID_CLARINETP3)) {
if (ha-enq-ucMaxPhysicalDevices == 15)
ha-ad_type = IPS_ADTYPE_SERVERAID3L;
else
ha-ad_type = IPS_ADTYPE_SERVERAID3;
-   } else if ((ha-revision_id = IPS_REVID_TROMBONE32) 
-  (ha-revision_id = IPS_REVID_TROMBONE64)) {
+   } else if ((ha-pcidev-revision = IPS_REVID_TROMBONE32) 
+  (ha-pcidev-revision = IPS_REVID_TROMBONE64)) {
ha-ad_type = IPS_ADTYPE_SERVERAID4H;
}
break;
 
case IPS_DEVICEID_MORPHEUS:
-   switch (ha-subdevice_id) {
+   switch (ha-pcidev-subsystem_device) {
case IPS_SUBDEVICEID_4L:
ha-ad_type = IPS_ADTYPE_SERVERAID4L;
break;
@@ -2285,7 +2285,7 @@ ips_identify_controller(ips_ha_t * ha)
break;
 
case IPS_DEVICEID_MARCO:
-   switch (ha-subdevice_id) {
+   switch (ha-pcidev-subsystem_device) {
case IPS_SUBDEVICEID_6M:
ha-ad_type = IPS_ADTYPE_SERVERAID6M;
break;
@@ -2332,20 +2332,20 @@ ips_get_bios_version(ips_ha_t * ha, int 
 
strncpy(ha-bios_version,?, 8);
 
-   if (ha-device_id == IPS_DEVICEID_COPPERHEAD) {
+   if (ha-pcidev-device == IPS_DEVICEID_COPPERHEAD) {
 

[patch 20/30] drivers/scsi/sgiwd93.c: export sgiwd93_reset()

2007-12-13 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

mips allmodconfig:

ERROR: sgiwd93_reset [drivers/scsi/wd33c93.ko] undefined!

Cc: Ralf Baechle [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sgiwd93.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/scsi/sgiwd93.c~drivers-scsi-sgiwd93c-export-sgiwd93_reset 
drivers/scsi/sgiwd93.c
--- a/drivers/scsi/sgiwd93.c~drivers-scsi-sgiwd93c-export-sgiwd93_reset
+++ a/drivers/scsi/sgiwd93.c
@@ -159,6 +159,7 @@ void sgiwd93_reset(unsigned long base)
udelay(50);
hregs-ctrl = 0;
 }
+EXPORT_SYMBOL_GPL(sgiwd93_reset);
 
 static inline void init_hpc_chain(struct hpc_data *hd)
 {
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 16/30] aacraid driver fails with Dell PowerEdge Expandable RAID Controller 3/Di

2007-12-13 Thread akpm
From: Salyzyn, Mark [EMAIL PROTECTED]

As reported in http://bugzilla.kernel.org/show_bug.cgi?id=3D9133 it was
discovered that the PERC line of controllers lacked a key 64 bit
ScatterGather capable SCSI pass-through function. The adapters are still
capable of 64 bit ScatterGather I/O commands, but these two can not be
mixed. This problem was exacerbated by the introduction of the SCSI
Generic access to the DASD physical devices.

The fix for users before this patch is applied is aacraid.dacmode=3D0 on
the kernel command line to disable 64 bit I/O.

The enclosed patch introduces a new adapter quirk and tries to limp
along by enabling pass-through in situations where memory is 32 bit
addressable on 64 bit machines, or disable the pass-through functions
altogether. I expect that the check for 32 bit addressable memory to be
controversial in that it can be incorrect in non-Dell non-Intel systems
that PERC would never be installed under, the alternative is to disable
pass-through in all cases which could be reported as another regression.

Pass-through is used for SCSI Generic access to the physical devices, or
for the management applications to properly function.

In systems where this patch has disabled pass-through because it is
unsupportable in combination with I/O performance, the user can choose
to enable pass-through by turning off dacmode (aacraid.dacmode=3D0) or
limiting the discovered kernel memory (mem=3D4G) with an associated loss
in runtime performance. If we chose instead to turn off 64 bit dacmode
for the adapters with this quirk, then this would be reported as another
regression.

Signed-off-by: Mark Salyzyn [EMAIL PROTECTED]
Cc: Marcin Krol [EMAIL PROTECTED]
Cc: Matt Domsch [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aacraid/aachba.c  |   15 ++-
 drivers/scsi/aacraid/aacraid.h |6 
 drivers/scsi/aacraid/commsup.c |6 ++--
 drivers/scsi/aacraid/linit.c   |   42 +--
 4 files changed, 47 insertions(+), 22 deletions(-)

diff -puN 
drivers/scsi/aacraid/aachba.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
 drivers/scsi/aacraid/aachba.c
--- 
a/drivers/scsi/aacraid/aachba.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
+++ a/drivers/scsi/aacraid/aachba.c
@@ -1190,6 +1190,15 @@ static int aac_scsi_32(struct fib * fib,
  (fib_callback) aac_srb_callback, (void *) 
cmd);
 }
 
+static int aac_scsi_32_64(struct fib * fib, struct scsi_cmnd * cmd)
+{
+   if ((sizeof(dma_addr_t)  4) 
+(num_physpages  (0xULL  PAGE_SHIFT)) 
+(fib-dev-adapter_info.options  AAC_OPT_SGMAP_HOST64))
+   return FAILED;
+   return aac_scsi_32(fib, cmd);
+}
+
 int aac_get_adapter_info(struct aac_dev* dev)
 {
struct fib* fibptr;
@@ -1267,6 +1276,8 @@ int aac_get_adapter_info(struct aac_dev*
 1, 1,
 NULL, NULL);
 
+   /* reasoned default */
+   dev-maximum_num_physicals = 16;
if (rcode = 0  le32_to_cpu(bus_info-Status) == ST_OK) {
dev-maximum_num_physicals = 
le32_to_cpu(bus_info-TargetsPerBus);
dev-maximum_num_channels = le32_to_cpu(bus_info-BusCount);
@@ -1376,7 +1387,9 @@ int aac_get_adapter_info(struct aac_dev*
 * interface.
 */
dev-a_ops.adapter_scsi = (dev-dac_support)
-   ? aac_scsi_64
+ ? ((aac_get_driver_ident(dev-cardtype)-quirks  AAC_QUIRK_SCSI_32)
+   ? aac_scsi_32_64
+   : aac_scsi_64)
: aac_scsi_32;
if (dev-raw_io_interface) {
dev-a_ops.adapter_bounds = (dev-raw_io_64)
diff -puN 
drivers/scsi/aacraid/aacraid.h~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
 drivers/scsi/aacraid/aacraid.h
--- 
a/drivers/scsi/aacraid/aacraid.h~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
+++ a/drivers/scsi/aacraid/aacraid.h
@@ -521,6 +521,12 @@ struct aac_driver_ident
 #define AAC_QUIRK_17SG 0x0010
 
 /*
+ * Some adapter firmware does not support 64 bit scsi passthrough
+ * commands.
+ */
+#define AAC_QUIRK_SCSI_32  0x0020
+
+/*
  * The adapter interface specs all queues to be located in the same
  * physically contigous block. The host structure that defines the
  * commuication queues will assume they are each a separate physically
diff -puN 
drivers/scsi/aacraid/commsup.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
 drivers/scsi/aacraid/commsup.c
--- 
a/drivers/scsi/aacraid/commsup.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
+++ a/drivers/scsi/aacraid/commsup.c
@@ -1099,7 +1099,8 @@ static int _aac_reset_adapter(struct aac
free_irq(aac-pdev-irq, aac);
kfree(aac-fsa_dev);
 

[patch 28/30] scsi: arm: convert to accessors and !use_sg cleanup

2007-12-13 Thread akpm
From: Boaz Harrosh [EMAIL PROTECTED]

 - convert to accessors and !use_sg cleanup

Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
Cc: Russell King [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/arm/acornscsi.c |   14 ++---
 drivers/scsi/arm/scsi.h  |   34 ++---
 2 files changed, 18 insertions(+), 30 deletions(-)

diff -puN drivers/scsi/arm/acornscsi.c~scsi-pending-arm-convert-to-accessors 
drivers/scsi/arm/acornscsi.c
--- a/drivers/scsi/arm/acornscsi.c~scsi-pending-arm-convert-to-accessors
+++ a/drivers/scsi/arm/acornscsi.c
@@ -1790,7 +1790,7 @@ int acornscsi_starttransfer(AS_Host *hos
return 0;
 }
 
-residual = host-SCpnt-request_bufflen - host-scsi.SCp.scsi_xferred;
+residual = scsi_bufflen(host-SCpnt) - host-scsi.SCp.scsi_xferred;
 
 sbic_arm_write(host-scsi.io_port, SBIC_SYNCHTRANSFER, 
host-device[host-SCpnt-device-id].sync_xfer);
 sbic_arm_writenext(host-scsi.io_port, residual  16);
@@ -2270,7 +2270,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *h
case 0x4b:  /* - PHASE_STATUSIN
*/
case 0x8b:  /* - PHASE_STATUSIN
*/
/* DATA IN - STATUS */
-   host-scsi.SCp.scsi_xferred = host-SCpnt-request_bufflen -
+   host-scsi.SCp.scsi_xferred = scsi_bufflen(host-SCpnt) -
  acornscsi_sbic_xfcount(host);
acornscsi_dma_stop(host);
acornscsi_readstatusbyte(host);
@@ -2281,7 +2281,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *h
case 0x4e:  /* - PHASE_MSGOUT  
*/
case 0x8e:  /* - PHASE_MSGOUT  
*/
/* DATA IN - MESSAGE OUT */
-   host-scsi.SCp.scsi_xferred = host-SCpnt-request_bufflen -
+   host-scsi.SCp.scsi_xferred = scsi_bufflen(host-SCpnt) -
  acornscsi_sbic_xfcount(host);
acornscsi_dma_stop(host);
acornscsi_sendmessage(host);
@@ -2291,7 +2291,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *h
case 0x4f:  /* message in   
*/
case 0x8f:  /* message in   
*/
/* DATA IN - MESSAGE IN */
-   host-scsi.SCp.scsi_xferred = host-SCpnt-request_bufflen -
+   host-scsi.SCp.scsi_xferred = scsi_bufflen(host-SCpnt) -
  acornscsi_sbic_xfcount(host);
acornscsi_dma_stop(host);
acornscsi_message(host);/* - PHASE_MSGIN, PHASE_DISCONNECT 
*/
@@ -2319,7 +2319,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *h
case 0x4b:  /* - PHASE_STATUSIN
*/
case 0x8b:  /* - PHASE_STATUSIN
*/
/* DATA OUT - STATUS */
-   host-scsi.SCp.scsi_xferred = host-SCpnt-request_bufflen -
+   host-scsi.SCp.scsi_xferred = scsi_bufflen(host-SCpnt) -
  acornscsi_sbic_xfcount(host);
acornscsi_dma_stop(host);
acornscsi_dma_adjust(host);
@@ -2331,7 +2331,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *h
case 0x4e:  /* - PHASE_MSGOUT  
*/
case 0x8e:  /* - PHASE_MSGOUT  
*/
/* DATA OUT - MESSAGE OUT */
-   host-scsi.SCp.scsi_xferred = host-SCpnt-request_bufflen -
+   host-scsi.SCp.scsi_xferred = scsi_bufflen(host-SCpnt) -
  acornscsi_sbic_xfcount(host);
acornscsi_dma_stop(host);
acornscsi_dma_adjust(host);
@@ -2342,7 +2342,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *h
case 0x4f:  /* message in   
*/
case 0x8f:  /* message in   
*/
/* DATA OUT - MESSAGE IN */
-   host-scsi.SCp.scsi_xferred = host-SCpnt-request_bufflen -
+   host-scsi.SCp.scsi_xferred = scsi_bufflen(host-SCpnt) -
  acornscsi_sbic_xfcount(host);
acornscsi_dma_stop(host);
acornscsi_dma_adjust(host);
diff -puN drivers/scsi/arm/scsi.h~scsi-pending-arm-convert-to-accessors 
drivers/scsi/arm/scsi.h
--- a/drivers/scsi/arm/scsi.h~scsi-pending-arm-convert-to-accessors
+++ a/drivers/scsi/arm/scsi.h
@@ -68,46 +68,34 @@ static inline void init_SCp(struct scsi_
 {
memset(SCpnt-SCp, 0, sizeof(struct scsi_pointer));
 
-   if (SCpnt-use_sg) {
+   if (scsi_bufflen(SCpnt)) {
unsigned long len = 0;
int buf;
 
- 

[patch 30/30] libsas: convert ATA bridge to use new EH

2007-12-13 Thread akpm
From: Darrick J. Wong [EMAIL PROTECTED]

Migrate the sas_ata bridge to use the new libata EH strategy, and
finally implement correct software reset.

WARNING WARNING WARNING!  This patch is for experimental use only; it is
nowhere near complete!  Especially the sas_ata_freeze() function.  This
patch may eat your data and kill your trees.

jgarzik: If an ATA command was in-progress at the time of a port freeze,
can complete after thawing?  (Does that even make sense?)

[EMAIL PROTECTED]: coding-style fixes]
Comments-requested-by: Darrick J. Wong [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/libsas/sas_ata.c |   86 ++--
 1 file changed, 71 insertions(+), 15 deletions(-)

diff -puN drivers/scsi/libsas/sas_ata.c~libsas-convert-ata-bridge-to-use-new-eh 
drivers/scsi/libsas/sas_ata.c
--- a/drivers/scsi/libsas/sas_ata.c~libsas-convert-ata-bridge-to-use-new-eh
+++ a/drivers/scsi/libsas/sas_ata.c
@@ -35,6 +35,8 @@
 #include ../scsi_transport_api.h
 #include scsi/scsi_eh.h
 
+static int sas_issue_ata_srst(struct domain_device *dev);
+
 static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts)
 {
/* Cheesy attempt to translate SAS errors into ATA.  Hah! */
@@ -233,37 +235,58 @@ static u8 sas_ata_check_status(struct at
return dev-sata_dev.tf.command;
 }
 
-static void sas_ata_phy_reset(struct ata_port *ap)
+static void sas_ata_freeze(struct ata_port *ap)
 {
-   struct domain_device *dev = ap-private_data;
-   struct sas_internal *i =
-   to_sas_internal(dev-port-ha-core.shost-transportt);
-   int res = 0;
+   /* reroute qc_done for all qc's on this port to a dumb free func */
+   /* i wonder if we can get away with throwing out anything that
+* completes in this time frame, or if we must find the commands
+* that are in progress and cancel only those? */
+   printk(KERN_ERR %s: STUB\n, __FUNCTION__);
+}
 
-   if (i-dft-lldd_I_T_nexus_reset)
-   res = i-dft-lldd_I_T_nexus_reset(dev);
+static void sas_ata_thaw(struct ata_port *ap)
+{
+   /* empty */
+   printk(KERN_ERR %s: STUB\n, __FUNCTION__);
+}
 
-   if (res)
-   SAS_DPRINTK(%s: Unable to reset I T nexus?\n, __FUNCTION__);
+static int sas_ata_soft_reset(struct ata_link *link, unsigned int *classes,
+  unsigned long deadline)
+{
+   struct ata_port *ap = link-ap;
+   struct domain_device *dev = ap-private_data;
+   int res;
 
+   /* Send SRST to device */
+   res = sas_issue_ata_srst(dev);
+   printk(KERN_ERR srst 0 returns %d\n, res);
+
+   /* Set new device type */
switch (dev-sata_dev.command_set) {
case ATA_COMMAND_SET:
SAS_DPRINTK(%s: Found ATA device.\n, __FUNCTION__);
-   ap-link.device[0].class = ATA_DEV_ATA;
+   *classes = ATA_DEV_ATA;
break;
case ATAPI_COMMAND_SET:
SAS_DPRINTK(%s: Found ATAPI device.\n, __FUNCTION__);
-   ap-link.device[0].class = ATA_DEV_ATAPI;
+   *classes = ATA_DEV_ATAPI;
break;
default:
SAS_DPRINTK(%s: Unknown SATA command set: %d.\n,
__FUNCTION__,
dev-sata_dev.command_set);
-   ap-link.device[0].class = ATA_DEV_UNKNOWN;
-   break;
+   *classes = ATA_DEV_UNKNOWN;
+   break;
}
 
-   ap-cbl = ATA_CBL_SATA;
+   /* FIXME: What if SRST fails? */
+   return 0;
+}
+
+static void sas_ata_error_handler(struct ata_port *ap)
+{
+   ata_do_eh(ap, NULL, sas_ata_soft_reset, NULL, NULL);
+   /* uh... hopefully there's no commands left in here? */
 }
 
 static void sas_ata_post_internal(struct ata_queued_cmd *qc)
@@ -353,7 +376,9 @@ static struct ata_port_operations sas_sa
.check_status   = sas_ata_check_status,
.check_altstatus= sas_ata_check_status,
.dev_select = ata_noop_dev_select,
-   .phy_reset  = sas_ata_phy_reset,
+   .error_handler  = sas_ata_error_handler,
+   .freeze = sas_ata_freeze,
+   .thaw   = sas_ata_thaw,
.post_internal_cmd  = sas_ata_post_internal,
.tf_read= sas_ata_tf_read,
.qc_prep= ata_noop_qc_prep,
@@ -658,6 +683,37 @@ out:
return res;
 }
 
+static int sas_issue_ata_srst(struct domain_device *dev)
+{
+   int res = 0;
+   struct sas_task *task;
+   struct dev_to_host_fis *d2h_fis = (struct dev_to_host_fis *)
+   dev-frame_rcvd[0];
+
+   res = -ENOMEM;
+   task = sas_alloc_task(GFP_KERNEL);
+   if (!task)
+ 

[patch 19/30] Dell CERC support for megaraid_mbox

2007-12-13 Thread akpm
From: Hannes Reinecke [EMAIL PROTECTED]

Newer Dell CERC firmware (= 6.62) implement a random deletion handling
compatible with the legacy megaraid driver.  The legacy handling shifted
the target ID by 0x80 only for I/O commands (READ/WRITE/etc), whereas
megaraid_mbox shifts the target ID always if random deletion is supported. 
The resulted in megaraid_mbox sending an INQUIRY to the wrong channel, and
not finding any devices, obviously.

So we disable the random deletion support if the offending firmware is
found.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=6695

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
Cc: Patro, Sumant [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_mbox.c |   17 +
 drivers/scsi/megaraid/megaraid_mbox.h |1 +
 2 files changed, 18 insertions(+)

diff -puN 
drivers/scsi/megaraid/megaraid_mbox.c~dell-cerc-support-for-megaraid_mbox 
drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c~dell-cerc-support-for-megaraid_mbox
+++ a/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3169,6 +3169,23 @@ megaraid_mbox_support_random_del(adapter
uint8_t raw_mbox[sizeof(mbox_t)];
int rval;
 
+   /*
+* Newer firmware on Dell CERC expect a different
+* random deletion handling, so disable it.
+*/
+   if (adapter-pdev-vendor == PCI_VENDOR_ID_AMI 
+   adapter-pdev-device == PCI_DEVICE_ID_AMI_MEGARAID3 
+   adapter-pdev-subsystem_vendor == PCI_VENDOR_ID_DELL 
+   adapter-pdev-subsystem_device == PCI_SUBSYS_ID_CERC_ATA100_4CH 
+   (adapter-fw_version[0]  '6' ||
+(adapter-fw_version[0] == '6' 
+ adapter-fw_version[2]  '6') ||
+(adapter-fw_version[0] == '6'
+  adapter-fw_version[2] == '6'
+  adapter-fw_version[3]  '1'))) {
+   con_log(CL_DLEVEL1, (megaraid: disable random deletion\n));
+   return 0;
+   }
 
mbox = (mbox_t *)raw_mbox;
 
diff -puN 
drivers/scsi/megaraid/megaraid_mbox.h~dell-cerc-support-for-megaraid_mbox 
drivers/scsi/megaraid/megaraid_mbox.h
--- a/drivers/scsi/megaraid/megaraid_mbox.h~dell-cerc-support-for-megaraid_mbox
+++ a/drivers/scsi/megaraid/megaraid_mbox.h
@@ -88,6 +88,7 @@
 #define PCI_SUBSYS_ID_PERC3_QC 0x0471
 #define PCI_SUBSYS_ID_PERC3_DC 0x0493
 #define PCI_SUBSYS_ID_PERC3_SC 0x0475
+#define PCI_SUBSYS_ID_CERC_ATA100_4CH  0x0511
 
 
 #define MBOX_MAX_SCSI_CMDS 128 // number of cmds reserved for kernel
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 22/30] sg: nopage

2007-12-13 Thread akpm
From: Nick Piggin [EMAIL PROTECTED]

Convert SG from nopage to fault.

Signed-off-by: Nick Piggin [EMAIL PROTECTED]
Cc: Douglas Gilbert [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sg.c |   23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff -puN drivers/scsi/sg.c~sg-nopage drivers/scsi/sg.c
--- a/drivers/scsi/sg.c~sg-nopage
+++ a/drivers/scsi/sg.c
@@ -1144,23 +1144,22 @@ sg_fasync(int fd, struct file *filp, int
return (retval  0) ? retval : 0;
 }
 
-static struct page *
-sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
+static int
+sg_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
Sg_fd *sfp;
-   struct page *page = NOPAGE_SIGBUS;
unsigned long offset, len, sa;
Sg_scatter_hold *rsv_schp;
struct scatterlist *sg;
int k;
 
if ((NULL == vma) || (!(sfp = (Sg_fd *) vma-vm_private_data)))
-   return page;
+   return VM_FAULT_SIGBUS;
rsv_schp = sfp-reserve;
-   offset = addr - vma-vm_start;
+   offset = vmf-pgoff  PAGE_SHIFT;
if (offset = rsv_schp-bufflen)
-   return page;
-   SCSI_LOG_TIMEOUT(3, printk(sg_vma_nopage: offset=%lu, scatg=%d\n,
+   return VM_FAULT_SIGBUS;
+   SCSI_LOG_TIMEOUT(3, printk(sg_vma_fault: offset=%lu, scatg=%d\n,
   offset, rsv_schp-k_use_sg));
sg = rsv_schp-buffer;
sa = vma-vm_start;
@@ -1169,21 +1168,21 @@ sg_vma_nopage(struct vm_area_struct *vma
len = vma-vm_end - sa;
len = (len  sg-length) ? len : sg-length;
if (offset  len) {
+   struct page *page;
page = virt_to_page(page_address(sg_page(sg)) + offset);
get_page(page); /* increment page count */
-   break;
+   vmf-page = page;
+   return 0; /* success */
}
sa += len;
offset -= len;
}
 
-   if (type)
-   *type = VM_FAULT_MINOR;
-   return page;
+   return VM_FAULT_SIGBUS;
 }
 
 static struct vm_operations_struct sg_mmap_vm_ops = {
-   .nopage = sg_vma_nopage,
+   .fault = sg_vma_fault,
 };
 
 static int
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 29/30] scsi: bidi support

2007-12-13 Thread akpm
From: Boaz Harrosh [EMAIL PROTECTED]

  At the block level bidi request uses req-next_rq pointer for a second
  bidi_read request.
  At Scsi-midlayer a second scsi_data_buffer structure is used for the
  bidi_read part. This bidi scsi_data_buffer is put on
  request-next_rq-special. Struct scsi_cmnd is not changed.

  - Define scsi_bidi_cmnd() to return true if it is a bidi request and a
second sgtable was allocated.

  - Define scsi_in()/scsi_out() to return the in or out scsi_data_buffer
from this command This API is to isolate users from the mechanics of
bidi.

  - Define scsi_end_bidi_request() to do what scsi_end_request() does but
for a bidi request. This is necessary because bidi commands are a bit
tricky here. (See comments in body)

  - scsi_release_buffers() will also release the bidi_read scsi_data_buffer

  - scsi_io_completion() on bidi commands will now call
scsi_end_bidi_request() and return.

  - The previous work done in scsi_init_io() is now done in a new
scsi_init_sgtable() (which is 99% identical to old scsi_init_io())
The new scsi_init_io() will call the above twice if needed also for
the bidi_read command. Only at this point is a command bidi.

  - In scsi_error.c at scsi_eh_prep/restore_cmnd() make sure bidi-lld is not
confused by a get-sense command that looks like bidi. This is done
by puting NULL at request-next_rq, and restoring.

Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/scsi_error.c |3 
 drivers/scsi/scsi_lib.c   |  144 
 include/scsi/scsi_cmnd.h  |   23 +
 include/scsi/scsi_eh.h|1 
 4 files changed, 141 insertions(+), 30 deletions(-)

diff -puN drivers/scsi/scsi_error.c~scsi-bidi-support drivers/scsi/scsi_error.c
--- a/drivers/scsi/scsi_error.c~scsi-bidi-support
+++ a/drivers/scsi/scsi_error.c
@@ -618,9 +618,11 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd 
memcpy(ses-cmnd, scmd-cmnd, sizeof(scmd-cmnd));
ses-data_direction = scmd-sc_data_direction;
ses-sdb = scmd-sdb;
+   ses-next_rq = scmd-request-next_rq;
ses-result = scmd-result;
 
memset(scmd-sdb, 0, sizeof(scmd-sdb));
+   scmd-request-next_rq = NULL;
 
if (sense_bytes) {
scmd-sdb.length = min_t(unsigned,
@@ -673,6 +675,7 @@ void scsi_eh_restore_cmnd(struct scsi_cm
memcpy(scmd-cmnd, ses-cmnd, sizeof(scmd-cmnd));
scmd-sc_data_direction = ses-data_direction;
scmd-sdb = ses-sdb;
+   scmd-request-next_rq = ses-next_rq;
scmd-result = ses-result;
 }
 EXPORT_SYMBOL(scsi_eh_restore_cmnd);
diff -puN drivers/scsi/scsi_lib.c~scsi-bidi-support drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c~scsi-bidi-support
+++ a/drivers/scsi/scsi_lib.c
@@ -64,6 +64,8 @@ static struct scsi_host_sg_pool scsi_sg_
 };
 #undef SP
 
+static struct kmem_cache *scsi_bidi_sdb_cache;
+
 static void scsi_run_queue(struct request_queue *q);
 
 /*
@@ -627,6 +629,28 @@ void scsi_run_host_queues(struct Scsi_Ho
scsi_run_queue(sdev-request_queue);
 }
 
+static void scsi_finalize_request(struct scsi_cmnd *cmd, int uptodate)
+{
+   struct request_queue *q = cmd-device-request_queue;
+   struct request *req = cmd-request;
+   unsigned long flags;
+
+   add_disk_randomness(req-rq_disk);
+
+   spin_lock_irqsave(q-queue_lock, flags);
+   if (blk_rq_tagged(req))
+   blk_queue_end_tag(q, req);
+
+   end_that_request_last(req, uptodate);
+   spin_unlock_irqrestore(q-queue_lock, flags);
+
+   /*
+* This will goose the queue request function at the end, so we don't
+* need to worry about launching another command.
+*/
+   scsi_next_command(cmd);
+}
+
 /*
  * Function:scsi_end_request()
  *
@@ -654,7 +678,6 @@ static struct scsi_cmnd *scsi_end_reques
 {
struct request_queue *q = cmd-device-request_queue;
struct request *req = cmd-request;
-   unsigned long flags;
 
/*
 * If there are blocks left over at the end, set up the command
@@ -683,19 +706,7 @@ static struct scsi_cmnd *scsi_end_reques
}
}
 
-   add_disk_randomness(req-rq_disk);
-
-   spin_lock_irqsave(q-queue_lock, flags);
-   if (blk_rq_tagged(req))
-   blk_queue_end_tag(q, req);
-   end_that_request_last(req, uptodate);
-   spin_unlock_irqrestore(q-queue_lock, flags);
-
-   /*
-* This will goose the queue request function at the end, so we don't
-* need to worry about launching another command.
-*/
-   scsi_next_command(cmd);
+   scsi_finalize_request(cmd, uptodate);
return NULL;
 }
 
@@ -894,10 +905,39 @@ void scsi_release_buffers(struct scsi_cm
scsi_free_sgtable(cmd-sdb);
 
memset(cmd-sdb, 0, sizeof(cmd-sdb));
+
+   if (scsi_bidi_cmnd(cmd)) {
+ 

[patch 25/30] drivers/scsi/ipr.c: use LIST_HEAD instead of LIST_HEAD_INIT

2007-12-13 Thread akpm
From: Denis Cheng [EMAIL PROTECTED]

Signed-off-by: Denis Cheng [EMAIL PROTECTED]
Acked-by: Brian King [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ipr.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/ipr.c~drivers-scsi-iprc-use-list_head-instead-of-list_head_init 
drivers/scsi/ipr.c
--- 
a/drivers/scsi/ipr.c~drivers-scsi-iprc-use-list_head-instead-of-list_head_init
+++ a/drivers/scsi/ipr.c
@@ -84,7 +84,7 @@
 /*
  *   Global Data
  */
-static struct list_head ipr_ioa_head = LIST_HEAD_INIT(ipr_ioa_head);
+static LIST_HEAD(ipr_ioa_head);
 static unsigned int ipr_log_level = IPR_DEFAULT_LOG_LEVEL;
 static unsigned int ipr_max_speed = 1;
 static int ipr_testmode = 0;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 21/30] scsi/qla2xxx/qla_os.c section fix

2007-12-13 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

WARNING: vmlinux.o(.text+0x2a4462): Section mismatch: reference to 
.exit.text:qla2x00_remove_one (between 'qla2xxx_pci_error_detected' and 
'qla2x00_stop_timer')

qla2x00_remove_one() mustn't be __devexit since it's called from
qla2xxx_pci_error_detected().

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Acked-by: Seokmann Ju [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/qla2xxx/qla_os.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/qla2xxx/qla_os.c~scsi-qla2xxx-qla_osc-section-fix 
drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c~scsi-qla2xxx-qla_osc-section-fix
+++ a/drivers/scsi/qla2xxx/qla_os.c
@@ -1823,7 +1823,7 @@ probe_out:
return ret;
 }
 
-static void __devexit
+static void
 qla2x00_remove_one(struct pci_dev *pdev)
 {
scsi_qla_host_t *ha;
@@ -2957,7 +2957,7 @@ static struct pci_driver qla2xxx_pci_dri
},
.id_table   = qla2xxx_pci_tbl,
.probe  = qla2x00_probe_one,
-   .remove = __devexit_p(qla2x00_remove_one),
+   .remove = qla2x00_remove_one,
.err_handler= qla2xxx_err_handler,
 };
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 23/30] 3W RAID drivers: memset not needed in probe

2007-12-13 Thread akpm
From: Denis Cheng [EMAIL PROTECTED]

The memory return from scsi_host_alloc is alloced by kzalloc, which is
already zero initilized, so memset not needed.

Signed-off-by: Denis Cheng [EMAIL PROTECTED]
Cc: Adam Radford [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/3w-9xxx.c |2 --
 drivers/scsi/3w-.c |2 --
 2 files changed, 4 deletions(-)

diff -puN drivers/scsi/3w-9xxx.c~3w-raid-drivers-memset-not-needed-in-probe 
drivers/scsi/3w-9xxx.c
--- a/drivers/scsi/3w-9xxx.c~3w-raid-drivers-memset-not-needed-in-probe
+++ a/drivers/scsi/3w-9xxx.c
@@ -2029,8 +2029,6 @@ static int __devinit twa_probe(struct pc
}
tw_dev = (TW_Device_Extension *)host-hostdata;
 
-   memset(tw_dev, 0, sizeof(TW_Device_Extension));
-
/* Save values to device extension */
tw_dev-host = host;
tw_dev-tw_pci_dev = pdev;
diff -puN drivers/scsi/3w-.c~3w-raid-drivers-memset-not-needed-in-probe 
drivers/scsi/3w-.c
--- a/drivers/scsi/3w-.c~3w-raid-drivers-memset-not-needed-in-probe
+++ a/drivers/scsi/3w-.c
@@ -2295,8 +2295,6 @@ static int __devinit tw_probe(struct pci
}
tw_dev = (TW_Device_Extension *)host-hostdata;
 
-   memset(tw_dev, 0, sizeof(TW_Device_Extension));
-
/* Save values to device extension */
tw_dev-host = host;
tw_dev-tw_pci_dev = pdev;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 18/30] scsi/qla2xxx/: possible cleanups

2007-12-13 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

- make the following needlessly global code static:
  - qla_attr.c: qla24xx_vport_delete()
  - qla_attr.c: qla24xx_vport_disable()
  - qla_mid.c: qla24xx_allocate_vp_id()
  - qla_mid.c: qla24xx_find_vhost_by_name()
  - qla_mid.c: qla2x00_do_dpc_vp()
  - qla_os.c: struct qla2x00_driver_template
  - qla_os.c: qla2x00_stop_timer()
  - qla_os.c: qla2x00_mem_alloc()
  - qla_os.c: qla2x00_mem_free()
  - qla_sup.c: qla2x00_lock_nvram_access()
  - qla_sup.c: qla2x00_unlock_nvram_access()
  - qla_sup.c: qla2x00_get_nvram_word()
  - qla_sup.c: qla2x00_write_nvram_word()
- #if 0 the following unused global functions:
  - qla_dbg.c: qla2x00_dump_pkt()
  - qla_mbx.c: qla2x00_system_error()
  - qla_mbx.c: qla2x00_get_serdes_params()
  - qla_mbx.c: qla2x00_get_idma_speed()
  - qla_mbx.c: qla24xx_get_vp_database()
  - qla_mbx.c: qla24xx_get_vp_entry()
- qla_os.c: remove some unneeded function prototypes

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/qla2xxx/qla_attr.c |6 +++---
 drivers/scsi/qla2xxx/qla_dbg.c  |2 ++
 drivers/scsi/qla2xxx/qla_gbl.h  |   25 -
 drivers/scsi/qla2xxx/qla_mbx.c  |   10 ++
 drivers/scsi/qla2xxx/qla_mid.c  |6 +++---
 drivers/scsi/qla2xxx/qla_os.c   |   20 ++--
 drivers/scsi/qla2xxx/qla_sup.c  |8 
 7 files changed, 28 insertions(+), 49 deletions(-)

diff -puN drivers/scsi/qla2xxx/qla_attr.c~scsi-qla2xxx-possible-cleanups 
drivers/scsi/qla2xxx/qla_attr.c
--- a/drivers/scsi/qla2xxx/qla_attr.c~scsi-qla2xxx-possible-cleanups
+++ a/drivers/scsi/qla2xxx/qla_attr.c
@@ -9,7 +9,7 @@
 #include linux/kthread.h
 #include linux/vmalloc.h
 
-int qla24xx_vport_disable(struct fc_vport *, bool);
+static int qla24xx_vport_disable(struct fc_vport *, bool);
 
 /* SYSFS attributes - 
*/
 
@@ -1113,7 +1113,7 @@ vport_create_failed_2:
return FC_VPORT_FAILED;
 }
 
-int
+static int
 qla24xx_vport_delete(struct fc_vport *fc_vport)
 {
scsi_qla_host_t *ha = shost_priv(fc_vport-shost);
@@ -1146,7 +1146,7 @@ qla24xx_vport_delete(struct fc_vport *fc
return 0;
 }
 
-int
+static int
 qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
 {
scsi_qla_host_t *vha = fc_vport-dd_data;
diff -puN drivers/scsi/qla2xxx/qla_dbg.c~scsi-qla2xxx-possible-cleanups 
drivers/scsi/qla2xxx/qla_dbg.c
--- a/drivers/scsi/qla2xxx/qla_dbg.c~scsi-qla2xxx-possible-cleanups
+++ a/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1428,6 +1428,7 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd 
printk(  sp flags=0x%x\n, sp-flags);
 }
 
+#if 0
 void
 qla2x00_dump_pkt(void *pkt)
 {
@@ -1442,6 +1443,7 @@ qla2x00_dump_pkt(void *pkt)
}
printk(\n);
 }
+#endif  /*  0  */
 
 #if defined(QL_DEBUG_ROUTINES)
 /*
diff -puN drivers/scsi/qla2xxx/qla_gbl.h~scsi-qla2xxx-possible-cleanups 
drivers/scsi/qla2xxx/qla_gbl.h
--- a/drivers/scsi/qla2xxx/qla_gbl.h~scsi-qla2xxx-possible-cleanups
+++ a/drivers/scsi/qla2xxx/qla_gbl.h
@@ -68,30 +68,20 @@ extern int num_hosts;
 /*
  * Global Functions in qla_mid.c source file.
  */
-extern struct scsi_host_template qla2x00_driver_template;
 extern struct scsi_host_template qla24xx_driver_template;
 extern struct scsi_transport_template *qla2xxx_transport_vport_template;
-extern uint8_t qla2x00_mem_alloc(scsi_qla_host_t *);
 extern void qla2x00_timer(scsi_qla_host_t *);
 extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long);
-extern void qla2x00_stop_timer(scsi_qla_host_t *);
-extern uint32_t qla24xx_allocate_vp_id(scsi_qla_host_t *);
 extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *);
 extern int qla24xx_disable_vp (scsi_qla_host_t *);
 extern int qla24xx_enable_vp (scsi_qla_host_t *);
-extern void qla2x00_mem_free(scsi_qla_host_t *);
 extern int qla24xx_control_vp(scsi_qla_host_t *, int );
 extern int qla24xx_modify_vp_config(scsi_qla_host_t *);
 extern int qla2x00_send_change_request(scsi_qla_host_t *, uint16_t, uint16_t);
 extern void qla2x00_vp_stop_timer(scsi_qla_host_t *);
 extern int qla24xx_configure_vhba (scsi_qla_host_t *);
-extern int qla24xx_get_vp_entry(scsi_qla_host_t *, uint16_t, int);
-extern int qla24xx_get_vp_database(scsi_qla_host_t *, uint16_t);
-extern int qla2x00_do_dpc_vp(scsi_qla_host_t *);
 extern void qla24xx_report_id_acquisition(scsi_qla_host_t *,
 struct vp_rpt_id_entry_24xx *);
-extern scsi_qla_host_t * qla24xx_find_vhost_by_name(scsi_qla_host_t *,
-uint8_t *);
 extern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *);
 extern int qla24xx_vport_create_req_sanity_check(struct fc_vport *);
 extern scsi_qla_host_t * qla24xx_create_vhost(struct fc_vport *);
@@ -113,7 +103,6 @@ extern void qla2xxx_wake_dpc(scsi_qla_ho
 extern void qla2x00_alert_all_vps(scsi_qla_host_t *, uint16_t *);
 extern void qla2x00_async_event(scsi_qla_host_t *, uint16_t *);
 extern void 

[patch 26/30] tgt: use scsi_init_io instead of scsi_alloc_sgtable

2007-12-13 Thread akpm
From: Boaz Harrosh [EMAIL PROTECTED]

  - If we export scsi_init_io()/scsi_release_buffers() instead of
scsi_{alloc,free}_sgtable() from scsi_lib than tgt code is
much more insulated from scsi_lib changes. As a bonus it will
also gain bidi capability when it comes.

Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
Acked-by: FUJITA Tomonori [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/scsi_lib.c |   21 ++---
 drivers/scsi/scsi_tgt_lib.c |   29 +
 include/scsi/scsi_cmnd.h|4 ++--
 3 files changed, 17 insertions(+), 37 deletions(-)

diff -puN 
drivers/scsi/scsi_lib.c~tgt-use-scsi_init_io-instead-of-scsi_alloc_sgtable 
drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c~tgt-use-scsi_init_io-instead-of-scsi_alloc_sgtable
+++ a/drivers/scsi/scsi_lib.c
@@ -739,7 +739,8 @@ static inline unsigned int scsi_sgtable_
return index;
 }
 
-struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
+static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd,
+   gfp_t gfp_mask)
 {
struct scsi_host_sg_pool *sgp;
struct scatterlist *sgl, *prev, *ret;
@@ -825,9 +826,7 @@ enomem:
return NULL;
 }
 
-EXPORT_SYMBOL(scsi_alloc_sgtable);
-
-void scsi_free_sgtable(struct scsi_cmnd *cmd)
+static void scsi_free_sgtable(struct scsi_cmnd *cmd)
 {
struct scatterlist *sgl = cmd-request_buffer;
struct scsi_host_sg_pool *sgp;
@@ -873,8 +872,6 @@ void scsi_free_sgtable(struct scsi_cmnd 
mempool_free(sgl, sgp-pool);
 }
 
-EXPORT_SYMBOL(scsi_free_sgtable);
-
 /*
  * Function:scsi_release_buffers()
  *
@@ -892,7 +889,7 @@ EXPORT_SYMBOL(scsi_free_sgtable);
  * the scatter-gather table, and potentially any bounce
  * buffers.
  */
-static void scsi_release_buffers(struct scsi_cmnd *cmd)
+void scsi_release_buffers(struct scsi_cmnd *cmd)
 {
if (cmd-use_sg)
scsi_free_sgtable(cmd);
@@ -904,6 +901,7 @@ static void scsi_release_buffers(struct 
cmd-request_buffer = NULL;
cmd-request_bufflen = 0;
 }
+EXPORT_SYMBOL(scsi_release_buffers);
 
 /*
  * Function:scsi_io_completion()
@@ -1105,7 +1103,7 @@ void scsi_io_completion(struct scsi_cmnd
  * Returns: 0 on success
  * BLKPREP_DEFER if the failure is retryable
  */
-static int scsi_init_io(struct scsi_cmnd *cmd)
+int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
 {
struct request *req = cmd-request;
intcount;
@@ -1120,7 +1118,7 @@ static int scsi_init_io(struct scsi_cmnd
/*
 * If sg table allocation fails, requeue request later.
 */
-   cmd-request_buffer = scsi_alloc_sgtable(cmd, GFP_ATOMIC);
+   cmd-request_buffer = scsi_alloc_sgtable(cmd, gfp_mask);
if (unlikely(!cmd-request_buffer)) {
scsi_unprep_request(req);
return BLKPREP_DEFER;
@@ -1141,6 +1139,7 @@ static int scsi_init_io(struct scsi_cmnd
cmd-use_sg = count;
return BLKPREP_OK;
 }
+EXPORT_SYMBOL(scsi_init_io);
 
 static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
struct request *req)
@@ -1186,7 +1185,7 @@ int scsi_setup_blk_pc_cmnd(struct scsi_d
 
BUG_ON(!req-nr_phys_segments);
 
-   ret = scsi_init_io(cmd);
+   ret = scsi_init_io(cmd, GFP_ATOMIC);
if (unlikely(ret))
return ret;
} else {
@@ -1237,7 +1236,7 @@ int scsi_setup_fs_cmnd(struct scsi_devic
if (unlikely(!cmd))
return BLKPREP_DEFER;
 
-   return scsi_init_io(cmd);
+   return scsi_init_io(cmd, GFP_ATOMIC);
 }
 EXPORT_SYMBOL(scsi_setup_fs_cmnd);
 
diff -puN 
drivers/scsi/scsi_tgt_lib.c~tgt-use-scsi_init_io-instead-of-scsi_alloc_sgtable 
drivers/scsi/scsi_tgt_lib.c
--- 
a/drivers/scsi/scsi_tgt_lib.c~tgt-use-scsi_init_io-instead-of-scsi_alloc_sgtable
+++ a/drivers/scsi/scsi_tgt_lib.c
@@ -331,8 +331,7 @@ static void scsi_tgt_cmd_done(struct scs
 
scsi_tgt_uspace_send_status(cmd, tcmd-itn_id, tcmd-tag);
 
-   if (scsi_sglist(cmd))
-   scsi_free_sgtable(cmd);
+   scsi_release_buffers(cmd);
 
queue_work(scsi_tgtd, tcmd-work);
 }
@@ -353,26 +352,6 @@ static int scsi_tgt_transfer_response(st
return 0;
 }
 
-static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask)
-{
-   struct request *rq = cmd-request;
-   int count;
-
-   cmd-use_sg = rq-nr_phys_segments;
-   cmd-request_buffer = scsi_alloc_sgtable(cmd, gfp_mask);
-   if (!cmd-request_buffer)
-   return -ENOMEM;
-
-   cmd-request_bufflen = rq-data_len;
-
-   dprintk(cmd %p cnt %d %lu\n, cmd, scsi_sg_count(cmd),
-   rq_data_dir(rq));
-   count = blk_rq_map_sg(rq-q, rq, scsi_sglist(cmd));

[patch 06/23] kill warnings in mptbase.h on parisc64

2007-11-21 Thread akpm
From: Kyle McMartin [EMAIL PROTECTED]

Verified all the arches necessary select the CONFIG_64BIT symbol.  This
also kills the warning (since it was using the 32-bit case) on parisc64 and
mips64.

Signed-off-by: Kyle McMartin [EMAIL PROTECTED]
Cc: Moore, Eric Dean [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/message/fusion/mptbase.h~kill-warnings-in-mptbaseh-on-parisc64 
drivers/message/fusion/mptbase.h
--- a/drivers/message/fusion/mptbase.h~kill-warnings-in-mptbaseh-on-parisc64
+++ a/drivers/message/fusion/mptbase.h
@@ -922,7 +922,7 @@ extern struct proc_dir_entry*mpt_proc_r
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 #endif /* } __KERNEL__ */
 
-#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || 
defined(__x86_64__) || defined(__powerpc__)
+#ifdef CONFIG_64BIT
 #define CAST_U32_TO_PTR(x) ((void *)(u64)x)
 #define CAST_PTR_TO_U32(x) ((u32)(u64)x)
 #else
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 01/23] git-scsi-misc gdth fix

2007-11-21 Thread akpm
From: James Bottomley [EMAIL PROTECTED]

On Sun, 2007-10-14 at 12:21 -0700, Andrew Morton wrote:
 On Sun, 14 Oct 2007 22:45:47 +0400 Dave Milter [EMAIL PROTECTED] wrote:

  I build linux-2.6.23-mm1 and try to boot it using qemu,
  and it crashed with trace like this:
  do_page_fault
  error_code
  lock_acquire
  _spin_lock_irqsave
  gdth_timeout
  run_timer_softirq
  __do_softirq
  do_softirq
 
  I have screenshot, but have no idea, is it legal to include it, if I
  sent copy to lkml.
  config of kernel in attachment,
  I apply all three patches from hot-fixes.
 

 The screenshot is here:  http://userweb.kernel.org/~akpm/crash.png

 It would appear that gdth_timeout() is passing a bad pointer into
 spin_lock_irqsave().

There's a bug in the gdth rework in that the instance can be deleted
from the list before the actual timer is stopped.  This can be worked
around I think by the following patch; although we really should be
stopping the timer from firing when the list goes empty.


James said:

This is almost certainly the wrong fix for real hardware.  Although it
kills the timer when the list goes empty, nothing will ever restart it
when the list fills again.

Boaz, since you touched all of this, you get to fix it.  The correct fix
will be to control the timer along with the actual list instead of at
entry/exit time.  If you're not going to add this empty check to the
timer routine, make sure you use del_timer_sync() before removing the
last element from the list.


Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |3 +++
 1 file changed, 3 insertions(+)

diff -puN drivers/scsi/gdth.c~git-scsi-misc-gdth-fix drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~git-scsi-misc-gdth-fix
+++ a/drivers/scsi/gdth.c
@@ -3793,6 +3793,9 @@ static void gdth_timeout(ulong data)
 gdth_ha_str *ha;
 ulong flags;
 
+if (list_empty(gdth_instances))
+   return;
+
 ha = list_first_entry(gdth_instances, gdth_ha_str, list);
 spin_lock_irqsave(ha-smp_lock, flags);
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 02/23] nsp32_restart_autoscsi(): remove error check

2007-11-21 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

The Coverity checker noted that we'll anyway Oops later when we ran into
this condition - and the error check didn't prevent that.

Considering that the error condition shouldn't be possible, and we are
not able to handle it easily, this patch simply removes the pointless
error check.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/nsp32.c |4 
 1 file changed, 4 deletions(-)

diff -puN drivers/scsi/nsp32.c~nsp32_restart_autoscsi-remove-error-check 
drivers/scsi/nsp32.c
--- a/drivers/scsi/nsp32.c~nsp32_restart_autoscsi-remove-error-check
+++ a/drivers/scsi/nsp32.c
@@ -1906,10 +1906,6 @@ static void nsp32_restart_autoscsi(struc
 
nsp32_dbg(NSP32_DEBUG_RESTART, enter);
 
-   if (data-cur_target == NULL || data-cur_lunt == NULL) {
-   nsp32_msg(KERN_ERR, Target or Lun is invalid);
-   }
-
/*
 * set SYNC_REG
 * Don't set BM_START_ADR before setting this register.
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 03/23] SCSI: early detection of medium not present, updated

2007-11-21 Thread akpm
From: Alan Stern [EMAIL PROTECTED]

Taken from http://bugzilla.kernel.org/show_bug.cgi?id=8904

An updated (by Albert, I assume) version of the fourteen-month-old patch here:

http://marc.info/?l=linux-kernelm=115412002912837w=2

Apparently fixes the bug described at
http://bugzilla.kernel.org/show_bug.cgi?id=8904

Needs some TLC.  Perhaps urgently.

Cc: Albert Lee [EMAIL PROTECTED]
Cc: Alan Stern [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Tejun Heo [EMAIL PROTECTED]
Cc: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/scsi_ioctl.c  |2 +-
 drivers/scsi/scsi_lib.c|   20 ++--
 drivers/scsi/sd.c  |2 +-
 drivers/scsi/sr.c  |   15 +--
 include/scsi/scsi_device.h |2 +-
 5 files changed, 30 insertions(+), 11 deletions(-)

diff -puN 
drivers/scsi/scsi_ioctl.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/scsi_ioctl.c
--- 
a/drivers/scsi/scsi_ioctl.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/scsi_ioctl.c
@@ -244,7 +244,7 @@ int scsi_ioctl(struct scsi_device *sdev,
return scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
case SCSI_IOCTL_TEST_UNIT_READY:
return scsi_test_unit_ready(sdev, IOCTL_NORMAL_TIMEOUT,
-   NORMAL_RETRIES);
+   NORMAL_RETRIES, NULL);
case SCSI_IOCTL_START_UNIT:
scsi_cmd[0] = START_STOP;
scsi_cmd[1] = 0;
diff -puN 
drivers/scsi/scsi_lib.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/scsi_lib.c
@@ -2010,15 +2010,26 @@ scsi_mode_sense(struct scsi_device *sdev
 }
 EXPORT_SYMBOL(scsi_mode_sense);
 
+/**
+ * scsi_test_unit_ready - test if unit is ready
+ * @sdev:  scsi device to change the state of.
+ * @timeout: command timeout
+ * @retries: number of retries before failing
+ * @media_maybe_present: 1 if media maybe present or not.
+ *   0 if media not present.
+ *
+ * Returns zero if unsuccessful or an error if TUR failed.
+ **/
 int
-scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries)
+scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, int 
*media_maybe_present)
 {
char cmd[] = {
TEST_UNIT_READY, 0, 0, 0, 0, 0,
};
struct scsi_sense_hdr sshdr;
int result;
-   
+   int maybe_present = 1;
+
result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
  timeout, retries);
 
@@ -2027,10 +2038,15 @@ scsi_test_unit_ready(struct scsi_device 
if ((scsi_sense_valid(sshdr)) 
((sshdr.sense_key == UNIT_ATTENTION) ||
 (sshdr.sense_key == NOT_READY))) {
+   if (sshdr.asc == 0x3A)
+   maybe_present = 0;
sdev-changed = 1;
result = 0;
}
}
+
+   if (media_maybe_present)
+   *media_maybe_present = maybe_present;
return result;
 }
 EXPORT_SYMBOL(scsi_test_unit_ready);
diff -puN drivers/scsi/sd.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/sd.c
--- a/drivers/scsi/sd.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/sd.c
@@ -767,7 +767,7 @@ static int sd_media_changed(struct gendi
retval = -ENODEV;
 
if (scsi_block_when_processing_errors(sdp))
-   retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES);
+   retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES, 
NULL);
 
/*
 * Unable to test, unit probably not ready.   This usually
diff -puN drivers/scsi/sr.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/sr.c
--- a/drivers/scsi/sr.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/sr.c
@@ -179,18 +179,21 @@ static int sr_media_change(struct cdrom_
 {
struct scsi_cd *cd = cdi-handle;
int retval;
+   int media_maybe_present;
 
if (CDSL_CURRENT != slot) {
/* no changer support */
return -EINVAL;
}
 
-   retval = scsi_test_unit_ready(cd-device, SR_TIMEOUT, MAX_RETRIES);
-   if (retval) {
-   /* Unable to test, unit probably not ready.  This usually
-* means there is no disc in the drive.  Mark as changed,
-* and we will figure it out later once the drive is
-* available again.  */
+   retval = scsi_test_unit_ready(cd-device, SR_TIMEOUT, MAX_RETRIES,
+ media_maybe_present);
+   if (retval || !media_maybe_present) {
+   /* Media not present or unable 

[patch 10/23] ips: PCI API cleanups

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

* pass Scsi_Host to ips_remove_device() via pci_set_drvdata(),
  allowing us to eliminate the ips_ha[] search loop and call
  ips_release() directly.

* call pci_{request,release}_regions() and eliminate individual
  request/release_[mem_]region() calls

* call pci_disable_device(), paired with pci_enable_device()

* s/0/NULL/ in a few places

* check ioremap() return value

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |   72 ++-
 1 file changed, 31 insertions(+), 41 deletions(-)

diff -puN drivers/scsi/ips.c~ips-pci-api-cleanups drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~ips-pci-api-cleanups
+++ a/drivers/scsi/ips.c
@@ -702,10 +702,6 @@ ips_release(struct Scsi_Host *sh)
/* free extra memory */
ips_free(ha);
 
-   /* Free I/O Region */
-   if (ha-io_addr)
-   release_region(ha-io_addr, ha-io_len);
-
/* free IRQ */
free_irq(ha-pcidev-irq, ha);
 
@@ -4394,8 +4390,6 @@ ips_free(ips_ha_t * ha)
ha-mem_ptr = NULL;
}
 
-   if (ha-mem_addr)
-   release_mem_region(ha-mem_addr, ha-mem_len);
ha-mem_addr = 0;
 
}
@@ -6880,20 +6874,14 @@ ips_register_scsi(int index)
 static void __devexit
 ips_remove_device(struct pci_dev *pci_dev)
 {
-   int i;
-   struct Scsi_Host *sh;
-   ips_ha_t *ha;
+   struct Scsi_Host *sh = pci_get_drvdata(pci_dev);
 
-   for (i = 0; i  IPS_MAX_ADAPTERS; i++) {
-   ha = ips_ha[i];
-   if (ha) {
-   if ((pci_dev-bus-number == ha-pcidev-bus-number) 
-   (pci_dev-devfn == ha-pcidev-devfn)) {
-   sh = ips_sh[i];
-   ips_release(sh);
-   }
-   }
-   }
+   pci_set_drvdata(pci_dev, NULL);
+
+   ips_release(sh);
+
+   pci_release_regions(pci_dev);
+   pci_disable_device(pci_dev);
 }
 
 //
@@ -6947,12 +6935,17 @@ module_exit(ips_module_exit);
 static int __devinit
 ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent)
 {
-   int uninitialized_var(index);
+   int index = -1;
int rc;
 
METHOD_TRACE(ips_insert_device, 1);
-   if (pci_enable_device(pci_dev))
-   return -1;
+   rc = pci_enable_device(pci_dev);
+   if (rc)
+   return rc;
+
+   rc = pci_request_regions(pci_dev, ips);
+   if (rc)
+   goto err_out;
 
rc = ips_init_phase1(pci_dev, index);
if (rc == SUCCESS)
@@ -6968,6 +6961,19 @@ ips_insert_device(struct pci_dev *pci_de
ips_num_controllers++;
 
ips_next_controller = ips_num_controllers;
+
+   if (rc  0) {
+   rc = -ENODEV;
+   goto err_out_regions;
+   }
+
+   pci_set_drvdata(pci_dev, ips_sh[index]);
+   return 0;
+
+err_out_regions:
+   pci_release_regions(pci_dev);
+err_out:
+   pci_disable_device(pci_dev);
return rc;
 }
 
@@ -7000,7 +7006,7 @@ ips_init_phase1(struct pci_dev *pci_dev,
METHOD_TRACE(ips_init_phase1, 1);
index = IPS_MAX_ADAPTERS;
for (j = 0; j  IPS_MAX_ADAPTERS; j++) {
-   if (ips_ha[j] == 0) {
+   if (ips_ha[j] == NULL) {
index = j;
break;
}
@@ -7037,32 +7043,17 @@ ips_init_phase1(struct pci_dev *pci_dev,
uint32_t base;
uint32_t offs;
 
-   if (!request_mem_region(mem_addr, mem_len, ips)) {
-   IPS_PRINTK(KERN_WARNING, pci_dev,
-  Couldn't allocate IO Memory space %x len 
%d.\n,
-  mem_addr, mem_len);
-   return -1;
-   }
-
base = mem_addr  PAGE_MASK;
offs = mem_addr - base;
ioremap_ptr = ioremap(base, PAGE_SIZE);
+   if (!ioremap_ptr)
+   return -1;
mem_ptr = ioremap_ptr + offs;
} else {
ioremap_ptr = NULL;
mem_ptr = NULL;
}
 
-   /* setup I/O mapped area (if applicable) */
-   if (io_addr) {
-   if (!request_region(io_addr, io_len, ips)) {
-   IPS_PRINTK(KERN_WARNING, pci_dev,
-  Couldn't allocate IO space %x len %d.\n,
-  io_addr, io_len);
-   return -1;
-   }
-   }
-
/* found a controller */
ha = kzalloc(sizeof (ips_ha_t), GFP_KERNEL);
if (ha == NULL) {
@@ -7071,7 +7062,6 @@ 

[patch 08/23] ips: remove ips_ha members that duplicate struct pci_dev members

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |  178 ---
 drivers/scsi/ips.h |   20 +---
 2 files changed, 91 insertions(+), 107 deletions(-)

diff -puN 
drivers/scsi/ips.c~ips-remove-ips_ha-members-that-duplicate-struct-pci_dev-members
 drivers/scsi/ips.c
--- 
a/drivers/scsi/ips.c~ips-remove-ips_ha-members-that-duplicate-struct-pci_dev-members
+++ a/drivers/scsi/ips.c
@@ -707,7 +707,7 @@ ips_release(struct Scsi_Host *sh)
release_region(ha-io_addr, ha-io_len);
 
/* free IRQ */
-   free_irq(ha-irq, ha);
+   free_irq(ha-pcidev-irq, ha);
 
scsi_host_put(sh);
 
@@ -1637,7 +1637,7 @@ ips_make_passthru(ips_ha_t *ha, struct s
return (IPS_FAILURE);
}
 
-   if (ha-device_id == IPS_DEVICEID_COPPERHEAD 
+   if (ha-pcidev-device == IPS_DEVICEID_COPPERHEAD 
pt-CoppCP.cmd.flashfw.op_code ==
IPS_CMD_RW_BIOSFW) {
ret = ips_flash_copperhead(ha, pt, scb);
@@ -2021,7 +2021,7 @@ ips_cleanup_passthru(ips_ha_t * ha, ips_
pt-ExtendedStatus = scb-extended_status;
pt-AdapterType = ha-ad_type;
 
-   if (ha-device_id == IPS_DEVICEID_COPPERHEAD 
+   if (ha-pcidev-device == IPS_DEVICEID_COPPERHEAD 
(scb-cmd.flashfw.op_code == IPS_CMD_DOWNLOAD ||
 scb-cmd.flashfw.op_code == IPS_CMD_RW_BIOSFW))
ips_free_flash_copperhead(ha);
@@ -2075,7 +2075,7 @@ ips_host_info(ips_ha_t * ha, char *ptr, 
  ha-mem_ptr);
}
 
-   copy_info(info, \tIRQ number: %d\n, ha-irq);
+   copy_info(info, \tIRQ number: %d\n, 
ha-pcidev-irq);
 
 /* For the Next 3 lines Check for Binary 0 at the end and don't include it 
if it's there. */
 /* That keeps everything happy for text operations on the proc file. 
   */
@@ -2232,31 +2232,31 @@ ips_identify_controller(ips_ha_t * ha)
 {
METHOD_TRACE(ips_identify_controller, 1);
 
-   switch (ha-device_id) {
+   switch (ha-pcidev-device) {
case IPS_DEVICEID_COPPERHEAD:
-   if (ha-revision_id = IPS_REVID_SERVERAID) {
+   if (ha-pcidev-revision = IPS_REVID_SERVERAID) {
ha-ad_type = IPS_ADTYPE_SERVERAID;
-   } else if (ha-revision_id == IPS_REVID_SERVERAID2) {
+   } else if (ha-pcidev-revision == IPS_REVID_SERVERAID2) {
ha-ad_type = IPS_ADTYPE_SERVERAID2;
-   } else if (ha-revision_id == IPS_REVID_NAVAJO) {
+   } else if (ha-pcidev-revision == IPS_REVID_NAVAJO) {
ha-ad_type = IPS_ADTYPE_NAVAJO;
-   } else if ((ha-revision_id == IPS_REVID_SERVERAID2)
+   } else if ((ha-pcidev-revision == IPS_REVID_SERVERAID2)
(ha-slot_num == 0)) {
ha-ad_type = IPS_ADTYPE_KIOWA;
-   } else if ((ha-revision_id = IPS_REVID_CLARINETP1) 
-  (ha-revision_id = IPS_REVID_CLARINETP3)) {
+   } else if ((ha-pcidev-revision = IPS_REVID_CLARINETP1) 
+  (ha-pcidev-revision = IPS_REVID_CLARINETP3)) {
if (ha-enq-ucMaxPhysicalDevices == 15)
ha-ad_type = IPS_ADTYPE_SERVERAID3L;
else
ha-ad_type = IPS_ADTYPE_SERVERAID3;
-   } else if ((ha-revision_id = IPS_REVID_TROMBONE32) 
-  (ha-revision_id = IPS_REVID_TROMBONE64)) {
+   } else if ((ha-pcidev-revision = IPS_REVID_TROMBONE32) 
+  (ha-pcidev-revision = IPS_REVID_TROMBONE64)) {
ha-ad_type = IPS_ADTYPE_SERVERAID4H;
}
break;
 
case IPS_DEVICEID_MORPHEUS:
-   switch (ha-subdevice_id) {
+   switch (ha-pcidev-subsystem_device) {
case IPS_SUBDEVICEID_4L:
ha-ad_type = IPS_ADTYPE_SERVERAID4L;
break;
@@ -2285,7 +2285,7 @@ ips_identify_controller(ips_ha_t * ha)
break;
 
case IPS_DEVICEID_MARCO:
-   switch (ha-subdevice_id) {
+   switch (ha-pcidev-subsystem_device) {
case IPS_SUBDEVICEID_6M:
ha-ad_type = IPS_ADTYPE_SERVERAID6M;
break;
@@ -2332,20 +2332,20 @@ ips_get_bios_version(ips_ha_t * ha, int 
 
strncpy(ha-bios_version,?, 8);
 
-   if (ha-device_id == IPS_DEVICEID_COPPERHEAD) {
+   if (ha-pcidev-device == IPS_DEVICEID_COPPERHEAD) {
 

[patch 09/23] ips: trim trailing whitespace

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

[EMAIL PROTECTED]: coding style fixes]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |   49 +--
 drivers/scsi/ips.h |   12 +-
 2 files changed, 31 insertions(+), 30 deletions(-)

diff -puN drivers/scsi/ips.c~ips-trim-trailing-whitespace drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~ips-trim-trailing-whitespace
+++ a/drivers/scsi/ips.c
@@ -389,17 +389,17 @@ static struct  pci_device_id  ips_pci_ta
 MODULE_DEVICE_TABLE( pci, ips_pci_table );
 
 static char ips_hot_plug_name[] = ips;
-   
+
 static int __devinit  ips_insert_device(struct pci_dev *pci_dev, const struct 
pci_device_id *ent);
 static void __devexit ips_remove_device(struct pci_dev *pci_dev);
-   
+
 static struct pci_driver ips_pci_driver = {
.name   = ips_hot_plug_name,
.id_table   = ips_pci_table,
.probe  = ips_insert_device,
.remove = __devexit_p(ips_remove_device),
 };
-   
+
 
 /*
  * Necessary forward function protoypes
@@ -587,7 +587,7 @@ static void
 ips_setup_funclist(ips_ha_t * ha)
 {
 
-   /*
+   /*
 * Setup Functions
 */
if (IPS_IS_MORPHEUS(ha) || IPS_IS_MARCO(ha)) {
@@ -2081,7 +2081,7 @@ ips_host_info(ips_ha_t * ha, char *ptr, 
 /* That keeps everything happy for text operations on the proc file. 
   */
 
if (le32_to_cpu(ha-nvram-signature) == IPS_NVRAM_P5_SIG) {
-if (ha-nvram-bios_low[3] == 0) { 
+   if (ha-nvram-bios_low[3] == 0) {
 copy_info(info,
  \tBIOS Version  : 
%c%c%c%c%c%c%c\n,
  ha-nvram-bios_high[0], 
ha-nvram-bios_high[1],
@@ -2780,10 +2780,11 @@ ips_next(ips_ha_t * ha, int intr)
scb-dcdb.cmd_attribute =
ips_command_direction[scb-scsi_cmd-cmnd[0]];
 
-/* Allow a WRITE BUFFER Command to Have no Data */
-/* This is Used by Tape Flash Utilites  */
-if ((scb-scsi_cmd-cmnd[0] == WRITE_BUFFER)  (scb-data_len == 0)) 
-scb-dcdb.cmd_attribute = 0;  
+   /* Allow a WRITE BUFFER Command to Have no Data */
+   /* This is Used by Tape Flash Utilites  */
+   if ((scb-scsi_cmd-cmnd[0] == WRITE_BUFFER) 
+   (scb-data_len == 0))
+   scb-dcdb.cmd_attribute = 0;
 
if (!(scb-dcdb.cmd_attribute  0x3))
scb-dcdb.transfer_length = 0;
@@ -3404,7 +3405,7 @@ ips_map_status(ips_ha_t * ha, ips_scb_t 
 
/* Restrict access to physical DASD */
if (scb-scsi_cmd-cmnd[0] == INQUIRY) {
-   ips_scmd_buf_read(scb-scsi_cmd, 
+   ips_scmd_buf_read(scb-scsi_cmd,
   inquiryData, sizeof (inquiryData));
if ((inquiryData.DeviceType  0x1f) == 
TYPE_DISK) {
errcode = DID_TIME_OUT;
@@ -4090,10 +4091,10 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS 
scb-scsi_cmd-result = errcode  16;
} else {/* bus == 0 */
/* restrict access to physical drives */
-   if (scb-scsi_cmd-cmnd[0] == INQUIRY) { 
-   ips_scmd_buf_read(scb-scsi_cmd, 
+   if (scb-scsi_cmd-cmnd[0] == INQUIRY) {
+   ips_scmd_buf_read(scb-scsi_cmd,
   inquiryData, sizeof (inquiryData));
-   if ((inquiryData.DeviceType  0x1f) == TYPE_DISK) 
+   if ((inquiryData.DeviceType  0x1f) == TYPE_DISK)
scb-scsi_cmd-result = DID_TIME_OUT  16;
}
}   /* else */
@@ -4661,8 +4662,8 @@ ips_isinit_morpheus(ips_ha_t * ha)
uint32_t bits;
 
METHOD_TRACE(ips_is_init_morpheus, 1);
-   
-   if (ips_isintr_morpheus(ha)) 
+
+   if (ips_isintr_morpheus(ha))
ips_flush_and_reset(ha);
 
post = readl(ha-mem_ptr + IPS_REG_I960_MSG0);
@@ -4686,7 +4687,7 @@ ips_isinit_morpheus(ips_ha_t * ha)
 /*   state ( was trying to INIT and an interrupt was already pending ) ...  */
 /*  */
 //
-static void 
+static void
 ips_flush_and_reset(ips_ha_t *ha)
 {
ips_scb_t *scb;
@@ -4718,9 +4719,9 @@ ips_flush_and_reset(ips_ha_t *ha)
if (ret == IPS_SUCCESS) {
time = 60 * 

[patch 07/23] hptiop: fix type mismatch warning

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

drivers/scsi/hptiop.c: In function 'hptiop_host_request_callback':
drivers/scsi/hptiop.c:378: warning: comparison of distinct pointer types lacks 
a cast
drivers/scsi/hptiop.c:378: warning: comparison of distinct pointer types lacks 
a cast

Use min_t(size_t, ...) to fix.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: HighPoint Linux Team [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/hptiop.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/hptiop.c~hptiop-fix-type-mismatch-warning 
drivers/scsi/hptiop.c
--- a/drivers/scsi/hptiop.c~hptiop-fix-type-mismatch-warning
+++ a/drivers/scsi/hptiop.c
@@ -376,7 +376,7 @@ static void hptiop_host_request_callback
memset(scp-sense_buffer,
0, sizeof(scp-sense_buffer));
memcpy(scp-sense_buffer, req-sg_list,
-   min(sizeof(scp-sense_buffer),
+   min_t(size_t, sizeof(scp-sense_buffer),
le32_to_cpu(req-dataxfer_length)));
break;
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 05/23] initio: fix conflict when loading driver

2007-11-21 Thread akpm
From: Alan Cox [EMAIL PROTECTED]

 I have a scanner connected to a Initio INI-950 SCSI card and I recently
 upgraded from SuSE 10.2 to 10.3.  The new kernel doesn't see any of my
 devices.  I get the following in /var/log/messages:

 ACPI: PCI Interrupt :00:0a.0[A] - GSI 17 (level, low) - IRQ 16
 initio: I/O port range 0x0 is busy.
 ACPI: PCI interrupt for device :00:0a.0 disabled

Humm not a collision - thats a bug in the driver updating.  Looks like the
changes I made and combined with Christoph's lost a line somewhere when I
was merging it all.  Try the following

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Cc: Scott Simpson [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/initio.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/scsi/initio.c~initio-fix-conflict-when-loading-driver 
drivers/scsi/initio.c
--- a/drivers/scsi/initio.c~initio-fix-conflict-when-loading-driver
+++ a/drivers/scsi/initio.c
@@ -2867,6 +2867,7 @@ static int initio_probe_one(struct pci_d
}
host = (struct initio_host *)shost-hostdata;
memset(host, 0, sizeof(struct initio_host));
+   host-addr = pci_resource_start(pdev, 0);
 
if (!request_region(host-addr, 256, i91u)) {
printk(KERN_WARNING initio: I/O port range 0x%x is busy.\n, 
host-addr);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 23/23] Dell CERC support for megaraid_mbox

2007-11-21 Thread akpm
From: Hannes Reinecke [EMAIL PROTECTED]

Newer Dell CERC firmware (= 6.62) implement a random deletion handling
compatible with the legacy megaraid driver.  The legacy handling shifted
the target ID by 0x80 only for I/O commands (READ/WRITE/etc), whereas
megaraid_mbox shifts the target ID always if random deletion is supported. 
The resulted in megaraid_mbox sending an INQUIRY to the wrong channel, and
not finding any devices, obviously.

So we disable the random deletion support if the offending firmware is
found.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=6695

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
Cc: Patro, Sumant [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_mbox.c |   17 +
 drivers/scsi/megaraid/megaraid_mbox.h |1 +
 2 files changed, 18 insertions(+)

diff -puN 
drivers/scsi/megaraid/megaraid_mbox.c~dell-cerc-support-for-megaraid_mbox 
drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c~dell-cerc-support-for-megaraid_mbox
+++ a/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3169,6 +3169,23 @@ megaraid_mbox_support_random_del(adapter
uint8_t raw_mbox[sizeof(mbox_t)];
int rval;
 
+   /*
+* Newer firmware on Dell CERC expect a different
+* random deletion handling, so disable it.
+*/
+   if (adapter-pdev-vendor == PCI_VENDOR_ID_AMI 
+   adapter-pdev-device == PCI_DEVICE_ID_AMI_MEGARAID3 
+   adapter-pdev-subsystem_vendor == PCI_VENDOR_ID_DELL 
+   adapter-pdev-subsystem_device == PCI_SUBSYS_ID_CERC_ATA100_4CH 
+   (adapter-fw_version[0]  '6' ||
+(adapter-fw_version[0] == '6' 
+ adapter-fw_version[2]  '6') ||
+(adapter-fw_version[0] == '6'
+  adapter-fw_version[2] == '6'
+  adapter-fw_version[3]  '1'))) {
+   con_log(CL_DLEVEL1, (megaraid: disable random deletion\n));
+   return 0;
+   }
 
mbox = (mbox_t *)raw_mbox;
 
diff -puN 
drivers/scsi/megaraid/megaraid_mbox.h~dell-cerc-support-for-megaraid_mbox 
drivers/scsi/megaraid/megaraid_mbox.h
--- a/drivers/scsi/megaraid/megaraid_mbox.h~dell-cerc-support-for-megaraid_mbox
+++ a/drivers/scsi/megaraid/megaraid_mbox.h
@@ -88,6 +88,7 @@
 #define PCI_SUBSYS_ID_PERC3_QC 0x0471
 #define PCI_SUBSYS_ID_PERC3_DC 0x0493
 #define PCI_SUBSYS_ID_PERC3_SC 0x0475
+#define PCI_SUBSYS_ID_CERC_ATA100_4CH  0x0511
 
 
 #define MBOX_MAX_SCSI_CMDS 128 // number of cmds reserved for kernel
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 18/23] aic94: fix section mismatches

2007-11-21 Thread akpm
From: Randy Dunlap [EMAIL PROTECTED]

Fix section mismatch warning:

WARNING: vmlinux.o(.init.text+0x23be6): Section mismatch: reference to 
.exit.text:asd_unmap_ha (between 'asd_pci_probe' and 'qla4xxx_module_init')
+
WARNING: vmlinux.o(.text+0x1ec8a8): Section mismatch: reference to .exit.text:as
d_unmap_ioport (between 'asd_unmap_ha' and 'asd_remove_dev_attrs')
WARNING: vmlinux.o(.text+0x1ec8b1): Section mismatch: reference to .exit.text:as
d_unmap_memio (between 'asd_unmap_ha' and 'asd_remove_dev_attrs')

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aic94xx/aic94xx_init.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/aic94xx/aic94xx_init.c~aic94-fix-section-mismatches 
drivers/scsi/aic94xx/aic94xx_init.c
--- a/drivers/scsi/aic94xx/aic94xx_init.c~aic94-fix-section-mismatches
+++ a/drivers/scsi/aic94xx/aic94xx_init.c
@@ -136,7 +136,7 @@ Err:
return err;
 }
 
-static void __devexit asd_unmap_memio(struct asd_ha_struct *asd_ha)
+static void asd_unmap_memio(struct asd_ha_struct *asd_ha)
 {
struct asd_ha_addrspace *io_handle;
 
@@ -173,7 +173,7 @@ static int __devinit asd_map_ioport(stru
return err;
 }
 
-static void __devexit asd_unmap_ioport(struct asd_ha_struct *asd_ha)
+static void asd_unmap_ioport(struct asd_ha_struct *asd_ha)
 {
pci_release_region(asd_ha-pcidev, PCI_IOBAR_OFFSET);
 }
@@ -210,7 +210,7 @@ Err:
return err;
 }
 
-static void __devexit asd_unmap_ha(struct asd_ha_struct *asd_ha)
+static void asd_unmap_ha(struct asd_ha_struct *asd_ha)
 {
if (asd_ha-iospace)
asd_unmap_ioport(asd_ha);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 21/23] scsi/advansys.c: make 3 functions static

2007-11-21 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/advansys.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/advansys.c~scsi-advansysc-make-3-functions-static 
drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c~scsi-advansysc-make-3-functions-static
+++ a/drivers/scsi/advansys.c
@@ -12261,7 +12261,7 @@ static ushort __devinit AdvReadEEPWord(A
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
-void __devinit
+static void __devinit
 AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
 {
ushort *wbuf;
@@ -12328,7 +12328,7 @@ AdvSet3550EEPConfig(AdvPortAddr iop_base
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
-void __devinit
+static void __devinit
 AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf)
 {
ushort *wbuf;
@@ -12395,7 +12395,7 @@ AdvSet38C0800EEPConfig(AdvPortAddr iop_b
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
-void __devinit
+static void __devinit
 AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf)
 {
ushort *wbuf;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 12/23] MegaRAID driver management char device moved to misc

2007-11-21 Thread akpm
From: Thomas Horsten [EMAIL PROTECTED]

The MegaRAID driver's common management module (megaraid_mm.c) creates a
char device used by the management tool megarc from LSI Logic (and
possibly other management tools).

In 2.6 with udev, this device doesn't get created because it is not
registered in sysfs.

I first fixed this by registering a class megaraid_mm, but realized that
this should probably be moved to misc devices, instead of taking up a char
major.  This is because only 1 device is used, even if there are multiple
adapters - the minor is never used (the adapter info is in the ioctl block
sent to the driver, not detected based on the minor number as one might
think).  So it is a complete waste to have an entire major taken by this.

So it now uses a misc device which I named megadev0 (the name that megarc
expects), and has a dynamic minor (previoulsy a dynamic major was used).

I have tested this on my own system with the megarc tool, and it works just
as fine as before (only now the device gets created correctly by udev).

Cc: [EMAIL PROTECTED]
Cc: Neela Syam Kolli [EMAIL PROTECTED]
Cc: Ju, Seokmann [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_mm.c |   20 +---
 drivers/scsi/megaraid/megaraid_mm.h |1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff -puN 
drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
 drivers/scsi/megaraid/megaraid_mm.c
--- 
a/drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.c
@@ -59,7 +59,6 @@ EXPORT_SYMBOL(mraid_mm_register_adp);
 EXPORT_SYMBOL(mraid_mm_unregister_adp);
 EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
 
-static int majorno;
 static uint32_t drvr_ver   = 0x02200207;
 
 static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_
.owner  = THIS_MODULE,
 };
 
+static struct miscdevice megaraid_mm_dev = {
+   .minor  = MISC_DYNAMIC_MINOR,
+   .name   = megadev0,
+   .fops   = lsi_fops,
+};
+
 /**
  * mraid_mm_open - open routine for char node interface
  * @inode  : unused
@@ -1184,15 +1189,16 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_
 static int __init
 mraid_mm_init(void)
 {
+   int err;
+
// Announce the driver version
con_log(CL_ANN, (KERN_INFO megaraid cmm: %s %s\n,
LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION));
 
-   majorno = register_chrdev(0, megadev, lsi_fops);
-
-   if (majorno  0) {
-   con_log(CL_ANN, (megaraid cmm: cannot get major\n));
-   return majorno;
+   err = misc_register(megaraid_mm_dev);
+   if (err  0) {
+   con_log(CL_ANN, (megaraid cmm: cannot register misc 
device\n));
+   return err;
}
 
init_waitqueue_head(wait_q);
@@ -1230,7 +1236,7 @@ mraid_mm_exit(void)
 {
con_log(CL_DLEVEL1 , (exiting common mod\n));
 
-   unregister_chrdev(majorno, megadev);
+   misc_deregister(megaraid_mm_dev);
 }
 
 module_init(mraid_mm_init);
diff -puN 
drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
 drivers/scsi/megaraid/megaraid_mm.h
--- 
a/drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.h
@@ -22,6 +22,7 @@
 #include linux/moduleparam.h
 #include linux/pci.h
 #include linux/list.h
+#include linux/miscdevice.h
 
 #include mbox_defs.h
 #include megaraid_ioctl.h
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 22/23] scsi/qla2xxx/: possible cleanups

2007-11-21 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

- make the following needlessly global code static:
  - qla_attr.c: qla24xx_vport_delete()
  - qla_attr.c: qla24xx_vport_disable()
  - qla_mid.c: qla24xx_allocate_vp_id()
  - qla_mid.c: qla24xx_find_vhost_by_name()
  - qla_mid.c: qla2x00_do_dpc_vp()
  - qla_os.c: struct qla2x00_driver_template
  - qla_os.c: qla2x00_stop_timer()
  - qla_os.c: qla2x00_mem_alloc()
  - qla_os.c: qla2x00_mem_free()
  - qla_sup.c: qla2x00_lock_nvram_access()
  - qla_sup.c: qla2x00_unlock_nvram_access()
  - qla_sup.c: qla2x00_get_nvram_word()
  - qla_sup.c: qla2x00_write_nvram_word()
- #if 0 the following unused global functions:
  - qla_dbg.c: qla2x00_dump_pkt()
  - qla_mbx.c: qla2x00_system_error()
  - qla_mbx.c: qla2x00_get_serdes_params()
  - qla_mbx.c: qla2x00_get_idma_speed()
  - qla_mbx.c: qla24xx_get_vp_database()
  - qla_mbx.c: qla24xx_get_vp_entry()
- qla_os.c: remove some unneeded function prototypes

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/qla2xxx/qla_attr.c |6 +++---
 drivers/scsi/qla2xxx/qla_dbg.c  |2 ++
 drivers/scsi/qla2xxx/qla_gbl.h  |   25 -
 drivers/scsi/qla2xxx/qla_mbx.c  |   10 ++
 drivers/scsi/qla2xxx/qla_mid.c  |6 +++---
 drivers/scsi/qla2xxx/qla_os.c   |   20 ++--
 drivers/scsi/qla2xxx/qla_sup.c  |8 
 7 files changed, 28 insertions(+), 49 deletions(-)

diff -puN drivers/scsi/qla2xxx/qla_attr.c~scsi-qla2xxx-possible-cleanups 
drivers/scsi/qla2xxx/qla_attr.c
--- a/drivers/scsi/qla2xxx/qla_attr.c~scsi-qla2xxx-possible-cleanups
+++ a/drivers/scsi/qla2xxx/qla_attr.c
@@ -9,7 +9,7 @@
 #include linux/kthread.h
 #include linux/vmalloc.h
 
-int qla24xx_vport_disable(struct fc_vport *, bool);
+static int qla24xx_vport_disable(struct fc_vport *, bool);
 
 /* SYSFS attributes - 
*/
 
@@ -1113,7 +1113,7 @@ vport_create_failed_2:
return FC_VPORT_FAILED;
 }
 
-int
+static int
 qla24xx_vport_delete(struct fc_vport *fc_vport)
 {
scsi_qla_host_t *ha = shost_priv(fc_vport-shost);
@@ -1146,7 +1146,7 @@ qla24xx_vport_delete(struct fc_vport *fc
return 0;
 }
 
-int
+static int
 qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
 {
scsi_qla_host_t *vha = fc_vport-dd_data;
diff -puN drivers/scsi/qla2xxx/qla_dbg.c~scsi-qla2xxx-possible-cleanups 
drivers/scsi/qla2xxx/qla_dbg.c
--- a/drivers/scsi/qla2xxx/qla_dbg.c~scsi-qla2xxx-possible-cleanups
+++ a/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1428,6 +1428,7 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd 
printk(  sp flags=0x%x\n, sp-flags);
 }
 
+#if 0
 void
 qla2x00_dump_pkt(void *pkt)
 {
@@ -1442,6 +1443,7 @@ qla2x00_dump_pkt(void *pkt)
}
printk(\n);
 }
+#endif  /*  0  */
 
 #if defined(QL_DEBUG_ROUTINES)
 /*
diff -puN drivers/scsi/qla2xxx/qla_gbl.h~scsi-qla2xxx-possible-cleanups 
drivers/scsi/qla2xxx/qla_gbl.h
--- a/drivers/scsi/qla2xxx/qla_gbl.h~scsi-qla2xxx-possible-cleanups
+++ a/drivers/scsi/qla2xxx/qla_gbl.h
@@ -68,30 +68,20 @@ extern int num_hosts;
 /*
  * Global Functions in qla_mid.c source file.
  */
-extern struct scsi_host_template qla2x00_driver_template;
 extern struct scsi_host_template qla24xx_driver_template;
 extern struct scsi_transport_template *qla2xxx_transport_vport_template;
-extern uint8_t qla2x00_mem_alloc(scsi_qla_host_t *);
 extern void qla2x00_timer(scsi_qla_host_t *);
 extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long);
-extern void qla2x00_stop_timer(scsi_qla_host_t *);
-extern uint32_t qla24xx_allocate_vp_id(scsi_qla_host_t *);
 extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *);
 extern int qla24xx_disable_vp (scsi_qla_host_t *);
 extern int qla24xx_enable_vp (scsi_qla_host_t *);
-extern void qla2x00_mem_free(scsi_qla_host_t *);
 extern int qla24xx_control_vp(scsi_qla_host_t *, int );
 extern int qla24xx_modify_vp_config(scsi_qla_host_t *);
 extern int qla2x00_send_change_request(scsi_qla_host_t *, uint16_t, uint16_t);
 extern void qla2x00_vp_stop_timer(scsi_qla_host_t *);
 extern int qla24xx_configure_vhba (scsi_qla_host_t *);
-extern int qla24xx_get_vp_entry(scsi_qla_host_t *, uint16_t, int);
-extern int qla24xx_get_vp_database(scsi_qla_host_t *, uint16_t);
-extern int qla2x00_do_dpc_vp(scsi_qla_host_t *);
 extern void qla24xx_report_id_acquisition(scsi_qla_host_t *,
 struct vp_rpt_id_entry_24xx *);
-extern scsi_qla_host_t * qla24xx_find_vhost_by_name(scsi_qla_host_t *,
-uint8_t *);
 extern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *);
 extern int qla24xx_vport_create_req_sanity_check(struct fc_vport *);
 extern scsi_qla_host_t * qla24xx_create_vhost(struct fc_vport *);
@@ -113,7 +103,6 @@ extern void qla2xxx_wake_dpc(scsi_qla_ho
 extern void qla2x00_alert_all_vps(scsi_qla_host_t *, uint16_t *);
 extern void qla2x00_async_event(scsi_qla_host_t *, uint16_t *);
 extern void 

[patch 16/23] SCSI/NCR5380: minor irq handler cleanups

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

* remove unnecessary cast

* remove unnecessary use of 'irq' function arg

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/NCR5380.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/NCR5380.c~scsi-ncr5380-minor-irq-handler-cleanups 
drivers/scsi/NCR5380.c
--- a/drivers/scsi/NCR5380.c~scsi-ncr5380-minor-irq-handler-cleanups
+++ a/drivers/scsi/NCR5380.c
@@ -1157,16 +1157,17 @@ static void NCR5380_main(struct work_str
  * Locks: takes the needed instance locks
  */
 
-static irqreturn_t NCR5380_intr(int irq, void *dev_id) 
+static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
 {
NCR5380_local_declare();
-   struct Scsi_Host *instance = (struct Scsi_Host *)dev_id;
+   struct Scsi_Host *instance = dev_id;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) 
instance-hostdata;
int done;
unsigned char basr;
unsigned long flags;
 
-   dprintk(NDEBUG_INTR, (scsi : NCR5380 irq %d triggered\n, irq));
+   dprintk(NDEBUG_INTR, (scsi : NCR5380 irq %d triggered\n,
+   instance-irq));
 
do {
done = 1;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 15/23] SCSI: fix bugs and canonicalize NCR5380_intr drivers

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

* Bug fix:  Make sure request_irq() and free_irq() are called
  with the same dev_id pointer argument.

* Bug fix:  always pass 'irq' and 'dev_id' (aka 'dummy')
  arguments to NCE5380_intr() when calling it manully.  For some drivers
  this doesn't matter, depending on whose copy of NCR5380_intr() is
  being used.

* Bug fix:  always pass Scsi_Host* to NCR5380_intr().  Most
  get this right, but some pass NULL or some other random/ignored
  value.  For some drivers this doesn't matter, depending on whose copy
  of NCR5380_intr() is being used.

* Wrap long request_irq() lines

[EMAIL PROTECTED]: coding style fixes]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/atari_scsi.c|   10 +-
 drivers/scsi/dtc.c   |5 +++--
 drivers/scsi/g_NCR5380.c |5 +++--
 drivers/scsi/mac_scsi.c  |4 ++--
 drivers/scsi/pas16.c |5 +++--
 drivers/scsi/sun3_scsi.c |4 ++--
 drivers/scsi/sun3_scsi_vme.c |4 ++--
 drivers/scsi/t128.c  |5 +++--
 8 files changed, 23 insertions(+), 19 deletions(-)

diff -puN 
drivers/scsi/atari_scsi.c~scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers 
drivers/scsi/atari_scsi.c
--- 
a/drivers/scsi/atari_scsi.c~scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers
+++ a/drivers/scsi/atari_scsi.c
@@ -393,7 +393,7 @@ static irqreturn_t scsi_tt_intr(int irq,
 
 #endif /* REAL_DMA */
 
-   NCR5380_intr(0, 0);
+   NCR5380_intr(irq, dummy);
 
 #if 0
/* To be sure the int is not masked */
@@ -458,7 +458,7 @@ static irqreturn_t scsi_falcon_intr(int 
 
 #endif /* REAL_DMA */
 
-   NCR5380_intr(0, 0);
+   NCR5380_intr(irq, dummy);
return IRQ_HANDLED;
 }
 
@@ -684,7 +684,7 @@ int atari_scsi_detect(struct scsi_host_t
 * interrupt after having cleared the pending flag for the DMA
 * interrupt. */
if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW,
-SCSI NCR5380, scsi_tt_intr)) {
+SCSI NCR5380, instance)) {
printk(KERN_ERR atari_scsi_detect: cannot allocate irq 
%d, aborting,IRQ_TT_MFP_SCSI);
scsi_unregister(atari_scsi_host);
atari_stram_free(atari_dma_buffer);
@@ -701,7 +701,7 @@ int atari_scsi_detect(struct scsi_host_t
 IRQ_TYPE_PRIO, Hades DMA emulator,
 hades_dma_emulator)) {
printk(KERN_ERR atari_scsi_detect: cannot 
allocate irq %d, aborting (MACH_IS_HADES),IRQ_AUTO_2);
-   free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr);
+   free_irq(IRQ_TT_MFP_SCSI, instance);
scsi_unregister(atari_scsi_host);
atari_stram_free(atari_dma_buffer);
atari_dma_buffer = 0;
@@ -761,7 +761,7 @@ int atari_scsi_detect(struct scsi_host_t
 int atari_scsi_release(struct Scsi_Host *sh)
 {
if (IS_A_TT())
-   free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr);
+   free_irq(IRQ_TT_MFP_SCSI, sh);
if (atari_dma_buffer)
atari_stram_free(atari_dma_buffer);
return 1;
diff -puN 
drivers/scsi/dtc.c~scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers 
drivers/scsi/dtc.c
--- a/drivers/scsi/dtc.c~scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers
+++ a/drivers/scsi/dtc.c
@@ -277,7 +277,8 @@ found:
/* With interrupts enabled, it will sometimes hang when doing 
heavy
 * reads. So better not enable them until I finger it out. */
if (instance-irq != SCSI_IRQ_NONE)
-   if (request_irq(instance-irq, dtc_intr, IRQF_DISABLED, 
dtc, instance)) {
+   if (request_irq(instance-irq, dtc_intr, IRQF_DISABLED,
+   dtc, instance)) {
printk(KERN_ERR scsi%d : IRQ%d not free, 
interrupts disabled\n, instance-host_no, instance-irq);
instance-irq = SCSI_IRQ_NONE;
}
@@ -459,7 +460,7 @@ static int dtc_release(struct Scsi_Host 
NCR5380_local_declare();
NCR5380_setup(shost);
if (shost-irq)
-   free_irq(shost-irq, NULL);
+   free_irq(shost-irq, shost);
NCR5380_exit(shost);
if (shost-io_port  shost-n_io_port)
release_region(shost-io_port, shost-n_io_port);
diff -puN 
drivers/scsi/g_NCR5380.c~scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers 
drivers/scsi/g_NCR5380.c
--- 
a/drivers/scsi/g_NCR5380.c~scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers
+++ a/drivers/scsi/g_NCR5380.c
@@ -460,7 +460,8 @@ int __init generic_NCR5380_detect(struct
  

[patch 11/23] ips: handle scsi_add_host() failure, and other err cleanups

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |   18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff -puN 
drivers/scsi/ips.c~ips-handle-scsi_add_host-failure-and-other-err-cleanups 
drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~ips-handle-scsi_add_host-failure-and-other-err-cleanups
+++ a/drivers/scsi/ips.c
@@ -6837,13 +6837,10 @@ ips_register_scsi(int index)
if (request_irq(ha-pcidev-irq, do_ipsintr, IRQF_SHARED, ips_name, 
ha)) {
IPS_PRINTK(KERN_WARNING, ha-pcidev,
   Unable to install interrupt handler\n);
-   scsi_host_put(sh);
-   return -1;
+   goto err_out_sh;
}
 
kfree(oldha);
-   ips_sh[index] = sh;
-   ips_ha[index] = ha;
 
/* Store away needed values for later use */
sh-unique_id = (ha-io_addr) ? ha-io_addr : ha-mem_addr;
@@ -6859,10 +6856,21 @@ ips_register_scsi(int index)
sh-max_channel = ha-nbus - 1;
sh-can_queue = ha-max_cmds - 1;
 
-   scsi_add_host(sh, NULL);
+   if (scsi_add_host(sh, ha-pcidev-dev))
+   goto err_out;
+
+   ips_sh[index] = sh;
+   ips_ha[index] = ha;
+
scsi_scan_host(sh);
 
return 0;
+
+err_out:
+   free_irq(ha-pcidev-irq, ha);
+err_out_sh:
+   scsi_host_put(sh);
+   return -1;
 }
 
 /*---*/
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 14/23] SCSI/sym53c416: kill pointless irq handler loop and test

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

- kill pointless irq handler loop to find base address, it is already
  passed to irq handler via Scsi_Host.

- kill now-pointless !base test.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c416.c |   16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff -puN 
drivers/scsi/sym53c416.c~scsi-sym53c416-kill-pointless-irq-handler-loop-and-test
 drivers/scsi/sym53c416.c
--- 
a/drivers/scsi/sym53c416.c~scsi-sym53c416-kill-pointless-irq-handler-loop-and-test
+++ a/drivers/scsi/sym53c416.c
@@ -328,27 +328,13 @@ static __inline__ unsigned int sym53c416
 static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id)
 {
struct Scsi_Host *dev = dev_id;
-   int base = 0;
+   int base = dev-io_port;
int i;
unsigned long flags = 0;
unsigned char status_reg, pio_int_reg, int_reg;
struct scatterlist *sg;
unsigned int tot_trans = 0;
 
-   /* We search the base address of the host adapter which caused the 
interrupt */
-   /* FIXME: should pass dev_id sensibly as hosts[i] */
-   for(i = 0; i  host_index  !base; i++)
-   if(irq == hosts[i].irq)
-   base = hosts[i].base;
-   /* If no adapter found, we cannot handle the interrupt. Leave a message 
*/
-   /* and continue. This should never happen...
*/
-   if(!base)
-   {
-   printk(KERN_ERR sym53c416: No host adapter defined for 
interrupt %d\n, irq);
-   return IRQ_NONE;
-   }
-   /* Now we have the base address and we can start handling the interrupt 
*/
-
spin_lock_irqsave(dev-host_lock,flags);
status_reg = inb(base + STATUS_REG);
pio_int_reg = inb(base + PIO_INT_REG);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 13/23] SCSI/gdth: kill unneeded 'irq' argument

2007-11-21 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Neither gdth_get_status() nor __gdth_interrupt() need their 'irq' argument,
so remove it.

[EMAIL PROTECTED]: coding style fixes]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Acked-by: Boaz Harrosh [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff -puN drivers/scsi/gdth.c~scsi-gdth-kill-unneeded-irq-argument 
drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~scsi-gdth-kill-unneeded-irq-argument
+++ a/drivers/scsi/gdth.c
@@ -141,7 +141,7 @@
 static void gdth_delay(int milliseconds);
 static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int 
*secs);
 static irqreturn_t gdth_interrupt(int irq, void *dev_id);
-static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq,
+static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
 int gdth_from_wait, int* pIndex);
 static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
Scsi_Cmnd *scp);
@@ -165,7 +165,6 @@ static int gdth_internal_cache_cmd(gdth_
 static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
 
 static void gdth_enable_int(gdth_ha_str *ha);
-static unchar gdth_get_status(gdth_ha_str *ha, int irq);
 static int gdth_test_busy(gdth_ha_str *ha);
 static int gdth_get_cmd_index(gdth_ha_str *ha);
 static void gdth_release_event(gdth_ha_str *ha);
@@ -1334,14 +1333,12 @@ static void __init gdth_enable_int(gdth_
 }
 
 /* return IStatus if interrupt was from this card else 0 */
-static unchar gdth_get_status(gdth_ha_str *ha, int irq)
+static unchar gdth_get_status(gdth_ha_str *ha)
 {
 unchar IStatus = 0;
 
-TRACE((gdth_get_status() irq %d ctr_count %d\n, irq, gdth_ctr_count));
+TRACE((gdth_get_status() irq %d ctr_count %d\n, ha-irq, 
gdth_ctr_count));
 
-if (ha-irq != (unchar)irq) /* check IRQ */
-return false;
 if (ha-type == GDT_EISA)
 IStatus = inb((ushort)ha-bmic + EDOORREG);
 else if (ha-type == GDT_ISA)
@@ -1523,7 +1520,7 @@ static int gdth_wait(gdth_ha_str *ha, in
 return 1;   /* no wait required */
 
 do {
-__gdth_interrupt(ha, (int)ha-irq, true, wait_index);
+   __gdth_interrupt(ha, true, wait_index);
 if (wait_index == index) {
 answer_found = TRUE;
 break;
@@ -3036,7 +3033,7 @@ static void gdth_clear_events(void)
 
 /* SCSI interface functions */
 
-static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq,
+static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
 int gdth_from_wait, int* pIndex)
 {
 gdt6m_dpram_str __iomem *dp6m_ptr = NULL;
@@ -3054,7 +3051,7 @@ static irqreturn_t __gdth_interrupt(gdth
 int act_int_coal = 0;   
 #endif
 
-TRACE((gdth_interrupt() IRQ %d\n,irq));
+TRACE((gdth_interrupt() IRQ %d\n, ha-irq));
 
 /* if polling and not from gdth_wait() - return */
 if (gdth_polling) {
@@ -3067,7 +3064,8 @@ static irqreturn_t __gdth_interrupt(gdth
 spin_lock_irqsave(ha-smp_lock, flags);
 
 /* search controller */
-if (0 == (IStatus = gdth_get_status(ha, irq))) {
+IStatus = gdth_get_status(ha);
+if (IStatus == 0) {
 /* spurious interrupt */
 if (!gdth_polling)
 spin_unlock_irqrestore(ha-smp_lock, flags);
@@ -3294,9 +3292,9 @@ static irqreturn_t __gdth_interrupt(gdth
 
 static irqreturn_t gdth_interrupt(int irq, void *dev_id)
 {
-   gdth_ha_str *ha = (gdth_ha_str *)dev_id;
+   gdth_ha_str *ha = dev_id;
 
-   return __gdth_interrupt(ha, irq, false, NULL);
+   return __gdth_interrupt(ha, false, NULL);
 }
 
 static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 20/23] aacraid driver fails with Dell PowerEdge Expandable RAID Controller 3/Di

2007-11-21 Thread akpm
From: Salyzyn, Mark [EMAIL PROTECTED]

As reported in http://bugzilla.kernel.org/show_bug.cgi?id=3D9133 it was
discovered that the PERC line of controllers lacked a key 64 bit
ScatterGather capable SCSI pass-through function. The adapters are still
capable of 64 bit ScatterGather I/O commands, but these two can not be
mixed. This problem was exacerbated by the introduction of the SCSI
Generic access to the DASD physical devices.

The fix for users before this patch is applied is aacraid.dacmode=3D0 on
the kernel command line to disable 64 bit I/O.

The enclosed patch introduces a new adapter quirk and tries to limp
along by enabling pass-through in situations where memory is 32 bit
addressable on 64 bit machines, or disable the pass-through functions
altogether. I expect that the check for 32 bit addressable memory to be
controversial in that it can be incorrect in non-Dell non-Intel systems
that PERC would never be installed under, the alternative is to disable
pass-through in all cases which could be reported as another regression.

Pass-through is used for SCSI Generic access to the physical devices, or
for the management applications to properly function.

In systems where this patch has disabled pass-through because it is
unsupportable in combination with I/O performance, the user can choose
to enable pass-through by turning off dacmode (aacraid.dacmode=3D0) or
limiting the discovered kernel memory (mem=3D4G) with an associated loss
in runtime performance. If we chose instead to turn off 64 bit dacmode
for the adapters with this quirk, then this would be reported as another
regression.

Signed-off-by: Mark Salyzyn [EMAIL PROTECTED]
Cc: Marcin Krol [EMAIL PROTECTED]
Cc: Matt Domsch [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aacraid/aachba.c  |   15 ++-
 drivers/scsi/aacraid/aacraid.h |6 
 drivers/scsi/aacraid/commsup.c |6 ++--
 drivers/scsi/aacraid/linit.c   |   42 +--
 4 files changed, 47 insertions(+), 22 deletions(-)

diff -puN 
drivers/scsi/aacraid/aachba.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
 drivers/scsi/aacraid/aachba.c
--- 
a/drivers/scsi/aacraid/aachba.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
+++ a/drivers/scsi/aacraid/aachba.c
@@ -1190,6 +1190,15 @@ static int aac_scsi_32(struct fib * fib,
  (fib_callback) aac_srb_callback, (void *) 
cmd);
 }
 
+static int aac_scsi_32_64(struct fib * fib, struct scsi_cmnd * cmd)
+{
+   if ((sizeof(dma_addr_t)  4) 
+(num_physpages  (0xULL  PAGE_SHIFT)) 
+(fib-dev-adapter_info.options  AAC_OPT_SGMAP_HOST64))
+   return FAILED;
+   return aac_scsi_32(fib, cmd);
+}
+
 int aac_get_adapter_info(struct aac_dev* dev)
 {
struct fib* fibptr;
@@ -1267,6 +1276,8 @@ int aac_get_adapter_info(struct aac_dev*
 1, 1,
 NULL, NULL);
 
+   /* reasoned default */
+   dev-maximum_num_physicals = 16;
if (rcode = 0  le32_to_cpu(bus_info-Status) == ST_OK) {
dev-maximum_num_physicals = 
le32_to_cpu(bus_info-TargetsPerBus);
dev-maximum_num_channels = le32_to_cpu(bus_info-BusCount);
@@ -1376,7 +1387,9 @@ int aac_get_adapter_info(struct aac_dev*
 * interface.
 */
dev-a_ops.adapter_scsi = (dev-dac_support)
-   ? aac_scsi_64
+ ? ((aac_get_driver_ident(dev-cardtype)-quirks  AAC_QUIRK_SCSI_32)
+   ? aac_scsi_32_64
+   : aac_scsi_64)
: aac_scsi_32;
if (dev-raw_io_interface) {
dev-a_ops.adapter_bounds = (dev-raw_io_64)
diff -puN 
drivers/scsi/aacraid/aacraid.h~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
 drivers/scsi/aacraid/aacraid.h
--- 
a/drivers/scsi/aacraid/aacraid.h~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
+++ a/drivers/scsi/aacraid/aacraid.h
@@ -521,6 +521,12 @@ struct aac_driver_ident
 #define AAC_QUIRK_17SG 0x0010
 
 /*
+ * Some adapter firmware does not support 64 bit scsi passthrough
+ * commands.
+ */
+#define AAC_QUIRK_SCSI_32  0x0020
+
+/*
  * The adapter interface specs all queues to be located in the same
  * physically contigous block. The host structure that defines the
  * commuication queues will assume they are each a separate physically
diff -puN 
drivers/scsi/aacraid/commsup.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
 drivers/scsi/aacraid/commsup.c
--- 
a/drivers/scsi/aacraid/commsup.c~aacraid-driver-fails-with-dell-poweredge-expandable-raid-controller-3-di
+++ a/drivers/scsi/aacraid/commsup.c
@@ -1099,7 +1099,8 @@ static int _aac_reset_adapter(struct aac
free_irq(aac-pdev-irq, aac);
kfree(aac-fsa_dev);
 

[patch 19/23] sym2: fix section mismatch warning

2007-11-21 Thread akpm
From: Randy Dunlap [EMAIL PROTECTED]

Fix section mismatch warning:

WARNING: vmlinux.o(.text+0x1ff3a2): Section mismatch: reference to 
.exit.text:sym2_remove (between 'sym2_io_error_detected' and 'sym_xpt_done')

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/sym53c8xx_2/sym_glue.c~sym2-fix-section-mismatch-warning 
drivers/scsi/sym53c8xx_2/sym_glue.c
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c~sym2-fix-section-mismatch-warning
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1744,7 +1744,7 @@ static int __devinit sym2_probe(struct p
return -ENODEV;
 }
 
-static void __devexit sym2_remove(struct pci_dev *pdev)
+static void sym2_remove(struct pci_dev *pdev)
 {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
 
@@ -2056,7 +2056,7 @@ static struct pci_driver sym2_driver = {
.name   = NAME53C8XX,
.id_table   = sym2_id_table,
.probe  = sym2_probe,
-   .remove = __devexit_p(sym2_remove),
+   .remove = sym2_remove,
.err_handler= sym2_err_handler,
 };
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 17/23] advansys: fix section mismatch warning

2007-11-21 Thread akpm
From: Randy Dunlap [EMAIL PROTECTED]

Fix section mismatch warning:

WARNING: vmlinux.o(.exit.text+0x152a): Section mismatch: reference to 
.init.data:_asc_def_iop_base (between 'advansys_isa_remove' and 'advansys_exit')

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/advansys.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/advansys.c~advansys-fix-section-mismatch-warning 
drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c~advansys-fix-section-mismatch-warning
+++ a/drivers/scsi/advansys.c
@@ -13906,7 +13906,7 @@ static int advansys_release(struct Scsi_
 
 #define ASC_IOADR_TABLE_MAX_IX  11
 
-static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = {
+static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
0x0210, 0x0230, 0x0250, 0x0330
 };
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 04/23] mptbase: reset ioc initiator during PCI resume

2007-11-21 Thread akpm
From: Darrick J. Wong [EMAIL PROTECTED]

It appears that the LSI SAS 1064E chip needs to be reset after a
suspend/resume cycle before the driver attempts further communications with
the chip.  Without this patch, resuming the chip results in this error
message being printed repeatedly and no more disk I/O.

mptbase: ioc0: ERROR - Invalid IOC facts reply, msgLength=0 offsetof=6!

So far it seems to fix suspend/resume on all the MPT Fusion cards I have
(SAS and U320 SCSI) but since I don't know the internals of that chip I
can't say for sure if this is a proper fix.

Signed-off-by: Darrick J. Wong [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.c |6 ++
 1 file changed, 6 insertions(+)

diff -puN 
drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume 
drivers/message/fusion/mptbase.c
--- 
a/drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume
+++ a/drivers/message/fusion/mptbase.c
@@ -1829,6 +1829,12 @@ mpt_resume(struct pci_dev *pdev)
(mpt_GetIocState(ioc, 1)  MPI_IOC_STATE_SHIFT),
CHIPREG_READ32(ioc-chip-Doorbell));
 
+   /* put ioc into READY_STATE */
+   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   printk(MYIOC_s_ERR_FMT
+   pci-resume:  IOC msg unit reset failed!\n, ioc-name);
+   }
+
/* bring ioc to operational state */
if ((recovery_state = mpt_do_ioc_recovery(ioc,
MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) {
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 3/7] qla2xxx printk fixes

2007-10-16 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

drivers/scsi/qla2xxx/qla_sup.c: In function 'qla24xx_write_flash_data':
drivers/scsi/qla2xxx/qla_sup.c:655: warning: format '%llx' expects type 'long 
long unsigned int', but argument 6 has type 'dma_addr_t'
drivers/scsi/qla2xxx/qla_sup.c: In function 'qla25xx_read_optrom_data':
drivers/scsi/qla2xxx/qla_sup.c:1853: warning: format '%llx' expects type 'long 
long unsigned int', but argument 6 has type 'dma_addr_t'

Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/qla2xxx/qla_sup.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/qla2xxx/qla_sup.c~qla2xxx-printk-fixes 
drivers/scsi/qla2xxx/qla_sup.c
--- a/drivers/scsi/qla2xxx/qla_sup.c~qla2xxx-printk-fixes
+++ a/drivers/scsi/qla2xxx/qla_sup.c
@@ -656,7 +656,7 @@ qla24xx_write_flash_data(scsi_qla_host_t
Unable to burst-write optrom segment 
(%x/%x/%llx).\n, ret,
flash_data_to_access_addr(faddr),
-   optrom_dma);
+   (unsigned long long)optrom_dma);
qla_printk(KERN_WARNING, ha,
Reverting to slow-write.\n);
 
@@ -1853,7 +1853,8 @@ qla25xx_read_optrom_data(struct scsi_qla
qla_printk(KERN_WARNING, ha,
Unable to burst-read optrom segment 
(%x/%x/%llx).\n, rval,
-   flash_data_to_access_addr(faddr), optrom_dma);
+   flash_data_to_access_addr(faddr),
+   (unsigned long long)optrom_dma);
qla_printk(KERN_WARNING, ha,
Reverting to slow-read.\n);
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 2/7] git scsi misc include fix

2007-10-16 Thread akpm
From: Paul Jackson [EMAIL PROTECTED]

The added line in scsi_eh.h:
struct scatterlist sense_sgl;
fails to compile, with the error:
field 'sense_sgl' has incomplete type
unless scatterlist.h happens to be included
somehow already ... which it isn't always.

So include scatterlist.h in scsi_eh.h directly.

Signed-off-by: Paul Jackson [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 include/scsi/scsi_eh.h |1 +
 1 file changed, 1 insertion(+)

diff -puN include/scsi/scsi_eh.h~git-scsi-misc-include-fix 
include/scsi/scsi_eh.h
--- a/include/scsi/scsi_eh.h~git-scsi-misc-include-fix
+++ a/include/scsi/scsi_eh.h
@@ -4,6 +4,7 @@
 #include linux/scatterlist.h
 
 #include scsi/scsi_cmnd.h
+#include linux/scatterlist.h
 struct scsi_device;
 struct Scsi_Host;
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 6/7] initio: fix conflict when loading driver

2007-10-16 Thread akpm
From: Alan Cox [EMAIL PROTECTED]

 I have a scanner connected to a Initio INI-950 SCSI card and I recently
 upgraded from SuSE 10.2 to 10.3.  The new kernel doesn't see any of my
 devices.  I get the following in /var/log/messages:

 ACPI: PCI Interrupt :00:0a.0[A] - GSI 17 (level, low) - IRQ 16
 initio: I/O port range 0x0 is busy.
 ACPI: PCI interrupt for device :00:0a.0 disabled

Humm not a collision - thats a bug in the driver updating.  Looks like the
changes I made and combined with Christoph's lost a line somewhere when I
was merging it all.  Try the following

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Cc: Scott Simpson [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/initio.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/scsi/initio.c~initio-fix-conflict-when-loading-driver 
drivers/scsi/initio.c
--- a/drivers/scsi/initio.c~initio-fix-conflict-when-loading-driver
+++ a/drivers/scsi/initio.c
@@ -2867,6 +2867,7 @@ static int initio_probe_one(struct pci_d
}
host = (struct initio_host *)shost-hostdata;
memset(host, 0, sizeof(struct initio_host));
+   host-addr = pci_resource_start(pdev, 0);
 
if (!request_region(host-addr, 256, i91u)) {
printk(KERN_WARNING initio: I/O port range 0x%x is busy.\n, 
host-addr);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 7/7] hptiop: avoid buffer overflow when returning sense data

2007-10-16 Thread akpm
From: HighPoint Linux Team [EMAIL PROTECTED]

avoid buffer overflow when returning sense data.

With current adapter firmware the driver is working but future firmware
updates may return sense data larger than 96 bytes, causing overflow on
scp-sense_buffer and a kernel crash.

This fix should be backported to earlier kernels.

Signed-off-by: HighPoint Linux Team [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/hptiop.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN 
drivers/scsi/hptiop.c~hptiop-avoid-buffer-overflow-when-returning-sense-data 
drivers/scsi/hptiop.c
--- 
a/drivers/scsi/hptiop.c~hptiop-avoid-buffer-overflow-when-returning-sense-data
+++ a/drivers/scsi/hptiop.c
@@ -375,8 +375,9 @@ static void hptiop_host_request_callback
scp-result = SAM_STAT_CHECK_CONDITION;
memset(scp-sense_buffer,
0, sizeof(scp-sense_buffer));
-   memcpy(scp-sense_buffer,
-   req-sg_list, le32_to_cpu(req-dataxfer_length));
+   memcpy(scp-sense_buffer, req-sg_list,
+   min(sizeof(scp-sense_buffer),
+   le32_to_cpu(req-dataxfer_length)));
break;
 
default:
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 5/7] PCI Error Recovery: Symbios SCSI First Failure

2007-10-16 Thread akpm
From: Linas Vepstas [EMAIL PROTECTED]

Implement the so-called first failure data capture (FFDC) for the symbios
PCI error recovery.  After a PCI error event is reported, the driver
requests that MMIO be enabled.  Once enabled, it then reads and dumps
assorted status registers, and concludes by requesting the usual reset
sequence.

(includes a whitespace fix for bad indentation).

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |   15 +++
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   18 ++
 3 files changed, 30 insertions(+), 4 deletions(-)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_glue.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1927,6 +1927,20 @@ static pci_ers_result_t sym2_io_error_de
disable_irq(pdev-irq);
pci_disable_device(pdev);
 
+   /* Request that MMIO be enabled, so register dump can be taken. */
+   return PCI_ERS_RESULT_CAN_RECOVER;
+}
+
+/**
+ * sym2_io_slot_dump -- Enable MMIO and dump debug registers
+ * @pdev: pointer to PCI device
+ */
+static pci_ers_result_t sym2_io_slot_dump(struct pci_dev *pdev)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   sym_dump_registers(np);
+
/* Request a slot reset. */
return PCI_ERS_RESULT_NEED_RESET;
 }
@@ -2181,6 +2195,7 @@ MODULE_DEVICE_TABLE(pci, sym2_id_table);
 
 static struct pci_error_handlers sym2_err_handler = {
.error_detected = sym2_io_error_detected,
+   .mmio_enabled = sym2_io_slot_dump,
.slot_reset = sym2_io_slot_reset,
.resume = sym2_io_resume,
 };
diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.h~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_glue.h
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.h~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -270,5 +270,6 @@ void sym_xpt_async_bus_reset(struct sym_
 void sym_xpt_async_sent_bdr(struct sym_hcb *np, int target);
 int  sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, 
struct sym_ccb *cp);
 void sym_log_bus_error(struct sym_hcb *np);
+void sym_dump_registers(struct sym_hcb *np);
 
 #endif /* SYM_GLUE_H */
diff -puN 
drivers/scsi/sym53c8xx_2/sym_hipd.c~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_hipd.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_hipd.c~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1180,10 +1180,10 @@ static void sym_log_hard_error(struct sy
scr_to_cpu((int) *(u32 *)(script_base + script_ofs)));
}
 
-printf (%s: regdump:, sym_name(np));
-for (i=0; i24;i++)
-printf ( %02x, (unsigned)INB_OFF(np, i));
-printf (.\n);
+   printf(%s: regdump:, sym_name(np));
+   for (i = 0; i  24; i++)
+   printf( %02x, (unsigned)INB_OFF(np, i));
+   printf(.\n);
 
/*
 *  PCI BUS error.
@@ -1192,6 +1192,16 @@ static void sym_log_hard_error(struct sy
sym_log_bus_error(np);
 }
 
+void sym_dump_registers(struct sym_hcb *np)
+{
+   u_short sist;
+   u_char dstat;
+
+   sist = INW(np, nc_sist);
+   dstat = INB(np, nc_dstat);
+   sym_log_hard_error(np, sist, dstat);
+}
+
 static struct sym_chip sym_dev_table[] = {
  {PCI_DEVICE_ID_NCR_53C810, 0x0f, 810, 4, 8, 4, 64,
  FE_ERL}
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 4/7] PCI Error Recovery: Symbios SCSI base support

2007-10-16 Thread akpm
From: Linas Vepstas [EMAIL PROTECTED]

Various PCI bus errors can be signaled by newer PCI controllers.  This
patch adds the PCI error recovery callbacks to the Symbios SCSI device
driver.  The patch has been tested, and appears to work well.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |  136 ++
 drivers/scsi/sym53c8xx_2/sym_glue.h |4 
 drivers/scsi/sym53c8xx_2/sym_hipd.c |6 +
 3 files changed, 146 insertions(+)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-base-support
 drivers/scsi/sym53c8xx_2/sym_glue.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-base-support
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -596,6 +596,10 @@ static irqreturn_t sym53c8xx_intr(int ir
unsigned long flags;
struct sym_hcb *np = (struct sym_hcb *)dev_id;
 
+   /* Avoid spinloop trying to handle interrupts on frozen device */
+   if (pci_channel_offline(np-s.device))
+   return IRQ_HANDLED;
+
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug ([);
 
spin_lock_irqsave(np-s.host-host_lock, flags);
@@ -665,6 +669,20 @@ static int sym_eh_handler(int op, char *
 
dev_warn(cmd-device-sdev_gendev, %s operation started.\n, opname);
 
+   /* We may be in an error condition because the PCI bus
+* went down. In this case, we need to wait until the
+* PCI bus is reset, the card is reset, and only then
+* proceed with the scsi error recovery.  There's no
+* point in hurrying; take a leisurely wait.
+*/
+#define WAIT_FOR_PCI_RECOVERY  35
+   if (pci_channel_offline(np-s.device)) {
+   int finished_reset = wait_for_completion_timeout(
+   np-s.io_reset_wait, WAIT_FOR_PCI_RECOVERY*HZ);
+   if (!finished_reset)
+   return SCSI_FAILED;
+   }
+
spin_lock_irq(host-host_lock);
/* This one is queued in some place - to wait for completion */
FOR_EACH_QUEUED_ELEMENT(np-busy_ccbq, qp) {
@@ -1449,6 +1467,7 @@ static struct Scsi_Host * __devinit sym_
np-maxoffs = dev-chip.offset_max;
np-maxburst= dev-chip.burst_max;
np-myaddr  = dev-host_id;
+   init_completion(np-s.io_reset_wait);
 
/*
 *  Edit its name.
@@ -1888,6 +1907,116 @@ static void __devexit sym2_remove(struct
attach_count--;
 }
 
+/**
+ * sym2_io_error_detected() -- called when PCI error is detected
+ * @pdev: pointer to PCI device
+ * @state: current state of the PCI slot
+ */
+static pci_ers_result_t sym2_io_error_detected(struct pci_dev *pdev,
+ enum pci_channel_state state)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   /* If slot is permanently frozen, turn everything off */
+   if (state == pci_channel_io_perm_failure) {
+   sym2_remove(pdev);
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   init_completion(np-s.io_reset_wait);
+   disable_irq(pdev-irq);
+   pci_disable_device(pdev);
+
+   /* Request a slot reset. */
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * sym2_reset_workarounds -- hardware-specific work-arounds
+ *
+ * This routine is similar to sym_set_workarounds(), except
+ * that, at this point, we already know that the device was
+ * succesfully intialized at least once before, and so most
+ * of the steps taken there are un-needed here.
+ */
+static void sym2_reset_workarounds(struct pci_dev *pdev)
+{
+   u_char revision;
+   u_short status_reg;
+   struct sym_chip *chip;
+
+   pci_read_config_byte(pdev, PCI_CLASS_REVISION, revision);
+   chip = sym_lookup_chip_table(pdev-device, revision);
+
+   /* Work around for errant bit in 895A, in a fashion
+* similar to what is done in sym_set_workarounds().
+*/
+   pci_read_config_word(pdev, PCI_STATUS, status_reg);
+   if (!(chip-features  FE_66MHZ)  (status_reg  PCI_STATUS_66MHZ)) {
+   status_reg = PCI_STATUS_66MHZ;
+   pci_write_config_word(pdev, PCI_STATUS, status_reg);
+   pci_read_config_word(pdev, PCI_STATUS, status_reg);
+   }
+}
+
+/**
+ * sym2_io_slot_reset() -- called when the pci bus has been reset.
+ * @pdev: pointer to PCI device
+ *
+ * Restart the card from scratch.
+ */
+static pci_ers_result_t sym2_io_slot_reset(struct pci_dev *pdev)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   printk(KERN_INFO %s: recovering from a PCI slot reset\n,
+ sym_name(np));
+
+   if (pci_enable_device(pdev)) {
+   printk(KERN_ERR %s: Unable to enable afer PCI reset\n,
+   sym_name(np));
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   pci_set_master(pdev);
+   

[patch 01/17] git-scsi-misc: arcmsr build fix

2007-10-02 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

drivers/scsi/arcmsr/arcmsr_hba.c:129: error: 'arcmsr_pci_error_detected' 
undeclared here (not in a function)
drivers/scsi/arcmsr/arcmsr_hba.c:130: error: 'arcmsr_pci_slot_reset' undeclared 
here (not in a function)

Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/arcmsr/arcmsr_hba.c |4 
 1 file changed, 4 insertions(+)

diff -puN drivers/scsi/arcmsr/arcmsr_hba.c~git-scsi-misc-arcmsr-build-fix 
drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c~git-scsi-misc-arcmsr-build-fix
+++ a/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -125,6 +125,10 @@ static struct scsi_host_template arcmsr_
.shost_attrs= arcmsr_host_attrs,
 };
 #ifdef CONFIG_SCSI_ARCMSR_AER
+static pci_ers_result_t arcmsr_pci_slot_reset(struct pci_dev *pdev);
+static pci_ers_result_t arcmsr_pci_error_detected(struct pci_dev *pdev,
+   pci_channel_state_t state);
+
 static struct pci_error_handlers arcmsr_pci_error_handlers = {
.error_detected = arcmsr_pci_error_detected,
.slot_reset = arcmsr_pci_slot_reset,
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 05/17] Remove dead references to MODULE_PARM macro

2007-10-02 Thread akpm
From: Robert P. J. Day [EMAIL PROTECTED]

Remove the useless references to the obsolete MODULE_PARM macro.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ibmmca.c |7 ---
 1 file changed, 7 deletions(-)

diff -puN drivers/scsi/ibmmca.c~remove-dead-references-to-module_parm-macro 
drivers/scsi/ibmmca.c
--- a/drivers/scsi/ibmmca.c~remove-dead-references-to-module_parm-macro
+++ a/drivers/scsi/ibmmca.c
@@ -460,13 +460,6 @@ module_param(boot_options, charp, 0);
 module_param_array(io_port, int, NULL, 0);
 module_param_array(scsi_id, int, NULL, 0);
 
-#if 0 /* FIXME: No longer exist? --RR */
-MODULE_PARM(display, 1i);
-MODULE_PARM(adisplay, 1i);
-MODULE_PARM(normal, 1i);
-MODULE_PARM(ansi, 1i);
-#endif
-
 MODULE_LICENSE(GPL);
 #endif
 /*counter of concurrent disk read/writes, to turn on/off disk led */
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 08/17] Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function

2007-10-02 Thread akpm
From: Jesper Juhl [EMAIL PROTECTED]

The Coverity checker noticed that we have a potential NULL pointer
deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register().
This patch handles it by adding the same test against NULL that is
used elsewhere in the same function.

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aic7xxx/aic7xxx_core.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN 
drivers/scsi/aic7xxx/aic7xxx_core.c~fix-a-potential-null-pointer-deref-in-the-aic7xxx-ahc_print_register-function
 drivers/scsi/aic7xxx/aic7xxx_core.c
--- 
a/drivers/scsi/aic7xxx/aic7xxx_core.c~fix-a-potential-null-pointer-deref-in-the-aic7xxx-ahc_print_register-function
+++ a/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -6557,7 +6557,8 @@ ahc_print_register(ahc_reg_parse_entry_t
printed = printf(%s[0x%x], name, value);
if (table == NULL) {
printed += printf( );
-   *cur_column += printed;
+   if (cur_column != NULL)
+   *cur_column += printed;
return (printed);
}
printed_mask = 0;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 06/17] Fix drivers/scsi/fdomain.c CONFIG_PCI=n warnings

2007-10-02 Thread akpm
From: Gabriel C [EMAIL PROTECTED]

I get this warnings on current git when CONFIG_PCI is not set :

drivers/scsi/fdomain.c:390: warning: 'PCI_dev' defined but not used
drivers/scsi/fdomain.c:1768: warning: 'fdomain_pci_tbl' defined but not used

Signed-off-by: Gabriel Craciunescu [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/fdomain.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN 
drivers/scsi/fdomain.c~fix-drivers-scsi-fdomainc-config_pci=n-warnings 
drivers/scsi/fdomain.c
--- a/drivers/scsi/fdomain.c~fix-drivers-scsi-fdomainc-config_pci=n-warnings
+++ a/drivers/scsi/fdomain.c
@@ -387,7 +387,9 @@ static void __iomem *bios_mem;
 static int   bios_major;
 static int   bios_minor;
 static int   PCI_bus;
+#ifdef CONFIG_PCI
 static struct pci_dev  *PCI_dev;
+#endif
 static int   Quantum;  /* Quantum board variant */
 static int   interrupt_level;
 static volatile int  in_command;
@@ -1764,6 +1766,7 @@ struct scsi_host_template fdomain_driver
 };
 
 #ifndef PCMCIA
+#ifdef CONFIG_PCI
 
 static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
@@ -1771,7 +1774,7 @@ static struct pci_device_id fdomain_pci_
{ }
 };
 MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl);
-
+#endif
 #define driver_template fdomain_driver_template
 #include scsi_module.c
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 12/17] advansys printk fix

2007-10-02 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

Fix this:

drivers/scsi/advansys.c: In function 'advansys_board_found':
drivers/scsi/advansys.c:16320: warning: format '%x' expects type 'unsigned 
int', but argument 3 has type 'resource_size_t'

and clean the code up a little.

Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/advansys.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff -puN drivers/scsi/advansys.c~advansys-printk-fix drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c~advansys-printk-fix
+++ a/drivers/scsi/advansys.c
@@ -14254,10 +14254,11 @@ advansys_board_found(int iop, struct dev
boardp-ioremap_addr = ioremap(pci_resource_start(pdev, 1),
   boardp-asc_n_io_port);
if (!boardp-ioremap_addr) {
-   ASC_PRINT3
-   (advansys_board_found: board %d: ioremap(%x, %d) 
returned NULL\n,
-boardp-id, pci_resource_start(pdev, 1),
-boardp-asc_n_io_port);
+   ASC_PRINT3(advansys_board_found: board %d: 
+   ioremap(%llx, %d) returned NULL\n,
+   boardp-id,
+   (unsigned long long)pci_resource_start(pdev, 1),
+   boardp-asc_n_io_port);
goto err_shost;
}
adv_dvc_varp-iop_base = (AdvPortAddr)boardp-ioremap_addr
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 10/17] scsi: send media state change modification events

2007-10-02 Thread akpm
From: Kay Sievers [EMAIL PROTECTED]

This will send for a card reader slot (remove/add media):
  UEVENT[1187091572.155884] change   
/devices/pci:00/:00:1d.7/usb5/5-2/5-2:1.0/host7/target7:0:0/7:0:0:0 
(scsi)
  UEVENT[1187091572.162314] remove   /block/sdb/sdb1 (block)
  UEVENT[1187091572.172464] add  /block/sdb/sdb1 (block)
  UEVENT[1187091572.175408] change   
/devices/pci:00/:00:1d.7/usb5/5-2/5-2:1.0/host7/target7:0:0/7:0:0:0 
(scsi)

and for a DVD drive (add/eject media):
  UEVENT[1187091590.189159] change   
/devices/pci:00/:00:1f.1/host4/target4:0:0/4:0:0:0 (scsi)
  UEVENT[1187091590.957124] add  /module/isofs (module)
  UEVENT[1187091604.468207] change   
/devices/pci:00/:00:1f.1/host4/target4:0:0/4:0:0:0 (scsi)

Userspace gets events, even for unpartitioned media. This unifies
the event handling for asynchronoous events (AN) and events caused by
perodical polling the device from userspace.

Signed-off-by: Kay Sievers [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Kristen Carlson Accardi [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sd.c |   24 +++-
 drivers/scsi/sr.c |   13 ++---
 drivers/scsi/sr.h |1 +
 include/scsi/sd.h |1 +
 4 files changed, 27 insertions(+), 12 deletions(-)

diff -puN drivers/scsi/sd.c~scsi-send-media-state-change-modification-events 
drivers/scsi/sd.c
--- a/drivers/scsi/sd.c~scsi-send-media-state-change-modification-events
+++ a/drivers/scsi/sd.c
@@ -741,8 +741,11 @@ static int sd_media_changed(struct gendi
 * can deal with it then.  It is only because of unrecoverable errors
 * that we would ever take a device offline in the first place.
 */
-   if (!scsi_device_online(sdp))
-   goto not_present;
+   if (!scsi_device_online(sdp)) {
+   set_media_not_present(sdkp);
+   retval = 1;
+   goto out;
+   }
 
/*
 * Using TEST_UNIT_READY enables differentiation between drive with
@@ -754,6 +757,7 @@ static int sd_media_changed(struct gendi
 * sd_revalidate() is called.
 */
retval = -ENODEV;
+
if (scsi_block_when_processing_errors(sdp))
retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES);
 
@@ -763,8 +767,11 @@ static int sd_media_changed(struct gendi
 * and we will figure it out later once the drive is
 * available again.
 */
-   if (retval)
-goto not_present;
+   if (retval) {
+   set_media_not_present(sdkp);
+   retval = 1;
+   goto out;
+   }
 
/*
 * For removable scsi disk we have to recognise the presence
@@ -775,12 +782,11 @@ static int sd_media_changed(struct gendi
 
retval = sdp-changed;
sdp-changed = 0;
-
+out:
+   if (retval != sdkp-previous_state)
+   scsi_device_event_notify(sdp, SDEV_MEDIA_CHANGE);
+   sdkp-previous_state = retval;
return retval;
-
-not_present:
-   set_media_not_present(sdkp);
-   return 1;
 }
 
 static int sd_sync_cache(struct scsi_disk *sdkp)
diff -puN drivers/scsi/sr.c~scsi-send-media-state-change-modification-events 
drivers/scsi/sr.c
--- a/drivers/scsi/sr.c~scsi-send-media-state-change-modification-events
+++ a/drivers/scsi/sr.c
@@ -190,8 +190,9 @@ static int sr_media_change(struct cdrom_
 * and we will figure it out later once the drive is
 * available again.  */
cd-device-changed = 1;
-   return 1;   /* This will force a flush, if called from
-* check_disk_change */
+   /* This will force a flush, if called from check_disk_change */
+   retval = 1;
+   goto out;
};
 
retval = cd-device-changed;
@@ -201,9 +202,15 @@ static int sr_media_change(struct cdrom_
if (retval) {
/* check multisession offset etc */
sr_cd_check(cdi);
-
get_sectorsize(cd);
}
+
+out:
+   /* Notify userspace, that media has changed. */
+   if (retval != cd-previous_state)
+   scsi_device_event_notify(cd-device, SDEV_MEDIA_CHANGE);
+   cd-previous_state = retval;
+
return retval;
 }
  
diff -puN drivers/scsi/sr.h~scsi-send-media-state-change-modification-events 
drivers/scsi/sr.h
--- a/drivers/scsi/sr.h~scsi-send-media-state-change-modification-events
+++ a/drivers/scsi/sr.h
@@ -37,6 +37,7 @@ typedef struct scsi_cd {
unsigned xa_flag:1; /* CD has XA sectors ? */
unsigned readcd_known:1;/* drive supports READ_CD (0xbe) */
unsigned readcd_cdda:1; /* reading audio data using READ_CD */
+   unsigned previous_state:1;  /* media has changed */
struct cdrom_device_info cdi;
/* We hold gendisk and scsi_device references on 

[patch 04/17] drivers/scsi/pcmcia/nsp_cs.c: remove kernel 2.4 code

2007-10-02 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/pcmcia/nsp_cs.c |  159 +
 drivers/scsi/pcmcia/nsp_cs.h |8 -
 2 files changed, 5 insertions(+), 162 deletions(-)

diff -puN 
drivers/scsi/pcmcia/nsp_cs.c~drivers-scsi-pcmcia-nsp_csc-remove-kernel-24-code 
drivers/scsi/pcmcia/nsp_cs.c
--- 
a/drivers/scsi/pcmcia/nsp_cs.c~drivers-scsi-pcmcia-nsp_csc-remove-kernel-24-code
+++ a/drivers/scsi/pcmcia/nsp_cs.c
@@ -25,8 +25,6 @@
 
 ***/
 
-/* $Id: nsp_cs.c,v 1.23 2003/08/18 11:09:19 elca Exp $ */
-
 #include linux/version.h
 #include linux/module.h
 #include linux/kernel.h
@@ -59,7 +57,7 @@
 #include nsp_cs.h
 
 MODULE_AUTHOR(YOKOTA Hiroshi [EMAIL PROTECTED]);
-MODULE_DESCRIPTION(WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI 
host adapter module $Revision: 1.23 $);
+MODULE_DESCRIPTION(WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI 
host adapter module);
 MODULE_SUPPORTED_DEVICE(sd,sr,sg,st);
 #ifdef MODULE_LICENSE
 MODULE_LICENSE(GPL);
@@ -83,10 +81,6 @@ static struct scsi_host_template nsp_dri
.proc_name   = nsp_cs,
.proc_info   = nsp_proc_info,
.name= WorkBit NinjaSCSI-3/32Bi(16bit),
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
-   .detect  = nsp_detect_old,
-   .release = nsp_release_old,
-#endif
.info= nsp_info,
.queuecommand= nsp_queuecommand,
 /* .eh_abort_handler= nsp_eh_abort,*/
@@ -97,9 +91,6 @@ static struct scsi_host_template nsp_dri
.sg_tablesize= SG_ALL,
.cmd_per_lun = 1,
.use_clustering  = DISABLE_CLUSTERING,
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,2))
-   .use_new_eh_code = 1,
-#endif
 };
 
 static nsp_hw_data nsp_data_base; /* attach - detect glue */
@@ -1313,11 +1304,7 @@ static struct Scsi_Host *nsp_detect(stru
nsp_hw_data *data_b = nsp_data_base, *data;
 
nsp_dbg(NSP_DEBUG_INIT, this_id=%d, sht-this_id);
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
host = scsi_host_alloc(nsp_driver_template, sizeof(nsp_hw_data));
-#else
-   host = scsi_register(sht, sizeof(nsp_hw_data));
-#endif
if (host == NULL) {
nsp_dbg(NSP_DEBUG_INIT, host failed);
return NULL;
@@ -1354,37 +1341,6 @@ static struct Scsi_Host *nsp_detect(stru
return host; /* detect done. */
 }
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
-static int nsp_detect_old(struct scsi_host_template *sht)
-{
-   if (nsp_detect(sht) == NULL) {
-   return 0;
-   } else {
-   //MOD_INC_USE_COUNT;
-   return 1;
-   }
-}
-
-
-static int nsp_release_old(struct Scsi_Host *shpnt)
-{
-   //nsp_hw_data *data = (nsp_hw_data *)shpnt-hostdata;
-
-   /* PCMCIA Card Service dose same things below. */
-   /* So we do nothing.   */
-   //if (shpnt-irq) {
-   //  free_irq(shpnt-irq, data-ScsiInfo);
-   //}
-   //if (shpnt-io_port) {
-   //  release_region(shpnt-io_port, shpnt-n_io_port);
-   //}
-
-   //MOD_DEC_USE_COUNT;
-
-   return 0;
-}
-#endif
-
 /**/
 /* return info string*/
 /**/
@@ -1403,19 +1359,9 @@ static const char *nsp_info(struct Scsi_
nsp_dbg(NSP_DEBUG_PROC, buffer=0x%p pos=0x%p length=%d 
%d\n, buffer, pos, length,  length - (pos - buffer));\
} \
} while(0)
-static int
-nsp_proc_info(
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   struct Scsi_Host *host,
-#endif
-   char  *buffer,
-   char **start,
-   off_t  offset,
-   intlength,
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   inthostno,
-#endif
-   intinout)
+
+static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start,
+off_t offset, int length, int inout)
 {
int id;
char *pos = buffer;
@@ -1423,24 +1369,13 @@ nsp_proc_info(
int speed;
unsigned long flags;
nsp_hw_data *data;
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   struct Scsi_Host *host;
-#else
int hostno;
-#endif
+
if (inout) {
return -EINVAL;
}
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
hostno = host-host_no;
-#else
-   /* search this HBA host */
-   host = scsi_host_hn_get(hostno);
-   if (host == NULL) {
-   return -ESRCH;
-   }
-#endif
data = (nsp_hw_data *)host-hostdata;
 
 
@@ -1675,10 +1610,6 @@ static int 

[patch 07/17] nsp32_restart_autoscsi(): remove error check

2007-10-02 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

The Coverity checker noted that we'll anyway Oops later when we ran into
this condition - and the error check didn't prevent that.

Considering that the error condition shouldn't be possible, and we are
not able to handle it easily, this patch simply removes the pointless
error check.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/nsp32.c |4 
 1 file changed, 4 deletions(-)

diff -puN drivers/scsi/nsp32.c~nsp32_restart_autoscsi-remove-error-check 
drivers/scsi/nsp32.c
--- a/drivers/scsi/nsp32.c~nsp32_restart_autoscsi-remove-error-check
+++ a/drivers/scsi/nsp32.c
@@ -1905,10 +1905,6 @@ static void nsp32_restart_autoscsi(struc
 
nsp32_dbg(NSP32_DEBUG_RESTART, enter);
 
-   if (data-cur_target == NULL || data-cur_lunt == NULL) {
-   nsp32_msg(KERN_ERR, Target or Lun is invalid);
-   }
-
/*
 * set SYNC_REG
 * Don't set BM_START_ADR before setting this register.
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 15/17] mpt fusion: shut up uninitialized variable warnings

2007-10-02 Thread akpm

drivers/message/fusion/mptctl.c: In function ‘mptctl_mpt_command’:
drivers/message/fusion/mptctl.c:1764: warning: ‘bufIn.len’ may be used 
uninitialized in this function
drivers/message/fusion/mptctl.c:1765: warning: ‘bufOut.len’ may be used 
uninitialized in this function

come because gcc gets confused by some goto statements in above function.
 The warnings have been verified to be bogus, however, the function does
initialize these later (after the offending goto's) in the function anyway.
 So let's move those initializations to top of function, thereby also
shutting up these warnings.

Signed-off-by: Satyam Sharma [EMAIL PROTECTED]
Acked-by: Eric Moore [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptctl.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff -puN 
drivers/message/fusion/mptctl.c~mpt-fusion-shut-up-uninitialized-variable 
drivers/message/fusion/mptctl.c
--- a/drivers/message/fusion/mptctl.c~mpt-fusion-shut-up-uninitialized-variable
+++ a/drivers/message/fusion/mptctl.c
@@ -1774,7 +1774,10 @@ mptctl_do_mpt_command (struct mpt_ioctl_
ulong   timeout;
struct scsi_device *sdev;
 
+   /* bufIn and bufOut are used for user to kernel space transfers
+*/
bufIn.kptr = bufOut.kptr = NULL;
+   bufIn.len = bufOut.len = 0;
 
if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, ioc))  0) ||
(ioc == NULL)) {
@@ -2108,11 +2111,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_
psge = (char *) (((int *) mf) + karg.dataSgeOffset);
flagsLength = 0;
 
-   /* bufIn and bufOut are used for user to kernel space transfers
-*/
-   bufIn.kptr = bufOut.kptr = NULL;
-   bufIn.len = bufOut.len = 0;
-
if (karg.dataOutSize  0)
sgSize ++;
 
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 17/17] scsi: use notifier chain for Asynchronous Event Notification

2007-10-02 Thread akpm
From: Kristen Carlson Accardi [EMAIL PROTECTED]

Add a notifier chain for SCSI asynchronous events.  Add a notifier block
for events which should be sent to user space, and add support for the
MEDIA_CHANGE event, which would be used by a driver when new media has been
inserted.

Signed-off-by: Kristen Carlson Accardi [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/Makefile|2 
 drivers/scsi/scsi.c  |2 
 drivers/scsi/scsi_aen.c  |  168 +
 drivers/scsi/scsi_lib.c  |   83 --
 drivers/scsi/scsi_priv.h |4 
 5 files changed, 175 insertions(+), 84 deletions(-)

diff -puN drivers/scsi/Makefile~scsi-use-notifier-chain-for-asynchronous-event 
drivers/scsi/Makefile
--- a/drivers/scsi/Makefile~scsi-use-notifier-chain-for-asynchronous-event
+++ a/drivers/scsi/Makefile
@@ -150,7 +150,7 @@ obj-$(CONFIG_SCSI_DEBUG)+= scsi_debug.o
 obj-$(CONFIG_SCSI_WAIT_SCAN)   += scsi_wait_scan.o
 
 scsi_mod-y += scsi.o hosts.o scsi_ioctl.o constants.o \
-  scsicam.o scsi_error.o scsi_lib.o
+  scsicam.o scsi_error.o scsi_lib.o scsi_aen.o
 scsi_mod-$(CONFIG_SCSI_DMA)+= scsi_lib_dma.o
 scsi_mod-y += scsi_scan.o scsi_sysfs.o scsi_devinfo.o
 scsi_mod-$(CONFIG_SCSI_NETLINK)+= scsi_netlink.o
diff -puN drivers/scsi/scsi.c~scsi-use-notifier-chain-for-asynchronous-event 
drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c~scsi-use-notifier-chain-for-asynchronous-event
+++ a/drivers/scsi/scsi.c
@@ -1045,6 +1045,8 @@ static int __init init_scsi(void)
if (error)
goto cleanup_sysctl;
 
+   scsi_aen_init();
+
scsi_netlink_init();
 
printk(KERN_NOTICE SCSI subsystem initialized\n);
diff -puN /dev/null drivers/scsi/scsi_aen.c
--- /dev/null
+++ a/drivers/scsi/scsi_aen.c
@@ -0,0 +1,168 @@
+/*
+ *  SCSI Asynchronous Event Notification
+ *
+ *  Copyright (c) 2007, Intel Corporation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Send Feedback to:  Kristen Carlson Accardi [EMAIL PROTECTED]
+ */
+#include linux/notifier.h
+
+#include scsi/scsi.h
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_dbg.h
+#include scsi/scsi_device.h
+#include scsi/scsi_driver.h
+#include scsi/scsi_eh.h
+#include scsi/scsi_host.h
+
+static int scsi_aen_uevent_notifier(struct notifier_block *nb,
+   unsigned long action, void *sdev);
+
+BLOCKING_NOTIFIER_HEAD(scsi_aen_chain);
+
+static struct notifier_block scsi_aen_nb = {
+   .notifier_call = scsi_aen_uevent_notifier,
+};
+
+/* must match scsi_device_event enum in scsi_device.h */
+static char * scsi_device_event_strings[] = {
+   MEDIA_CHANGE=1,
+};
+
+/**scsi_aen_notifier_register - register to receive aen events
+ * @nb: callers notifier_block
+ *
+ * Add a callers notifier_block to the AEN notify chain.
+ */
+int scsi_aen_notifier_register(struct notifier_block *nb)
+{
+   return blocking_notifier_chain_register(scsi_aen_chain, nb);
+}
+EXPORT_SYMBOL_GPL(scsi_aen_notifier_register);
+
+/**scsi_aen_notifier_register - register to receive aen events
+ * @nb: callers notifier_block
+ *
+ * remove a callers notifier_block from the AEN notify chain.
+ */
+int scsi_aen_notifier_unregister(struct notifier_block *nb)
+{
+   return blocking_notifier_chain_unregister(scsi_aen_chain, nb);
+}
+EXPORT_SYMBOL_GPL(scsi_aen_notifier_unregister);
+
+/**
+ * scsi_device_set_event - Add a new Async event to the event list
+ * @sdev: scsi_device event occurred on
+ * @event: the scsi device event
+ *
+ * Add a new scsi_device_event_info struct to the scsi_device_event_list
+ * queue.  This may be called from interrupt context.
+ *
+ * Returns 0 if successful, -ENOMEM otherwise.
+ */
+static int
+scsi_device_set_event(struct scsi_device *sdev, enum scsi_device_event event)
+{
+   struct scsi_device_event_info *scsi_event;
+   unsigned long flags;
+
+   scsi_event = kzalloc(sizeof(*scsi_event), GFP_ATOMIC);
+   if (!scsi_event)
+   return -ENOMEM;
+   INIT_LIST_HEAD(scsi_event-link);
+   

[patch 16/17] mptbase: reset ioc initiator during PCI resume

2007-10-02 Thread akpm
From: Darrick J. Wong [EMAIL PROTECTED]

It appears that the LSI SAS 1064E chip needs to be reset after a
suspend/resume cycle before the driver attempts further communications with
the chip.  Without this patch, resuming the chip results in this error
message being printed repeatedly and no more disk I/O.

mptbase: ioc0: ERROR - Invalid IOC facts reply, msgLength=0 offsetof=6!

So far it seems to fix suspend/resume on all the MPT Fusion cards I have
(SAS and U320 SCSI) but since I don't know the internals of that chip I
can't say for sure if this is a proper fix.

Signed-off-by: Darrick J. Wong [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/mptbase.c |6 ++
 1 file changed, 6 insertions(+)

diff -puN 
drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume 
drivers/message/fusion/mptbase.c
--- 
a/drivers/message/fusion/mptbase.c~mptbase-reset-ioc-initiator-during-pci-resume
+++ a/drivers/message/fusion/mptbase.c
@@ -1830,6 +1830,12 @@ mpt_resume(struct pci_dev *pdev)
(mpt_GetIocState(ioc, 1)  MPI_IOC_STATE_SHIFT),
CHIPREG_READ32(ioc-chip-Doorbell));
 
+   /* put ioc into READY_STATE */
+   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   printk(MYIOC_s_ERR_FMT
+   pci-resume:  IOC msg unit reset failed!\n, ioc-name);
+   }
+
/* bring ioc to operational state */
if ((recovery_state = mpt_do_ioc_recovery(ioc,
MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) {
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 13/17] drivers/scsi/imm.c: fix check-after-use

2007-10-02 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

The Coverity checker spotted that we have already oops'ed if cmd
was NULL.

Since cmd being NULL doesn't seem to be possible at this point this
patch removes the NULL check.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/imm.c |4 
 1 file changed, 4 deletions(-)

diff -puN drivers/scsi/imm.c~drivers-scsi-immc-fix-check-after-use 
drivers/scsi/imm.c
--- a/drivers/scsi/imm.c~drivers-scsi-immc-fix-check-after-use
+++ a/drivers/scsi/imm.c
@@ -740,10 +740,6 @@ static void imm_interrupt(struct work_st
struct Scsi_Host *host = cmd-device-host;
unsigned long flags;
 
-   if (!cmd) {
-   printk(IMM: bug in imm_interrupt\n);
-   return;
-   }
if (imm_engine(dev, cmd)) {
schedule_delayed_work(dev-imm_tq, 1);
return;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 09/17] add includes to scsi_transport_iscsi.h

2007-10-02 Thread akpm
From: Michael S. Tsirkin [EMAIL PROTECTED]

scsi/scsi_transport_iscsi.h uses struct mutex and struct list_head,
so while linux/mutex.h and linux/list.h seem to be pulled in indirectly
by one of the headers it includes, the right thing
is to include linux/mutex.h and linus/list.h directly.

Signed-off-by: Michael S. Tsirkin [EMAIL PROTECTED]
Acked-by: Mike Christie [EMAIL PROTECTED]
Cc: Roland Dreier [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 include/scsi/scsi_transport_iscsi.h |2 ++
 1 file changed, 2 insertions(+)

diff -puN 
include/scsi/scsi_transport_iscsi.h~add-includes-to-scsi_transport_iscsih 
include/scsi/scsi_transport_iscsi.h
--- a/include/scsi/scsi_transport_iscsi.h~add-includes-to-scsi_transport_iscsih
+++ a/include/scsi/scsi_transport_iscsi.h
@@ -24,6 +24,8 @@
 #define SCSI_TRANSPORT_ISCSI_H
 
 #include linux/device.h
+#include linux/list.h
+#include linux/mutex.h
 #include scsi/iscsi_if.h
 
 struct scsi_transport_template;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 02/17] PCI Error Recovery: Symbios SCSI base support

2007-10-02 Thread akpm
From: Linas Vepstas [EMAIL PROTECTED]

Various PCI bus errors can be signaled by newer PCI controllers.  This
patch adds the PCI error recovery callbacks to the Symbios SCSI device
driver.  The patch has been tested, and appears to work well.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |  136 ++
 drivers/scsi/sym53c8xx_2/sym_glue.h |4 
 drivers/scsi/sym53c8xx_2/sym_hipd.c |6 +
 3 files changed, 146 insertions(+)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-base-support
 drivers/scsi/sym53c8xx_2/sym_glue.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-base-support
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -596,6 +596,10 @@ static irqreturn_t sym53c8xx_intr(int ir
unsigned long flags;
struct sym_hcb *np = (struct sym_hcb *)dev_id;
 
+   /* Avoid spinloop trying to handle interrupts on frozen device */
+   if (pci_channel_offline(np-s.device))
+   return IRQ_HANDLED;
+
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug ([);
 
spin_lock_irqsave(np-s.host-host_lock, flags);
@@ -665,6 +669,20 @@ static int sym_eh_handler(int op, char *
 
dev_warn(cmd-device-sdev_gendev, %s operation started.\n, opname);
 
+   /* We may be in an error condition because the PCI bus
+* went down. In this case, we need to wait until the
+* PCI bus is reset, the card is reset, and only then
+* proceed with the scsi error recovery.  There's no
+* point in hurrying; take a leisurely wait.
+*/
+#define WAIT_FOR_PCI_RECOVERY  35
+   if (pci_channel_offline(np-s.device)) {
+   int finished_reset = wait_for_completion_timeout(
+   np-s.io_reset_wait, WAIT_FOR_PCI_RECOVERY*HZ);
+   if (!finished_reset)
+   return SCSI_FAILED;
+   }
+
spin_lock_irq(host-host_lock);
/* This one is queued in some place - to wait for completion */
FOR_EACH_QUEUED_ELEMENT(np-busy_ccbq, qp) {
@@ -1449,6 +1467,7 @@ static struct Scsi_Host * __devinit sym_
np-maxoffs = dev-chip.offset_max;
np-maxburst= dev-chip.burst_max;
np-myaddr  = dev-host_id;
+   init_completion(np-s.io_reset_wait);
 
/*
 *  Edit its name.
@@ -1887,6 +1906,116 @@ static void __devexit sym2_remove(struct
attach_count--;
 }
 
+/**
+ * sym2_io_error_detected() -- called when PCI error is detected
+ * @pdev: pointer to PCI device
+ * @state: current state of the PCI slot
+ */
+static pci_ers_result_t sym2_io_error_detected(struct pci_dev *pdev,
+ enum pci_channel_state state)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   /* If slot is permanently frozen, turn everything off */
+   if (state == pci_channel_io_perm_failure) {
+   sym2_remove(pdev);
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   init_completion(np-s.io_reset_wait);
+   disable_irq(pdev-irq);
+   pci_disable_device(pdev);
+
+   /* Request a slot reset. */
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * sym2_reset_workarounds -- hardware-specific work-arounds
+ *
+ * This routine is similar to sym_set_workarounds(), except
+ * that, at this point, we already know that the device was
+ * succesfully intialized at least once before, and so most
+ * of the steps taken there are un-needed here.
+ */
+static void sym2_reset_workarounds(struct pci_dev *pdev)
+{
+   u_char revision;
+   u_short status_reg;
+   struct sym_chip *chip;
+
+   pci_read_config_byte(pdev, PCI_CLASS_REVISION, revision);
+   chip = sym_lookup_chip_table(pdev-device, revision);
+
+   /* Work around for errant bit in 895A, in a fashion
+* similar to what is done in sym_set_workarounds().
+*/
+   pci_read_config_word(pdev, PCI_STATUS, status_reg);
+   if (!(chip-features  FE_66MHZ)  (status_reg  PCI_STATUS_66MHZ)) {
+   status_reg = PCI_STATUS_66MHZ;
+   pci_write_config_word(pdev, PCI_STATUS, status_reg);
+   pci_read_config_word(pdev, PCI_STATUS, status_reg);
+   }
+}
+
+/**
+ * sym2_io_slot_reset() -- called when the pci bus has been reset.
+ * @pdev: pointer to PCI device
+ *
+ * Restart the card from scratch.
+ */
+static pci_ers_result_t sym2_io_slot_reset(struct pci_dev *pdev)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   printk(KERN_INFO %s: recovering from a PCI slot reset\n,
+ sym_name(np));
+
+   if (pci_enable_device(pdev)) {
+   printk(KERN_ERR %s: Unable to enable afer PCI reset\n,
+   sym_name(np));
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   pci_set_master(pdev);
+   

[patch 11/17] Fix section mismatch in the Adaptec DPT SCSI Raid driver

2007-10-02 Thread akpm
From: Joe Korty [EMAIL PROTECTED]

Fix section mismatch in the Adaptec DPT SCSI Raid driver.

WARNING: vmlinux.o(.init.text+0x1fcd2): Section mismatch:
reference to .exit.text:adpt_exit (between 'adpt_init' and 
'ahc_linux_init')

This warning is due to adaptec device detection calling the exit routine on
failure to properly register the adaptec device.

The exit routine + call was added on July 30 by

Commit: 55d9fcf57ba5ec427544fca7abc335cf3da78160
Author: Matthew Wilcox
Subject: [SCSI] dpt_i2o: convert to SCSI hotplug model.

Mathew: isn't a module exit routine a little too strong to be calling on the
failure of a single device?  Module exit implies that other, non-failing
adaptec raid devices will also get shut down.  

Signed-off-by: Joe Korty [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/dpt_i2o.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/dpt_i2o.c~fix-section-mismatch-in-the-adaptec-dpt-scsi-raid-driver 
drivers/scsi/dpt_i2o.c
--- 
a/drivers/scsi/dpt_i2o.c~fix-section-mismatch-in-the-adaptec-dpt-scsi-raid-driver
+++ a/drivers/scsi/dpt_i2o.c
@@ -3346,7 +3346,7 @@ static int __init adpt_init(void)
return count  0 ? 0 : -ENODEV;
 }
 
-static void __exit adpt_exit(void)
+static void adpt_exit(void)
 {
while (hba_chain)
adpt_release(hba_chain);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 14/17] SCSI: early detection of medium not present, updated

2007-10-02 Thread akpm
From: Alan Stern [EMAIL PROTECTED]

Taken from http://bugzilla.kernel.org/show_bug.cgi?id=8904

An updated (by Albert, I assume) version of the fourteen-month-old patch here:

http://marc.info/?l=linux-kernelm=115412002912837w=2

Apparently fixes the bug described at
http://bugzilla.kernel.org/show_bug.cgi?id=8904

Needs some TLC.  Perhaps urgently.

Cc: Albert Lee [EMAIL PROTECTED]
Cc: Alan Stern [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Tejun Heo [EMAIL PROTECTED]
Cc: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/scsi_ioctl.c  |2 +-
 drivers/scsi/scsi_lib.c|   20 ++--
 drivers/scsi/sd.c  |2 +-
 drivers/scsi/sr.c  |   15 +--
 include/scsi/scsi_device.h |2 +-
 5 files changed, 30 insertions(+), 11 deletions(-)

diff -puN 
drivers/scsi/scsi_ioctl.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/scsi_ioctl.c
--- 
a/drivers/scsi/scsi_ioctl.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/scsi_ioctl.c
@@ -239,7 +239,7 @@ int scsi_ioctl(struct scsi_device *sdev,
return scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
case SCSI_IOCTL_TEST_UNIT_READY:
return scsi_test_unit_ready(sdev, IOCTL_NORMAL_TIMEOUT,
-   NORMAL_RETRIES);
+   NORMAL_RETRIES, NULL);
case SCSI_IOCTL_START_UNIT:
scsi_cmd[0] = START_STOP;
scsi_cmd[1] = 0;
diff -puN 
drivers/scsi/scsi_lib.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/scsi_lib.c
@@ -1875,15 +1875,26 @@ scsi_mode_sense(struct scsi_device *sdev
 }
 EXPORT_SYMBOL(scsi_mode_sense);
 
+/**
+ * scsi_test_unit_ready - test if unit is ready
+ * @sdev:  scsi device to change the state of.
+ * @timeout: command timeout
+ * @retries: number of retries before failing
+ * @media_maybe_present: 1 if media maybe present or not.
+ *   0 if media not present.
+ *
+ * Returns zero if unsuccessful or an error if TUR failed.
+ **/
 int
-scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries)
+scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, int 
*media_maybe_present)
 {
char cmd[] = {
TEST_UNIT_READY, 0, 0, 0, 0, 0,
};
struct scsi_sense_hdr sshdr;
int result;
-   
+   int maybe_present = 1;
+
result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
  timeout, retries);
 
@@ -1892,10 +1903,15 @@ scsi_test_unit_ready(struct scsi_device 
if ((scsi_sense_valid(sshdr)) 
((sshdr.sense_key == UNIT_ATTENTION) ||
 (sshdr.sense_key == NOT_READY))) {
+   if (sshdr.asc == 0x3A)
+   maybe_present = 0;
sdev-changed = 1;
result = 0;
}
}
+
+   if (media_maybe_present)
+   *media_maybe_present = maybe_present;
return result;
 }
 EXPORT_SYMBOL(scsi_test_unit_ready);
diff -puN drivers/scsi/sd.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/sd.c
--- a/drivers/scsi/sd.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/sd.c
@@ -759,7 +759,7 @@ static int sd_media_changed(struct gendi
retval = -ENODEV;
 
if (scsi_block_when_processing_errors(sdp))
-   retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES);
+   retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES, 
NULL);
 
/*
 * Unable to test, unit probably not ready.   This usually
diff -puN drivers/scsi/sr.c~scsi-early-detection-of-medium-not-present-updated 
drivers/scsi/sr.c
--- a/drivers/scsi/sr.c~scsi-early-detection-of-medium-not-present-updated
+++ a/drivers/scsi/sr.c
@@ -177,18 +177,21 @@ static int sr_media_change(struct cdrom_
 {
struct scsi_cd *cd = cdi-handle;
int retval;
+   int media_maybe_present;
 
if (CDSL_CURRENT != slot) {
/* no changer support */
return -EINVAL;
}
 
-   retval = scsi_test_unit_ready(cd-device, SR_TIMEOUT, MAX_RETRIES);
-   if (retval) {
-   /* Unable to test, unit probably not ready.  This usually
-* means there is no disc in the drive.  Mark as changed,
-* and we will figure it out later once the drive is
-* available again.  */
+   retval = scsi_test_unit_ready(cd-device, SR_TIMEOUT, MAX_RETRIES,
+ media_maybe_present);
+   if (retval || !media_maybe_present) {
+   /* Media not present or unable 

[patch 03/17] PCI Error Recovery: Symbios SCSI First Failure

2007-10-02 Thread akpm
From: Linas Vepstas [EMAIL PROTECTED]

Implement the so-called first failure data capture (FFDC) for the symbios
PCI error recovery.  After a PCI error event is reported, the driver
requests that MMIO be enabled.  Once enabled, it then reads and dumps
assorted status registers, and concludes by requesting the usual reset
sequence.

(includes a whitespace fix for bad indentation).

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |   15 +++
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   18 ++
 3 files changed, 30 insertions(+), 4 deletions(-)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_glue.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1926,6 +1926,20 @@ static pci_ers_result_t sym2_io_error_de
disable_irq(pdev-irq);
pci_disable_device(pdev);
 
+   /* Request that MMIO be enabled, so register dump can be taken. */
+   return PCI_ERS_RESULT_CAN_RECOVER;
+}
+
+/**
+ * sym2_io_slot_dump -- Enable MMIO and dump debug registers
+ * @pdev: pointer to PCI device
+ */
+static pci_ers_result_t sym2_io_slot_dump(struct pci_dev *pdev)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   sym_dump_registers(np);
+
/* Request a slot reset. */
return PCI_ERS_RESULT_NEED_RESET;
 }
@@ -2180,6 +2194,7 @@ MODULE_DEVICE_TABLE(pci, sym2_id_table);
 
 static struct pci_error_handlers sym2_err_handler = {
.error_detected = sym2_io_error_detected,
+   .mmio_enabled = sym2_io_slot_dump,
.slot_reset = sym2_io_slot_reset,
.resume = sym2_io_resume,
 };
diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.h~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_glue.h
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.h~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -270,5 +270,6 @@ void sym_xpt_async_bus_reset(struct sym_
 void sym_xpt_async_sent_bdr(struct sym_hcb *np, int target);
 int  sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, 
struct sym_ccb *cp);
 void sym_log_bus_error(struct sym_hcb *np);
+void sym_dump_registers(struct sym_hcb *np);
 
 #endif /* SYM_GLUE_H */
diff -puN 
drivers/scsi/sym53c8xx_2/sym_hipd.c~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_hipd.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_hipd.c~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1180,10 +1180,10 @@ static void sym_log_hard_error(struct sy
scr_to_cpu((int) *(u32 *)(script_base + script_ofs)));
}
 
-printf (%s: regdump:, sym_name(np));
-for (i=0; i24;i++)
-printf ( %02x, (unsigned)INB_OFF(np, i));
-printf (.\n);
+   printf(%s: regdump:, sym_name(np));
+   for (i = 0; i  24; i++)
+   printf( %02x, (unsigned)INB_OFF(np, i));
+   printf(.\n);
 
/*
 *  PCI BUS error.
@@ -1192,6 +1192,16 @@ static void sym_log_hard_error(struct sy
sym_log_bus_error(np);
 }
 
+void sym_dump_registers(struct sym_hcb *np)
+{
+   u_short sist;
+   u_char dstat;
+
+   sist = INW(np, nc_sist);
+   dstat = INB(np, nc_dstat);
+   sym_log_hard_error(np, sist, dstat);
+}
+
 static struct sym_chip sym_dev_table[] = {
  {PCI_DEVICE_ID_NCR_53C810, 0x0f, 810, 4, 8, 4, 64,
  FE_ERL}
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 01/30] bsg: declare request_queue

2007-08-10 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

include/linux/bsg.h:67: warning: 'struct request_queue' declared inside 
parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or 
declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside 
parameter list

Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 include/linux/bsg.h |3 +++
 1 files changed, 3 insertions(+)

diff -puN include/linux/bsg.h~bsg-declare-request_queue include/linux/bsg.h
--- a/include/linux/bsg.h~bsg-declare-request_queue
+++ a/include/linux/bsg.h
@@ -53,6 +53,9 @@ struct sg_io_v4 {
 
 #ifdef __KERNEL__
 
+struct request_queue;
+struct device;
+
 #if defined(CONFIG_BLK_DEV_BSG)
 struct bsg_class_device {
struct class_device *class_dev;
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 05/30] drivers/scsi/pcmcia/nsp_cs.c: remove kernel 2.4 code

2007-08-10 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/pcmcia/nsp_cs.c |  159 +
 drivers/scsi/pcmcia/nsp_cs.h |8 -
 2 files changed, 5 insertions(+), 162 deletions(-)

diff -puN 
drivers/scsi/pcmcia/nsp_cs.c~drivers-scsi-pcmcia-nsp_csc-remove-kernel-24-code 
drivers/scsi/pcmcia/nsp_cs.c
--- 
a/drivers/scsi/pcmcia/nsp_cs.c~drivers-scsi-pcmcia-nsp_csc-remove-kernel-24-code
+++ a/drivers/scsi/pcmcia/nsp_cs.c
@@ -25,8 +25,6 @@
 
 ***/
 
-/* $Id: nsp_cs.c,v 1.23 2003/08/18 11:09:19 elca Exp $ */
-
 #include linux/version.h
 #include linux/module.h
 #include linux/kernel.h
@@ -59,7 +57,7 @@
 #include nsp_cs.h
 
 MODULE_AUTHOR(YOKOTA Hiroshi [EMAIL PROTECTED]);
-MODULE_DESCRIPTION(WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI 
host adapter module $Revision: 1.23 $);
+MODULE_DESCRIPTION(WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI 
host adapter module);
 MODULE_SUPPORTED_DEVICE(sd,sr,sg,st);
 #ifdef MODULE_LICENSE
 MODULE_LICENSE(GPL);
@@ -83,10 +81,6 @@ static struct scsi_host_template nsp_dri
.proc_name   = nsp_cs,
.proc_info   = nsp_proc_info,
.name= WorkBit NinjaSCSI-3/32Bi(16bit),
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
-   .detect  = nsp_detect_old,
-   .release = nsp_release_old,
-#endif
.info= nsp_info,
.queuecommand= nsp_queuecommand,
 /* .eh_abort_handler= nsp_eh_abort,*/
@@ -97,9 +91,6 @@ static struct scsi_host_template nsp_dri
.sg_tablesize= SG_ALL,
.cmd_per_lun = 1,
.use_clustering  = DISABLE_CLUSTERING,
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,2))
-   .use_new_eh_code = 1,
-#endif
 };
 
 static nsp_hw_data nsp_data_base; /* attach - detect glue */
@@ -1313,11 +1304,7 @@ static struct Scsi_Host *nsp_detect(stru
nsp_hw_data *data_b = nsp_data_base, *data;
 
nsp_dbg(NSP_DEBUG_INIT, this_id=%d, sht-this_id);
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
host = scsi_host_alloc(nsp_driver_template, sizeof(nsp_hw_data));
-#else
-   host = scsi_register(sht, sizeof(nsp_hw_data));
-#endif
if (host == NULL) {
nsp_dbg(NSP_DEBUG_INIT, host failed);
return NULL;
@@ -1354,37 +1341,6 @@ static struct Scsi_Host *nsp_detect(stru
return host; /* detect done. */
 }
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
-static int nsp_detect_old(struct scsi_host_template *sht)
-{
-   if (nsp_detect(sht) == NULL) {
-   return 0;
-   } else {
-   //MOD_INC_USE_COUNT;
-   return 1;
-   }
-}
-
-
-static int nsp_release_old(struct Scsi_Host *shpnt)
-{
-   //nsp_hw_data *data = (nsp_hw_data *)shpnt-hostdata;
-
-   /* PCMCIA Card Service dose same things below. */
-   /* So we do nothing.   */
-   //if (shpnt-irq) {
-   //  free_irq(shpnt-irq, data-ScsiInfo);
-   //}
-   //if (shpnt-io_port) {
-   //  release_region(shpnt-io_port, shpnt-n_io_port);
-   //}
-
-   //MOD_DEC_USE_COUNT;
-
-   return 0;
-}
-#endif
-
 /**/
 /* return info string*/
 /**/
@@ -1403,19 +1359,9 @@ static const char *nsp_info(struct Scsi_
nsp_dbg(NSP_DEBUG_PROC, buffer=0x%p pos=0x%p length=%d 
%d\n, buffer, pos, length,  length - (pos - buffer));\
} \
} while(0)
-static int
-nsp_proc_info(
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   struct Scsi_Host *host,
-#endif
-   char  *buffer,
-   char **start,
-   off_t  offset,
-   intlength,
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   inthostno,
-#endif
-   intinout)
+
+static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start,
+off_t offset, int length, int inout)
 {
int id;
char *pos = buffer;
@@ -1423,24 +1369,13 @@ nsp_proc_info(
int speed;
unsigned long flags;
nsp_hw_data *data;
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   struct Scsi_Host *host;
-#else
int hostno;
-#endif
+
if (inout) {
return -EINVAL;
}
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
hostno = host-host_no;
-#else
-   /* search this HBA host */
-   host = scsi_host_hn_get(hostno);
-   if (host == NULL) {
-   return -ESRCH;
-   }
-#endif
data = (nsp_hw_data *)host-hostdata;
 
 
@@ -1675,10 +1610,6 @@ static int 

[patch 02/30] aacraid: rename check_reset

2007-08-10 Thread akpm
From: Andrew Morton [EMAIL PROTECTED]

Too generic, clashes with ISDN.

Acked-by: Mark Salyzyn [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aacraid/aachba.c  |8 
 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/aacraid/commsup.c |5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff -puN drivers/scsi/aacraid/aachba.c~aacraid-rename-check_reset 
drivers/scsi/aacraid/aachba.c
--- a/drivers/scsi/aacraid/aachba.c~aacraid-rename-check_reset
+++ a/drivers/scsi/aacraid/aachba.c
@@ -177,9 +177,9 @@ int check_interval = 24 * 60 * 60;
 module_param(check_interval, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(check_interval, Interval in seconds between adapter health 
checks.);
 
-int check_reset = 1;
-module_param(check_reset, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(check_reset, If adapter fails health check, reset the 
adapter.);
+int aac_check_reset = 1;
+module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(aac_check_reset, If adapter fails health check, reset the 
adapter.);
 
 int expose_physicals = -1;
 module_param(expose_physicals, int, S_IRUGO|S_IWUSR);
@@ -1305,7 +1305,7 @@ int aac_get_adapter_info(struct aac_dev*
  
(int)sizeof(dev-supplement_adapter_info.VpdInfo.Tsid),
  dev-supplement_adapter_info.VpdInfo.Tsid);
}
-   if (!check_reset ||
+   if (!aac_check_reset ||
  (dev-supplement_adapter_info.SupportedOptions2 
  le32_to_cpu(AAC_OPTION_IGNORE_RESET))) {
printk(KERN_INFO %s%d: Reset Adapter Ignored\n,
diff -puN drivers/scsi/aacraid/aacraid.h~aacraid-rename-check_reset 
drivers/scsi/aacraid/aacraid.h
--- a/drivers/scsi/aacraid/aacraid.h~aacraid-rename-check_reset
+++ a/drivers/scsi/aacraid/aacraid.h
@@ -1871,4 +1871,4 @@ extern int aac_reset_devices;
 extern int aac_commit;
 extern int update_interval;
 extern int check_interval;
-extern int check_reset;
+extern int aac_check_reset;
diff -puN drivers/scsi/aacraid/commsup.c~aacraid-rename-check_reset 
drivers/scsi/aacraid/commsup.c
--- a/drivers/scsi/aacraid/commsup.c~aacraid-rename-check_reset
+++ a/drivers/scsi/aacraid/commsup.c
@@ -1372,8 +1372,9 @@ int aac_check_health(struct aac_dev * aa
 
printk(KERN_ERR %s: Host adapter BLINK LED 0x%x\n, aac-name, 
BlinkLED);
 
-   if (!check_reset || (aac-supplement_adapter_info.SupportedOptions2 
- le32_to_cpu(AAC_OPTION_IGNORE_RESET)))
+   if (!aac_check_reset ||
+   (aac-supplement_adapter_info.SupportedOptions2 
+   le32_to_cpu(AAC_OPTION_IGNORE_RESET)))
goto out;
host = aac-scsi_host_ptr;
if (aac-thread-pid != current-pid)
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 06/30] Remove dead references to MODULE_PARM macro

2007-08-10 Thread akpm
From: Robert P. J. Day [EMAIL PROTECTED]

Remove the useless references to the obsolete MODULE_PARM macro.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ibmmca.c |7 ---
 1 files changed, 7 deletions(-)

diff -puN drivers/scsi/ibmmca.c~remove-dead-references-to-module_parm-macro 
drivers/scsi/ibmmca.c
--- a/drivers/scsi/ibmmca.c~remove-dead-references-to-module_parm-macro
+++ a/drivers/scsi/ibmmca.c
@@ -460,13 +460,6 @@ module_param(boot_options, charp, 0);
 module_param_array(io_port, int, NULL, 0);
 module_param_array(scsi_id, int, NULL, 0);
 
-#if 0 /* FIXME: No longer exist? --RR */
-MODULE_PARM(display, 1i);
-MODULE_PARM(adisplay, 1i);
-MODULE_PARM(normal, 1i);
-MODULE_PARM(ansi, 1i);
-#endif
-
 MODULE_LICENSE(GPL);
 #endif
 /*counter of concurrent disk read/writes, to turn on/off disk led */
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 07/30] Incorrect SCSI transfer length computation from odd sized scsi_execute_async() transfers.

2007-08-10 Thread akpm
From: Jeremy Linton [EMAIL PROTECTED]

Any function which use scsi_execute_async() and transfers odd sized data
that doesn't align correctly with the segment sizes may have its transfer
length padded out to the closest segment size.

For writes, this results in unnecessary data being transfered to the SCSI
target.  For reads, it affects the residual data length being returned to
the application since the residual length will be based on the padded
transfer size rather than the actual request size.

The easiest way to see this is by trying to read using the SG_IO ioctl a
large (32k) buffer size from a tape device that only has a few bytes of
data stored for the current block.  The resulting resid will generally be
incorrect.

I've fixed this simply by changing scsi_req_map_sg() so that it places the
requested transfer length in rq-data_len rather than the sum of all the sg
segments.

Signed-off-by: Jeremy Linton [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/scsi_lib.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/scsi_lib.c~incorrect-scsi-transfer-length-computation-from-odd 
drivers/scsi/scsi_lib.c
--- 
a/drivers/scsi/scsi_lib.c~incorrect-scsi-transfer-length-computation-from-odd
+++ a/drivers/scsi/scsi_lib.c
@@ -355,7 +355,7 @@ static int scsi_req_map_sg(struct reques
}
 
rq-buffer = rq-data = NULL;
-   rq-data_len = data_len;
+   rq-data_len = bufflen;
return 0;
 
 free_bios:
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 09/30] Clean up duplicate includes in drivers/scsi/

2007-08-10 Thread akpm
From: Jesper Juhl [EMAIL PROTECTED]

This patch cleans up duplicate includes in
drivers/scsi/

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
Acked-by: James Smart [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/NCR_D700.c  |1 -
 drivers/scsi/lpfc/lpfc_debugfs.c |1 -
 drivers/scsi/lpfc/lpfc_init.c|1 -
 3 files changed, 3 deletions(-)

diff -puN drivers/scsi/NCR_D700.c~clean-up-duplicate-includes-in-drivers-scsi 
drivers/scsi/NCR_D700.c
--- a/drivers/scsi/NCR_D700.c~clean-up-duplicate-includes-in-drivers-scsi
+++ a/drivers/scsi/NCR_D700.c
@@ -97,7 +97,6 @@
 #include linux/kernel.h
 #include linux/module.h
 #include linux/mca.h
-#include linux/interrupt.h
 #include asm/io.h
 #include scsi/scsi_host.h
 #include scsi/scsi_device.h
diff -puN 
drivers/scsi/lpfc/lpfc_debugfs.c~clean-up-duplicate-includes-in-drivers-scsi 
drivers/scsi/lpfc/lpfc_debugfs.c
--- 
a/drivers/scsi/lpfc/lpfc_debugfs.c~clean-up-duplicate-includes-in-drivers-scsi
+++ a/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -43,7 +43,6 @@
 #include lpfc_crtn.h
 #include lpfc_vport.h
 #include lpfc_version.h
-#include lpfc_vport.h
 #include lpfc_debugfs.h
 
 #ifdef CONFIG_LPFC_DEBUG_FS
diff -puN 
drivers/scsi/lpfc/lpfc_init.c~clean-up-duplicate-includes-in-drivers-scsi 
drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c~clean-up-duplicate-includes-in-drivers-scsi
+++ a/drivers/scsi/lpfc/lpfc_init.c
@@ -43,7 +43,6 @@
 #include lpfc_crtn.h
 #include lpfc_vport.h
 #include lpfc_version.h
-#include lpfc_vport.h
 
 static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int);
 static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *);
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 08/30] Use menuconfig objects: Fusion

2007-08-10 Thread akpm
From: Jan Engelhardt [EMAIL PROTECTED]

Change Kconfig objects from menu, config into menuconfig so
that the user can disable the whole feature without having to
enter the menu first.

Signed-off-by: Jan Engelhardt [EMAIL PROTECTED]
Cc: Moore, Eric Dean [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/fusion/Kconfig |   19 ++-
 1 files changed, 10 insertions(+), 9 deletions(-)

diff -puN drivers/message/fusion/Kconfig~use-menuconfig-objects-fusion 
drivers/message/fusion/Kconfig
--- a/drivers/message/fusion/Kconfig~use-menuconfig-objects-fusion
+++ a/drivers/message/fusion/Kconfig
@@ -1,15 +1,19 @@
 
-menu Fusion MPT device support
+menuconfig FUSION
+   bool Fusion MPT device support
depends on PCI
+   ---help---
+   Say Y here to get to see options for Fusion Message
+   Passing Technology (MPT) drivers.
+   This option alone does not add any kernel code.
+
+   If you say N, all options in this submenu will be skipped and disabled.
 
-config FUSION
-   bool
-   default n
+if FUSION
 
 config FUSION_SPI
tristate Fusion MPT ScsiHost drivers for SPI
depends on PCI  SCSI
-   select FUSION
select SCSI_SPI_ATTRS
---help---
  SCSI HOST support for a parallel SCSI host adapters.
@@ -24,7 +28,6 @@ config FUSION_SPI
 config FUSION_FC
tristate Fusion MPT ScsiHost drivers for FC
depends on PCI  SCSI
-   select FUSION
select SCSI_FC_ATTRS
---help---
  SCSI HOST support for a Fiber Channel host adapters.
@@ -42,7 +45,6 @@ config FUSION_FC
 config FUSION_SAS
tristate Fusion MPT ScsiHost drivers for SAS
depends on PCI  SCSI
-   select FUSION
select SCSI_SAS_ATTRS
---help---
  SCSI HOST support for a SAS host adapters.
@@ -56,7 +58,6 @@ config FUSION_SAS
 
 config FUSION_MAX_SGE
int Maximum number of scatter gather entries (16 - 128)
-   depends on FUSION
default 128
range 16 128
help
@@ -116,4 +117,4 @@ config FUSION_LOGGING
  There are various debug levels that an be found in the source:
  file:drivers/message/fusion/mptdebug.h
 
-endmenu
+endif # FUSION
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   4   >