Lines Matching refs:info
23 struct ocxl_file_info *info;
26 info = idr_find(&minors_idr, MINOR(devno));
27 if (info)
28 get_device(&info->dev);
30 return info;
33 static int allocate_minor(struct ocxl_file_info *info)
38 minor = idr_alloc(&minors_idr, info, 0, OCXL_NUM_MINORS, GFP_KERNEL);
43 static void free_minor(struct ocxl_file_info *info)
46 idr_remove(&minors_idr, MINOR(info->dev.devt));
52 struct ocxl_file_info *info;
58 info = find_and_get_file_info(inode->i_rdev);
59 if (!info)
62 rc = ocxl_context_alloc(&ctx, info->afu, inode->i_mapping);
64 put_device(&info->dev);
67 put_device(&info->dev);
484 // Free the info struct
487 struct ocxl_file_info *info = container_of(dev, struct ocxl_file_info, dev);
489 ocxl_afu_put(info->afu);
490 kfree(info);
493 static int ocxl_file_make_visible(struct ocxl_file_info *info)
497 cdev_init(&info->cdev, &ocxl_afu_fops);
498 rc = cdev_add(&info->cdev, info->dev.devt, 1);
500 dev_err(&info->dev, "Unable to add afu char device: %d\n", rc);
507 static void ocxl_file_make_invisible(struct ocxl_file_info *info)
509 cdev_del(&info->cdev);
516 struct ocxl_file_info *info;
520 info = kzalloc(sizeof(*info), GFP_KERNEL);
521 if (info == NULL)
524 minor = allocate_minor(info);
526 kfree(info);
530 info->dev.parent = &fn->dev;
531 info->dev.devt = MKDEV(MAJOR(ocxl_dev), minor);
532 info->dev.class = ocxl_class;
533 info->dev.release = info_release;
535 info->afu = afu;
538 rc = dev_set_name(&info->dev, "%s.%s.%hhu",
543 rc = device_register(&info->dev);
545 free_minor(info);
546 put_device(&info->dev);
550 rc = ocxl_sysfs_register_afu(info);
554 rc = ocxl_file_make_visible(info);
558 ocxl_afu_set_private(afu, info);
563 ocxl_sysfs_unregister_afu(info); // safe to call even if register failed
564 free_minor(info);
565 device_unregister(&info->dev);
569 free_minor(info);
570 kfree(info);
576 struct ocxl_file_info *info = ocxl_afu_get_private(afu);
578 if (!info)
581 ocxl_file_make_invisible(info);
582 ocxl_sysfs_unregister_afu(info);
583 free_minor(info);
584 device_unregister(&info->dev);