Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b0cb1a19d05b8ea8611a9ef48a17fe417f1832e6
Commit: b0cb1a19d05b8ea8611a9ef48a17fe417f1832e6
Parent: 6c8dca5d53f95009d4fff00195bf38f277dc4366
Author: Rafael J. Wysocki [EMAIL PROTECTED]
AuthorDate: Sun Jul 29 23:24:36 2007 +0200
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Sun Jul 29 16:45:38 2007 -0700

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid
confusion (among other things, with CONFIG_SUSPEND introduced in the
next patch).

Signed-off-by: Rafael J. Wysocki [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/i386/Kconfig.debug |4 ++--
 arch/i386/kernel/e820.c |2 +-
 arch/i386/mm/init.c |2 +-
 arch/i386/power/Makefile|2 +-
 arch/powerpc/Kconfig.debug  |2 +-
 arch/powerpc/configs/lite5200_defconfig |2 +-
 arch/powerpc/configs/pmac32_defconfig   |2 +-
 arch/powerpc/kernel/Makefile|6 +++---
 arch/ppc/configs/TQM8540_defconfig  |2 +-
 arch/ppc/configs/TQM8541_defconfig  |2 +-
 arch/ppc/configs/TQM8555_defconfig  |2 +-
 arch/ppc/configs/TQM8560_defconfig  |2 +-
 arch/ppc/configs/ev64360_defconfig  |2 +-
 arch/ppc/configs/ml300_defconfig|2 +-
 arch/ppc/configs/ml403_defconfig|2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |2 +-
 arch/ppc/configs/prep_defconfig |2 +-
 arch/sparc64/Kconfig.debug  |2 +-
 arch/x86_64/defconfig   |2 +-
 arch/x86_64/kernel/Makefile |2 +-
 arch/x86_64/kernel/suspend.c|4 ++--
 drivers/acpi/sleep/main.c   |6 +++---
 drivers/acpi/sleep/proc.c   |2 +-
 drivers/i2c/chips/tps65010.c|2 +-
 include/asm-i386/e820.h |2 +-
 include/linux/suspend.h |8 
 kernel/power/Kconfig|6 +++---
 kernel/power/Makefile   |2 +-
 kernel/power/main.c |2 +-
 kernel/power/power.h|2 +-
 kernel/sys.c|2 +-
 mm/Kconfig  |4 ++--
 mm/swapfile.c   |6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index b31c080..f03531e 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
  This option will slow down process creation somewhat.
 
 comment Page alloc debug is incompatible with Software Suspend on i386
-   depends on DEBUG_KERNEL  SOFTWARE_SUSPEND
+   depends on DEBUG_KERNEL  HIBERNATION
 
 config DEBUG_PAGEALLOC
bool Debug page memory allocations
-   depends on DEBUG_KERNEL  !SOFTWARE_SUSPEND  !HUGETLBFS
+   depends on DEBUG_KERNEL  !HIBERNATION  !HUGETLBFS
help
  Unmap pages from the kernel linear mapping after free_pages().
  This results in a large slowdown, but helps to find certain types
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index e60cddb..3c86b97 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -321,7 +321,7 @@ static int __init request_standard_resources(void)
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM)  defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM)  defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 4c4809f..730a5b1 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
 /*
  * Swap suspend  friends need this for resume because things like the 
intel-agp
  * driver might have split up a kernel 4MB mapping.
diff --git a/arch/i386/power/Makefile b/arch/i386/power/Makefile
index 2de7bbf..d764ec9 100644
--- a/arch/i386/power/Makefile
+++ b/arch/i386/power/Makefile
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)   += cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)  += swsusp.o suspend.o
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 5c71624..22acece 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
 bool Debug page memory allocations
-depends on 

Introduce CONFIG_SUSPEND for suspend-to-Ram and standby

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=296699de6bdc717189a331ab6bbe90e05c94db06
Commit: 296699de6bdc717189a331ab6bbe90e05c94db06
Parent: b0cb1a19d05b8ea8611a9ef48a17fe417f1832e6
Author: Rafael J. Wysocki [EMAIL PROTECTED]
AuthorDate: Sun Jul 29 23:27:18 2007 +0200
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Sun Jul 29 16:45:38 2007 -0700

Introduce CONFIG_SUSPEND for suspend-to-Ram and standby

Introduce CONFIG_SUSPEND representing the ability to enter system sleep
states, such as the ACPI S3 state, and allow the user to choose SUSPEND
and HIBERNATION independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has
been chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if
CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the
code needed for both suspend and hibernation.

The top-level power management headers and the ACPI code related to
suspend and hibernation are modified to use the new definitions (the
changes in drivers/acpi/sleep/main.c are, mostly, moving code to reduce
the number of ifdefs).

There are many other files in which CONFIG_PM can be replaced with
CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
the future.

Signed-off-by: Rafael J. Wysocki [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/acpi/Kconfig|8 
 drivers/acpi/sleep/Makefile |2 +-
 drivers/acpi/sleep/main.c   |   94 +++
 drivers/acpi/sleep/proc.c   |   10 ++--
 drivers/acpi/sleep/sleep.h  |2 +
 drivers/base/power/Makefile |2 +-
 drivers/base/power/power.h  |4 +-
 include/acpi/acpi_bus.h |9 
 include/acpi/acpi_drivers.h |4 ++
 include/linux/freezer.h |6 +-
 include/linux/pm.h  |   15 +--
 include/linux/suspend.h |   10 ++--
 kernel/power/Kconfig|   41 +++
 kernel/power/Makefile   |3 +-
 kernel/power/main.c |   26 
 kernel/power/power.h|   10 -
 mm/page_alloc.c |4 +-
 17 files changed, 164 insertions(+), 86 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 22b401b..66e78d5 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -63,6 +63,14 @@ config ACPI_PROCFS
 
  Say N to delete /proc/acpi/ files that have moved to /sys/
 
+config ACPI_PROCFS_SLEEP
+   bool /proc/acpi/sleep (deprecated)
+   depends on PM_SLEEP  ACPI_PROCFS
+   default n
+   ---help---
+ Create /proc/acpi/sleep
+ Deprecated by /sys/power/state
+
 config ACPI_AC
tristate AC Adapter
depends on X86
diff --git a/drivers/acpi/sleep/Makefile b/drivers/acpi/sleep/Makefile
index 01a993a..2bec897 100644
--- a/drivers/acpi/sleep/Makefile
+++ b/drivers/acpi/sleep/Makefile
@@ -1,5 +1,5 @@
 obj-y  := poweroff.o wakeup.o
-obj-y  += main.o
+obj-$(CONFIG_PM_SLEEP) += main.o
 obj-$(CONFIG_X86)  += proc.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index b4e94c8..e8cff5d 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -21,6 +21,9 @@
 
 u8 sleep_states[ACPI_S_STATE_COUNT];
 
+static u32 acpi_target_sleep_state = ACPI_STATE_S0;
+
+#ifdef CONFIG_SUSPEND
 static struct pm_ops acpi_pm_ops;
 
 extern void do_suspend_lowlevel(void);
@@ -34,11 +37,6 @@ static u32 acpi_suspend_states[] = {
 
 static int init_8259A_after_S1;
 
-extern int acpi_sleep_prepare(u32 acpi_state);
-extern void acpi_power_off(void);
-
-static u32 acpi_target_sleep_state = ACPI_STATE_S0;
-
 /**
  * acpi_pm_set_target - Set the target system sleep state to the state
  * associated with given @pm_state, if supported.
@@ -163,21 +161,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
return 0;
 }
 
-int acpi_suspend(u32 acpi_state)
-{
-   suspend_state_t states[] = {
-   [1] = PM_SUSPEND_STANDBY,
-   [3] = PM_SUSPEND_MEM,
-   [5] = PM_SUSPEND_MAX
-   };
-
-   if (acpi_state  6  states[acpi_state])
-   return pm_suspend(states[acpi_state]);
-   if (acpi_state == 4)
-   return hibernate();
-   return -EINVAL;
-}
-
 static int acpi_pm_state_valid(suspend_state_t pm_state)
 {
u32 acpi_state;
@@ -202,6 +185,27 @@ static struct pm_ops acpi_pm_ops = {
.finish = acpi_pm_finish,
 };
 
+/*
+ * Toshiba fails to preserve interrupts over S1, reinitialization
+ * of 8259 is needed after S1 resume.
+ */
+static int __init init_ints_after_s1(struct dmi_system_id *d)
+{
+   printk(KERN_WARNING %s with broken S1 

Remove fs.h from mm.h

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e950f6f0189f65f8bf069cf2272649ef418f5e4
Commit: 4e950f6f0189f65f8bf069cf2272649ef418f5e4
Parent: 673d5b43daa00b42759cecc6b0760b8bf6be80d2
Author: Alexey Dobriyan [EMAIL PROTECTED]
AuthorDate: Mon Jul 30 02:36:13 2007 +0400
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Sun Jul 29 17:09:29 2007 -0700

Remove fs.h from mm.h

Remove fs.h from mm.h. For this,
 1) Uninline vma_wants_writenotify(). It's pretty huge anyway.
 2) Add back fs.h or less bloated headers (err.h) to files that need it.

As result, on x86_64 allyesconfig, fs.h dependencies cut down from 3929 
files
rebuilt down to 3444 (-12.3%).

Cross-compile tested without regressions on my two usual configs and (sigh):

alpha  arm-mx1adsmips-bigsur  powerpc-ebony
alpha-allnoconfig  arm-neponset  mips-capcellapowerpc-g5
alpha-defconfigarm-netwinder mips-cobalt  powerpc-holly
alpha-up   arm-netx  mips-db1000  powerpc-iseries
armarm-ns9xxxmips-db1100  
powerpc-linkstation
arm-assabetarm-omap_h2_1610  mips-db1200  powerpc-lite5200
arm-at91rm9200dk   arm-onearmmips-db1500  powerpc-maple
arm-at91rm9200ek   arm-picotux200mips-db1550  
powerpc-mpc7448_hpc2
arm-at91sam9260ek  arm-pleb  mips-ddb5477 
powerpc-mpc8272_ads
arm-at91sam9261ek  arm-pnx4008   mips-decstation  
powerpc-mpc8313_rdb
arm-at91sam9263ek  arm-pxa255-idpmips-e55 
powerpc-mpc832x_mds
arm-at91sam9rlek   arm-realview  mips-emma2rh 
powerpc-mpc832x_rdb
arm-ateb9200   arm-realview-smp  mips-excite  
powerpc-mpc834x_itx
arm-badge4 arm-rpc   mips-fulong  
powerpc-mpc834x_itxgp
arm-carmevaarm-s3c2410   mips-ip22
powerpc-mpc834x_mds
arm-cerfcube   arm-shannon   mips-ip27
powerpc-mpc836x_mds
arm-clps7500   arm-shark mips-ip32
powerpc-mpc8540_ads
arm-collie arm-simpadmips-jazzpowerpc-mpc8544_ds
arm-corgi  arm-spitz mips-jmr3927 
powerpc-mpc8560_ads
arm-csb337 arm-trizeps4  mips-malta   powerpc-mpc8568mds
arm-csb637 arm-versatile mips-mipssim 
powerpc-mpc85xx_cds
arm-ebsa110i386  mips-mpc30x  
powerpc-mpc8641_hpcn
arm-edb7211i386-allnoconfig  mips-msp71xx powerpc-mpc866_ads
arm-em_x270i386-defconfigmips-ocelot  powerpc-mpc885_ads
arm-ep93xx i386-up   mips-pb1100  powerpc-pasemi
arm-footbridge ia64  mips-pb1500  powerpc-pmac32
arm-fortunet   ia64-allnoconfig  mips-pb1550  powerpc-ppc64
arm-h3600  ia64-bigsur   mips-pnx8550-jbs powerpc-prpmc2800
arm-h7201  ia64-defconfigmips-pnx8550-stb810  powerpc-ps3
arm-h7202  ia64-gensparsemips-qemupowerpc-pseries
arm-hackkitia64-sim  mips-rbhma4200   powerpc-up
arm-integrator ia64-sn2  mips-rbhma4500   s390
arm-iop13xxia64-tigermips-rm200   s390-allnoconfig
arm-iop32x ia64-up   mips-sb1250-swarms390-defconfig
arm-iop33x ia64-zx1  mips-seads390-up
arm-ixp2000m68k  mips-tb0219  sparc
arm-ixp23xxm68k-amigamips-tb0226  sparc-allnoconfig
arm-ixp4xx m68k-apollo   mips-tb0287  sparc-defconfig
arm-jornada720 m68k-atarimips-workpad sparc-up
arm-kafa   m68k-bvme6000 mips-wrppmc  sparc64
arm-kb9202 m68k-hp300mips-yosemite
sparc64-allnoconfig
arm-ks8695 m68k-mac  parisc   sparc64-defconfig
arm-lart   m68k-mvme147  parisc-allnoconfig   sparc64-up
arm-lpd270 m68k-mvme16x  parisc-defconfig um-x86_64
arm-lpd7a400   m68k-q40  parisc-upx86_64
arm-lpd7a404   m68k-sun3 powerpc  x86_64-allnoconfig
arm-lubbockm68k-sun3xpowerpc-cell x86_64-defconfig
arm-lusl7200   mips  powerpc-celleb   x86_64-up
arm-mainstone  mips-atlaspowerpc-chrp32

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/alpha/kernel/smp.c|1 +
 arch/arm/kernel/setup.c|1 +
 arch/arm/kernel/smp.c  |1 +
 arch/frv/kernel/sys_frv.c  |1 +
 

[SCSI] qla2xxx: Data accessors Cleanup of last merge

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4b39c1d98327b0a572392cdb0ee22db1de0e7cb9
Commit: 4b39c1d98327b0a572392cdb0ee22db1de0e7cb9
Parent: f695baf2df9e0413d3521661070103711545207a
Author: Boaz Harrosh [EMAIL PROTECTED]
AuthorDate: Sun Jul 22 17:28:55 2007 +0300
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Mon Jul 23 14:27:48 2007 -0500

[SCSI] qla2xxx: Data accessors Cleanup of last merge

- Left overs from last code merges of qla2xxx

Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
Acked-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/qla2xxx/qla_isr.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index b8f226a..50539da 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1068,7 +1068,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
 * values.
 */
if (resid 
-   ((unsigned)(cp-request_bufflen - resid) 
+   ((unsigned)(scsi_bufflen(cp) - resid) 
 cp-underflow)) {
DEBUG2(qla_printk(KERN_INFO, ha,
scsi(%ld:%d:%d:%d): Mid-layer underflow 
@@ -1076,7 +1076,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
error status.\n, ha-host_no,
cp-device-channel, cp-device-id,
cp-device-lun, resid,
-   cp-request_bufflen));
+   scsi_bufflen(cp)));
 
cp-result = DID_ERROR  16 | lscsi_status;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] bsg: use lib/idr.c to find a unique minor number

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=598443a2124618fc8fe5a8bae32c129666ac3eab
Commit: 598443a2124618fc8fe5a8bae32c129666ac3eab
Parent: 4b39c1d98327b0a572392cdb0ee22db1de0e7cb9
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Mon Jul 23 09:33:26 2007 +0900
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Mon Jul 23 16:49:44 2007 -0500

[SCSI] bsg: use lib/idr.c to find a unique minor number

This replaces the current linear search for a unique minor number with
lib/idr.c.

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Acked-by: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 block/bsg.c |   69 ++
 include/linux/bsg.h |1 -
 2 files changed, 30 insertions(+), 40 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index b571869..8e4de53 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -24,6 +24,7 @@
 #include linux/cdev.h
 #include linux/percpu.h
 #include linux/uio.h
+#include linux/idr.h
 #include linux/bsg.h
 
 #include scsi/scsi.h
@@ -70,13 +71,12 @@ enum {
 #endif
 
 static DEFINE_MUTEX(bsg_mutex);
-static int bsg_device_nr, bsg_minor_idx;
+static DEFINE_IDR(bsg_minor_idr);
 
 #define BSG_LIST_ARRAY_SIZE8
 static struct hlist_head bsg_device_list[BSG_LIST_ARRAY_SIZE];
 
 static struct class *bsg_class;
-static LIST_HEAD(bsg_class_list);
 static int bsg_major;
 
 static struct kmem_cache *bsg_cmd_cachep;
@@ -781,23 +781,18 @@ static struct bsg_device *__bsg_get_device(int minor)
 
 static struct bsg_device *bsg_get_device(struct inode *inode, struct file 
*file)
 {
-   struct bsg_device *bd = __bsg_get_device(iminor(inode));
-   struct bsg_class_device *bcd, *__bcd;
+   struct bsg_device *bd;
+   struct bsg_class_device *bcd;
 
+   bd = __bsg_get_device(iminor(inode));
if (bd)
return bd;
 
/*
 * find the class device
 */
-   bcd = NULL;
mutex_lock(bsg_mutex);
-   list_for_each_entry(__bcd, bsg_class_list, list) {
-   if (__bcd-minor == iminor(inode)) {
-   bcd = __bcd;
-   break;
-   }
-   }
+   bcd = idr_find(bsg_minor_idr, iminor(inode));
mutex_unlock(bsg_mutex);
 
if (!bcd)
@@ -936,13 +931,12 @@ void bsg_unregister_queue(struct request_queue *q)
return;
 
mutex_lock(bsg_mutex);
+   idr_remove(bsg_minor_idr, bcd-minor);
sysfs_remove_link(q-kobj, bsg);
class_device_unregister(bcd-class_dev);
put_device(bcd-dev);
bcd-class_dev = NULL;
bcd-dev = NULL;
-   list_del_init(bcd-list);
-   bsg_device_nr--;
mutex_unlock(bsg_mutex);
 }
 EXPORT_SYMBOL_GPL(bsg_unregister_queue);
@@ -950,9 +944,9 @@ EXPORT_SYMBOL_GPL(bsg_unregister_queue);
 int bsg_register_queue(struct request_queue *q, struct device *gdev,
   const char *name)
 {
-   struct bsg_class_device *bcd, *__bcd;
+   struct bsg_class_device *bcd;
dev_t dev;
-   int ret = -EMFILE;
+   int ret, minor;
struct class_device *class_dev = NULL;
const char *devname;
 
@@ -969,28 +963,26 @@ int bsg_register_queue(struct request_queue *q, struct 
device *gdev,
 
bcd = q-bsg_dev;
memset(bcd, 0, sizeof(*bcd));
-   INIT_LIST_HEAD(bcd-list);
 
mutex_lock(bsg_mutex);
-   if (bsg_device_nr == BSG_MAX_DEVS) {
-   printk(KERN_ERR bsg: too many bsg devices\n);
-   goto err;
-   }
 
-retry:
-   list_for_each_entry(__bcd, bsg_class_list, list) {
-   if (__bcd-minor == bsg_minor_idx) {
-   bsg_minor_idx++;
-   if (bsg_minor_idx == BSG_MAX_DEVS)
-   bsg_minor_idx = 0;
-   goto retry;
-   }
+   ret = idr_pre_get(bsg_minor_idr, GFP_KERNEL);
+   if (!ret) {
+   ret = -ENOMEM;
+   goto unlock;
}
 
-   bcd-minor = bsg_minor_idx++;
-   if (bsg_minor_idx == BSG_MAX_DEVS)
-   bsg_minor_idx = 0;
+   ret = idr_get_new(bsg_minor_idr, bcd, minor);
+   if (ret  0)
+   goto unlock;
 
+   if (minor = BSG_MAX_DEVS) {
+   printk(KERN_ERR bsg: too many bsg devices\n);
+   ret = -EINVAL;
+   goto remove_idr;
+   }
+
+   bcd-minor = minor;
bcd-queue = q;
bcd-dev = get_device(gdev);
dev = MKDEV(bsg_major, bcd-minor);
@@ -998,27 +990,26 @@ retry:
devname);
if (IS_ERR(class_dev)) {
ret = PTR_ERR(class_dev);
-   goto err_put;
+   goto put_dev;
}
bcd-class_dev = class_dev;
 
if (q-kobj.sd) {
ret = sysfs_create_link(q-kobj, 

[SCSI] bsg: remove unnecessary code and comments

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1079ddcb07e0c39b576cd60174ca00ed9545c163
Commit: 1079ddcb07e0c39b576cd60174ca00ed9545c163
Parent: 598443a2124618fc8fe5a8bae32c129666ac3eab
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Mon Jul 23 09:33:27 2007 +0900
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Mon Jul 23 16:50:16 2007 -0500

[SCSI] bsg: remove unnecessary code and comments

- kill uhdr in bsg_command structure
- it's not necessary to put SG v4 stuff to block/scsi_ioctl.c

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 block/bsg.c |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index 8e4de53..12c287b 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -9,13 +9,6 @@
  *  archive for more details.
  *
  */
-/*
- * TODO
- * - Should this get merged, block/scsi_ioctl.c will be migrated into
- *   this file. To keep maintenance down, it's easier to have them
- *   seperated right now.
- *
- */
 #include linux/module.h
 #include linux/init.h
 #include linux/file.h
@@ -92,7 +85,6 @@ struct bsg_command {
struct bio *bidi_bio;
int err;
struct sg_io_v4 hdr;
-   struct sg_io_v4 __user *uhdr;
char sense[SCSI_SENSE_BUFFERSIZE];
 };
 
@@ -620,7 +612,6 @@ static int __bsg_write(struct bsg_device *bd, const char 
__user *buf,
break;
}
 
-   bc-uhdr = (struct sg_io_v4 __user *) buf;
if (copy_from_user(bc-hdr, buf, sizeof(bc-hdr))) {
ret = -EFAULT;
break;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: Fix security hole

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=60395bb60e0b5e4e0808ac8eb07a92f6c9cdea1f
Commit: 60395bb60e0b5e4e0808ac8eb07a92f6c9cdea1f
Parent: 1079ddcb07e0c39b576cd60174ca00ed9545c163
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Mon Jul 23 14:51:05 2007 +0100
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Mon Jul 23 16:52:30 2007 -0500

[SCSI] aacraid: Fix security hole

On the SCSI layer ioctl path there is no implicit permissions check for
ioctls (and indeed other drivers implement unprivileged ioctls). aacraid
however allows all sorts of very admin only things to be done so should
check.

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aacraid/linit.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index d76e1a8..c709dc8 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -636,6 +636,8 @@ static int aac_cfg_open(struct inode *inode, struct file 
*file)
 static int aac_cfg_ioctl(struct inode *inode,  struct file *file,
unsigned int cmd, unsigned long arg)
 {
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
return aac_do_ioctl(file-private_data, cmd, (void __user *)arg);
 }
 
@@ -689,6 +691,8 @@ static int aac_compat_ioctl(struct scsi_device *sdev, int 
cmd, void __user *arg)
 
 static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned 
long arg)
 {
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
return aac_compat_do_ioctl((struct aac_dev *)file-private_data, cmd, 
arg);
 }
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: sysfs adapter reset/status format change.

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bbf17d6483a7feb4c1eeef9fd553976d4f394e4c
Commit: bbf17d6483a7feb4c1eeef9fd553976d4f394e4c
Parent: 60395bb60e0b5e4e0808ac8eb07a92f6c9cdea1f
Author: Salyzyn, Mark [EMAIL PROTECTED]
AuthorDate: Mon Jul 23 10:13:48 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Mon Jul 23 16:58:43 2007 -0500

[SCSI] aacraid: sysfs adapter reset/status format change.

We need to newline terminate responses from nodes within the sysfs tree,
the Adapter status value reported by the reset adapter node is adjusted.

Signed-off-by: Mark Salyzyn [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aacraid/linit.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c709dc8..d27c838 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -826,7 +826,7 @@ static ssize_t aac_show_reset_adapter(struct class_device 
*class_dev,
tmp = aac_adapter_check_health(dev);
if ((tmp == 0)  dev-in_reset)
tmp = -EBUSY;
-   len = snprintf(buf, PAGE_SIZE, 0x%x, tmp);
+   len = snprintf(buf, PAGE_SIZE, 0x%x\n, tmp);
return len;
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] libsas: SMP request handler shouldn't crash when rphy is NULL

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2cd614c8732172524c36cd5245620338928062b6
Commit: 2cd614c8732172524c36cd5245620338928062b6
Parent: bbf17d6483a7feb4c1eeef9fd553976d4f394e4c
Author: Darrick J. Wong [EMAIL PROTECTED]
AuthorDate: Tue Jul 24 09:33:49 2007 -0700
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Tue Jul 24 13:02:26 2007 -0400

[SCSI] libsas: SMP request handler shouldn't crash when rphy is NULL

sas_smp_handler crashes when smp utils are used with an aic94xx host
because certain devices (the sas_host itself, specifically) lack rphy
structures.  No rphy means no SMP target support, but we shouldn't crash
here.

Signed-off-by: Darrick J. Wong [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/libsas/sas_expander.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libsas/sas_expander.c 
b/drivers/scsi/libsas/sas_expander.c
index b500f0c..8603ae6 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1879,7 +1879,7 @@ int sas_smp_handler(struct Scsi_Host *shost, struct 
sas_rphy *rphy,
struct request *req)
 {
struct domain_device *dev;
-   int ret, type = rphy-identify.device_type;
+   int ret, type;
struct request *rsp = req-next_rq;
 
if (!rsp) {
@@ -1888,12 +1888,13 @@ int sas_smp_handler(struct Scsi_Host *shost, struct 
sas_rphy *rphy,
return -EINVAL;
}
 
-   /* seems aic94xx doesn't support */
+   /* no rphy means no smp target support (ie aic94xx host) */
if (!rphy) {
printk(%s: can we send a smp request to a host?\n,
   __FUNCTION__);
return -EINVAL;
}
+   type = rphy-identify.device_type;
 
if (type != SAS_EDGE_EXPANDER_DEVICE 
type != SAS_FANOUT_EXPANDER_DEVICE) {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] bsg: fix unused variable warnings for BLK_DEV_BSG=n

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a4ee0df8b3d007f0d685d38a56dc0b91e01aaaf7
Commit: a4ee0df8b3d007f0d685d38a56dc0b91e01aaaf7
Parent: 2cd614c8732172524c36cd5245620338928062b6
Author: James Bottomley [EMAIL PROTECTED]
AuthorDate: Mon Jul 23 09:53:51 2007 -0500
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Tue Jul 24 14:24:05 2007 -0400

[SCSI] bsg: fix unused variable warnings for BLK_DEV_BSG=n

Just using #defines for the
bsg_register_queue()/bsg_unregister_queue() can cause undefined
variables when they're defined to nothing.  Use dummy inline functions
instead.

Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 include/linux/bsg.h |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 241eed0..102dc09 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -59,8 +59,13 @@ struct bsg_class_device {
 extern int bsg_register_queue(struct request_queue *, struct device *, const 
char *);
 extern void bsg_unregister_queue(struct request_queue *);
 #else
-#define bsg_register_queue(disk, dev, name)(0)
-#define bsg_unregister_queue(disk) do { } while (0)
+static inline int bsg_register_queue(struct request_queue * rq, struct device 
*dev, const char *name)
+{
+   return 0;
+}
+static inline void bsg_unregister_queue(struct request_queue *rq)
+{
+}
 #endif
 
 #endif /* __KERNEL__ */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] sym53c8xx: don't claim cpqarray device

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=147e505e23a2bda35689876af48f201d527dde91
Commit: 147e505e23a2bda35689876af48f201d527dde91
Parent: a4ee0df8b3d007f0d685d38a56dc0b91e01aaaf7
Author: Chip Coldwell [EMAIL PROTECTED]
AuthorDate: Wed May 23 14:41:38 2007 -0700
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Tue Jul 24 18:38:46 2007 -0400

[SCSI] sym53c8xx: don't claim cpqarray device

Apropos this thread

http://marc.theaimsgroup.com/?l=linux-scsim=115591706804045w=2

which led to this patch


http://www.kernel.org/git/?p=linux/kernel/git/jejb/scsi-rc-fixes-2.6.git;a=commit;h=b2b3c121076961333977f485f0d54c22121df920

We also need to fix sym53c8xx only to bind to the PCI ID if it is of
device class PCI_CLASS_STORAGE_SCSI (otherwise it will be the cpqarray
RAID device).

Signed-off-by: Chip Coldwell [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 15a5145..3db2232 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -2033,7 +2033,7 @@ static struct pci_device_id sym2_id_table[] __devinitdata 
= {
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C875,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C1510,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, /* new */
+ PCI_ANY_ID, PCI_ANY_ID,  PCI_CLASS_STORAGE_SCSI8,  0x00, 0UL }, 
/* new */
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C895A,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C875A,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] simscsi: convert to use the data buffer accessors

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fd3adb2ae8e16a02dfd5ed68f50fcf76fcdaff0b
Commit: fd3adb2ae8e16a02dfd5ed68f50fcf76fcdaff0b
Parent: 147e505e23a2bda35689876af48f201d527dde91
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Mon Jul 23 09:40:54 2007 +0900
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Wed Jul 25 16:18:11 2007 -0400

[SCSI] simscsi: convert to use the data buffer accessors

- remove the unnecessary map_single path.

- convert to use the new accessors for the sg lists and the
parameters.

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Acked-by: Tony Luck [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 arch/ia64/hp/sim/simscsi.c |   66 ++--
 1 files changed, 15 insertions(+), 51 deletions(-)

diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index bb87682..decdf6e 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -122,48 +122,22 @@ simscsi_biosparam (struct scsi_device *sdev, struct 
block_device *n,
 }
 
 static void
-simscsi_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset, 
unsigned long len)
-{
-   struct disk_stat stat;
-   struct disk_req req;
-
-   req.addr = __pa(sc-request_buffer);
-   req.len  = len; /* # of bytes to transfer */
-
-   if (sc-request_bufflen  req.len)
-   return;
-
-   stat.fd = desc[sc-device-id];
-   if (DBG)
-   printk(simscsi_%s @ %lx (off %lx)\n,
-  mode == SSC_READ ? read:write, req.addr, offset);
-   ia64_ssc(stat.fd, 1, __pa(req), offset, mode);
-   ia64_ssc(__pa(stat), 0, 0, 0, SSC_WAIT_COMPLETION);
-
-   if (stat.count == req.len) {
-   sc-result = GOOD;
-   } else {
-   sc-result = DID_ERROR  16;
-   }
-}
-
-static void
 simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset)
 {
-   int list_len = sc-use_sg;
-   struct scatterlist *sl = (struct scatterlist *)sc-request_buffer;
+   int i;
+   struct scatterlist *sl;
struct disk_stat stat;
struct disk_req req;
 
stat.fd = desc[sc-device-id];
 
-   while (list_len) {
+   scsi_for_each_sg(sc, sl, scsi_sg_count(sc), i) {
req.addr = __pa(page_address(sl-page) + sl-offset);
req.len  = sl-length;
if (DBG)
printk(simscsi_sg_%s @ %lx (off %lx) use_sg=%d 
len=%d\n,
   mode == SSC_READ ? read:write, req.addr, 
offset,
-  list_len, sl-length);
+  scsi_sg_count(sc) - i, sl-length);
ia64_ssc(stat.fd, 1, __pa(req), offset, mode);
ia64_ssc(__pa(stat), 0, 0, 0, SSC_WAIT_COMPLETION);
 
@@ -173,8 +147,6 @@ simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, 
unsigned long offset)
return;
}
offset +=  sl-length;
-   sl++;
-   list_len--;
}
sc-result = GOOD;
 }
@@ -190,10 +162,7 @@ simscsi_readwrite6 (struct scsi_cmnd *sc, int mode)
unsigned long offset;
 
offset = (((sc-cmnd[1]  0x1f)  16) | (sc-cmnd[2]  8) | 
sc-cmnd[3])*512;
-   if (sc-use_sg  0)
-   simscsi_sg_readwrite(sc, mode, offset);
-   else
-   simscsi_readwrite(sc, mode, offset, sc-cmnd[4]*512);
+   simscsi_sg_readwrite(sc, mode, offset);
 }
 
 static size_t
@@ -230,26 +199,21 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
| ((unsigned long)sc-cmnd[3]  16)
| ((unsigned long)sc-cmnd[4]   8) 
| ((unsigned long)sc-cmnd[5]   0))*512UL;
-   if (sc-use_sg  0)
-   simscsi_sg_readwrite(sc, mode, offset);
-   else
-   simscsi_readwrite(sc, mode, offset, ((sc-cmnd[7]  8) | 
sc-cmnd[8])*512);
+   simscsi_sg_readwrite(sc, mode, offset);
 }
 
 static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
 {
 
-   int scatterlen = sc-use_sg;
+   int i;
+   unsigned thislen;
struct scatterlist *slp;
 
-   if (scatterlen == 0)
-   memcpy(sc-request_buffer, buf, len);
-   else for (slp = (struct scatterlist *)sc-request_buffer;
- scatterlen--  0  len  0; slp++) {
-   unsigned thislen = min(len, slp-length);
-
+   scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) {
+   if (!len)
+   break;
+   thislen = min(len, slp-length);
memcpy(page_address(slp-page) + slp-offset, buf, thislen);
-   slp++;
len -= thislen;
}
 }
@@ -275,7 +239,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void 
(*done)(struct scsi_cmnd *))
if (target_id = 15  

[SCSI] libsas: Remove PCI dependencies

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1d1bbee61e4ecdaad450e9bf4d9983876ed53a43
Commit: 1d1bbee61e4ecdaad450e9bf4d9983876ed53a43
Parent: fd3adb2ae8e16a02dfd5ed68f50fcf76fcdaff0b
Author: Jeff Garzik [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 09:28:37 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Thu Jul 26 09:42:43 2007 -0400

[SCSI] libsas: Remove PCI dependencies

Eliminate unnecessary PCI dependencies in libsas.  It should use generic
DMA and struct device like other subsystems.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aic94xx/aic94xx_init.c |4 +---
 drivers/scsi/libsas/sas_ata.c   |   30 +++---
 drivers/scsi/libsas/sas_discover.c  |3 +--
 drivers/scsi/libsas/sas_dump.c  |2 +-
 include/scsi/libsas.h   |2 +-
 5 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c 
b/drivers/scsi/aic94xx/aic94xx_init.c
index ab00aec..63bcde2 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -586,7 +586,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
goto Err;
}
asd_ha-pcidev = dev;
-   asd_ha-sas_ha.pcidev = asd_ha-pcidev;
+   asd_ha-sas_ha.dev = asd_ha-pcidev-dev;
asd_ha-sas_ha.lldd_ha = asd_ha;
 
asd_ha-name = asd_dev-name;
@@ -605,8 +605,6 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
goto Err_free;
}
 
-
-
err = asd_dev-setup(asd_ha);
if (err)
goto Err_free;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index ced2de3..5e573ef 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -382,7 +382,7 @@ int sas_ata_init_host_and_port(struct domain_device 
*found_dev,
struct ata_port *ap;
 
ata_host_init(found_dev-sata_dev.ata_host,
- ha-pcidev-dev,
+ ha-dev,
  sata_port_info.flags,
  sas_sata_ops);
ap = ata_sas_port_alloc(found_dev-sata_dev.ata_host,
@@ -448,10 +448,10 @@ static void sas_disc_task_done(struct sas_task *task)
  * @task: the task to be executed
  * @buffer: pointer to buffer to do I/O
  * @size: size of @buffer
- * @pci_dma_dir: PCI_DMA_...
+ * @dma_dir: DMA direction.  DMA_xxx
  */
 static int sas_execute_task(struct sas_task *task, void *buffer, int size,
-   int pci_dma_dir)
+   enum dma_data_direction dma_dir)
 {
int res = 0;
struct scatterlist *scatter = NULL;
@@ -461,7 +461,7 @@ static int sas_execute_task(struct sas_task *task, void 
*buffer, int size,
struct sas_internal *i =
to_sas_internal(task-dev-port-ha-core.shost-transportt);
 
-   if (pci_dma_dir != PCI_DMA_NONE) {
+   if (dma_dir != DMA_NONE) {
scatter = kzalloc(sizeof(*scatter), GFP_KERNEL);
if (!scatter)
goto out;
@@ -474,11 +474,11 @@ static int sas_execute_task(struct sas_task *task, void 
*buffer, int size,
task-scatter = scatter;
task-num_scatter = num_scatter;
task-total_xfer_len = size;
-   task-data_dir = pci_dma_dir;
+   task-data_dir = dma_dir;
task-task_done = sas_disc_task_done;
-   if (pci_dma_dir != PCI_DMA_NONE 
+   if (dma_dir != DMA_NONE 
sas_protocol_ata(task-task_proto)) {
-   task-num_scatter = pci_map_sg(task-dev-port-ha-pcidev,
+   task-num_scatter = dma_map_sg(task-dev-port-ha-dev,
   task-scatter,
   task-num_scatter,
   task-data_dir);
@@ -565,9 +565,9 @@ static int sas_execute_task(struct sas_task *task, void 
*buffer, int size,
}
}
 ex_err:
-   if (pci_dma_dir != PCI_DMA_NONE) {
+   if (dma_dir != DMA_NONE) {
if (sas_protocol_ata(task-task_proto))
-   pci_unmap_sg(task-dev-port-ha-pcidev,
+   dma_unmap_sg(task-dev-port-ha-dev,
 task-scatter, task-num_scatter,
 task-data_dir);
kfree(scatter);
@@ -628,11 +628,11 @@ static void sas_get_ata_command_set(struct domain_device 
*dev)
  * @features: the features register
  * @buffer: pointer to buffer to do I/O
  * @size: size of @buffer
- * @pci_dma_dir: PCI_DMA_...
+ * @dma_dir: DMA direction.  DMA_xxx
  */
 static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
 u8 features, void *buffer, int size,
-int pci_dma_dir)
+enum 

[SCSI] libiscsi: make sure session is not blocked when removing host

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=464bb99ea448dc2f017be9150a8be9ab1f021979
Commit: 464bb99ea448dc2f017be9150a8be9ab1f021979
Parent: 1d1bbee61e4ecdaad450e9bf4d9983876ed53a43
Author: Mike Christie [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 12:46:45 2007 -0500
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:11:14 2007 -0400

[SCSI] libiscsi: make sure session is not blocked when removing host

When we logout we block the session since we are not taking any more
commands, but when we call remove host we want to make sure any
IO that got queued up and blocked gets failed upwards quickly, so
we unblock the session and fail it.

Signed-off-by: Mike Christie [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/libiscsi.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 4d85ce1..271a2d6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1473,6 +1473,7 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
struct iscsi_session *session = iscsi_hostdata(shost-hostdata);
struct module *owner = cls_session-transport-owner;
 
+   iscsi_unblock_session(cls_session);
scsi_remove_host(shost);
 
iscsi_pool_free(session-mgmtpool, (void**)session-mgmt_cmds);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] iscsi_tcp, ib_iser Enable module refcounting for iscsi host template

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7974392c0b0d4e7a2a17ca3597d51a29b9841aa5
Commit: 7974392c0b0d4e7a2a17ca3597d51a29b9841aa5
Parent: 464bb99ea448dc2f017be9150a8be9ab1f021979
Author: Mike Christie [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 12:46:46 2007 -0500
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:11:45 2007 -0400

[SCSI] iscsi_tcp, ib_iser Enable module refcounting for iscsi host template

This prevents the iscsi modules from being unloaded while
there are active mounts from an iscsi target.

Signed-off-by: Olaf Kirch [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/iser/iscsi_iser.c |1 +
 drivers/scsi/iscsi_tcp.c |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 5db3143..bad8dac 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -548,6 +548,7 @@ iscsi_iser_ep_disconnect(__u64 ep_handle)
 }
 
 static struct scsi_host_template iscsi_iser_sht = {
+   .module = THIS_MODULE,
.name   = iSCSI Initiator over iSER, v. DRV_VER,
.queuecommand   = iscsi_queuecommand,
.can_queue  = ISCSI_DEF_XMIT_CMDS_MAX - 1,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 7829ab1..93034b4 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -2221,6 +2221,7 @@ static int iscsi_tcp_slave_configure(struct scsi_device 
*sdev)
 }
 
 static struct scsi_host_template iscsi_sht = {
+   .module = THIS_MODULE,
.name   = iSCSI Initiator over TCP/IP,
.queuecommand   = iscsi_queuecommand,
.change_queue_depth = iscsi_change_queue_depth,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] libiscsi: fix cmd seqeunce number checking

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e07264071f7f2b02a2973cb28d9fdf5eb8866cc1
Commit: e07264071f7f2b02a2973cb28d9fdf5eb8866cc1
Parent: 7974392c0b0d4e7a2a17ca3597d51a29b9841aa5
Author: Mike Christie [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 12:46:48 2007 -0500
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:12:05 2007 -0400

[SCSI] libiscsi: fix cmd seqeunce number checking

We should not be checking the cmd windown for just handling r2t responses.
And if the window closes in on us, always have scsi-ml requeue the command
from our queuecommand function.

Signed-off-by: Mike Christie [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/libiscsi.c |   46 +-
 include/scsi/libiscsi.h |3 +++
 2 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 271a2d6..5606d1e 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -596,9 +596,16 @@ static void iscsi_prep_mtask(struct iscsi_conn *conn,
nop-cmdsn = cpu_to_be32(session-cmdsn);
if (hdr-itt != RESERVED_ITT) {
hdr-itt = build_itt(mtask-itt, conn-id, session-age);
+   /*
+* TODO: We always use immediate, so we never hit this.
+* If we start to send tmfs or nops as non-immediate then
+* we should start checking the cmdsn numbers for mgmt tasks.
+*/
if (conn-c_stage == ISCSI_CONN_STARTED 
-   !(hdr-opcode  ISCSI_OP_IMMEDIATE))
+   !(hdr-opcode  ISCSI_OP_IMMEDIATE)) {
+   session-queued_cmdsn++;
session-cmdsn++;
+   }
}
 
if (session-tt-init_mgmt_task)
@@ -641,9 +648,11 @@ static int iscsi_check_cmdsn_window_closed(struct 
iscsi_conn *conn)
/*
 * Check for iSCSI window and take care of CmdSN wrap-around
 */
-   if (!iscsi_sna_lte(session-cmdsn, session-max_cmdsn)) {
-   debug_scsi(iSCSI CmdSN closed. MaxCmdSN %u CmdSN %u\n,
-  session-max_cmdsn, session-cmdsn);
+   if (!iscsi_sna_lte(session-queued_cmdsn, session-max_cmdsn)) {
+   debug_scsi(iSCSI CmdSN closed. ExpCmdSn %u MaxCmdSN %u 
+  CmdSN %u/%u\n, session-exp_cmdsn,
+  session-max_cmdsn, session-cmdsn,
+  session-queued_cmdsn);
return -ENOSPC;
}
return 0;
@@ -722,11 +731,6 @@ check_mgmt:
 
/* process command queue */
while (!list_empty(conn-xmitqueue)) {
-   rc = iscsi_check_cmdsn_window_closed(conn);
-   if (rc) {
-   spin_unlock_bh(conn-session-lock);
-   return rc;
-   }
/*
 * iscsi tcp may readd the task to the xmitqueue to send
 * write data
@@ -834,12 +838,6 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void 
(*done)(struct scsi_cmnd *))
goto fault;
}
 
-   /*
-* We check this here and in data xmit, because if we get to the point
-* that this check is hitting the window then we have enough IO in
-* flight and enough IO waiting to be transmitted it is better
-* to let the scsi/block layer queue up.
-*/
if (iscsi_check_cmdsn_window_closed(conn)) {
reason = FAILURE_WINDOW_CLOSED;
goto reject;
@@ -850,6 +848,8 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void 
(*done)(struct scsi_cmnd *))
reason = FAILURE_OOM;
goto reject;
}
+   session-queued_cmdsn++;
+
sc-SCp.phase = session-age;
sc-SCp.ptr = (char *)ctask;
 
@@ -1140,7 +1140,13 @@ static void fail_command(struct iscsi_conn *conn, struct 
iscsi_cmd_task *ctask,
if (!sc)
return;
 
-   if (ctask-state != ISCSI_TASK_PENDING)
+   if (ctask-state == ISCSI_TASK_PENDING)
+   /*
+* cmd never made it to the xmit thread, so we should not count
+* the cmd in the sequencing
+*/
+   conn-session-queued_cmdsn--;
+   else
conn-session-tt-cleanup_cmd_task(conn, ctask);
iscsi_ctask_mtask_cleanup(ctask);
 
@@ -1392,7 +1398,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
session-state = ISCSI_STATE_FREE;
session-mgmtpool_max = ISCSI_MGMT_CMDS_MAX;
session-cmds_max = cmds_max;
-   session-cmdsn = initial_cmdsn;
+   session-queued_cmdsn = session-cmdsn = initial_cmdsn;
session-exp_cmdsn = initial_cmdsn + 1;
session-max_cmdsn = initial_cmdsn + 1;
session-max_r2t = 1;
@@ -1616,11 +1622,8 @@ void 

[SCSI] iscsi_tcp: Turn off bounce buffers

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b6d44fe9582b9d90a0b16f508ac08a90d899bf56
Commit: b6d44fe9582b9d90a0b16f508ac08a90d899bf56
Parent: e07264071f7f2b02a2973cb28d9fdf5eb8866cc1
Author: Mike Christie [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 12:46:47 2007 -0500
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:12:54 2007 -0400

[SCSI] iscsi_tcp: Turn off bounce buffers

It was found by LSI that on setups with large amounts of memory
we were bouncing buffers when we did not need to. If the iscsi tcp
code touches the data buffer (or a helper does),
it will kmap the buffer. iscsi_tcp also does not interact with hardware,
so it does not have any hw dma restrictions. This patch sets the bounce
buffer settings for our device queue so buffers should not be bounced
because of a driver limit.

Signed-off-by: Mike Christie [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/iscsi_tcp.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 93034b4..a21455d 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -2216,6 +2216,7 @@ static void iscsi_tcp_session_destroy(struct 
iscsi_cls_session *cls_session)
 
 static int iscsi_tcp_slave_configure(struct scsi_device *sdev)
 {
+   blk_queue_bounce_limit(sdev-request_queue, BLK_BOUNCE_ANY);
blk_queue_dma_alignment(sdev-request_queue, 0);
return 0;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: draw line in sand, sundry cleanup and version update

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c835e3727b87115f98c612a5ecb8882826d2537e
Commit: c835e3727b87115f98c612a5ecb8882826d2537e
Parent: b6d44fe9582b9d90a0b16f508ac08a90d899bf56
Author: Salyzyn, Mark [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 14:20:02 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:13:28 2007 -0400

[SCSI] aacraid: draw line in sand, sundry cleanup and version update

Minor unimportant cuttings from the floor bundled in with a version
stamp update. Only controversial change is the dropping of Alan Cox
copyright on the nark.c module since that file has no code written by
him in it.

Signed-off-by: Mark Salyzyn [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aacraid/aachba.c  |3 +--
 drivers/scsi/aacraid/aacraid.h |6 +++---
 drivers/scsi/aacraid/linit.c   |3 +--
 drivers/scsi/aacraid/nark.c|3 +--
 drivers/scsi/aacraid/rkt.c |2 +-
 5 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index a26baab..54cdfcc 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -194,8 +194,7 @@ static inline int aac_valid_context(struct scsi_cmnd 
*scsicmd,
struct scsi_device *device;
 
if (unlikely(!scsicmd || !scsicmd-scsi_done )) {
-   dprintk((KERN_WARNING aac_valid_context: scsi command 
corrupt\n))
-;
+   dprintk((KERN_WARNING aac_valid_context: scsi command 
corrupt\n));
 aac_fib_complete(fibptr);
 aac_fib_free(fibptr);
 return 0;
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 400d034..94727b9 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 2447
+# define AAC_DRIVER_BUILD 2449
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
@@ -1807,10 +1807,10 @@ struct aac_aifcmd {
  * accounting for the fact capacity could be a 64 bit value
  *
  */
-static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
+static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
 {
sector_div(capacity, divisor);
-   return (u32)capacity;
+   return capacity;
 }
 
 /* SCp.phase values */
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index d27c838..813556c 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1126,9 +1126,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
 static void aac_shutdown(struct pci_dev *dev)
 {
struct Scsi_Host *shost = pci_get_drvdata(dev);
-   struct aac_dev *aac = (struct aac_dev *)shost-hostdata;
scsi_block_requests(shost);
-   __aac_shutdown(aac);
+   __aac_shutdown((struct aac_dev *)shost-hostdata);
 }
 
 static void __devexit aac_remove_one(struct pci_dev *pdev)
diff --git a/drivers/scsi/aacraid/nark.c b/drivers/scsi/aacraid/nark.c
index a8ace56..c55f7c8 100644
--- a/drivers/scsi/aacraid/nark.c
+++ b/drivers/scsi/aacraid/nark.c
@@ -1,11 +1,10 @@
 /*
  * Adaptec AAC series RAID controller driver
- * (c) Copyright 2001 Red Hat Inc. [EMAIL PROTECTED]
  *
  * based on the old aacraid driver that is..
  * Adaptec aacraid device driver for Linux.
  *
- * Copyright (c) 2000 Adaptec, Inc. ([EMAIL PROTECTED])
+ * Copyright (c) 2006-2007 Adaptec, Inc. ([EMAIL PROTECTED])
  *
  * 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
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index 9c5fcfb..8cd6588 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -5,7 +5,7 @@
  * based on the old aacraid driver that is..
  * Adaptec aacraid device driver for Linux.
  *
- * Copyright (c) 2000 Adaptec, Inc. ([EMAIL PROTECTED])
+ * Copyright (c) 2000-2007 Adaptec, Inc. ([EMAIL PROTECTED])
  *
  * 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
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: fix to honor ignored parameters in sysfs attributes

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=281afe1947d855661754850de29d7530b2ff18dc
Commit: 281afe1947d855661754850de29d7530b2ff18dc
Parent: c835e3727b87115f98c612a5ecb8882826d2537e
Author: Seokmann Ju [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 13:43:34 2007 -0700
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:14:22 2007 -0400

[SCSI] qla2xxx: fix to honor ignored parameters in sysfs attributes

This is a patch to fix 'segmentation fault' issue which was initiated
by Richard Lary [EMAIL PROTECTED].  Thanks again Richard.

- on following sysfs attritute function, changes have made so that both
  count and offset input parameters are honored by the functions.
= qla2x00_sysfs_read_nvram()
= qla2x00_sysfs_read_vpd()
- made changes so that NVRAM data to be cached to minimize H/W accesses
  during agent querying of the driver's.

Signed-off-by: Seokmann Ju [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/qla2xxx/qla_attr.c |   39 +++
 drivers/scsi/qla2xxx/qla_def.h  |4 
 drivers/scsi/qla2xxx/qla_init.c |   19 +++
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 1612f92..0f2a9f5 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -91,18 +91,20 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj,
 {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj)));
-   unsigned long   flags;
+   int size = ha-nvram_size;
+   char*nvram_cache = ha-nvram;
 
-   if (!capable(CAP_SYS_ADMIN) || off != 0)
+   if (!capable(CAP_SYS_ADMIN) || off  size || count == 0)
return 0;
+   if (off + count  size) {
+   size -= off;
+   count = size;
+   }
 
-   /* Read NVRAM. */
-   spin_lock_irqsave(ha-hardware_lock, flags);
-   ha-isp_ops-read_nvram(ha, (uint8_t *)buf, ha-nvram_base,
-   ha-nvram_size);
-   spin_unlock_irqrestore(ha-hardware_lock, flags);
+   /* Read NVRAM data from cache. */
+   memcpy(buf, nvram_cache[off], count);
 
-   return ha-nvram_size;
+   return count;
 }
 
 static ssize_t
@@ -144,6 +146,8 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj,
/* Write NVRAM. */
spin_lock_irqsave(ha-hardware_lock, flags);
ha-isp_ops-write_nvram(ha, (uint8_t *)buf, ha-nvram_base, count);
+   ha-isp_ops-read_nvram(ha, (uint8_t *)ha-nvram, ha-nvram_base,
+   count);
spin_unlock_irqrestore(ha-hardware_lock, flags);
 
set_bit(ISP_ABORT_NEEDED, ha-dpc_flags);
@@ -298,18 +302,20 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj,
 {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj)));
-   unsigned long flags;
+   int   size = ha-vpd_size;
+   char  *vpd_cache = ha-vpd;
 
-   if (!capable(CAP_SYS_ADMIN) || off != 0)
+   if (!capable(CAP_SYS_ADMIN) || off  size || count == 0)
return 0;
+   if (off + count  size) {
+   size -= off;
+   count = size;
+   }
 
-   /* Read NVRAM. */
-   spin_lock_irqsave(ha-hardware_lock, flags);
-   ha-isp_ops-read_nvram(ha, (uint8_t *)buf, ha-vpd_base,
-   ha-vpd_size);
-   spin_unlock_irqrestore(ha-hardware_lock, flags);
+   /* Read NVRAM data from cache. */
+   memcpy(buf, vpd_cache[off], count);
 
-   return ha-vpd_size;
+   return count;
 }
 
 static ssize_t
@@ -327,6 +333,7 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj,
/* Write NVRAM. */
spin_lock_irqsave(ha-hardware_lock, flags);
ha-isp_ops-write_nvram(ha, (uint8_t *)buf, ha-vpd_base, count);
+   ha-isp_ops-read_nvram(ha, (uint8_t *)ha-vpd, ha-vpd_base, count);
spin_unlock_irqrestore(ha-hardware_lock, flags);
 
return count;
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 0c9f36c..27ae3a5 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2340,10 +2340,14 @@ typedef struct scsi_qla_host {
uint8_t serial2;
 
/* NVRAM configuration data */
+#define MAX_NVRAM_SIZE 4096
+#define VPD_OFFSET MAX_NVRAM_SIZE / 2
uint16_tnvram_size;
uint16_tnvram_base;
+   void*nvram;
uint16_tvpd_size;
uint16_tvpd_base;
+   void*vpd;
 
uint16_tloop_reset_delay;
uint8_t retry_count;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 5ec798c..374abe1 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ 

[SCSI] aic79xx, aic7xxx: Fix incorrect width setting

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0f82cb9211f800f77636af11f0670e5fc6de6256
Commit: 0f82cb9211f800f77636af11f0670e5fc6de6256
Parent: 281afe1947d855661754850de29d7530b2ff18dc
Author: James Bottomley [EMAIL PROTECTED]
AuthorDate: Thu Jul 26 17:13:10 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Fri Jul 27 09:20:20 2007 -0400

[SCSI] aic79xx, aic7xxx: Fix incorrect width setting

Wide transfers are required for every setting of PPR apart from QAS.
It seems the DV code starts at the minimum, which turns on DT and Wide
regardless of the setting of max_width.  Redo the PPR and period
setting routines to respect max_width (i.e. start at period = 10 if it
is zero).

This fixes bugzilla 8366

Acked-by: Freels, James D. [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aic7xxx/aic79xx_osm.c |   23 +--
 drivers/scsi/aic7xxx/aic7xxx_osm.c |   11 ---
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c 
b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 286ab83..a055a96 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -2284,9 +2284,12 @@ static void ahd_linux_set_period(struct scsi_target 
*starget, int period)
if (period  8)
period = 8;
if (period  10) {
-   ppr_options |= MSG_EXT_PPR_DT_REQ;
-   if (period == 8)
-   ppr_options |= MSG_EXT_PPR_IU_REQ;
+   if (spi_max_width(starget)) {
+   ppr_options |= MSG_EXT_PPR_DT_REQ;
+   if (period == 8)
+   ppr_options |= MSG_EXT_PPR_IU_REQ;
+   } else
+   period = 10;
}
 
dt = ppr_options  MSG_EXT_PPR_DT_REQ;
@@ -2365,7 +2368,7 @@ static void ahd_linux_set_dt(struct scsi_target *starget, 
int dt)
printf(%s: %s DT\n, ahd_name(ahd), 
   dt ? enabling : disabling);
 #endif
-   if (dt) {
+   if (dt  spi_max_width(starget)) {
ppr_options |= MSG_EXT_PPR_DT_REQ;
if (!width)
ahd_linux_set_width(starget, 1);
@@ -2447,7 +2450,7 @@ static void ahd_linux_set_iu(struct scsi_target *starget, 
int iu)
   iu ? enabling : disabling);
 #endif
 
-   if (iu) {
+   if (iu  spi_max_width(starget)) {
ppr_options |= MSG_EXT_PPR_IU_REQ;
ppr_options |= MSG_EXT_PPR_DT_REQ; /* IU requires DT */
}
@@ -2487,7 +2490,7 @@ static void ahd_linux_set_rd_strm(struct scsi_target 
*starget, int rdstrm)
   rdstrm  ? enabling : disabling);
 #endif
 
-   if (rdstrm)
+   if (rdstrm  spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_RD_STRM;
 
ahd_compile_devinfo(devinfo, shost-this_id, starget-id, 0,
@@ -2523,7 +2526,7 @@ static void ahd_linux_set_wr_flow(struct scsi_target 
*starget, int wrflow)
   wrflow ? enabling : disabling);
 #endif
 
-   if (wrflow)
+   if (wrflow  spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_WR_FLOW;
 
ahd_compile_devinfo(devinfo, shost-this_id, starget-id, 0,
@@ -2567,7 +2570,7 @@ static void ahd_linux_set_rti(struct scsi_target 
*starget, int rti)
   rti ? enabling : disabling);
 #endif
 
-   if (rti)
+   if (rti  spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_RTI;
 
ahd_compile_devinfo(devinfo, shost-this_id, starget-id, 0,
@@ -2603,7 +2606,7 @@ static void ahd_linux_set_pcomp_en(struct scsi_target 
*starget, int pcomp)
   pcomp ? Enable : Disable);
 #endif
 
-   if (pcomp) {
+   if (pcomp  spi_max_width(starget)) {
uint8_t precomp;
 
if (ahd-unit  ARRAY_SIZE(aic79xx_iocell_info)) {
@@ -2647,7 +2650,7 @@ static void ahd_linux_set_hold_mcs(struct scsi_target 
*starget, int hold)
unsigned int dt = ppr_options  MSG_EXT_PPR_DT_REQ;
unsigned long flags;
 
-   if (hold)
+   if (hold  spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_HOLD_MCS;
 
ahd_compile_devinfo(devinfo, shost-this_id, starget-id, 0,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c 
b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 1803ab6..2e9c38f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -2317,8 +2317,13 @@ static void ahc_linux_set_period(struct scsi_target 
*starget, int period)
 
if (period  9)
period = 9; /* 12.5ns is our minimum */
-   if (period == 9)
-   ppr_options |= MSG_EXT_PPR_DT_REQ;
+   if (period == 9) {
+   if (spi_max_width(starget))
+   ppr_options |= MSG_EXT_PPR_DT_REQ;

[SCSI] add easyRAID to the no report luns blacklist

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=80b1c7bdc1cc69a804f416761f5faafcb6284086
Commit: 80b1c7bdc1cc69a804f416761f5faafcb6284086
Parent: 27c868c2233fe0d34b21ceb5287bb2f7617f1095
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Fri Jul 27 13:30:02 2007 -0700
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 10:00:28 2007 -0400

[SCSI] add easyRAID to the no report luns blacklist

According to http://bugzilla.kernel.org/show_bug.cgi?id=5953, the
easyRAID returns rubbish to REPORT LUNS.

Cc: Natalie Protasevich [EMAIL PROTECTED]
Cc: Hans-Christian Armingeon [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/scsi_devinfo.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 19c44f0..e2ea739 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -154,6 +154,9 @@ static struct {
{EMC,  Invista, *, BLIST_SPARSELUN | BLIST_LARGELUN},
{EMC, SYMMETRIX, NULL, BLIST_SPARSELUN | BLIST_LARGELUN | 
BLIST_FORCELUN},
{EMULEX, MD21/S2 ESDI, NULL, BLIST_SINGLELUN},
+   {easyRAID, 16P, NULL, BLIST_NOREPORTLUN},
+   {easyRAID, X6P, NULL, BLIST_NOREPORTLUN},
+   {easyRAID, F8, NULL, BLIST_NOREPORTLUN},
{FSC, CentricStor, *, BLIST_SPARSELUN | BLIST_LARGELUN},
{Generic, USB SD Reader, 1.00, BLIST_FORCELUN | BLIST_INQUIRY_36},
{Generic, USB Storage-SMC, 0180, BLIST_FORCELUN | 
BLIST_INQUIRY_36},
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: add SCSI SYNCHONIZE_CACHE range checking

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b90f90d2303f27b9b241ab78419a07b41de5ac62
Commit: b90f90d2303f27b9b241ab78419a07b41de5ac62
Parent: 80b1c7bdc1cc69a804f416761f5faafcb6284086
Author: Salyzyn, Mark [EMAIL PROTECTED]
AuthorDate: Fri Jul 27 09:48:49 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 10:09:07 2007 -0400

[SCSI] aacraid: add SCSI SYNCHONIZE_CACHE range checking

Customer running an application that issues SYNCHRONIZE_CACHE calls
directly noticed the broad stroke of the current implementation in the
aacraid driver resulting in multiple applications feeding I/O to the
storage causing the issuing application to stall for long periods of
time. By only waiting for the current WRITE commands, rather than all
commands, to complete; and those that are in range of the
SYNCHRONIZE_CACHE call that would associate more tightly with the
issuing application before telling the Firmware to flush it's dirty
cache, we managed to reduce the stalling. The Firmware itself still
flushes all the dirty cache associated with the array ignoring the
range, it just does so in a more timely manner.

Signed-off-by: Mark Salyzyn [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aacraid/aachba.c |   63 +++-
 1 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 54cdfcc..6800e57 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1688,23 +1688,23 @@ static void synchronize_callback(void *context, struct 
fib *fibptr)
if (!aac_valid_context(cmd, fibptr))
return;
 
-   dprintk((KERN_DEBUG synchronize_callback[cpu %d]: t = %ld.\n, 
+   dprintk((KERN_DEBUG synchronize_callback[cpu %d]: t = %ld.\n,
smp_processor_id(), jiffies));
BUG_ON(fibptr == NULL);
 
 
synchronizereply = fib_data(fibptr);
if (le32_to_cpu(synchronizereply-status) == CT_OK)
-   cmd-result = DID_OK  16 | 
+   cmd-result = DID_OK  16 |
COMMAND_COMPLETE  8 | SAM_STAT_GOOD;
else {
struct scsi_device *sdev = cmd-device;
struct aac_dev *dev = fibptr-dev;
u32 cid = sdev_id(sdev);
-   printk(KERN_WARNING 
+   printk(KERN_WARNING
 synchronize_callback: synchronize failed, status = %d\n,
 le32_to_cpu(synchronizereply-status));
-   cmd-result = DID_OK  16 | 
+   cmd-result = DID_OK  16 |
COMMAND_COMPLETE  8 | SAM_STAT_CHECK_CONDITION;
set_sense((u8 *)dev-fsa_dev[cid].sense_data,
HARDWARE_ERROR,
@@ -1712,7 +1712,7 @@ static void synchronize_callback(void *context, struct 
fib *fibptr)
ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
0, 0);
memcpy(cmd-sense_buffer, dev-fsa_dev[cid].sense_data,
- min(sizeof(dev-fsa_dev[cid].sense_data), 
+ min(sizeof(dev-fsa_dev[cid].sense_data),
  sizeof(cmd-sense_buffer)));
}
 
@@ -1730,6 +1730,9 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
struct scsi_device *sdev = scsicmd-device;
int active = 0;
struct aac_dev *aac;
+   u64 lba = ((u64)scsicmd-cmnd[2]  24) | (scsicmd-cmnd[3]  16) |
+   (scsicmd-cmnd[4]  8) | scsicmd-cmnd[5];
+   u32 count = (scsicmd-cmnd[7]  8) | scsicmd-cmnd[8];
unsigned long flags;
 
/*
@@ -1738,7 +1741,51 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
 */
spin_lock_irqsave(sdev-list_lock, flags);
list_for_each_entry(cmd, sdev-cmd_list, list)
-   if (cmd != scsicmd  cmd-SCp.phase == AAC_OWNER_FIRMWARE) {
+   if (cmd-SCp.phase == AAC_OWNER_FIRMWARE) {
+   u64 cmnd_lba;
+   u32 cmnd_count;
+
+   if (cmd-cmnd[0] == WRITE_6) {
+   cmnd_lba = ((cmd-cmnd[1]  0x1F)  16) |
+   (cmd-cmnd[2]  8) |
+   cmd-cmnd[3];
+   cmnd_count = cmd-cmnd[4];
+   if (cmnd_count == 0)
+   cmnd_count = 256;
+   } else if (cmd-cmnd[0] == WRITE_16) {
+   cmnd_lba = ((u64)cmd-cmnd[2]  56) |
+   ((u64)cmd-cmnd[3]  48) |
+   ((u64)cmd-cmnd[4]  40) |
+   ((u64)cmd-cmnd[5]  32) |
+ 

[SCSI] aacraid: fix Sunrise Lake reset handling

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9859c1aa7e16822c574e1be89d61fbfe6188b50f
Commit: 9859c1aa7e16822c574e1be89d61fbfe6188b50f
Parent: b90f90d2303f27b9b241ab78419a07b41de5ac62
Author: Salyzyn, Mark [EMAIL PROTECTED]
AuthorDate: Fri Jul 27 10:29:26 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 10:11:32 2007 -0400

[SCSI] aacraid: fix Sunrise Lake reset handling

The patch is *much* smaller than the description. I am attempting to
answer to those that want to understand an issue that was reported in
May this year.

If a Sunrise Lake based card that requires an alternate reset mechanism
is set up to ignore the commanded IOP_RESET it reports 0x0010
(IOP_RESET ignored) instead of 0x3803000F (use alternate reset mechanism
to reset all cores), and thus the reset platform function decides to
switch to IOP_RESET_ALWAYS because the reset platform function
parameters indicate that we *need* to reset the card. IOP_RESET_ALWAYS
then responds with the 0x3803000F return code, but alas we treat this as
an error instead of using the alternate reset mechanism (put a 0x03 into
the register offset 0x38). The reset fails, but the fact that the
IOP_RESET_ALWAYS command was issued has put the card in a purposeful
shutdown state in preparation for the alternate hardware reset to be
applied. Yuck.

IOP_RESET is ignored in internal production cards, typically to ensure
that we catch all adapter lockup issues without the driver progressing
further, so this would not appear to be a field issue and thus this
patch was destined to be only in the internal Adaptec source tree.
IOP_RESET_ALWAYS is reserved for
kexec/kdump/FirmwareUpdate/AutomatedTestFrames so we did not function as
expected in any case. Also in the past we have had OEMs specifically
request that cards not be resetable after a BlinkLED/FirmwareAssert for
one reason or another and To head off the possibility that the Sunrise
Lake based cards would suffer a similar fate, we propose the enclosed
fix.

Yinghai Lu of SUN had a pre-production card with IOP_RESET disabled when
he reported an issue to the linux kernel list back in May regarding a
kexec problem resulting from this reset being ignore. His fix was to
update the Firmware to one that did not ignore the IOP_RESET. Previous
kernels did not attempt to reset the adapter and that is why it surfaced
as a regression in his hands.

The current list of aacraid based cards that use Sunrise Lake:

9005:0285:9005:02b5 Adaptec 5445
9005:0285:9005:02b6 Adaptec 5805
9005:0285:9005:02b7 Adaptec 5085
9005:0285:9005:02c3 Adaptec 51205
9005:0285:9005:02c4 Adaptec 51605
9005:0285:9005:02ce Adaptec 51245
9005:0285:9005:02cf Adaptec 51645
9005:0285:9005:02d0 Adaptec 52445
9005:0285:9005:02d1 Adaptec 5405
9005:0285:9005:02b8 ICP ICP5445SL
9005:0285:9005:02b9 ICP ICP5085SL
9005:0285:9005:02ba ICP ICP5805SL
9005:0285:9005:02c5 ICP ICP5125SL
9005:0285:9005:02c6 ICP ICP5165SL
9005:0285:108e:7aac SUN STK RAID REM
9005:0285:108e:0286 SUN STK RAID INT
9005:0285:108e:0287 SUN STK RAID EXT
9005:0285:108e:7aae SUN STK RAID EM

All of these are publicly released with IOP_RESET enabled. So there is
no immediate need for this patch.

Signed-off-by: Mark Salyzyn [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/aacraid/rx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index ebc65b9..73eef3d 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -472,7 +472,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int 
bled)
else {
bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS,
  0, 0, 0, 0, 0, 0, var, NULL, NULL, NULL, NULL);
-   if (!bled  (var != 0x0001))
+   if (!bled  (var != 0x0001)  (var != 0x3803000F))
bled = -EINVAL;
}
if (bled  (bled != -ETIMEDOUT))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] bsg: Fix build for CONFIG_BLOCK=n

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=99d4d0a9f251a87e0710c6f1fb46ac0d4bce12cb
Commit: 99d4d0a9f251a87e0710c6f1fb46ac0d4bce12cb
Parent: 9859c1aa7e16822c574e1be89d61fbfe6188b50f
Author: Paul Mundt [EMAIL PROTECTED]
AuthorDate: Sat Jul 28 23:45:43 2007 +0900
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 10:56:06 2007 -0400

[SCSI] bsg: Fix build for CONFIG_BLOCK=n

BLK_DEV_BSG was added outside of the if BLOCK check, which allows it to
be enabled when CONFIG_BLOCK=n. This leads to many screenlengths of
errors, starting with a parse error on the request_queue_t definition.
Obviously this wasn't intended for CONFIG_BLOCK=n usage, so just move the
option back in to the block.

Caught with a randconfig on sh.

Signed-off-by: Paul Mundt [EMAIL PROTECTED]
Acked-by: Jens Axboe [EMAIL PROTECTED]
Acked-by: FUJITA Tomonori [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 block/Kconfig |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/Kconfig b/block/Kconfig
index ca2ef4e..2484e0e 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -49,8 +49,6 @@ config LSF
 
  If unsure, say Y.
 
-endif # BLOCK
-
 config BLK_DEV_BSG
bool Block layer SG support v4 (EXPERIMENTAL)
depends on EXPERIMENTAL
@@ -64,4 +62,6 @@ config BLK_DEV_BSG
protocols (e.g. Task Management Functions and SMP in Serial
Attached SCSI).
 
+endif # BLOCK
+
 source block/Kconfig.iosched
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] libsas: Fix potential NULL dereference in sas_smp_get_phy_events()

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=92631fa4d0afa64b82144eab714fbf2f4049dabe
Commit: 92631fa4d0afa64b82144eab714fbf2f4049dabe
Parent: 99d4d0a9f251a87e0710c6f1fb46ac0d4bce12cb
Author: Jesper Juhl [EMAIL PROTECTED]
AuthorDate: Sat Jul 28 01:13:33 2007 +0200
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 10:58:28 2007 -0400

[SCSI] libsas: Fix potential NULL dereference in sas_smp_get_phy_events()

In sas_smp_get_phy_events() we never test if the call to
alloc_smp_req(RPEL_REQ_SIZE) succeeds or fails. That means we run
the risk of dereferencing a NULL pointer if it does fail. Far
better to test if we got NULL back and in that case return -ENOMEM
just as we already do for the other memory allocation in that
function.

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/scsi/libsas/sas_expander.c |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/libsas/sas_expander.c 
b/drivers/scsi/libsas/sas_expander.c
index 8603ae6..8727436 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -507,14 +507,21 @@ static int sas_dev_present_in_domain(struct asd_sas_port 
*port,
 int sas_smp_get_phy_events(struct sas_phy *phy)
 {
int res;
+   u8 *req;
+   u8 *resp;
struct sas_rphy *rphy = dev_to_rphy(phy-dev.parent);
struct domain_device *dev = sas_find_dev_by_rphy(rphy);
-   u8 *req = alloc_smp_req(RPEL_REQ_SIZE);
-   u8 *resp = kzalloc(RPEL_RESP_SIZE, GFP_KERNEL);
 
-   if (!resp)
+   req = alloc_smp_req(RPEL_REQ_SIZE);
+   if (!req)
return -ENOMEM;
 
+   resp = alloc_smp_resp(RPEL_RESP_SIZE);
+   if (!resp) {
+   kfree(req);
+   return -ENOMEM;
+   }
+
req[1] = SMP_REPORT_PHY_ERR_LOG;
req[9] = phy-number;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] mpt fusion: logging support in Kconfig, Makefile, mptbase.h and addition of mptdebug.h

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5c1b91b9923d1b3d33576e391ff7b587bdff7a3e
Commit: 5c1b91b9923d1b3d33576e391ff7b587bdff7a3e
Parent: 92631fa4d0afa64b82144eab714fbf2f4049dabe
Author: Prakash, Sathya [EMAIL PROTECTED]
AuthorDate: Tue Jul 24 15:40:08 2007 +0530
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 11:25:35 2007 -0400

[SCSI] mpt fusion: logging support in Kconfig, Makefile, mptbase.h and 
addition of mptdebug.h

This patch adds a new file mptdebug.h in the fusion source directory,
which contains different debug macros.  The existing debug macros and
flags are removed from the mptbase.h and Makefile In Kconfig a new
configuration parameter FUSION_LOGGING is added to enable/disable the
logging support during compile time.

signed-off-by: Sathya Prakash [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/message/fusion/Kconfig|   14 ++
 drivers/message/fusion/Makefile   |   37 +-
 drivers/message/fusion/mptbase.h  |  198 +-
 drivers/message/fusion/mptdebug.h |  288 +
 4 files changed, 308 insertions(+), 229 deletions(-)

diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
index 4494e0f..f55cc03 100644
--- a/drivers/message/fusion/Kconfig
+++ b/drivers/message/fusion/Kconfig
@@ -102,4 +102,18 @@ config FUSION_LAN
 
  If unsure whether you really want or need this, say N.
 
+config FUSION_LOGGING
+   bool Fusion MPT logging facility
+   depends on FUSION
+   ---help---
+ This turns on a logging facility that can be used to debug a number
+ of Fusion MPT related problems.
+
+ The debug level can be programmed on the fly via SysFS (hex values)
+
+ echo [level]  /sys/class/scsi_host/host#/debug_level
+
+ There are various debug levels that an be found in the source:
+ file:drivers/message/fusion/mptdebug.h
+
 endmenu
diff --git a/drivers/message/fusion/Makefile b/drivers/message/fusion/Makefile
index 6003b46..95c9532 100644
--- a/drivers/message/fusion/Makefile
+++ b/drivers/message/fusion/Makefile
@@ -1,39 +1,8 @@
 # Fusion MPT drivers; recognized debug defines...
-#  MPT general:
-#EXTRA_CFLAGS += -DMPT_DEBUG
-#EXTRA_CFLAGS += -DMPT_DEBUG_MSG_FRAME
-#EXTRA_CFLAGS += -DMPT_DEBUG_SG
-#EXTRA_CFLAGS += -DMPT_DEBUG_EVENTS
-#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE_EVENTS
-#EXTRA_CFLAGS += -DMPT_DEBUG_INIT
-#EXTRA_CFLAGS += -DMPT_DEBUG_EXIT
-#EXTRA_CFLAGS += -DMPT_DEBUG_FAIL
-#EXTRA_CFLAGS += -DMPT_DEBUG_DV
-#EXTRA_CFLAGS += -DMPT_DEBUG_TM
-#EXTRA_CFLAGS += -DMPT_DEBUG_REPLY
 
-#
-# driver/module specifics...
-#
-#  For mptbase:
-#CFLAGS_mptbase.o += -DMPT_DEBUG_HANDSHAKE
-#CFLAGS_mptbase.o += -DMPT_DEBUG_CONFIG
-#CFLAGS_mptbase.o += -DMPT_DEBUG_DL
-#CFLAGS_mptbase.o += -DMPT_DEBUG_IRQ
-#CFLAGS_mptbase.o += -DMPT_DEBUG_RESET
-#
-#  For mptscsih:
-#CFLAGS_mptscsih.o += -DMPT_DEBUG_SCSI
-#
-#  For mptctl:
-#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
-#
-#  For mptfc:
-#CFLAGS_mptfc.o += -DMPT_DEBUG_FC
-
-#  For mptsas:
-#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS
-#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS_WIDE
+# enable verbose logging
+# CONFIG_FUSION_LOGGING needs to be enabled in Kconfig
+#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE
 
 
 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 98eb9c6..15ff226 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -186,6 +186,7 @@
  * MPT drivers.  NOTE: Users of these macro defs must
  * themselves define their own MYNAM.
  */
+#define MYIOC_s_DEBUG_FMT  KERN_DEBUG MYNAM : %s: 
 #define MYIOC_s_INFO_FMT   KERN_INFO MYNAM : %s: 
 #define MYIOC_s_NOTE_FMT   KERN_NOTICE MYNAM : %s: 
 #define MYIOC_s_WARN_FMT   KERN_WARNING MYNAM : %s: WARNING - 
@@ -543,6 +544,7 @@ typedef struct _MPT_ADAPTER
char board_tracer[16];
u16  nvdata_version_persistent;
u16  nvdata_version_default;
+   int  debug_level;
u8   io_missing_delay;
u8   device_missing_delay;
SYSIF_REGS __iomem  *chip;  /* == c8817000 (mmap) */
@@ -718,171 +720,7 @@ typedef struct _mpt_sge {
 /*
  *  Funky (private) macros...
  */
-#ifdef MPT_DEBUG
-#define dprintk(x)  printk x
-#else
-#define dprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_INIT
-#define dinitprintk(x)  printk x
-#define DBG_DUMP_FW_REQUEST_FRAME(mfp) \
-   {   int  i, n = 10; \
-   u32 *m = (u32 *)(mfp);  \
-   printk(KERN_INFO  );  \
-   for (i=0; in; i++)   

[SCSI] mpt fusion: Changes in mptscsih.c for logging support

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6757d6b4c0701866bbf2ac02c397f78879b75e58
Commit: 6757d6b4c0701866bbf2ac02c397f78879b75e58
Parent: 436ace725f35eb9af16b1986e3e9d776d384b7db
Author: Prakash, Sathya [EMAIL PROTECTED]
AuthorDate: Wed Jul 25 11:14:01 2007 +0530
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 11:30:27 2007 -0400

[SCSI] mpt fusion: Changes in mptscsih.c for logging support

This patch contains changes in mptscsih.c to support logging in MPT fusion
drivers.

The changes are majorly in debug printks, the existing debugprintk are
modified accroding to new debug macros defined in the file mptbdebug.h

A new sysfs attribute is added to retrieve and modify the debug level.

signed-off-by: Sathya Prakash [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/message/fusion/mptscsih.c |  446 +---
 1 files changed, 260 insertions(+), 186 deletions(-)

diff --git a/drivers/message/fusion/mptscsih.c 
b/drivers/message/fusion/mptscsih.c
index fd3aa26..5431529 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -191,7 +191,7 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int *retIndex)
int rc;
int chain_idx;
 
-   dsgprintk((MYIOC_s_INFO_FMT getFreeChainBuffer called\n,
+   dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT getFreeChainBuffer called\n,
ioc-name));
spin_lock_irqsave(ioc-FreeQlock, flags);
if (!list_empty(ioc-FreeChainQ)) {
@@ -203,12 +203,12 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int 
*retIndex)
offset = (u8 *)chainBuf - (u8 *)ioc-ChainBuffer;
chain_idx = offset / ioc-req_sz;
rc = SUCCESS;
-   dsgprintk((MYIOC_s_ERR_FMT getFreeChainBuffer chainBuf=%p 
ChainBuffer=%p offset=%d chain_idx=%d\n,
+   dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT getFreeChainBuffer 
chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n,
ioc-name, chainBuf, ioc-ChainBuffer, offset, 
chain_idx));
} else {
rc = FAILED;
chain_idx = MPT_HOST_NO_CHAIN;
-   dfailprintk((MYIOC_s_INFO_FMT getFreeChainBuffer failed\n,
+   dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT getFreeChainBuffer 
failed\n,
ioc-name));
}
spin_unlock_irqrestore(ioc-FreeQlock, flags);
@@ -337,7 +337,7 @@ nextSGEset:
 */
pReq-ChainOffset = 0;
RequestNB = (((sgeOffset - 1)  ioc-NBShiftFactor)  + 
1)  0x03;
-   dsgprintk((MYIOC_s_INFO_FMT
+   dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT
Single Buffer RequestNB=%x, sgeOffset=%d\n, 
ioc-name, RequestNB, sgeOffset));
ioc-RequestNB[req_idx] = RequestNB;
}
@@ -353,7 +353,7 @@ nextSGEset:
 * Loop until done.
 */
 
-   dsgprintk((MYIOC_s_INFO_FMT SG: Chain Required! sg done %d\n,
+   dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT SG: Chain Required! sg 
done %d\n,
ioc-name, sg_done));
 
/* Set LAST_ELEMENT flag for last non-chain element
@@ -386,7 +386,7 @@ nextSGEset:
 */
pReq-ChainOffset = (u8) (sgeOffset  2);
RequestNB = (((sgeOffset - 1)  ioc-NBShiftFactor)  + 
1)  0x03;
-   dsgprintk((MYIOC_s_ERR_FMT Chain Buffer Needed, 
RequestNB=%x sgeOffset=%d\n, ioc-name, RequestNB, sgeOffset));
+   dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT Chain Buffer 
Needed, RequestNB=%x sgeOffset=%d\n, ioc-name, RequestNB, sgeOffset));
ioc-RequestNB[req_idx] = RequestNB;
}
 
@@ -397,7 +397,7 @@ nextSGEset:
 * in current buffer. Get a chain buffer.
 */
if ((mptscsih_getFreeChainBuffer(ioc, newIndex)) == FAILED) {
-   dfailprintk((MYIOC_s_INFO_FMT
+   dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
getFreeChainBuffer FAILED SCSI cmd=%02x (%p)\n,
ioc-name, pReq-CDB[0], SCpnt));
return FAILED;
@@ -419,7 +419,7 @@ nextSGEset:
 *   out the Address and Flags fields.
 */
chainSge = (char *) psge;
-   dsgprintk((KERN_INFO   Current buff @ %p (index 0x%x),
+   dsgprintk(ioc, printk(KERN_DEBUG   Current buff @ %p (index 
0x%x),
psge, req_idx));
 
/* Start the SGE for the next buffer
@@ -428,7 +428,7 @@ nextSGEset:
sgeOffset = 0;
sg_done = 0;

[SCSI] mpt fusion: Changes in mptfc.c mptlan.c mptsas.c and mptspi.c for logging support

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6ecdd638aa840604b87195f2097cabbd095092c
Commit: d6ecdd638aa840604b87195f2097cabbd095092c
Parent: 6757d6b4c0701866bbf2ac02c397f78879b75e58
Author: Prakash, Sathya [EMAIL PROTECTED]
AuthorDate: Tue Jul 24 15:47:41 2007 +0530
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 11:31:54 2007 -0400

[SCSI] mpt fusion: Changes in mptfc.c mptlan.c mptsas.c and mptspi.c for 
logging support

This patch contains changes in mptfc.c, mptlan.c, mptsas.c and mptspi.c to
support logging in MPT fusion drivers.

The changes are majorly in debug printks, the existing debugprintk are
modified accroding to new debug macros defined in the file mptbdebug.h

signed-off-by: Sathya Prakash [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/message/fusion/mptfc.c  |  108 +++-
 drivers/message/fusion/mptlan.c |3 +-
 drivers/message/fusion/mptsas.c |  276 ++-
 drivers/message/fusion/mptspi.c |   53 +++-
 4 files changed, 194 insertions(+), 246 deletions(-)

diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index f2ebaa9..8422c25 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -188,16 +188,18 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
  int (*func)(struct scsi_cmnd *SCpnt),
  const char *caller)
 {
+   MPT_SCSI_HOST   *hd;
struct scsi_device  *sdev = SCpnt-device;
struct Scsi_Host*shost = sdev-host;
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
unsigned long   flags;
int ready;
 
+   hd = (MPT_SCSI_HOST *) SCpnt-device-host-hostdata;
spin_lock_irqsave(shost-host_lock, flags);
while ((ready = fc_remote_port_chkready(rport)  16) == DID_IMM_RETRY) 
{
spin_unlock_irqrestore(shost-host_lock, flags);
-   dfcprintk ((MYIOC_s_INFO_FMT
+   dfcprintk (hd-ioc, printk(MYIOC_s_DEBUG_FMT
mptfc_block_error_handler.%d: %d:%d, port status is 
DID_IMM_RETRY, deferring %s recovery.\n,
((MPT_SCSI_HOST *) shost-hostdata)-ioc-name,
@@ -209,7 +211,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
spin_unlock_irqrestore(shost-host_lock, flags);
 
if (ready == DID_NO_CONNECT || !SCpnt-device-hostdata) {
-   dfcprintk ((MYIOC_s_INFO_FMT
+   dfcprintk (hd-ioc, printk(MYIOC_s_DEBUG_FMT
%s.%d: %d:%d, failing recovery, 
port state %d, vdev %p.\n, caller,
((MPT_SCSI_HOST *) shost-hostdata)-ioc-name,
@@ -218,7 +220,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
SCpnt-device-hostdata));
return FAILED;
}
-   dfcprintk ((MYIOC_s_INFO_FMT
+   dfcprintk (hd-ioc, printk(MYIOC_s_DEBUG_FMT
%s.%d: %d:%d, executing recovery.\n, caller,
((MPT_SCSI_HOST *) shost-hostdata)-ioc-name,
((MPT_SCSI_HOST *) shost-hostdata)-ioc-sh-host_no,
@@ -483,7 +485,7 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, 
FCDevicePage0_t *pg0)
 
pn = (u64)ri-pg0.WWPN.High  32 | 
(u64)ri-pg0.WWPN.Low;
nn = (u64)ri-pg0.WWNN.High  32 | 
(u64)ri-pg0.WWNN.Low;
-   dfcprintk ((MYIOC_s_INFO_FMT
+   dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, 
rport tid %d, tmo %d\n,
ioc-name,
@@ -559,6 +561,35 @@ mptfc_target_alloc(struct scsi_target *starget)
 
return rc;
 }
+/*
+ * mptfc_dump_lun_info
+ * @ioc
+ * @rport
+ * @sdev
+ *
+ */
+static void
+mptfc_dump_lun_info(MPT_ADAPTER *ioc, struct fc_rport *rport, struct 
scsi_device *sdev,
+   VirtTarget *vtarget)
+{
+   u64 nn, pn;
+   struct mptfc_rport_info *ri;
+
+   ri = *((struct mptfc_rport_info **)rport-dd_data);
+   pn = (u64)ri-pg0.WWPN.High  32 | (u64)ri-pg0.WWPN.Low;
+   nn = (u64)ri-pg0.WWNN.High  32 | (u64)ri-pg0.WWNN.Low;
+   dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
+   mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, 
+   CurrentTargetID %d, %x %llx %llx\n,
+   ioc-name,
+   sdev-host-host_no,
+   vtarget-num_luns,
+   sdev-id, ri-pg0.CurrentTargetID,
+   ri-pg0.PortIdentifier,
+   (unsigned long long)pn,
+   (unsigned long long)nn));
+}
+
 
 /*
  * OS entry point to allow host driver to alloc memory
@@ -606,25 +637,7 @@ 

Make lguest compile with CONFIG_BLOCK=n and CONFIG_NET=n

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=05ff09706bacc92ccadde3a74289118789581475
Commit: 05ff09706bacc92ccadde3a74289118789581475
Parent: a6ce22a5f61ba838b43763bf1e5be399f9dee4d0
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Jul 30 10:25:22 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Sun Jul 29 17:37:45 2007 -0700

Make lguest compile with CONFIG_BLOCK=n and CONFIG_NET=n

Gabriel C reports lguest doesn't compile with CONFIG_BLOCK=n.  Fix this
by introducing a config var for the block device, which depends on
LGUEST  BLOCK.  Do the same for the net driver, rather then depending
gratuitously on CONFIG_NET.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Gabriel C [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/block/Makefile |2 +-
 drivers/lguest/Kconfig |   10 +-
 drivers/net/Makefile   |2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index a7a0990..014e721 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -31,4 +31,4 @@ obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
 obj-$(CONFIG_BLK_DEV_UB)   += ub.o
 
 obj-$(CONFIG_XEN_BLKDEV_FRONTEND)  += xen-blkfront.o
-obj-$(CONFIG_LGUEST_GUEST) += lguest_blk.o
+obj-$(CONFIG_LGUEST_BLOCK) += lguest_blk.o
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 43d901f..888205c 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -1,6 +1,6 @@
 config LGUEST
tristate Linux hypervisor example code
-   depends on X86  PARAVIRT  NET  EXPERIMENTAL  !X86_PAE
+   depends on X86  PARAVIRT  EXPERIMENTAL  !X86_PAE
select LGUEST_GUEST
select HVC_DRIVER
---help---
@@ -18,3 +18,11 @@ config LGUEST_GUEST
  The guest needs code built-in, even if the host has lguest
  support as a module.  The drivers are tiny, so we build them
  in too.
+
+config LGUEST_NET
+   tristate
+   depends on LGUEST_GUEST  NET
+
+config LGUEST_BLOCK
+   tristate
+   depends on LGUEST_GUEST  BLOCK
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 94b78cc..e684212 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -177,7 +177,7 @@ obj-$(CONFIG_ZORRO8390) += zorro8390.o
 obj-$(CONFIG_HPLANCE) += hplance.o 7990.o
 obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o
 obj-$(CONFIG_EQUALIZER) += eql.o
-obj-$(CONFIG_LGUEST_GUEST) += lguest_net.o
+obj-$(CONFIG_LGUEST_NET) += lguest_net.o
 obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o
 obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
 obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] mpt fusion: Changes in mptctl.c for logging support

2007-07-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=09120a8cd38dbdb0c9a59ff8456cf88b510e6baa
Commit: 09120a8cd38dbdb0c9a59ff8456cf88b510e6baa
Parent: d6ecdd638aa840604b87195f2097cabbd095092c
Author: Prakash, Sathya [EMAIL PROTECTED]
AuthorDate: Tue Jul 24 15:49:05 2007 +0530
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Sat Jul 28 11:33:45 2007 -0400

[SCSI] mpt fusion: Changes in mptctl.c for logging support

This patch contains changes in mptctl.c to support logging in MPT fusion 
drivers

The changes are majorly in debug printks, the existing debugprintk are
modified accroding to new debug macros defined in the file mptbdebug.h

signed-off-by: Sathya Prakash [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/message/fusion/mptctl.c |  266 +--
 1 files changed, 141 insertions(+), 125 deletions(-)

diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 58e6c31..89695e7 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -181,7 +181,7 @@ static inline int
 mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
 {
int rc = 0;
-   dctlprintk((KERN_INFO MYNAM ::mptctl_syscall_down(%p,%d) called\n, 
ioc, nonblock));
+// dctlprintk(ioc, printk(KERN_DEBUG MYNAM ::mptctl_syscall_down(%p,%d) 
called\n, ioc, nonblock));
 
if (nonblock) {
if (!mutex_trylock(ioc-ioctl-ioctl_mutex))
@@ -190,7 +190,7 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
if (mutex_lock_interruptible(ioc-ioctl-ioctl_mutex))
rc = -ERESTARTSYS;
}
-   dctlprintk((KERN_INFO MYNAM ::mptctl_syscall_down return %d\n, rc));
+// dctlprintk(ioc, printk(KERN_DEBUG MYNAM ::mptctl_syscall_down return 
%d\n, rc));
return rc;
 }
 
@@ -209,18 +209,19 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, 
MPT_FRAME_HDR *reply)
u16 iocStatus;
u8 cmd;
 
-   dctlprintk((mptctl_reply()!\n));
if (req)
 cmd = req-u.hdr.Function;
else
return 1;
+   dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT \tcompleting mpi function 
(0x%02X), req=%p, 
+   reply=%p\n, ioc-name,  req-u.hdr.Function, req, reply));
 
if (ioc-ioctl) {
 
if (reply==NULL) {
 
-   dctlprintk((mptctl_reply() NULL Reply 
-   Function=%x!\n, cmd));
+   dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT 
mptctl_reply() NULL Reply 
+   Function=%x!\n, ioc-name, cmd));
 
ioc-ioctl-status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
ioc-ioctl-reset = ~MPTCTL_RESET_OK;
@@ -233,14 +234,9 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, 
MPT_FRAME_HDR *reply)
 
}
 
-   dctlprintk((mptctl_reply() with req=%p 
-   reply=%p Function=%x!\n, req, reply, cmd));
-
/* Copy the reply frame (which much exist
 * for non-SCSI I/O) to the IOC structure.
 */
-   dctlprintk((Copying Reply Frame @%p to ioc%d!\n,
-   reply, ioc-id));
memcpy(ioc-ioctl-ReplyFrame, reply,
min(ioc-reply_sz, 4*reply-u.reply.MsgLength));
ioc-ioctl-status |= MPT_IOCTL_STATUS_RF_VALID;
@@ -252,8 +248,24 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, 
MPT_FRAME_HDR *reply)
if (iocStatus  == MPI_IOCSTATUS_SUCCESS)
ioc-ioctl-status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
 
+   if (iocStatus || reply-u.reply.IOCLogInfo)
+   dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT \tiocstatus 
(0x%04X), 
+   loginfo (0x%08X)\n, ioc-name,
+   iocStatus,
+   le32_to_cpu(reply-u.reply.IOCLogInfo)));
+
if ((cmd == MPI_FUNCTION_SCSI_IO_REQUEST) ||
(cmd == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
+
+   if (reply-u.sreply.SCSIStatus || 
reply-u.sreply.SCSIState)
+   dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+   \tscsi_status (0x%02x), scsi_state 
(0x%02x), 
+   tag = (0x%04x), transfer_count 
(0x%08x)\n, ioc-name,
+   reply-u.sreply.SCSIStatus,
+   reply-u.sreply.SCSIState,
+   le16_to_cpu(reply-u.sreply.TaskTag),
+   
le32_to_cpu(reply-u.sreply.TransferCount)));
+
ioc-ioctl-reset = ~MPTCTL_RESET_OK;
 
if ((iocStatus ==