All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Benoit Parrot <bparrot@ti.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: ti-vpe: cal: avoid FIELD_GET assertion
Date: Mon, 7 Dec 2020 01:57:15 +0200	[thread overview]
Message-ID: <X81v22O9LxsAIUKs@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20201203230738.1481199-1-arnd@kernel.org>

Hi Arnd,

Thank you for the patch.

On Fri, Dec 04, 2020 at 12:07:30AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> FIELD_GET() must only be used with a mask that is a compile-time
> constant:
> 
> drivers/media/platform/ti-vpe/cal.h: In function 'cal_read_field':
> include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_247' declared with attribute error: FIELD_GET: mask is not constant
> include/linux/bitfield.h:46:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
>    46 |   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),  \
>       |   ^~~~~~~~~~~~~~~~
> drivers/media/platform/ti-vpe/cal.h:220:9: note: in expansion of macro 'FIELD_GET'
>   220 |  return FIELD_GET(mask, cal_read(cal, offset));
>       |         ^~~~~~~~~
> 
> The problem here is that the function is not always inlined. Mark it
> __always_inline to avoid the problem.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

This doesn't conflict with the series I've just sent for the CAL driver,
and can thus be applied first or on top. Hans, can I let you handle this
?

> ---
>  drivers/media/platform/ti-vpe/cal.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h
> index 4123405ee0cf..20d07311d222 100644
> --- a/drivers/media/platform/ti-vpe/cal.h
> +++ b/drivers/media/platform/ti-vpe/cal.h
> @@ -215,7 +215,7 @@ static inline void cal_write(struct cal_dev *cal, u32 offset, u32 val)
>  	iowrite32(val, cal->base + offset);
>  }
>  
> -static inline u32 cal_read_field(struct cal_dev *cal, u32 offset, u32 mask)
> +static __always_inline u32 cal_read_field(struct cal_dev *cal, u32 offset, u32 mask)
>  {
>  	return FIELD_GET(mask, cal_read(cal, offset));
>  }

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2020-12-06 23:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 23:07 [PATCH] media: ti-vpe: cal: avoid FIELD_GET assertion Arnd Bergmann
2020-12-06 23:57 ` Laurent Pinchart [this message]

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=X81v22O9LxsAIUKs@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=bparrot@ti.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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.