 port->class_dev.class = &umad_class; port->class_dev.dev   = device->dma_device; port->class_dev.devt  = port->dev.dev;  snprintf(port->class_dev.class_id, BUS_ID_SIZE, "umad%d", port->devnum);  if (class_device_register(&port->class_dev)) 
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)) 
static int ib_umad_init_port(struct ib_device *device, int port_num,			     struct ib_umad_port *port){	spin_lock(&map_lock);	port->devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS);	if (port->devnum >= IB_UMAD_MAX_PORTS) {		spin_unlock(&map_lock);		return -1;	}	port->sm_devnum = find_next_zero_bit(dev_map, IB_UMAD_MAX_PORTS * 2, IB_UMAD_MAX_PORTS);	if (port->sm_devnum >= IB_UMAD_MAX_PORTS * 2) {		spin_unlock(&map_lock);		return -1;	}	set_bit(port->devnum, dev_map);	set_bit(port->sm_devnum, dev_map);	spin_unlock(&map_lock);	port->ib_dev   = device;	port->port_num = port_num;	init_MUTEX(&port->sm_sem);	cdev_init(&port->dev, &umad_fops);	port->dev.owner = THIS_MODULE;	kobject_set_name(&port->dev.kobj, "umad%d", port->devnum);	if (cdev_add(&port->dev, base_dev + port->devnum, 1))		return -1;	port->class_dev.class = &umad_class;	port->class_dev.dev   = device->dma_device;	port->class_dev.devt  = port->dev.dev;	snprintf(port->class_dev.class_id, BUS_ID_SIZE, "umad%d", port->devnum);	if (class_device_register(&port->class_dev))		goto err_cdev;	class_set_devdata(&port->class_dev, port);	kref_get(&port->umad_dev->ref);	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;	cdev_init(&port->sm_dev, &umad_sm_fops);	port->sm_dev.owner = THIS_MODULE;	kobject_set_name(&port->dev.kobj, "issm%d", port->sm_devnum - IB_UMAD_MAX_PORTS);	if (cdev_add(&port->sm_dev, base_dev + port->sm_devnum, 1))		return -1;	port->sm_class_dev.class = &umad_class;	port->sm_class_dev.dev   = device->dma_device;	port->sm_class_dev.devt  = port->sm_dev.dev;	snprintf(port->sm_class_dev.class_id, BUS_ID_SIZE, "issm%d", port->sm_devnum - IB_UMAD_MAX_PORTS);	if (class_device_register(&port->sm_class_dev))		goto err_sm_cdev;	class_set_devdata(&port->sm_class_dev, port);	kref_get(&port->umad_dev->ref);	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;	return 0;err_sm_class:	class_device_unregister(&port->sm_class_dev);err_sm_cdev:	cdev_del(&port->sm_dev);err_class:	class_device_unregister(&port->class_dev);err_cdev:	cdev_del(&port->dev);	clear_bit(port->devnum, dev_map);	return -1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/a74968f8c3b1166cfe0942901b56165f06ab6f60/user_mad.c/clean/drivers/infiniband/core/user_mad.c