[PATCH 4/8] drm/vc4: kms: Simplify a bit the private obj state hooks

Thomas Zimmermann tzimmermann at suse.de
Thu Nov 19 04:27:18 EST 2020


Maybe merge this into the commit that introduces the functionality.

Am 13.11.20 um 16:29 schrieb Maxime Ripard:
> Some fields that we're going to add cannot be just copied over to the
> new state, and thus kmemdup is a bit unnecessary. Let's move to kzalloc
> instead, and clean it up in the process.
> 
> Signed-off-by: Maxime Ripard <maxime at cerno.tech>
> ---
>   drivers/gpu/drm/vc4/vc4_kms.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index d6712924681e..3d0065df10f9 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -695,23 +695,25 @@ static int vc4_load_tracker_obj_init(struct vc4_dev *vc4)
>   static struct drm_private_state *
>   vc4_hvs_channels_duplicate_state(struct drm_private_obj *obj)
>   {
> +	struct vc4_hvs_state *old_state = to_vc4_hvs_state(obj->state);
>   	struct vc4_hvs_state *state;
>   
> -	state = kmemdup(obj->state, sizeof(*state), GFP_KERNEL);
> +	state = kzalloc(sizeof(*state), GFP_KERNEL);
>   	if (!state)
>   		return NULL;
>   
>   	__drm_atomic_helper_private_obj_duplicate_state(obj, &state->base);
>   
> +	state->unassigned_channels = old_state->unassigned_channels;
> +
>   	return &state->base;
>   }
>   
>   static void vc4_hvs_channels_destroy_state(struct drm_private_obj *obj,
>   					   struct drm_private_state *state)
>   {
> -	struct vc4_hvs_state *hvs_state;
> +	struct vc4_hvs_state *hvs_state = to_vc4_hvs_state(state);
>   
> -	hvs_state = to_vc4_hvs_state(state);
>   	kfree(hvs_state);
>   }
>   
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x680DC11D530B7A23.asc
Type: application/pgp-keys
Size: 7435 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20201119/c341725e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20201119/c341725e/attachment-0001.sig>


More information about the linux-arm-kernel mailing list