linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: Maxime Ripard <maxime@cerno.tech>,
	Jernej Skrabec <jernej.skrabec@siol.net>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/7] drm/sun4i: de2: Don't return de2_fmt_info struct
Date: Tue, 25 Feb 2020 16:52:18 +0800	[thread overview]
Message-ID: <CAGb2v64g7Q4e+ic08pA7tbamgToOjyYzuzqP0bpqBZjRuRUrPA@mail.gmail.com> (raw)
In-Reply-To: <20200225083448.6upblnctjjrbarje@gilmour.lan>

On Tue, Feb 25, 2020 at 4:35 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> 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@siol.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?

I guess we could just define an "invalid" value, and have the function
return that if can't find a match? I'm guessing 0x0 is valid, so maybe
0xffffffff or 0xdeadbeef ?

That would keep consistency with everything else all the while
removing the level of indirection you wanted to.

ChenYu


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

  reply	other threads:[~2020-02-25  8:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 17:38 [PATCH 0/7] drm/sun4i: de2/de3 format fixes and updates Jernej Skrabec
2020-02-24 17:38 ` [PATCH 1/7] drm/sun4i: de2/de3: Remove unsupported VI layer formats Jernej Skrabec
2020-02-24 17:38 ` [PATCH 2/7] drm/sun4i: Add separate DE3 " Jernej Skrabec
2020-02-24 17:38 ` [PATCH 3/7] drm/sun4i: Fix DE2 VI layer format support Jernej Skrabec
2020-02-24 17:38 ` [PATCH 4/7] drm/sun4i: de2: rgb field in de2 format struct is redundant Jernej Skrabec
2020-02-24 17:38 ` [PATCH 5/7] drm/sun4i: de2: csc_mode in de2 format struct is mostly redundant Jernej Skrabec
2020-02-24 17:39 ` [PATCH 6/7] drm/sun4i: de2: Don't return de2_fmt_info struct Jernej Skrabec
2020-02-25  8:34   ` Maxime Ripard
2020-02-25  8:52     ` Chen-Yu Tsai [this message]
2020-02-25 18:50       ` Jernej Škrabec
2020-02-26  3:29         ` Chen-Yu Tsai
2020-02-26 17:25         ` Maxime Ripard
2020-02-24 17:39 ` [PATCH 7/7] drm/sun4i: Sort includes in VI and UI layer code Jernej Skrabec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGb2v64g7Q4e+ic08pA7tbamgToOjyYzuzqP0bpqBZjRuRUrPA@mail.gmail.com \
    --to=wens@csie.org \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).