From 3d9780b97667fcd63159c0933fdce75465da6c70 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Mon, 21 May 2007 20:59:47 -0400 Subject: [SCSI] fusion: Fix |/|| confusion There are several cases where the fusion driver uses the logical || to try to do an arithmetical or ... fix by replacing with |. Signed-off-by: Dave Jones Acked-by: "Moore, Eric" Signed-off-by: James Bottomley --- drivers/message/fusion/mptbase.h | 2 +- drivers/message/fusion/mptscsih.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index d25d3be8fcd..165f81d16d0 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -436,7 +436,7 @@ typedef struct _MPT_SAS_MGMT { typedef struct _mpt_ioctl_events { u32 event; /* Specified by define above */ u32 eventContext; /* Index or counter */ - int data[2]; /* First 8 bytes of Event Data */ + u32 data[2]; /* First 8 bytes of Event Data */ } MPT_IOCTL_EVENTS; /* diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index fa0f7761652..3bd94f11e7d 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -2463,11 +2463,11 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; ioc->events[idx].eventContext = ioc->eventContext; - ioc->events[idx].data[0] = (pReq->LUN[1] << 24) || - (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) || - (sc->device->channel << 8) || sc->device->id; + ioc->events[idx].data[0] = (pReq->LUN[1] << 24) | + (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) | + (sc->device->channel << 8) | sc->device->id; - ioc->events[idx].data[1] = (sense_data[13] << 8) || sense_data[12]; + ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12]; ioc->eventContext++; if (hd->ioc->pcidev->vendor == -- cgit v1.2.3 From e578e9a1cc8a5983d87126d5877e305d3189f1b9 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Wed, 23 May 2007 13:58:05 -0700 Subject: i2o: destroy event queue only when drv->event is set i2o_driver_register() initalizes event queue for driver only when drv->event is set. So similarly the event queue should be destroyed only when drv->event is set in the error path. Otherwise destroy_workqueue() will called with NULL. Cc: Markus Lidel Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/message/i2o/driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index d3235f213c8..d330e4eb86a 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c @@ -123,8 +123,12 @@ int i2o_driver_register(struct i2o_driver *drv) } rc = driver_register(&drv->driver); - if (rc) - destroy_workqueue(drv->event_queue); + if (rc) { + if (drv->event) { + destroy_workqueue(drv->event_queue); + drv->event_queue = NULL; + } + } return rc; }; -- cgit v1.2.3 From be324797d9b2a10f767e89dfbd880c735249bef9 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Wed, 23 May 2007 13:58:06 -0700 Subject: i2o: fix notifiers when max_drivers is configured Maximum number of I2O drivers which could be registered is configurable by max_drivers module parameter. But the module parameter is ignored and default value (I2O_MAX_DRIVERS = 8) is used in the loops to notify all registered drivers. Cc: Markus Lidel Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/message/i2o/driver.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index d330e4eb86a..a3ee1796af0 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core.h" #define OSM_NAME "i2o" @@ -260,7 +261,7 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c) int i; struct i2o_driver *drv; - for (i = 0; i < I2O_MAX_DRIVERS; i++) { + for (i = 0; i < i2o_max_drivers; i++) { drv = i2o_drivers[i]; if (drv) @@ -280,7 +281,7 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) int i; struct i2o_driver *drv; - for (i = 0; i < I2O_MAX_DRIVERS; i++) { + for (i = 0; i < i2o_max_drivers; i++) { drv = i2o_drivers[i]; if (drv) @@ -299,7 +300,7 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) int i; struct i2o_driver *drv; - for (i = 0; i < I2O_MAX_DRIVERS; i++) { + for (i = 0; i < i2o_max_drivers; i++) { drv = i2o_drivers[i]; if (drv) @@ -318,7 +319,7 @@ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev) int i; struct i2o_driver *drv; - for (i = 0; i < I2O_MAX_DRIVERS; i++) { + for (i = 0; i < i2o_max_drivers; i++) { drv = i2o_drivers[i]; if (drv) @@ -340,8 +341,7 @@ int __init i2o_driver_init(void) spin_lock_init(&i2o_drivers_lock); if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || - ((i2o_max_drivers ^ (i2o_max_drivers - 1)) != - (2 * i2o_max_drivers - 1))) { + !is_power_of_2(i2o_max_drivers)) { osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and " "a power of 2\n", i2o_max_drivers); i2o_max_drivers = I2O_MAX_DRIVERS; @@ -349,7 +349,7 @@ int __init i2o_driver_init(void) osm_info("max drivers = %d\n", i2o_max_drivers); i2o_drivers = - kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); + kcalloc(i2o_max_drivers, sizeof(*i2o_drivers), GFP_KERNEL); if (!i2o_drivers) return -ENOMEM; -- cgit v1.2.3 From 82cd0e8410ae74d3fd39d168049381eafc489e5b Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Wed, 23 May 2007 13:58:07 -0700 Subject: i2o: eliminate a peculiar constraint on i2o_max_drivers There is no reason i2o_max_drivers must be a power of two. This patch eliminates such a constraint. Cc: Markus Lidel Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/message/i2o/driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index a3ee1796af0..e0d474b1743 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "core.h" #define OSM_NAME "i2o" @@ -340,10 +339,9 @@ int __init i2o_driver_init(void) spin_lock_init(&i2o_drivers_lock); - if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || - !is_power_of_2(i2o_max_drivers)) { - osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and " - "a power of 2\n", i2o_max_drivers); + if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64)) { + osm_warn("max_drivers set to %d, but must be >=2 and <= 64\n", + i2o_max_drivers); i2o_max_drivers = I2O_MAX_DRIVERS; } osm_info("max drivers = %d\n", i2o_max_drivers); -- cgit v1.2.3