[PATCH 03/16] ASoC: SOF: ops: add readb/writeb helpers
Nathan Chancellor
nathan at kernel.org
Thu Oct 27 22:02:38 CEST 2022
On Thu, Oct 27, 2022 at 03:58:08PM -0400, Pierre-Louis Bossart wrote:
>
>
> On 10/27/22 14:51, Nathan Chancellor wrote:
> > 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?
>
> Thanks for the report. We've had these patches for a while and always
> compile for ARM, and didn't see any issues raised. Meh.
>
> I don't have a strong appetite for changes in common parts, maybe it's
> just simpler to use read8/write8 as callback names to avoid the
> conflict, something like the patch attached (compile-tested only). In
> hindsight it'd also be more consistent with the use of read64/write64
> that was added earlier in SOF helpers.
That diff resolves the build failure for me as well. I will put it into
my test matrix and make sure that it does not cause any other build
issues.
Cheers,
Nathan
More information about the Alsa-devel
mailing list