/** * drmm_add_action - add a managed release action to a &drm_device * @dev: DRM device * @action: function which should be called when @dev is released * @data: opaque pointer, passed to @action * * This function adds the @release action with optional parameter @data to the * list of cleanup actions for @dev. The cleanup actions will be run in reverse * order in the final drm_dev_put() call for @dev.
*/ #define drmm_add_action(dev, action, data) \
__drmm_add_action(dev, action, data, #action)
/** * drmm_add_action_or_reset - add a managed release action to a &drm_device * @dev: DRM device * @action: function which should be called when @dev is released * @data: opaque pointer, passed to @action * * Similar to drmm_add_action(), with the only difference that upon failure * @action is directly called for any cleanup work necessary on failures.
*/ #define drmm_add_action_or_reset(dev, action, data) \
__drmm_add_action_or_reset(dev, action, data, #action)
/** * drmm_kzalloc - &drm_device managed kzalloc() * @dev: DRM device * @size: size of the memory allocation * @gfp: GFP allocation flags * * This is a &drm_device managed version of kzalloc(). The allocated memory is * automatically freed on the final drm_dev_put(). Memory can also be freed * before the final drm_dev_put() by calling drmm_kfree().
*/ staticinlinevoid *drmm_kzalloc(struct drm_device *dev, size_t size, gfp_t gfp)
{ return drmm_kmalloc(dev, size, gfp | __GFP_ZERO);
}
/** * drmm_kmalloc_array - &drm_device managed kmalloc_array() * @dev: DRM device * @n: number of array elements to allocate * @size: size of array member * @flags: GFP allocation flags * * This is a &drm_device managed version of kmalloc_array(). The allocated * memory is automatically freed on the final drm_dev_put() and works exactly * like a memory allocation obtained by drmm_kmalloc().
*/ staticinlinevoid *drmm_kmalloc_array(struct drm_device *dev,
size_t n, size_t size, gfp_t flags)
{
size_t bytes;
if (unlikely(check_mul_overflow(n, size, &bytes))) return NULL;
return drmm_kmalloc(dev, bytes, flags);
}
/** * drmm_kcalloc - &drm_device managed kcalloc() * @dev: DRM device * @n: number of array elements to allocate * @size: size of array member * @flags: GFP allocation flags * * This is a &drm_device managed version of kcalloc(). The allocated memory is * automatically freed on the final drm_dev_put() and works exactly like a * memory allocation obtained by drmm_kmalloc().
*/ staticinlinevoid *drmm_kcalloc(struct drm_device *dev,
size_t n, size_t size, gfp_t flags)
{ return drmm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
}
/** * drmm_mutex_init - &drm_device-managed mutex_init() * @dev: DRM device * @lock: lock to be initialized * * Returns: * 0 on success, or a negative errno code otherwise. * * This is a &drm_device-managed version of mutex_init(). The initialized * lock is automatically destroyed on the final drm_dev_put().
*/ #define drmm_mutex_init(dev, lock) ({ \
mutex_init(lock); \
drmm_add_action_or_reset(dev, __drmm_mutex_release, lock); \
}) \
/** * drmm_alloc_ordered_workqueue - &drm_device managed alloc_ordered_workqueue() * @dev: DRM device * @fmt: printf format for the name of the workqueue * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful) * @args: args for @fmt * * This is a &drm_device-managed version of alloc_ordered_workqueue(). The * allocated workqueue is automatically destroyed on the final drm_dev_put(). * * Returns: workqueue on success, negative ERR_PTR otherwise.
*/ #define drmm_alloc_ordered_workqueue(dev, fmt, flags, args...) \
({ \ struct workqueue_struct *wq = alloc_ordered_workqueue(fmt, flags, ##args); \
wq ? ({ \ int ret = drmm_add_action_or_reset(dev, __drmm_workqueue_release, wq); \
ret ? ERR_PTR(ret) : wq; \
}) : ERR_PTR(-ENOMEM); \
})
#endif
Messung V0.5
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
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.