[PATCH 03/16] ASoC: SOF: ops: add readb/writeb helpers

Nathan Chancellor nathan at kernel.org
Thu Oct 27 20:51:02 CEST 2022


Hi Pierre-Louis,

On Mon, Oct 24, 2022 at 11:52:57AM -0500, Pierre-Louis Bossart wrote:
> These will be used to add more consistency in the SOF core and
> drivers.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
> Reviewed-by: Rander Wang <rander.wang at intel.com>
> Reviewed-by: Péter Ujfalusi <peter.ujfalusi at linux.intel.com>

This change is now in -next as commit 74fe0c4dcb41 ("ASoC: SOF: ops: add
readb/writeb helpers"), where it breaks the build badly on at least
ARCH=arm:

$ kmake ARCH=arm CROSS_COMPILE=arm-linux-gnu- allmodconfig sound/soc/sof/
...
In file included from sound/soc/sof/sof-client.c:16:
sound/soc/sof/ops.h: In function ‘snd_sof_dsp_writeb’:
sound/soc/sof/ops.h:309:75: error: macro "writeb" passed 3 arguments, but takes just 2
  309 |                 sof_ops(sdev)->writeb(sdev, sdev->bar[bar] + offset, value);
      |                                                                           ^
In file included from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:17,
                 from ./arch/arm/include/asm/hardirq.h:10,
                 from ./include/linux/hardirq.h:11,
                 from ./include/linux/interrupt.h:11,
                 from sound/soc/sof/ops.h:15:
./arch/arm/include/asm/io.h:288: note: macro "writeb" defined here
  288 | #define writeb(v,c)             ({ __iowmb(); writeb_relaxed(v,c); })
      |
sound/soc/sof/ops.h:309:30: error: statement with no effect [-Werror=unused-value]
  309 |                 sof_ops(sdev)->writeb(sdev, sdev->bar[bar] + offset, value);
      |                              ^
sound/soc/sof/ops.h: In function ‘snd_sof_dsp_readb’:
sound/soc/sof/ops.h:336:74: error: macro "readb" passed 2 arguments, but takes just 1
  336 |                 return sof_ops(sdev)->readb(sdev, sdev->bar[bar] + offset);
      |                                                                          ^
./arch/arm/include/asm/io.h:284: note: macro "readb" defined here
  284 | #define readb(c)                ({ u8  __v = readb_relaxed(c); __iormb(); __v; })
      |
sound/soc/sof/ops.h:336:37: error: returning ‘u8 (*)(struct snd_sof_dev *, void *)’ {aka ‘unsigned char (*)(struct snd_sof_dev *, void *)’} from a function with return type ‘u8’ {aka ‘unsigned char’} makes integer from pointer without a cast [-Werror=int-conversion]
  336 |                 return sof_ops(sdev)->readb(sdev, sdev->bar[bar] + offset);
      |                                     ^
cc1: all warnings being treated as errors
...

I guess the preprocessor gets to these calls first and everything
explodes from there. Perhaps these should be namespaced somehow?

Cheers,
Nathan


More information about the Alsa-devel mailing list