[Intel-gfx] [PATCH] drm/ttm: let struct ttm_device_funcs be placed in rodata

Thomas Zimmermann tzimmermann at suse.de
Tue May 16 16:08:51 UTC 2023



Am 09.03.23 um 13:37 schrieb Jani Nikula:
> Make the struct ttm_device_funcs pointers const so the data can be placed in rodata.
> 
> Cc: Christian Koenig <christian.koenig at amd.com>
> Cc: Huang Rui <ray.huang at amd.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Thomas Zimmermann <tzimmermann at suse.de>

> ---
>   drivers/gpu/drm/ttm/ttm_device.c | 2 +-
>   include/drm/ttm/ttm_device.h     | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index ae2f19dc9f81..a71bb1362de4 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -190,7 +190,7 @@ EXPORT_SYMBOL(ttm_device_swapout);
>    * Returns:
>    * !0: Failure.
>    */
> -int ttm_device_init(struct ttm_device *bdev, struct ttm_device_funcs *funcs,
> +int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *funcs,
>   		    struct device *dev, struct address_space *mapping,
>   		    struct drm_vma_offset_manager *vma_manager,
>   		    bool use_dma_alloc, bool use_dma32)
> diff --git a/include/drm/ttm/ttm_device.h b/include/drm/ttm/ttm_device.h
> index 56e82ba2d046..c22f30535c84 100644
> --- a/include/drm/ttm/ttm_device.h
> +++ b/include/drm/ttm/ttm_device.h
> @@ -223,7 +223,7 @@ struct ttm_device {
>   	 * @funcs: Function table for the device.
>   	 * Constant after bo device init
>   	 */
> -	struct ttm_device_funcs *funcs;
> +	const struct ttm_device_funcs *funcs;
>   
>   	/**
>   	 * @sysman: Resource manager for the system domain.
> @@ -287,7 +287,7 @@ static inline void ttm_set_driver_manager(struct ttm_device *bdev, int type,
>   	bdev->man_drv[type] = manager;
>   }
>   
> -int ttm_device_init(struct ttm_device *bdev, struct ttm_device_funcs *funcs,
> +int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *funcs,
>   		    struct device *dev, struct address_space *mapping,
>   		    struct drm_vma_offset_manager *vma_manager,
>   		    bool use_dma_alloc, bool use_dma32);

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20230516/a14080a2/attachment.sig>


More information about the Intel-gfx mailing list