diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 22:49:58 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 22:49:58 (GMT) |
commit | e80ab411e589e00550e2e6e5a6a02d59cc730357 (patch) | |
tree | 870225ff7b5b8d03e82a996963213a4bb9cce248 /drivers/infiniband/core/user_mad.c | |
parent | 529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff) | |
parent | ee959b00c335d7780136c5abda37809191fe52c3 (diff) | |
download | linux-fsl-qoriq-e80ab411e589e00550e2e6e5a6a02d59cc730357.tar.xz |
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/core/user_mad.c')
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 109 |
1 files changed, 55 insertions, 54 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index be953e8..3aa2db5 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -88,11 +88,11 @@ enum { */ struct ib_umad_port { - struct cdev *dev; - struct class_device *class_dev; + struct cdev *cdev; + struct device *dev; - struct cdev *sm_dev; - struct class_device *sm_class_dev; + struct cdev *sm_cdev; + struct device *sm_dev; struct semaphore sm_sem; struct mutex file_mutex; @@ -948,27 +948,29 @@ static struct ib_client umad_client = { .remove = ib_umad_remove_one }; -static ssize_t show_ibdev(struct class_device *class_dev, char *buf) +static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr, + char *buf) { - struct ib_umad_port *port = class_get_devdata(class_dev); + struct ib_umad_port *port = dev_get_drvdata(dev); if (!port) return -ENODEV; return sprintf(buf, "%s\n", port->ib_dev->name); } -static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); +static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); -static ssize_t show_port(struct class_device *class_dev, char *buf) +static ssize_t show_port(struct device *dev, struct device_attribute *attr, + char *buf) { - struct ib_umad_port *port = class_get_devdata(class_dev); + struct ib_umad_port *port = dev_get_drvdata(dev); if (!port) return -ENODEV; return sprintf(buf, "%d\n", port->port_num); } -static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL); +static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); static ssize_t show_abi_version(struct class *class, char *buf) { @@ -994,48 +996,47 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, mutex_init(&port->file_mutex); INIT_LIST_HEAD(&port->file_list); - port->dev = cdev_alloc(); - if (!port->dev) + port->cdev = cdev_alloc(); + if (!port->cdev) return -1; - port->dev->owner = THIS_MODULE; - port->dev->ops = &umad_fops; - kobject_set_name(&port->dev->kobj, "umad%d", port->dev_num); - if (cdev_add(port->dev, base_dev + port->dev_num, 1)) + port->cdev->owner = THIS_MODULE; + port->cdev->ops = &umad_fops; + kobject_set_name(&port->cdev->kobj, "umad%d", port->dev_num); + if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) goto err_cdev; - port->class_dev = class_device_create(umad_class, NULL, port->dev->dev, - device->dma_device, - "umad%d", port->dev_num); - if (IS_ERR(port->class_dev)) + port->dev = device_create(umad_class, device->dma_device, + port->cdev->dev, "umad%d", port->dev_num); + if (IS_ERR(port->dev)) goto err_cdev; - if (class_device_create_file(port->class_dev, &class_device_attr_ibdev)) - goto err_class; - if (class_device_create_file(port->class_dev, &class_device_attr_port)) - goto err_class; - - port->sm_dev = cdev_alloc(); - if (!port->sm_dev) - goto err_class; - port->sm_dev->owner = THIS_MODULE; - port->sm_dev->ops = &umad_sm_fops; - kobject_set_name(&port->sm_dev->kobj, "issm%d", port->dev_num); - if (cdev_add(port->sm_dev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) + if (device_create_file(port->dev, &dev_attr_ibdev)) + goto err_dev; + if (device_create_file(port->dev, &dev_attr_port)) + goto err_dev; + + port->sm_cdev = cdev_alloc(); + if (!port->sm_cdev) + goto err_dev; + port->sm_cdev->owner = THIS_MODULE; + port->sm_cdev->ops = &umad_sm_fops; + kobject_set_name(&port->sm_cdev->kobj, "issm%d", port->dev_num); + if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) goto err_sm_cdev; - port->sm_class_dev = class_device_create(umad_class, NULL, port->sm_dev->dev, - device->dma_device, - "issm%d", port->dev_num); - if (IS_ERR(port->sm_class_dev)) + port->sm_dev = device_create(umad_class, device->dma_device, + port->sm_cdev->dev, + "issm%d", port->dev_num); + if (IS_ERR(port->sm_dev)) goto err_sm_cdev; - class_set_devdata(port->class_dev, port); - class_set_devdata(port->sm_class_dev, port); + dev_set_drvdata(port->dev, port); + dev_set_drvdata(port->sm_dev, port); - if (class_device_create_file(port->sm_class_dev, &class_device_attr_ibdev)) - goto err_sm_class; - if (class_device_create_file(port->sm_class_dev, &class_device_attr_port)) - goto err_sm_class; + if (device_create_file(port->sm_dev, &dev_attr_ibdev)) + goto err_sm_dev; + if (device_create_file(port->sm_dev, &dev_attr_port)) + goto err_sm_dev; spin_lock(&port_lock); umad_port[port->dev_num] = port; @@ -1043,17 +1044,17 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, return 0; -err_sm_class: - class_device_destroy(umad_class, port->sm_dev->dev); +err_sm_dev: + device_destroy(umad_class, port->sm_cdev->dev); err_sm_cdev: - cdev_del(port->sm_dev); + cdev_del(port->sm_cdev); -err_class: - class_device_destroy(umad_class, port->dev->dev); +err_dev: + device_destroy(umad_class, port->cdev->dev); err_cdev: - cdev_del(port->dev); + cdev_del(port->cdev); clear_bit(port->dev_num, dev_map); return -1; @@ -1065,14 +1066,14 @@ static void ib_umad_kill_port(struct ib_umad_port *port) int already_dead; int id; - class_set_devdata(port->class_dev, NULL); - class_set_devdata(port->sm_class_dev, NULL); + dev_set_drvdata(port->dev, NULL); + dev_set_drvdata(port->sm_dev, NULL); - class_device_destroy(umad_class, port->dev->dev); - class_device_destroy(umad_class, port->sm_dev->dev); + device_destroy(umad_class, port->cdev->dev); + device_destroy(umad_class, port->sm_cdev->dev); - cdev_del(port->dev); - cdev_del(port->sm_dev); + cdev_del(port->cdev); + cdev_del(port->sm_cdev); spin_lock(&port_lock); umad_port[port->dev_num] = NULL; |