aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:49:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:49:58 -0400
commite80ab411e589e00550e2e6e5a6a02d59cc730357 (patch)
tree870225ff7b5b8d03e82a996963213a4bb9cce248 /drivers/infiniband/hw/mlx4/main.c
parent529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff)
parentee959b00c335d7780136c5abda37809191fe52c3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits) SCSI: convert struct class_device to struct device DRM: remove unused dev_class IB: rename "dev" to "srp_dev" in srp_host structure IB: convert struct class_device to struct device memstick: convert struct class_device to struct device driver core: replace remaining __FUNCTION__ occurrences sysfs: refill attribute buffer when reading from offset 0 PM: Remove destroy_suspended_device() Firmware: add iSCSI iBFT Support PM: Remove legacy PM (fix) Kobject: Replace list_for_each() with list_for_each_entry(). SYSFS: Explicitly include required header file slab.h. Driver core: make device_is_registered() work for class devices PM: Convert wakeup flag accessors to inline functions PM: Make wakeup flags available whenever CONFIG_PM is set PM: Fix misuse of wakeup flag accessors in serial core Driver core: Call device_pm_add() after bus_add_device() in device_add() PM: Handle device registrations during suspend/resume block: send disk "change" event for rescan_partitions() sysdev: detect multiple driver registrations ... Fixed trivial conflict in include/linux/memory.h due to semaphore header file change (made irrelevant by the change to mutex).
Diffstat (limited to 'drivers/infiniband/hw/mlx4/main.c')
-rw-r--r--drivers/infiniband/hw/mlx4/main.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 136c76c7b4e7..4d9b5ac42202 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -481,42 +481,51 @@ out:
481 return err; 481 return err;
482} 482}
483 483
484static ssize_t show_hca(struct class_device *cdev, char *buf) 484static ssize_t show_hca(struct device *device, struct device_attribute *attr,
485 char *buf)
485{ 486{
486 struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); 487 struct mlx4_ib_dev *dev =
488 container_of(device, struct mlx4_ib_dev, ib_dev.dev);
487 return sprintf(buf, "MT%d\n", dev->dev->pdev->device); 489 return sprintf(buf, "MT%d\n", dev->dev->pdev->device);
488} 490}
489 491
490static ssize_t show_fw_ver(struct class_device *cdev, char *buf) 492static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr,
493 char *buf)
491{ 494{
492 struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); 495 struct mlx4_ib_dev *dev =
496 container_of(device, struct mlx4_ib_dev, ib_dev.dev);
493 return sprintf(buf, "%d.%d.%d\n", (int) (dev->dev->caps.fw_ver >> 32), 497 return sprintf(buf, "%d.%d.%d\n", (int) (dev->dev->caps.fw_ver >> 32),
494 (int) (dev->dev->caps.fw_ver >> 16) & 0xffff, 498 (int) (dev->dev->caps.fw_ver >> 16) & 0xffff,
495 (int) dev->dev->caps.fw_ver & 0xffff); 499 (int) dev->dev->caps.fw_ver & 0xffff);
496} 500}
497 501
498static ssize_t show_rev(struct class_device *cdev, char *buf) 502static ssize_t show_rev(struct device *device, struct device_attribute *attr,
503 char *buf)
499{ 504{
500 struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); 505 struct mlx4_ib_dev *dev =
506 container_of(device, struct mlx4_ib_dev, ib_dev.dev);
501 return sprintf(buf, "%x\n", dev->dev->rev_id); 507 return sprintf(buf, "%x\n", dev->dev->rev_id);
502} 508}
503 509
504static ssize_t show_board(struct class_device *cdev, char *buf) 510static ssize_t show_board(struct device *device, struct device_attribute *attr,
511 char *buf)
505{ 512{
506 struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); 513 struct mlx4_ib_dev *dev =
507 return sprintf(buf, "%.*s\n", MLX4_BOARD_ID_LEN, dev->dev->board_id); 514 container_of(device, struct mlx4_ib_dev, ib_dev.dev);
515 return sprintf(buf, "%.*s\n", MLX4_BOARD_ID_LEN,
516 dev->dev->board_id);
508} 517}
509 518
510static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); 519static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
511static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); 520static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
512static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); 521static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
513static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); 522static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);
514 523
515static struct class_device_attribute *mlx4_class_attributes[] = { 524static struct device_attribute *mlx4_class_attributes[] = {
516 &class_device_attr_hw_rev, 525 &dev_attr_hw_rev,
517 &class_device_attr_fw_ver, 526 &dev_attr_fw_ver,
518 &class_device_attr_hca_type, 527 &dev_attr_hca_type,
519 &class_device_attr_board_id 528 &dev_attr_board_id
520}; 529};
521 530
522static void *mlx4_ib_add(struct mlx4_dev *dev) 531static void *mlx4_ib_add(struct mlx4_dev *dev)
@@ -640,8 +649,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
640 goto err_reg; 649 goto err_reg;
641 650
642 for (i = 0; i < ARRAY_SIZE(mlx4_class_attributes); ++i) { 651 for (i = 0; i < ARRAY_SIZE(mlx4_class_attributes); ++i) {
643 if (class_device_create_file(&ibdev->ib_dev.class_dev, 652 if (device_create_file(&ibdev->ib_dev.dev,
644 mlx4_class_attributes[i])) 653 mlx4_class_attributes[i]))
645 goto err_reg; 654 goto err_reg;
646 } 655 }
647 656