# Re: \[PATCH v6 5/6\] fbdev: Move framebuffer I/O helpers into \<asm/fb.h\>

- From: Thomas Zimmermann \<tzimmermann@suse.de\>
- Date: 2023-05-10 14:27:28 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2023/05/2193318
- Thread: https://ratatoskr.run/oe-kbuild-all/2023/05/2193281/t.md

```text
Hi

Am 10.05.23 um 16:15 schrieb Arnd Bergmann:
> On Wed, May 10, 2023, at 16:03, kernel test robot wrote:
>
>>
>>     cc1: warning: arch/sh/include/mach-hp6xx: No such file or directory
>> [-Wmissing-include-dirs]
>>     cc1: warning: arch/sh/include/mach-hp6xx: No such file or directory
>> [-Wmissing-include-dirs]
>>     In file included from drivers/video/fbdev/hitfb.c:27:
>>     drivers/video/fbdev/hitfb.c: In function 'hitfb_accel_wait':
>>>> arch/sh/include/asm/hd64461.h:18:33: warning: passing argument 1 of 'fb_readw' makes pointer from integer without a cast [-Wint-conversion]
>>        18 | #define HD64461_IO_OFFSET(x)    (HD64461_IOBASE + (x))
>>           |                                 ^~~~~~~~~~~~~~~~~~~~~~
>>           |                                 |
>>           |                                 unsigned int
>>     arch/sh/include/asm/hd64461.h:93:33: note: in expansion of macro
>> 'HD64461_IO_OFFSET'
>>        93 | #define HD64461_GRCFGR          HD64461_IO_OFFSET(0x1044)
>>     /* Accelerator Configuration Register */
>>           |                                 ^~~~~~~~~~~~~~~~~
>>     drivers/video/fbdev/hitfb.c:47:25: note: in expansion of macro
>> 'HD64461_GRCFGR'
>>        47 |         while (fb_readw(HD64461_GRCFGR) &
>> HD64461_GRCFGR_ACCSTATUS) ;
>
> 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#L35

Best regards
Thomas

>
>         Arnd

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
```

## Attachments

- [OpenPGP\_signature](https://ratatoskr.run/linux-fbdev/2023/05/2193318/attachment/0) (application/pgp-signature, 840 bytes)
