Re: [PATCH v6 5/6] fbdev: Move framebuffer I/O helpers into <asm/fb.h>
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2023-05-11 12:36:14
Also in:
dri-devel, linux-arch, linux-m68k, lkml, loongarch, oe-kbuild-all, sparclinux
Hi Arnd, CC Artur, who's working on HP Jornada 680. On Wed, May 10, 2023 at 5:55 PM Arnd Bergmann [off-list ref] wrote:
On Wed, May 10, 2023, at 16:27, Thomas Zimmermann wrote:quoted
Am 10.05.23 um 16:15 schrieb Arnd Bergmann:quoted
On Wed, May 10, 2023, at 16:03, kernel test robot wrote:quoted
quoted
I think that's a preexisting bug and I have no idea what the correct solution is. Looking for HD64461 shows it being used both with inw/outw and readw/writew, so there is no way to have the correct type. The sh __raw_readw() definition hides this bug, but that is a problem with arch/sh and it probably hides others as well.The constant HD64461_IOBASE is defined as integer at https://elixir.bootlin.com/linux/latest/source/arch/sh/include/asm/hd64461.h#L17 but fb_readw() expects a volatile-void pointer. I guess we could add a cast somewhere to silence the problem. In the current upstream code, that appears to be done by sh's __raw_readw() internally: https://elixir.bootlin.com/linux/latest/source/arch/sh/include/asm/io.h#L35Sure, that would make it build again, but that still doesn't make the code correct, since it's completely unclear what base address the HD64461_IOBASE is relative to. The hp6xx platform code only passes it through inw()/outw(), which take an offset relative to sh_io_port_base, but that is not initialized on hp6xx. I tried to find in the history when it broke, apparently that was in 2007 commit 34a780a0afeb ("sh: hp6xx pata_platform support."), which removed the custom inw/outw implementations.
See also commit 4aafae27d0ce73f8 ("sh: hd64461 tidying."), which
claims they are no longer needed.
Don't the I/O port macros just treat the port as an absolute base address
when sh_io_port_base isn't set?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds