Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/prime: Unexport helpers for fd/handle conversion

Unexport drm_gem_prime_fd_to_handle() and drm_gem_prime_handle_to_fd().
Both are only used internally within the PRIME code.

v2:
* reword docs as functions are now unexported (Simon)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230620080252.16368-4-tzimmermann@suse.de

+15 -25
+15 -18
drivers/gpu/drm/drm_prime.c
··· 278 278 } 279 279 EXPORT_SYMBOL(drm_gem_dmabuf_release); 280 280 281 - /** 281 + /* 282 282 * drm_gem_prime_fd_to_handle - PRIME import function for GEM drivers 283 283 * @dev: drm_device to import into 284 284 * @file_priv: drm file-private structure ··· 292 292 * 293 293 * Returns 0 on success or a negative error code on failure. 294 294 */ 295 - int drm_gem_prime_fd_to_handle(struct drm_device *dev, 296 - struct drm_file *file_priv, int prime_fd, 297 - uint32_t *handle) 295 + static int drm_gem_prime_fd_to_handle(struct drm_device *dev, 296 + struct drm_file *file_priv, int prime_fd, 297 + uint32_t *handle) 298 298 { 299 299 struct dma_buf *dma_buf; 300 300 struct drm_gem_object *obj; ··· 360 360 dma_buf_put(dma_buf); 361 361 return ret; 362 362 } 363 - EXPORT_SYMBOL(drm_gem_prime_fd_to_handle); 364 363 365 364 int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, 366 365 struct drm_file *file_priv) ··· 408 409 return dmabuf; 409 410 } 410 411 411 - /** 412 + /* 412 413 * drm_gem_prime_handle_to_fd - PRIME export function for GEM drivers 413 414 * @dev: dev to export the buffer from 414 415 * @file_priv: drm file-private structure ··· 421 422 * The actual exporting from GEM object to a dma-buf is done through the 422 423 * &drm_gem_object_funcs.export callback. 423 424 */ 424 - int drm_gem_prime_handle_to_fd(struct drm_device *dev, 425 - struct drm_file *file_priv, uint32_t handle, 426 - uint32_t flags, 427 - int *prime_fd) 425 + static int drm_gem_prime_handle_to_fd(struct drm_device *dev, 426 + struct drm_file *file_priv, uint32_t handle, 427 + uint32_t flags, 428 + int *prime_fd) 428 429 { 429 430 struct drm_gem_object *obj; 430 431 int ret = 0; ··· 506 507 507 508 return ret; 508 509 } 509 - EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); 510 510 511 511 int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, 512 512 struct drm_file *file_priv) ··· 864 866 * @obj: GEM object to export 865 867 * @flags: flags like DRM_CLOEXEC and DRM_RDWR 866 868 * 867 - * This is the implementation of the &drm_gem_object_funcs.export functions for GEM drivers 868 - * using the PRIME helpers. It is used as the default in 869 - * drm_gem_prime_handle_to_fd(). 869 + * This is the implementation of the &drm_gem_object_funcs.export functions 870 + * for GEM drivers using the PRIME helpers. It is used as the default for 871 + * drivers that do not set their own. 870 872 */ 871 873 struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj, 872 874 int flags) ··· 962 964 * @dev: drm_device to import into 963 965 * @dma_buf: dma-buf object to import 964 966 * 965 - * This is the implementation of the gem_prime_import functions for GEM drivers 966 - * using the PRIME helpers. Drivers can use this as their 967 - * &drm_driver.gem_prime_import implementation. It is used as the default 968 - * implementation in drm_gem_prime_fd_to_handle(). 967 + * This is the implementation of the gem_prime_import functions for GEM 968 + * drivers using the PRIME helpers. It is the default for drivers that do 969 + * not set their own &drm_driver.gem_prime_import. 969 970 * 970 971 * Drivers must arrange to call drm_prime_gem_destroy() from their 971 972 * &drm_gem_object_funcs.free hook when using this function.
-7
include/drm/drm_prime.h
··· 60 60 61 61 struct drm_device; 62 62 struct drm_gem_object; 63 - struct drm_file; 64 63 65 64 /* core prime functions */ 66 65 struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, 67 66 struct dma_buf_export_info *exp_info); 68 67 void drm_gem_dmabuf_release(struct dma_buf *dma_buf); 69 - 70 - int drm_gem_prime_fd_to_handle(struct drm_device *dev, 71 - struct drm_file *file_priv, int prime_fd, uint32_t *handle); 72 - int drm_gem_prime_handle_to_fd(struct drm_device *dev, 73 - struct drm_file *file_priv, uint32_t handle, uint32_t flags, 74 - int *prime_fd); 75 68 76 69 /* helper functions for exporting */ 77 70 int drm_gem_map_attach(struct dma_buf *dma_buf,