aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/i2o/device.c
diff options
context:
space:
mode:
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