Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Takanari Hayama <taki@igel.co.jp>
Cc: linux-renesas-soc@vger.kernel.org,
	kieran.bingham+renesas@ideasonboard.com
Subject: Re: [PATCH 1/3] tests: Support enum property type
Date: Sun, 31 Jul 2022 19:18:22 +0300	[thread overview]
Message-ID: <YuarTkDWaYjvAl/h@pendragon.ideasonboard.com> (raw)
In-Reply-To: <YuanO6pgmtEvfwRj@pendragon.ideasonboard.com>

One more comment.

On Sun, Jul 31, 2022 at 07:01:00PM +0300, Laurent Pinchart wrote:
> Hi Hayama-san,
> 
> Thank you for the patch.
> 
> On Mon, Jul 04, 2022 at 11:56:30AM +0900, Takanari Hayama wrote:
> > Add a support for enum property type to AtomicRequest.
> > 
> > Signed-off-by: Takanari Hayama <taki@igel.co.jp>
> > ---
> >  tests/kmstest.py | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/kmstest.py b/tests/kmstest.py
> > index 11cc328b5b32..224c160e32fa 100755
> > --- a/tests/kmstest.py
> > +++ b/tests/kmstest.py
> > @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq):
> >  
> >                      min, max = prop.values
> >                      v = min + int((max - min) * int(v[:-1]) / 100)
> > -                else:
> > +                elif v.isnumeric():
> >                      v = int(v)
> > +                else:
> > +                    prop = obj.get_prop(k)

I've run this test on a kernel that doesn't support the blend mode
property, and the prop.type access below raised an exception that isn't
very nice to read. If that's fine with you, I'll add

                    if not prop:
                        raise RuntimeError(f'Property {k} not supported by object {obj}')

here to make error messages more readable.

> > +                    if prop.type != pykms.PropertyType.Enum:
> > +                        raise RuntimeError(f'Unsupported property type {prop.type} for value {v}')
> > +                    for value, mode in prop.enums.items():
> 
> I'd replace "mode" with "name" here. Apart from that,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> I'll change this when applying the patch.
> 
> > +                        if mode == v:
> > +                            v = value
> > +                            break
> > +                    else:
> > +                        raise RuntimeError(f'Enum value with name "{v}" not found in property {k}')
> >  
> >              if not isinstance(v, int):
> >                  raise RuntimeError(f'Unsupported value type {type(v)} for property {k}')

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-07-31 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04  2:56 [PATCH 0/3] Test pixel blend mode Takanari Hayama
2022-07-04  2:56 ` [PATCH 1/3] tests: Support enum property type Takanari Hayama
2022-07-04  8:43   ` Sergei Shtylyov
2022-07-04  8:53     ` Takanari Hayama
2022-07-04  9:00       ` Sergei Shtylyov
2022-07-04  9:13         ` Takanari Hayama
2022-07-31 16:00   ` Laurent Pinchart
2022-07-31 16:18     ` Laurent Pinchart [this message]
2022-08-01  8:29       ` Takanari Hayama
2022-07-04  2:56 ` [PATCH 2/3] kmstest: Support specifying pixel blend mode for planes Takanari Hayama
2022-07-31 16:02   ` Laurent Pinchart
2022-07-04  2:56 ` [PATCH 3/3] tests: Add pixel blend mode test Takanari Hayama
2022-07-31 18:50   ` Laurent Pinchart

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=YuarTkDWaYjvAl/h@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=taki@igel.co.jp \
    /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