All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Krzysztof Wilczyński" <kw@linux.com>
Cc: bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Jim Quinlan <jim2101024@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Rob Herring <robh@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v1 1/1] PCI: brcmstb: Use GENMASK() as __GENMASK() is for internal use only
Date: Wed, 27 Oct 2021 13:27:19 +0300	[thread overview]
Message-ID: <YXkphydcdD9giKqs@smile.fi.intel.com> (raw)
In-Reply-To: <YXkjMO0ULRGqZPbr@rocinante>

On Wed, Oct 27, 2021 at 12:00:16PM +0200, Krzysztof Wilczyński wrote:
> > Use GENMASK() as __GENMASK() is for internal use only.
> 
> To add, for posterity, that using __GENMASK() bypasses the
> GENMASK_INPUT_CHECK() macro that adds extra validation.

In general, yes, but here we have a variable...

> > -	u32 val = __GENMASK(31, msi->legacy_shift);
> > +	u32 val = GENMASK(31, msi->legacy_shift);

...which make me thing that the whole construction is ugly
(and I truly believe the code is very ugly here, because
 the idea behind GENMASK() is to be used with constants).

So, what about

	u32 val = ~(BIT(msi->legacy_shift) - 1);

instead?

> Thank you!
> 
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Thank you!

-- 
With Best Regards,
Andy Shevchenko



WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Krzysztof Wilczyński" <kw@linux.com>
Cc: bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Jim Quinlan <jim2101024@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Rob Herring <robh@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v1 1/1] PCI: brcmstb: Use GENMASK() as __GENMASK() is for internal use only
Date: Wed, 27 Oct 2021 13:27:19 +0300	[thread overview]
Message-ID: <YXkphydcdD9giKqs@smile.fi.intel.com> (raw)
In-Reply-To: <YXkjMO0ULRGqZPbr@rocinante>

On Wed, Oct 27, 2021 at 12:00:16PM +0200, Krzysztof Wilczyński wrote:
> > Use GENMASK() as __GENMASK() is for internal use only.
> 
> To add, for posterity, that using __GENMASK() bypasses the
> GENMASK_INPUT_CHECK() macro that adds extra validation.

In general, yes, but here we have a variable...

> > -	u32 val = __GENMASK(31, msi->legacy_shift);
> > +	u32 val = GENMASK(31, msi->legacy_shift);

...which make me thing that the whole construction is ugly
(and I truly believe the code is very ugly here, because
 the idea behind GENMASK() is to be used with constants).

So, what about

	u32 val = ~(BIT(msi->legacy_shift) - 1);

instead?

> Thank you!
> 
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Thank you!

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-10-27 10:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  9:34 [PATCH v1 1/1] PCI: brcmstb: Use GENMASK() as __GENMASK() is for internal use only Andy Shevchenko
2021-10-27  9:34 ` Andy Shevchenko
2021-10-27  9:57 ` Andy Shevchenko
2021-10-27  9:57   ` Andy Shevchenko
2021-10-27 10:00 ` Krzysztof Wilczyński
2021-10-27 10:00   ` Krzysztof Wilczyński
2021-10-27 10:27   ` Andy Shevchenko [this message]
2021-10-27 10:27     ` Andy Shevchenko
2021-10-27 10:28     ` Andy Shevchenko
2021-10-27 10:28       ` Andy Shevchenko
2021-11-15 12:21     ` Krzysztof Wilczyński
2021-11-15 12:21       ` Krzysztof Wilczyński

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=YXkphydcdD9giKqs@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=jim2101024@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=nsaenz@kernel.org \
    --cc=robh@kernel.org \
    /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.