summaryrefslogtreecommitdiffstats
path: root/drivers/message/i2o/driver.c
diff options
context:
space:
mode:
authorMarkus Lidel <Markus.Lidel@shadowconnect.com>2005-06-23 22:02:21 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 00:05:29 -0700
commit9e87545f06930c1d294423a8091d1077e7444a47 (patch)
treeef05fca1becfa0e1584f234ddf9b1a430b7d018e /drivers/message/i2o/driver.c
parentb2aaee33fbb354a2f08121aa1c1be55841102761 (diff)
downloadlinux-9e87545f06930c1d294423a8091d1077e7444a47.tar.gz
linux-9e87545f06930c1d294423a8091d1077e7444a47.tar.bz2
linux-9e87545f06930c1d294423a8091d1077e7444a47.zip
[PATCH] I2O: second code cleanup of sparse warnings and unneeded syncronization
Changes: - Added header "core.h" for i2o_core.ko internal definitions - More sparse fixes - Changed display of TID's in sysfs attributes from XXX to 0xXXX - Use the right functions for accessing I/O and normal memory - Removed error handling of SCSI device errors and let the SCSI layer take care of it - Added new device / removed device handling to SCSI-OSM - Make status access volatile - Cleaned up activation of I2O controller - Removed unnecessary wmb() and rmb() calls - Use own struct i2o_io for I/O memory instead of struct i2o_dma Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/message/i2o/driver.c')
-rw-r--r--drivers/message/i2o/driver.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index 393be8e2914c..c32f9dbc5744 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -17,11 +17,12 @@
#include <linux/module.h>
#include <linux/rwsem.h>
#include <linux/i2o.h>
+#include "core.h"
#define OSM_NAME "i2o"
/* max_drivers - Maximum I2O drivers (OSMs) which could be registered */
-unsigned int i2o_max_drivers = I2O_MAX_DRIVERS;
+static unsigned int i2o_max_drivers = I2O_MAX_DRIVERS;
module_param_named(max_drivers, i2o_max_drivers, uint, 0);
MODULE_PARM_DESC(max_drivers, "maximum number of OSM's to support");
@@ -179,15 +180,10 @@ void i2o_driver_unregister(struct i2o_driver *drv)
int i2o_driver_dispatch(struct i2o_controller *c, u32 m)
{
struct i2o_driver *drv;
- struct i2o_message __iomem *msg = i2o_msg_out_to_virt(c, m);
- u32 context;
+ struct i2o_message *msg = i2o_msg_out_to_virt(c, m);
+ u32 context = le32_to_cpu(msg->u.s.icntxt);
unsigned long flags;
- if(unlikely(!msg))
- return -EIO;
-
- context = readl(&msg->u.s.icntxt);
-
if (unlikely(context >= i2o_max_drivers)) {
osm_warn("%s: Spurious reply to unknown driver %d\n", c->name,
context);
@@ -204,11 +200,11 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m)
return -EIO;
}
- if ((readl(&msg->u.head[1]) >> 24) == I2O_CMD_UTIL_EVT_REGISTER) {
+ if ((le32_to_cpu(msg->u.head[1]) >> 24) == I2O_CMD_UTIL_EVT_REGISTER) {
struct i2o_device *dev, *tmp;
struct i2o_event *evt;
u16 size;
- u16 tid = readl(&msg->u.head[1]) & 0xfff;
+ u16 tid = le32_to_cpu(msg->u.head[1]) & 0xfff;
osm_debug("event received from device %d\n", tid);
@@ -216,16 +212,16 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m)
return -EIO;
/* cut of header from message size (in 32-bit words) */
- size = (readl(&msg->u.head[0]) >> 16) - 5;
+ size = (le32_to_cpu(msg->u.head[0]) >> 16) - 5;
evt = kmalloc(size * 4 + sizeof(*evt), GFP_ATOMIC | __GFP_ZERO);
if (!evt)
return -ENOMEM;
evt->size = size;
- evt->tcntxt = readl(&msg->u.s.tcntxt);
- evt->event_indicator = readl(&msg->body[0]);
- memcpy_fromio(&evt->tcntxt, &msg->u.s.tcntxt, size * 4);
+ evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt);
+ evt->event_indicator = le32_to_cpu(msg->body[0]);
+ memcpy(&evt->tcntxt, &msg->u.s.tcntxt, size * 4);
list_for_each_entry_safe(dev, tmp, &c->devices, list)
if (dev->lct_data.tid == tid) {