/** * accel_set_device_instance_params() - Set some device parameters for accel device * @kdev: Pointer to the device instance. * @index: The minor's index * * This function creates the dev_t of the device using the accel major and * the device's minor number. In addition, it sets the class and type of the * device instance to the accel sysfs class and device type, respectively.
*/ void accel_set_device_instance_params(struct device *kdev, int index)
{
kdev->devt = MKDEV(ACCEL_MAJOR, index);
kdev->class = &accel_class;
kdev->type = &accel_sysfs_device_minor;
}
/** * accel_open - open method for ACCEL file * @inode: device inode * @filp: file pointer. * * This function must be used by drivers as their &file_operations.open method. * It looks up the correct ACCEL device and instantiates all the per-file * resources for it. It also calls the &drm_driver.open driver callback. * * Return: 0 on success or negative errno value on failure.
*/ int accel_open(struct inode *inode, struct file *filp)
{ struct drm_device *dev; struct drm_minor *minor; int retcode;
minor = drm_minor_acquire(&accel_minors_xa, iminor(inode)); if (IS_ERR(minor)) return PTR_ERR(minor);
dev = minor->dev;
atomic_fetch_inc(&dev->open_count);
/* share address_space across all char-devs of a single device */
filp->f_mapping = dev->anon_inode->i_mapping;
retcode = drm_open_helper(filp, minor); if (retcode) goto err_undo;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.