diff options
author | Markus Lidel <Markus.Lidel@shadowconnect.com> | 2005-06-24 01:02:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:29 -0400 |
commit | 9e87545f06930c1d294423a8091d1077e7444a47 (patch) | |
tree | ef05fca1becfa0e1584f234ddf9b1a430b7d018e /drivers/message/i2o/driver.c | |
parent | b2aaee33fbb354a2f08121aa1c1be55841102761 (diff) |
[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.c | 24 |
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 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/rwsem.h> | 18 | #include <linux/rwsem.h> |
19 | #include <linux/i2o.h> | 19 | #include <linux/i2o.h> |
20 | #include "core.h" | ||
20 | 21 | ||
21 | #define OSM_NAME "i2o" | 22 | #define OSM_NAME "i2o" |
22 | 23 | ||
23 | /* max_drivers - Maximum I2O drivers (OSMs) which could be registered */ | 24 | /* max_drivers - Maximum I2O drivers (OSMs) which could be registered */ |
24 | unsigned int i2o_max_drivers = I2O_MAX_DRIVERS; | 25 | static unsigned int i2o_max_drivers = I2O_MAX_DRIVERS; |
25 | module_param_named(max_drivers, i2o_max_drivers, uint, 0); | 26 | module_param_named(max_drivers, i2o_max_drivers, uint, 0); |
26 | MODULE_PARM_DESC(max_drivers, "maximum number of OSM's to support"); | 27 | MODULE_PARM_DESC(max_drivers, "maximum number of OSM's to support"); |
27 | 28 | ||
@@ -179,15 +180,10 @@ void i2o_driver_unregister(struct i2o_driver *drv) | |||
179 | int i2o_driver_dispatch(struct i2o_controller *c, u32 m) | 180 | int i2o_driver_dispatch(struct i2o_controller *c, u32 m) |
180 | { | 181 | { |
181 | struct i2o_driver *drv; | 182 | struct i2o_driver *drv; |
182 | struct i2o_message __iomem *msg = i2o_msg_out_to_virt(c, m); | 183 | struct i2o_message *msg = i2o_msg_out_to_virt(c, m); |
183 | u32 context; | 184 | u32 context = le32_to_cpu(msg->u.s.icntxt); |
184 | unsigned long flags; | 185 | unsigned long flags; |
185 | 186 | ||
186 | if(unlikely(!msg)) | ||
187 | return -EIO; | ||
188 | |||
189 | context = readl(&msg->u.s.icntxt); | ||
190 | |||
191 | if (unlikely(context >= i2o_max_drivers)) { | 187 | if (unlikely(context >= i2o_max_drivers)) { |
192 | osm_warn("%s: Spurious reply to unknown driver %d\n", c->name, | 188 | osm_warn("%s: Spurious reply to unknown driver %d\n", c->name, |
193 | context); | 189 | context); |
@@ -204,11 +200,11 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m) | |||
204 | return -EIO; | 200 | return -EIO; |
205 | } | 201 | } |
206 | 202 | ||
207 | if ((readl(&msg->u.head[1]) >> 24) == I2O_CMD_UTIL_EVT_REGISTER) { | 203 | if ((le32_to_cpu(msg->u.head[1]) >> 24) == I2O_CMD_UTIL_EVT_REGISTER) { |
208 | struct i2o_device *dev, *tmp; | 204 | struct i2o_device *dev, *tmp; |
209 | struct i2o_event *evt; | 205 | struct i2o_event *evt; |
210 | u16 size; | 206 | u16 size; |
211 | u16 tid = readl(&msg->u.head[1]) & 0xfff; | 207 | u16 tid = le32_to_cpu(msg->u.head[1]) & 0xfff; |
212 | 208 | ||
213 | osm_debug("event received from device %d\n", tid); | 209 | osm_debug("event received from device %d\n", tid); |
214 | 210 | ||
@@ -216,16 +212,16 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m) | |||
216 | return -EIO; | 212 | return -EIO; |
217 | 213 | ||
218 | /* cut of header from message size (in 32-bit words) */ | 214 | /* cut of header from message size (in 32-bit words) */ |
219 | size = (readl(&msg->u.head[0]) >> 16) - 5; | 215 | size = (le32_to_cpu(msg->u.head[0]) >> 16) - 5; |
220 | 216 | ||
221 | evt = kmalloc(size * 4 + sizeof(*evt), GFP_ATOMIC | __GFP_ZERO); | 217 | evt = kmalloc(size * 4 + sizeof(*evt), GFP_ATOMIC | __GFP_ZERO); |
222 | if (!evt) | 218 | if (!evt) |
223 | return -ENOMEM; | 219 | return -ENOMEM; |
224 | 220 | ||
225 | evt->size = size; | 221 | evt->size = size; |
226 | evt->tcntxt = readl(&msg->u.s.tcntxt); | 222 | evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt); |
227 | evt->event_indicator = readl(&msg->body[0]); | 223 | evt->event_indicator = le32_to_cpu(msg->body[0]); |
228 | memcpy_fromio(&evt->tcntxt, &msg->u.s.tcntxt, size * 4); | 224 | memcpy(&evt->tcntxt, &msg->u.s.tcntxt, size * 4); |
229 | 225 | ||
230 | list_for_each_entry_safe(dev, tmp, &c->devices, list) | 226 | list_for_each_entry_safe(dev, tmp, &c->devices, list) |
231 | if (dev->lct_data.tid == tid) { | 227 | if (dev->lct_data.tid == tid) { |