From: John Hunter <zhjwpku@xxxxxxxxx> IMHO, some annotations were copypaste from somewhere else, it is obviously not rightly modified. Hope I am right with that. --- drivers/gpu/drm/drm_crtc.c | 115 ++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f2d667b..7f771e9 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -205,12 +205,12 @@ char *drm_get_connector_status_name(enum drm_connector_status status) /** * drm_mode_object_get - allocate a new identifier * @dev: DRM device - * @ptr: object pointer, used to generate unique ID - * @type: object type + * @obj: object pointer, used to generate unique ID + * @obj_type: object type * * LOCKING: * - * Create a unique identifier based on @ptr in @dev's identifier space. Used + * Create a unique identifier based on @obj in @dev's identifier space. Used * for tracking modes, CRTCs and connectors. * * RETURNS: @@ -245,12 +245,12 @@ again: /** * drm_mode_object_put - free an identifer * @dev: DRM device - * @id: ID to free + * @object: object to free * * LOCKING: * Caller must hold DRM mode_config lock. * - * Free @id from @dev's unique identifier pool. + * Free @object from @dev's unique identifier pool. */ static void drm_mode_object_put(struct drm_device *dev, struct drm_mode_object *object) @@ -353,10 +353,11 @@ EXPORT_SYMBOL(drm_framebuffer_reference); void drm_framebuffer_cleanup(struct drm_framebuffer *fb) { struct drm_device *dev = fb->dev; + /* * This could be moved to drm_framebuffer_remove(), but for * debugging is nice to keep around the list of fb's that are - * no longer associated w/ a drm_file but are not unreferenced + * no longer associated with a drm_file but are not unreferenced * yet. (i915 and omapdrm have debugfs files which will show * this.) */ @@ -519,7 +520,7 @@ EXPORT_SYMBOL(drm_mode_remove); * @dev: DRM device * @connector: the connector to init * @funcs: callbacks for this connector - * @name: user visible name of the connector + * @connector_type: type of the connector * * LOCKING: * Takes mode config lock. @@ -683,7 +684,8 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, plane->format_count = format_count; plane->possible_crtcs = possible_crtcs; - /* private planes are not exposed to userspace, but depending on + /* + * private planes are not exposed to userspace, but depending on * display hardware, might be convenient to allow sharing programming * for the scanout engine with the crtc implementation. */ @@ -1188,10 +1190,9 @@ static int drm_crtc_convert_umode(struct drm_display_mode *out, /** * drm_mode_getresources - get graphics configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -1249,7 +1250,6 @@ int drm_mode_getresources(struct drm_device *dev, void *data, list_for_each(lh, &dev->mode_config.encoder_list) encoder_count++; } else { - crtc_count = mode_group->num_crtcs; connector_count = mode_group->num_connectors; encoder_count = mode_group->num_encoders; @@ -1328,7 +1328,6 @@ int drm_mode_getresources(struct drm_device *dev, void *data, } copied++; } - } } card_res->count_encoders = encoder_count; @@ -1376,10 +1375,9 @@ out: /** * drm_mode_getcrtc - get CRTC configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -1421,10 +1419,8 @@ int drm_mode_getcrtc(struct drm_device *dev, crtc_resp->fb_id = 0; if (crtc->enabled) { - drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->mode); crtc_resp->mode_valid = 1; - } else { crtc_resp->mode_valid = 0; } @@ -1436,10 +1432,9 @@ out: /** * drm_mode_getconnector - get connector configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -1732,8 +1727,8 @@ out: /** * drm_mode_setplane - set up or tear down an plane * @dev: DRM device - * @data: ioctl data* - * @file_prive: DRM file info + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -1862,10 +1857,9 @@ out: /** * drm_mode_setcrtc - set CRTC configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -2077,6 +2071,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, goto out; } } + out: mutex_unlock(&dev->mode_config.mutex); return ret; @@ -2120,10 +2115,9 @@ EXPORT_SYMBOL(drm_mode_legacy_fb_format); /** * drm_mode_addfb - add an FB to the graphics configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -2304,10 +2298,9 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r) /** * drm_mode_addfb2 - add an FB to the graphics configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -2370,10 +2363,9 @@ out: /** * drm_mode_rmfb - remove an FB from the configuration - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -2425,10 +2417,9 @@ out: /** * drm_mode_getfb - get FB info - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * LOCKING: * Takes mode config lock. @@ -2515,6 +2506,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, ret = -EINVAL; goto out_err1; } + clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); if (!clips) { ret = -ENOMEM; @@ -2544,15 +2536,14 @@ out_err1: return ret; } - /** * drm_fb_release - remove and free the FBs on this file - * @filp: file * from the ioctl + * @priv: file * from the ioctl * * LOCKING: * Takes mode config lock. * - * Destroy all the FBs associated with @filp. + * Destroy all the FBs associated with @priv. * * Called by the user via ioctl. * @@ -2616,7 +2607,7 @@ int drm_mode_attachmode_crtc(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(!list_empty(&list)); - out: +out: list_for_each_entry_safe(dup_mode, next, &list, head) drm_mode_destroy(dev, dup_mode); @@ -2660,10 +2651,9 @@ EXPORT_SYMBOL(drm_mode_detachmode_crtc); /** * drm_fb_attachmode - Attach a user mode to an connector - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * This attaches a user specified mode to an connector. * Called by the user via ioctl. @@ -2707,6 +2697,7 @@ int drm_mode_attachmode_ioctl(struct drm_device *dev, } drm_mode_attachmode(dev, connector, mode); + out: mutex_unlock(&dev->mode_config.mutex); return ret; @@ -2715,10 +2706,9 @@ out: /** * drm_fb_detachmode - Detach a user specified mode from an connector - * @inode: inode from the ioctl - * @filp: file * from the ioctl - * @cmd: cmd from ioctl - * @arg: arg from ioctl + * @dev: DRM device + * @data: ioctl data + * @file_priv: DRM file info * * Called by the user via ioctl. * @@ -2754,6 +2744,7 @@ int drm_mode_detachmode_ioctl(struct drm_device *dev, } ret = drm_mode_detachmode(dev, connector, &mode); + out: mutex_unlock(&dev->mode_config.mutex); return ret; @@ -2790,6 +2781,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, list_add_tail(&property->head, &dev->mode_config.property_list); return property; + fail: kfree(property->values); kfree(property); @@ -3078,6 +3070,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev, } out_resp->count_enum_blobs = blob_count; } + done: mutex_unlock(&dev->mode_config.mutex); return ret; @@ -3187,6 +3180,7 @@ static bool drm_property_change_is_valid(struct drm_property *property, { if (property->flags & DRM_MODE_PROP_IMMUTABLE) return false; + if (property->flags & DRM_MODE_PROP_RANGE) { if (value < property->values[0] || value > property->values[1]) return false; @@ -3194,6 +3188,7 @@ static bool drm_property_change_is_valid(struct drm_property *property, } else if (property->flags & DRM_MODE_PROP_BITMASK) { int i; uint64_t valid_mask = 0; + for (i = 0; i < property->num_values; i++) valid_mask |= (1ULL << property->values[i]); return !(value & ~valid_mask); @@ -3326,6 +3321,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, } } arg->count_props = props_count; + out: mutex_unlock(&dev->mode_config.mutex); return ret; @@ -3487,7 +3483,6 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, out: mutex_unlock(&dev->mode_config.mutex); return ret; - } int drm_mode_gamma_get_ioctl(struct drm_device *dev, @@ -3535,6 +3530,7 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev, ret = -EFAULT; goto out; } + out: mutex_unlock(&dev->mode_config.mutex); return ret; @@ -3668,6 +3664,7 @@ int drm_mode_create_dumb_ioctl(struct drm_device *dev, if (!dev->driver->dumb_create) return -ENOSYS; + return dev->driver->dumb_create(file_priv, dev, args); } -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel