diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx4/main.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 49 |
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 | ||
484 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 484 | static 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 | ||
490 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | 492 | static 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 | ||
498 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 502 | static 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 | ||
504 | static ssize_t show_board(struct class_device *cdev, char *buf) | 510 | static 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 | ||
510 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 519 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
511 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 520 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
512 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 521 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
513 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | 522 | static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); |
514 | 523 | ||
515 | static struct class_device_attribute *mlx4_class_attributes[] = { | 524 | static 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 | ||
522 | static void *mlx4_ib_add(struct mlx4_dev *dev) | 531 | static 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 | ||