All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	jacob.e.keller@intel.com
Subject: Re: [PATCH net-next 1/3] tools: ynl-gen: support sub-type for binary attributes
Date: Thu, 8 May 2025 09:54:39 -0700	[thread overview]
Message-ID: <20250508095439.26c63ff3@kernel.org> (raw)
In-Reply-To: <CAD4GDZzR7DV-z7HA7=r9tmXmgkQu30K5QE9nAdz2eZfvKPOusA@mail.gmail.com>

On Thu, 8 May 2025 12:33:10 +0100 Donald Hunter wrote:
> >  class TypeBinary(Type):
> >      def arg_member(self, ri):
> > +        if self.get('sub-type') and self.get('sub-type') in scalars:  
> 
> This check is repeated a lot, so maybe it would benefit from a
> _has_scalar_sub_type() helper?

I've gotten used to repeating the conditions in TypeArrayNest 
and TypeMultiAttr...

Looking at it now, since I'm using .get() the part of the condition 
is unnecessary. How about just:

	if self.get('sub-type') in scalars:

? None is not a scalar after all

  reply	other threads:[~2025-05-08 16:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08  2:28 [PATCH net-next 0/3] tools: ynl-gen: support sub-types for binary attributes Jakub Kicinski
2025-05-08  2:28 ` [PATCH net-next 1/3] tools: ynl-gen: support sub-type " Jakub Kicinski
2025-05-08 11:33   ` Donald Hunter
2025-05-08 16:54     ` Jakub Kicinski [this message]
2025-05-09  9:05       ` Donald Hunter
2025-05-08  2:28 ` [PATCH net-next 2/3] tools: ynl-gen: auto-indent else Jakub Kicinski
2025-05-08 11:34   ` Donald Hunter
2025-05-08  2:28 ` [PATCH net-next 3/3] tools: ynl-gen: support struct for binary attributes Jakub Kicinski
2025-05-08 11:36   ` Donald Hunter

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=20250508095439.26c63ff3@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.