2020-10-28 15:10:58

by Peilin Ye

[permalink] [raw]
Subject: [PATCH 0/5] Preparation work for using font_desc in vc_data

Hi Daniel, Hi Greg, Hi all,

We are planning to use `font_desc` instead of `console_font` in `vc_data`,
and this is just some prep work for it. It doesn't do much, but at least
it removes two "FIXME"s in fbcon.c :)

Peilin Ye (5):
[1/5] fbdev/atafb: Remove unused extern variables

Searching for `fontdata` gave me this in fbdev/atafb.c:

extern unsigned char fontdata_8x8[];
extern unsigned char fontdata_8x16[];

...which freaked me out, since in 6735b4632def ("Fonts: Support
FONT_EXTRA_WORDS macros for built-in fonts") I changed them from char
arrays to structures, in lib/fonts/. Fortunately it turns out these
extern variables have nothing to do with lib/fonts/, and are not being
used anywhere, so remove them for less confusion.

m68k cross-compiled.

[2/5] Fonts: Make font size unsigned in font_desc

Our goal is to use `font_desc` "everywhere" in the kernel, and signed
`width` and `height` is inappropriate.

Also, change some printk() format identifiers in console/sticore.c from
`%d` to `%u`. parisc cross-compiled.

[3/5] Fonts: Add charcount field to font_desc

Add `unsigned int charcount` to `font_desc`, and update each of our 13
built-in fonts.

[4/5] fbcon: Avoid hard-coding built-in font charcount
[5/5] parisc/sticore: Avoid hard-coding built-in font charcount

Everyone (tty, fbcon, sticore, etc.) is assuming that all built-in fonts
have 256 characters, and is using hard-coded 256 or 255 everywhere.
These two patches removes some of them. [5/5] is parisc cross-compiled.

Now is a good time to review all find_font() and get_default_font()
callers:

drivers/media/pci/solo6x10/solo6x10-enc.c 133 const struct font_desc *vga = find_font("VGA8x16");
drivers/media/test-drivers/vimc/vimc-core.c 268 const struct font_desc *font = find_font("VGA8x16");
drivers/media/test-drivers/vivid/vivid-core.c 1928 const struct font_desc *font = find_font("VGA8x16");
drivers/usb/misc/sisusbvga/sisusb.c 2285 myfont = find_font("VGA8x16");
* These 4 only care about font VGA8x16, so let them be for now;

drivers/video/console/sticore.c 499 fbfont = find_font(fbfont_name);
drivers/video/console/sticore.c 501 fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0);
* Uses 255 and 256, (hopefully) cleaned up by [5/5];

drivers/video/fbdev/core/fbcon.c 999 if (!fontname[0] || !(font = find_font(fontname)))
drivers/video/fbdev/core/fbcon.c 1000 font = get_default_font(info->var.xres,
drivers/video/fbdev/core/fbcon.c 1078 if (!fontname[0] || !(font = find_font(fontname)))
drivers/video/fbdev/core/fbcon.c 1079 font = get_default_font(info->var.xres,
* Use 256, cleaned up by [4/5];

drivers/video/fbdev/core/fbcon.c 2548 else if (!(f = find_font(name)))
drivers/video/fbdev/core/fbcon.c 2546 f = get_default_font(info->var.xres, info->var.yres,
* Uses 256 but no easy fix. I'll clean this up after making
fbcon_do_set_font() pass a `font_desc` as parameter;

drivers/firmware/efi/earlycon.c 234 font = get_default_font(xres, yres, -1, -1);
* Does not care about charcount.

Thank you!
Peilin Ye

drivers/video/console/sticore.c | 10 +++++-----
drivers/video/fbdev/atafb.c | 8 --------
drivers/video/fbdev/core/fbcon.c | 5 ++---
include/linux/font.h | 3 ++-
lib/fonts/font_10x18.c | 1 +
lib/fonts/font_6x10.c | 1 +
lib/fonts/font_6x11.c | 1 +
lib/fonts/font_6x8.c | 1 +
lib/fonts/font_7x14.c | 1 +
lib/fonts/font_8x16.c | 1 +
lib/fonts/font_8x8.c | 1 +
lib/fonts/font_acorn_8x8.c | 1 +
lib/fonts/font_mini_4x6.c | 1 +
lib/fonts/font_pearl_8x8.c | 1 +
lib/fonts/font_sun12x22.c | 1 +
lib/fonts/font_sun8x16.c | 1 +
lib/fonts/font_ter16x32.c | 1 +
17 files changed, 22 insertions(+), 17 deletions(-)

--
2.25.1


2020-10-28 15:15:31

by Peilin Ye

[permalink] [raw]
Subject: [PATCH 1/5] fbdev/atafb: Remove unused extern variables

Remove 6 unused extern variables to reduce confusion. It is worth
mentioning that lib/fonts/font_8x8.c and lib/fonts/font_8x16.c also
declare `fontdata_8x8` and `fontdata_8x16` respectively, and this file
has nothing to do with them.

Signed-off-by: Peilin Ye <[email protected]>
---
$ # Build-tested (Ubuntu 20.04)
$ sudo apt install gcc-m68k-linux-gnu
$ cp arch/m68k/configs/atari_defconfig .config
$ make ARCH=m68k menuconfig
$ make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- -j`nproc` all

drivers/video/fbdev/atafb.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index f253daa05d9d..e3812a8ff55a 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -240,14 +240,6 @@ static int *MV300_reg = MV300_reg_8bit;

static int inverse;

-extern int fontheight_8x8;
-extern int fontwidth_8x8;
-extern unsigned char fontdata_8x8[];
-
-extern int fontheight_8x16;
-extern int fontwidth_8x16;
-extern unsigned char fontdata_8x16[];
-
/*
* struct fb_ops {
* * open/release and usage marking
--
2.25.1

2020-10-28 15:22:27

by Peilin Ye

[permalink] [raw]
Subject: [PATCH 2/5] Fonts: Make font size unsigned in font_desc

It is improper to define `width` and `height` as signed in `struct
font_desc`. Make them unsigned. Also, change the corresponding printk()
format identifiers from `%d` to `%u`, in sti_select_fbfont().

Signed-off-by: Peilin Ye <[email protected]>
---
Build-tested.

drivers/video/console/sticore.c | 2 +-
include/linux/font.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 6a26a364f9bd..d1bb5915082b 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -502,7 +502,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
if (!fbfont)
return NULL;

- pr_info("STI selected %dx%d framebuffer font %s for sticon\n",
+ pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
fbfont->width, fbfont->height, fbfont->name);

bpc = ((fbfont->width+7)/8) * fbfont->height;
diff --git a/include/linux/font.h b/include/linux/font.h
index b5b312c19e46..4f50d736ea72 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -16,7 +16,7 @@
struct font_desc {
int idx;
const char *name;
- int width, height;
+ unsigned int width, height;
const void *data;
int pref;
};
--
2.25.1

2020-10-28 20:09:42

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 1/5] fbdev/atafb: Remove unused extern variables

On Tue, Oct 27, 2020 at 12:31:08PM -0400, Peilin Ye wrote:
> Remove 6 unused extern variables to reduce confusion. It is worth
> mentioning that lib/fonts/font_8x8.c and lib/fonts/font_8x16.c also
> declare `fontdata_8x8` and `fontdata_8x16` respectively, and this file
> has nothing to do with them.
>
> Signed-off-by: Peilin Ye <[email protected]>

This was unused ever since this driver was merged into 2.1.67 (I looked at
historical linux git trees quickly). Save to delete I'd say, probably just
copypasted from some outdated driver template that was even older.

Applied to drm-misc-next.
-Daniel
> ---
> $ # Build-tested (Ubuntu 20.04)
> $ sudo apt install gcc-m68k-linux-gnu
> $ cp arch/m68k/configs/atari_defconfig .config
> $ make ARCH=m68k menuconfig
> $ make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- -j`nproc` all
>
> drivers/video/fbdev/atafb.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
> index f253daa05d9d..e3812a8ff55a 100644
> --- a/drivers/video/fbdev/atafb.c
> +++ b/drivers/video/fbdev/atafb.c
> @@ -240,14 +240,6 @@ static int *MV300_reg = MV300_reg_8bit;
>
> static int inverse;
>
> -extern int fontheight_8x8;
> -extern int fontwidth_8x8;
> -extern unsigned char fontdata_8x8[];
> -
> -extern int fontheight_8x16;
> -extern int fontwidth_8x16;
> -extern unsigned char fontdata_8x16[];
> -
> /*
> * struct fb_ops {
> * * open/release and usage marking
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-10-28 20:16:21

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 2/5] Fonts: Make font size unsigned in font_desc

On Tue, Oct 27, 2020 at 12:33:05PM -0400, Peilin Ye wrote:
> It is improper to define `width` and `height` as signed in `struct
> font_desc`. Make them unsigned. Also, change the corresponding printk()
> format identifiers from `%d` to `%u`, in sti_select_fbfont().
>
> Signed-off-by: Peilin Ye <[email protected]>

I'm not entirely sure of the motivation here ... height/width should never
ever be even close to the limit here. Or have you seen integer math that
could potentially go wrong if we go with unsigned instead of int?
-Daniel

> ---
> Build-tested.
>
> drivers/video/console/sticore.c | 2 +-
> include/linux/font.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
> index 6a26a364f9bd..d1bb5915082b 100644
> --- a/drivers/video/console/sticore.c
> +++ b/drivers/video/console/sticore.c
> @@ -502,7 +502,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
> if (!fbfont)
> return NULL;
>
> - pr_info("STI selected %dx%d framebuffer font %s for sticon\n",
> + pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
> fbfont->width, fbfont->height, fbfont->name);
>
> bpc = ((fbfont->width+7)/8) * fbfont->height;
> diff --git a/include/linux/font.h b/include/linux/font.h
> index b5b312c19e46..4f50d736ea72 100644
> --- a/include/linux/font.h
> +++ b/include/linux/font.h
> @@ -16,7 +16,7 @@
> struct font_desc {
> int idx;
> const char *name;
> - int width, height;
> + unsigned int width, height;
> const void *data;
> int pref;
> };
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-10-28 23:44:11

by Peilin Ye

[permalink] [raw]
Subject: Re: [PATCH 2/5] Fonts: Make font size unsigned in font_desc

On Wed, Oct 28, 2020 at 09:18:44AM +0100, Daniel Vetter wrote:
> On Wed, Oct 28, 2020 at 01:43:07AM -0400, Peilin Ye wrote:
> > On Tue, Oct 27, 2020 at 07:50:58PM +0100, Daniel Vetter wrote:
> > > On Tue, Oct 27, 2020 at 12:33:05PM -0400, Peilin Ye wrote:
> > > > It is improper to define `width` and `height` as signed in `struct
> > > > font_desc`. Make them unsigned. Also, change the corresponding printk()
> > > > format identifiers from `%d` to `%u`, in sti_select_fbfont().
> > > >
> > > > Signed-off-by: Peilin Ye <[email protected]>
> > >
> > > I'm not entirely sure of the motivation here ... height/width should never
> > > ever be even close to the limit here. Or have you seen integer math that
> > > could potentially go wrong if we go with unsigned instead of int?
> >
> > Oh... No, I have not. I just thought we shouldn't represent a length
> > using a signed value. Also, width and height in console_font are
> > unsigned int - that shouldn't matter that much though.
>
> Oh this is actually a good reason, since that's the uapi structure. And so
> using the exact same signedness should help a bit with accidental casting
> bugs.
>
> If you mention this in the commit message I think this is good to go.

Ah, I see, v2 on the way. Please ignore [v2 3/5], that doesn't hunk with
this patch in effect...

One newbie question, should I mention in the commit message, if a patch
depends on another patch in the series in order to hunk properly?

Peilin

2020-10-29 00:57:52

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH 1/5] fbdev/atafb: Remove unused extern variables



Am 27.10.20 um 17:31 schrieb Peilin Ye:
> Remove 6 unused extern variables to reduce confusion. It is worth
> mentioning that lib/fonts/font_8x8.c and lib/fonts/font_8x16.c also
> declare `fontdata_8x8` and `fontdata_8x16` respectively, and this file
> has nothing to do with them.
>
> Signed-off-by: Peilin Ye <[email protected]>

Acked-by: Thomas Zimmermann <[email protected]>

> ---
> $ # Build-tested (Ubuntu 20.04)
> $ sudo apt install gcc-m68k-linux-gnu
> $ cp arch/m68k/configs/atari_defconfig .config
> $ make ARCH=m68k menuconfig
> $ make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- -j`nproc` all
>
> drivers/video/fbdev/atafb.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
> index f253daa05d9d..e3812a8ff55a 100644
> --- a/drivers/video/fbdev/atafb.c
> +++ b/drivers/video/fbdev/atafb.c
> @@ -240,14 +240,6 @@ static int *MV300_reg = MV300_reg_8bit;
>
> static int inverse;
>
> -extern int fontheight_8x8;
> -extern int fontwidth_8x8;
> -extern unsigned char fontdata_8x8[];
> -
> -extern int fontheight_8x16;
> -extern int fontwidth_8x16;
> -extern unsigned char fontdata_8x16[];
> -
> /*
> * struct fb_ops {
> * * open/release and usage marking
>

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

2020-10-29 00:58:17

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 1/5] fbdev/atafb: Remove unused extern variables

On Tue, Oct 27, 2020 at 6:12 PM Peilin Ye <[email protected]> wrote:
> Remove 6 unused extern variables to reduce confusion. It is worth
> mentioning that lib/fonts/font_8x8.c and lib/fonts/font_8x16.c also
> declare `fontdata_8x8` and `fontdata_8x16` respectively, and this file
> has nothing to do with them.
>
> Signed-off-by: Peilin Ye <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2020-10-29 07:36:55

by Peilin Ye

[permalink] [raw]
Subject: [PATCH v2 2/5] Fonts: Make font size unsigned in font_desc

`width` and `height` are defined as unsigned in our UAPI font descriptor
`struct console_font`. Make them unsigned in our kernel font descriptor
`struct font_desc`, too.

Also, change the corresponding printk() format identifiers from `%d` to
`%u`, in sti_select_fbfont().

Signed-off-by: Peilin Ye <[email protected]>
---
Change in v2:
- Mention `struct console_font` in the commit message. (Suggested by
Daniel Vetter <[email protected]>)

drivers/video/console/sticore.c | 2 +-
include/linux/font.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 6a26a364f9bd..d1bb5915082b 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -502,7 +502,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
if (!fbfont)
return NULL;

- pr_info("STI selected %dx%d framebuffer font %s for sticon\n",
+ pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
fbfont->width, fbfont->height, fbfont->name);

bpc = ((fbfont->width+7)/8) * fbfont->height;
diff --git a/include/linux/font.h b/include/linux/font.h
index b5b312c19e46..4f50d736ea72 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -16,7 +16,7 @@
struct font_desc {
int idx;
const char *name;
- int width, height;
+ unsigned int width, height;
const void *data;
int pref;
};
--
2.25.1

2020-10-29 08:46:49

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 2/5] Fonts: Make font size unsigned in font_desc

On Wed, Oct 28, 2020 at 06:56:47AM -0400, Peilin Ye wrote:
> `width` and `height` are defined as unsigned in our UAPI font descriptor
> `struct console_font`. Make them unsigned in our kernel font descriptor
> `struct font_desc`, too.
>
> Also, change the corresponding printk() format identifiers from `%d` to
> `%u`, in sti_select_fbfont().
>
> Signed-off-by: Peilin Ye <[email protected]>

Pushed to drm-misc-next, thanks for the patch.
-Daniel

> ---
> Change in v2:
> - Mention `struct console_font` in the commit message. (Suggested by
> Daniel Vetter <[email protected]>)
>
> drivers/video/console/sticore.c | 2 +-
> include/linux/font.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
> index 6a26a364f9bd..d1bb5915082b 100644
> --- a/drivers/video/console/sticore.c
> +++ b/drivers/video/console/sticore.c
> @@ -502,7 +502,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
> if (!fbfont)
> return NULL;
>
> - pr_info("STI selected %dx%d framebuffer font %s for sticon\n",
> + pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
> fbfont->width, fbfont->height, fbfont->name);
>
> bpc = ((fbfont->width+7)/8) * fbfont->height;
> diff --git a/include/linux/font.h b/include/linux/font.h
> index b5b312c19e46..4f50d736ea72 100644
> --- a/include/linux/font.h
> +++ b/include/linux/font.h
> @@ -16,7 +16,7 @@
> struct font_desc {
> int idx;
> const char *name;
> - int width, height;
> + unsigned int width, height;
> const void *data;
> int pref;
> };
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-10-29 08:53:52

by Peilin Ye

[permalink] [raw]
Subject: Re: [PATCH 2/5] Fonts: Make font size unsigned in font_desc

On Tue, Oct 27, 2020 at 07:50:58PM +0100, Daniel Vetter wrote:
> On Tue, Oct 27, 2020 at 12:33:05PM -0400, Peilin Ye wrote:
> > It is improper to define `width` and `height` as signed in `struct
> > font_desc`. Make them unsigned. Also, change the corresponding printk()
> > format identifiers from `%d` to `%u`, in sti_select_fbfont().
> >
> > Signed-off-by: Peilin Ye <[email protected]>
>
> I'm not entirely sure of the motivation here ... height/width should never
> ever be even close to the limit here. Or have you seen integer math that
> could potentially go wrong if we go with unsigned instead of int?

Oh... No, I have not. I just thought we shouldn't represent a length
using a signed value. Also, width and height in console_font are
unsigned int - that shouldn't matter that much though.

[3/5] doesn't hunk properly without this patch, I'll send a v2 for [3/5]
soon.

Peilin

2020-10-29 10:00:21

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 2/5] Fonts: Make font size unsigned in font_desc

On Wed, Oct 28, 2020 at 01:43:07AM -0400, Peilin Ye wrote:
> On Tue, Oct 27, 2020 at 07:50:58PM +0100, Daniel Vetter wrote:
> > On Tue, Oct 27, 2020 at 12:33:05PM -0400, Peilin Ye wrote:
> > > It is improper to define `width` and `height` as signed in `struct
> > > font_desc`. Make them unsigned. Also, change the corresponding printk()
> > > format identifiers from `%d` to `%u`, in sti_select_fbfont().
> > >
> > > Signed-off-by: Peilin Ye <[email protected]>
> >
> > I'm not entirely sure of the motivation here ... height/width should never
> > ever be even close to the limit here. Or have you seen integer math that
> > could potentially go wrong if we go with unsigned instead of int?
>
> Oh... No, I have not. I just thought we shouldn't represent a length
> using a signed value. Also, width and height in console_font are
> unsigned int - that shouldn't matter that much though.

Oh this is actually a good reason, since that's the uapi structure. And so
using the exact same signedness should help a bit with accidental casting
bugs.

If you mention this in the commit message I think this is good to go.
-Daniel

>
> [3/5] doesn't hunk properly without this patch, I'll send a v2 for [3/5]
> soon.
>
> Peilin
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-11-02 15:05:39

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 0/5] Preparation work for using font_desc in vc_data

On Tue, Oct 27, 2020 at 12:27:35PM -0400, Peilin Ye wrote:
> Hi Daniel, Hi Greg, Hi all,
>
> We are planning to use `font_desc` instead of `console_font` in `vc_data`,
> and this is just some prep work for it. It doesn't do much, but at least
> it removes two "FIXME"s in fbcon.c :)

Btw nitpeek on how you submit patches: The threading you're using here is
"deep" i.e. every patch is reply to the previous patch. The usual thing
is flat, i.e. all patches are replies to the cover letter.

I think only very old versions of git had the former as a default, so not
sure what's going on. But the deep threading makes piecing the
conversation together quite a bit harder, at least here in mutt.
-Daniel


>
> Peilin Ye (5):
> [1/5] fbdev/atafb: Remove unused extern variables
>
> Searching for `fontdata` gave me this in fbdev/atafb.c:
>
> extern unsigned char fontdata_8x8[];
> extern unsigned char fontdata_8x16[];
>
> ...which freaked me out, since in 6735b4632def ("Fonts: Support
> FONT_EXTRA_WORDS macros for built-in fonts") I changed them from char
> arrays to structures, in lib/fonts/. Fortunately it turns out these
> extern variables have nothing to do with lib/fonts/, and are not being
> used anywhere, so remove them for less confusion.
>
> m68k cross-compiled.
>
> [2/5] Fonts: Make font size unsigned in font_desc
>
> Our goal is to use `font_desc` "everywhere" in the kernel, and signed
> `width` and `height` is inappropriate.
>
> Also, change some printk() format identifiers in console/sticore.c from
> `%d` to `%u`. parisc cross-compiled.
>
> [3/5] Fonts: Add charcount field to font_desc
>
> Add `unsigned int charcount` to `font_desc`, and update each of our 13
> built-in fonts.
>
> [4/5] fbcon: Avoid hard-coding built-in font charcount
> [5/5] parisc/sticore: Avoid hard-coding built-in font charcount
>
> Everyone (tty, fbcon, sticore, etc.) is assuming that all built-in fonts
> have 256 characters, and is using hard-coded 256 or 255 everywhere.
> These two patches removes some of them. [5/5] is parisc cross-compiled.
>
> Now is a good time to review all find_font() and get_default_font()
> callers:
>
> drivers/media/pci/solo6x10/solo6x10-enc.c 133 const struct font_desc *vga = find_font("VGA8x16");
> drivers/media/test-drivers/vimc/vimc-core.c 268 const struct font_desc *font = find_font("VGA8x16");
> drivers/media/test-drivers/vivid/vivid-core.c 1928 const struct font_desc *font = find_font("VGA8x16");
> drivers/usb/misc/sisusbvga/sisusb.c 2285 myfont = find_font("VGA8x16");
> * These 4 only care about font VGA8x16, so let them be for now;
>
> drivers/video/console/sticore.c 499 fbfont = find_font(fbfont_name);
> drivers/video/console/sticore.c 501 fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0);
> * Uses 255 and 256, (hopefully) cleaned up by [5/5];
>
> drivers/video/fbdev/core/fbcon.c 999 if (!fontname[0] || !(font = find_font(fontname)))
> drivers/video/fbdev/core/fbcon.c 1000 font = get_default_font(info->var.xres,
> drivers/video/fbdev/core/fbcon.c 1078 if (!fontname[0] || !(font = find_font(fontname)))
> drivers/video/fbdev/core/fbcon.c 1079 font = get_default_font(info->var.xres,
> * Use 256, cleaned up by [4/5];
>
> drivers/video/fbdev/core/fbcon.c 2548 else if (!(f = find_font(name)))
> drivers/video/fbdev/core/fbcon.c 2546 f = get_default_font(info->var.xres, info->var.yres,
> * Uses 256 but no easy fix. I'll clean this up after making
> fbcon_do_set_font() pass a `font_desc` as parameter;
>
> drivers/firmware/efi/earlycon.c 234 font = get_default_font(xres, yres, -1, -1);
> * Does not care about charcount.
>
> Thank you!
> Peilin Ye
>
> drivers/video/console/sticore.c | 10 +++++-----
> drivers/video/fbdev/atafb.c | 8 --------
> drivers/video/fbdev/core/fbcon.c | 5 ++---
> include/linux/font.h | 3 ++-
> lib/fonts/font_10x18.c | 1 +
> lib/fonts/font_6x10.c | 1 +
> lib/fonts/font_6x11.c | 1 +
> lib/fonts/font_6x8.c | 1 +
> lib/fonts/font_7x14.c | 1 +
> lib/fonts/font_8x16.c | 1 +
> lib/fonts/font_8x8.c | 1 +
> lib/fonts/font_acorn_8x8.c | 1 +
> lib/fonts/font_mini_4x6.c | 1 +
> lib/fonts/font_pearl_8x8.c | 1 +
> lib/fonts/font_sun12x22.c | 1 +
> lib/fonts/font_sun8x16.c | 1 +
> lib/fonts/font_ter16x32.c | 1 +
> 17 files changed, 22 insertions(+), 17 deletions(-)
>
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch