Re: [PATCH v3 4/6] fbdev: Include <linux/io.h> via <asm/fb.h>

From
Geert Uytterhoeven <geert@linux-m68k.org>
Date
2023-05-03 08:10:14
Also in
dri-devel, linux-arch, linux-arm-kernel, linux-m68k, lkml, loongarch, sparclinux
Reply to
Javier Martinez Canillas, 2023-05-03
On Wed, May 3, 2023 at 9:19 AM Javier Martinez Canillas
[off-list ref] wrote:
Thomas Zimmermann [off-list ref] writes:
quoted
Am 02.05.23 um 21:54 schrieb Sam Ravnborg:
quoted
On Tue, May 02, 2023 at 03:02:21PM +0200, Thomas Zimmermann wrote:
[...]
quoted
quoted
quoted
  #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */
  #include <video/vga.h>

+#include <asm/fb.h>
When we have a header like linux/fb.h - it is my understanding that it is
preferred to include that file, and not the asm/fb.h variant.

This is assuming the linux/fb.h contains the generic stuff, and includes
asm/fb.h for the architecture specific parts.

So drivers will include linux/fb.h and then they automatically get the
architecture specific parts from asm/fb.h.

In other words, drivers are not supposed to include asm/fb.h, if
linux.fb.h exists - and linux/fb.h shall include the asm/fb.h.

If the above holds true, then it is wrong and not needed to add asm/fb.h
as seen above.


There are countless examples where the above are not followed,
but to my best understanding the above it the preferred way to do it.
Where did youher this? I only know about this in the case of asm/io.h
vs. linux/io.h.
I understand that's the case too. I believe even checkpatch.pl complains
about it? (not that the script always get right, but just as an example).
One more to chime in: in general, drivers should only include <linux/foo.h>.
Including <asm/foo.h> directly is the exception.

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
Thread (23 messages) 23 messages, 5 authors, last reply 2023-05-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help