aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-10-20 15:54:01 -0400
committerRoland Dreier <rolandd@cisco.com>2005-10-20 15:54:01 -0400
commitbbf207860931b6a033d0fbcd170ae2332c0d8216 (patch)
tree9ffa1c4d1b045e1b5bfbe23a8e8f07973d170c9a /drivers/infiniband
parent2e0c512aff978a7040464e81fc9c0dfdf4639c23 (diff)
[IB] user_mad: Use class_device.devt
Use devt member of struct class_device so that we don't have to create our own "dev" file in sysfs. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/user_mad.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 38f4bfbb7135..fd200c064a2e 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -671,17 +671,6 @@ static struct ib_client umad_client = {
671 .remove = ib_umad_remove_one 671 .remove = ib_umad_remove_one
672}; 672};
673 673
674static ssize_t show_dev(struct class_device *class_dev, char *buf)
675{
676 struct ib_umad_port *port = class_get_devdata(class_dev);
677
678 if (class_dev == &port->class_dev)
679 return print_dev_t(buf, port->dev.dev);
680 else
681 return print_dev_t(buf, port->sm_dev.dev);
682}
683static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
684
685static ssize_t show_ibdev(struct class_device *class_dev, char *buf) 674static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
686{ 675{
687 struct ib_umad_port *port = class_get_devdata(class_dev); 676 struct ib_umad_port *port = class_get_devdata(class_dev);
@@ -762,6 +751,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
762 751
763 port->class_dev.class = &umad_class; 752 port->class_dev.class = &umad_class;
764 port->class_dev.dev = device->dma_device; 753 port->class_dev.dev = device->dma_device;
754 port->class_dev.devt = port->dev.dev;
765 755
766 snprintf(port->class_dev.class_id, BUS_ID_SIZE, "umad%d", port->devnum); 756 snprintf(port->class_dev.class_id, BUS_ID_SIZE, "umad%d", port->devnum);
767 757
@@ -771,8 +761,6 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
771 class_set_devdata(&port->class_dev, port); 761 class_set_devdata(&port->class_dev, port);
772 kref_get(&port->umad_dev->ref); 762 kref_get(&port->umad_dev->ref);
773 763
774 if (class_device_create_file(&port->class_dev, &class_device_attr_dev))
775 goto err_class;
776 if (class_device_create_file(&port->class_dev, &class_device_attr_ibdev)) 764 if (class_device_create_file(&port->class_dev, &class_device_attr_ibdev))
777 goto err_class; 765 goto err_class;
778 if (class_device_create_file(&port->class_dev, &class_device_attr_port)) 766 if (class_device_create_file(&port->class_dev, &class_device_attr_port))
@@ -786,6 +774,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
786 774
787 port->sm_class_dev.class = &umad_class; 775 port->sm_class_dev.class = &umad_class;
788 port->sm_class_dev.dev = device->dma_device; 776 port->sm_class_dev.dev = device->dma_device;
777 port->sm_class_dev.devt = port->sm_dev.dev;
789 778
790 snprintf(port->sm_class_dev.class_id, BUS_ID_SIZE, "issm%d", port->sm_devnum - IB_UMAD_MAX_PORTS); 779 snprintf(port->sm_class_dev.class_id, BUS_ID_SIZE, "issm%d", port->sm_devnum - IB_UMAD_MAX_PORTS);
791 780
@@ -795,8 +784,6 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
795 class_set_devdata(&port->sm_class_dev, port); 784 class_set_devdata(&port->sm_class_dev, port);
796 kref_get(&port->umad_dev->ref); 785 kref_get(&port->umad_dev->ref);
797 786
798 if (class_device_create_file(&port->sm_class_dev, &class_device_attr_dev))
799 goto err_sm_class;
800 if (class_device_create_file(&port->sm_class_dev, &class_device_attr_ibdev)) 787 if (class_device_create_file(&port->sm_class_dev, &class_device_attr_ibdev))
801 goto err_sm_class; 788 goto err_sm_class;
802 if (class_device_create_file(&port->sm_class_dev, &class_device_attr_port)) 789 if (class_device_create_file(&port->sm_class_dev, &class_device_attr_port))