lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Feb 2020 09:34:48 +0100
From:   Maxime Ripard <maxime@...no.tech>
To:     Jernej Skrabec <jernej.skrabec@...l.net>
Cc:     wens@...e.org, airlied@...ux.ie, daniel@...ll.ch,
        dri-devel@...ts.freedesktop.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] drm/sun4i: de2: Don't return de2_fmt_info struct

Hi,

On Mon, Feb 24, 2020 at 06:39:00PM +0100, Jernej Skrabec wrote:
> Now that de2_fmt_info contains only DRM <-> HW format mapping, it
> doesn't make sense to return pointer to structure when searching by DRM
> format. Rework that to return only HW format instead.
>
> This doesn't make any functional change.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@...l.net>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c    | 15 +++++++++++----
>  drivers/gpu/drm/sun4i/sun8i_mixer.h    |  7 +------
>  drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 10 +++++-----
>  drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 12 ++++++------
>  4 files changed, 23 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> index e078ec96de2d..56cc037fd312 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -27,6 +27,11 @@
>  #include "sun8i_vi_layer.h"
>  #include "sunxi_engine.h"
>
> +struct de2_fmt_info {
> +	u32	drm_fmt;
> +	u32	de2_fmt;
> +};
> +
>  static const struct de2_fmt_info de2_formats[] = {
>  	{
>  		.drm_fmt = DRM_FORMAT_ARGB8888,
> @@ -230,15 +235,17 @@ static const struct de2_fmt_info de2_formats[] = {
>  	},
>  };
>
> -const struct de2_fmt_info *sun8i_mixer_format_info(u32 format)
> +int sun8i_mixer_drm_format_to_hw(u32 format, u32 *hw_format)
>  {
>  	unsigned int i;
>
>  	for (i = 0; i < ARRAY_SIZE(de2_formats); ++i)
> -		if (de2_formats[i].drm_fmt == format)
> -			return &de2_formats[i];
> +		if (de2_formats[i].drm_fmt == format) {
> +			*hw_format = de2_formats[i].de2_fmt;
> +			return 0;
> +		}
>
> -	return NULL;
> +	return -EINVAL;
>  }

I'm not too sure about that one. It breaks the consistency with the
other functions, and I don't really see a particular benefit to it?

The rest of the series is
Acked-by: Maxime Ripard <mripard@...nel.org>

Maxime

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ