aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/i2o/device.c
diff options
context:
space:
mode:
authorMarkus Lidel <Markus.Lidel@shadowconnect.com>2005-06-24 01:02:21 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:29 -0400
commit9e87545f06930c1d294423a8091d1077e7444a47 (patch)
treeef05fca1becfa0e1584f234ddf9b1a430b7d018e /drivers/message/i2o/device.c
parentb2aaee33fbb354a2f08121aa1c1be55841102761 (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/device.c')
-rw-r--r--drivers/message/i2o/device.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c
index f1b7eb63d54b..0ee342ea29bc 100644
--- a/drivers/message/i2o/device.c
+++ b/drivers/message/i2o/device.c
@@ -16,9 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/i2o.h> 17#include <linux/i2o.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19 19#include "core.h"
20/* Exec OSM functions */
21extern struct bus_type i2o_bus_type;
22 20
23/** 21/**
24 * i2o_device_issue_claim - claim or release a device 22 * i2o_device_issue_claim - claim or release a device
@@ -293,12 +291,12 @@ int i2o_device_parse_lct(struct i2o_controller *c)
293 } 291 }
294 292
295 if (lct->table_size * 4 > c->dlct.len) { 293 if (lct->table_size * 4 > c->dlct.len) {
296 memcpy_fromio(c->lct, c->dlct.virt, c->dlct.len); 294 memcpy(c->lct, c->dlct.virt, c->dlct.len);
297 up(&c->lct_lock); 295 up(&c->lct_lock);
298 return -EAGAIN; 296 return -EAGAIN;
299 } 297 }
300 298
301 memcpy_fromio(c->lct, c->dlct.virt, lct->table_size * 4); 299 memcpy(c->lct, c->dlct.virt, lct->table_size * 4);
302 300
303 lct = c->lct; 301 lct = c->lct;
304 302
@@ -353,7 +351,7 @@ static ssize_t i2o_device_class_show_class_id(struct class_device *cd,
353{ 351{
354 struct i2o_device *dev = to_i2o_device(cd->dev); 352 struct i2o_device *dev = to_i2o_device(cd->dev);
355 353
356 sprintf(buf, "%03x\n", dev->lct_data.class_id); 354 sprintf(buf, "0x%03x\n", dev->lct_data.class_id);
357 return strlen(buf) + 1; 355 return strlen(buf) + 1;
358}; 356};
359 357
@@ -368,7 +366,7 @@ static ssize_t i2o_device_class_show_tid(struct class_device *cd, char *buf)
368{ 366{
369 struct i2o_device *dev = to_i2o_device(cd->dev); 367 struct i2o_device *dev = to_i2o_device(cd->dev);
370 368
371 sprintf(buf, "%03x\n", dev->lct_data.tid); 369 sprintf(buf, "0x%03x\n", dev->lct_data.tid);
372 return strlen(buf) + 1; 370 return strlen(buf) + 1;
373}; 371};
374 372
@@ -490,7 +488,7 @@ static int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist,
490 if (rc == -ETIMEDOUT) 488 if (rc == -ETIMEDOUT)
491 return rc; 489 return rc;
492 490
493 memcpy_fromio(reslist, res.virt, res.len); 491 memcpy(reslist, res.virt, res.len);
494 i2o_dma_free(dev, &res); 492 i2o_dma_free(dev, &res);
495 493
496 /* Query failed */ 494 /* Query failed */
@@ -532,17 +530,23 @@ int i2o_parm_field_get(struct i2o_device *i2o_dev, int group, int field,
532 void *buf, int buflen) 530 void *buf, int buflen)
533{ 531{
534 u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field }; 532 u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field };
535 u8 resblk[8 + buflen]; /* 8 bytes for header */ 533 u8 *resblk; /* 8 bytes for header */
536 int size; 534 int size;
537 535
538 if (field == -1) /* whole group */ 536 if (field == -1) /* whole group */
539 opblk[4] = -1; 537 opblk[4] = -1;
540 538
539 resblk = kmalloc(buflen + 8, GFP_KERNEL | GFP_ATOMIC);
540 if (!resblk)
541 return -ENOMEM;
542
541 size = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_GET, opblk, 543 size = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_GET, opblk,
542 sizeof(opblk), resblk, buflen + 8); 544 sizeof(opblk), resblk, buflen + 8);
543 545
544 memcpy(buf, resblk + 8, buflen); /* cut off header */ 546 memcpy(buf, resblk + 8, buflen); /* cut off header */
545 547
548 kfree(resblk);
549
546 if (size > buflen) 550 if (size > buflen)
547 return buflen; 551 return buflen;
548 552