From: Peilin Ye <yepeilin.cs@gmail.com> To: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>, Helge Deller <deller@gmx.de>, linux-parisc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye <yepeilin.cs@gmail.com> Subject: [PATCH v3 4/5] parisc/sticore: Avoid hard-coding built-in font charcount Date: Thu, 12 Nov 2020 07:14:21 -0500 [thread overview] Message-ID: <037186fb50cf3d17bb7bc9482357635b9df6076e.1605169912.git.yepeilin.cs@gmail.com> (raw) In-Reply-To: <cover.1605169912.git.yepeilin.cs@gmail.com> sti_select_fbfont() and sti_cook_fonts() are hard-coding the number of characters of our built-in fonts as 256. Recently, we included that information in our kernel font descriptor `struct font_desc`, so use `fbfont->charcount` instead of hard-coded values. Depends on patch "Fonts: Add charcount field to font_desc". Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- v2: https://lore.kernel.org/lkml/c38042bbf5c9777c84900d56c09f3c156b32af48.1603788512.git.yepeilin.cs@gmail.com/ Changes since v1: - Slightly improved commit message. - Rebased onto linux-next. drivers/video/console/sticore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index d1bb5915082b..f869b723494f 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -506,7 +506,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) fbfont->width, fbfont->height, fbfont->name); bpc = ((fbfont->width+7)/8) * fbfont->height; - size = bpc * 256; + size = bpc * fbfont->charcount; size += sizeof(struct sti_rom_font); nf = kzalloc(size, STI_LOWMEM); @@ -514,7 +514,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) return NULL; nf->first_char = 0; - nf->last_char = 255; + nf->last_char = fbfont->charcount - 1; nf->width = fbfont->width; nf->height = fbfont->height; nf->font_type = STI_FONT_HPROMAN8; @@ -525,7 +525,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) dest = nf; dest += sizeof(struct sti_rom_font); - memcpy(dest, fbfont->data, bpc*256); + memcpy(dest, fbfont->data, bpc * fbfont->charcount); cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); if (!cooked_font) { @@ -660,7 +660,7 @@ static int sti_cook_fonts(struct sti_cooked_rom *cooked_rom, void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f) { unsigned char *n, *p, *q; - int size = f->raw->bytes_per_char * 256 + sizeof(struct sti_rom_font); + int size = f->raw->bytes_per_char * (f->raw->last_char + 1) + sizeof(struct sti_rom_font); struct sti_rom_font *old_font; if (sti->wordmode) -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Peilin Ye <yepeilin.cs@gmail.com> To: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: linux-fbdev@vger.kernel.org, linux-parisc@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Helge Deller <deller@gmx.de>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>, Peilin Ye <yepeilin.cs@gmail.com> Subject: [PATCH v3 4/5] parisc/sticore: Avoid hard-coding built-in font charcount Date: Thu, 12 Nov 2020 07:14:21 -0500 [thread overview] Message-ID: <037186fb50cf3d17bb7bc9482357635b9df6076e.1605169912.git.yepeilin.cs@gmail.com> (raw) In-Reply-To: <cover.1605169912.git.yepeilin.cs@gmail.com> sti_select_fbfont() and sti_cook_fonts() are hard-coding the number of characters of our built-in fonts as 256. Recently, we included that information in our kernel font descriptor `struct font_desc`, so use `fbfont->charcount` instead of hard-coded values. Depends on patch "Fonts: Add charcount field to font_desc". Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- v2: https://lore.kernel.org/lkml/c38042bbf5c9777c84900d56c09f3c156b32af48.1603788512.git.yepeilin.cs@gmail.com/ Changes since v1: - Slightly improved commit message. - Rebased onto linux-next. drivers/video/console/sticore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index d1bb5915082b..f869b723494f 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -506,7 +506,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) fbfont->width, fbfont->height, fbfont->name); bpc = ((fbfont->width+7)/8) * fbfont->height; - size = bpc * 256; + size = bpc * fbfont->charcount; size += sizeof(struct sti_rom_font); nf = kzalloc(size, STI_LOWMEM); @@ -514,7 +514,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) return NULL; nf->first_char = 0; - nf->last_char = 255; + nf->last_char = fbfont->charcount - 1; nf->width = fbfont->width; nf->height = fbfont->height; nf->font_type = STI_FONT_HPROMAN8; @@ -525,7 +525,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) dest = nf; dest += sizeof(struct sti_rom_font); - memcpy(dest, fbfont->data, bpc*256); + memcpy(dest, fbfont->data, bpc * fbfont->charcount); cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); if (!cooked_font) { @@ -660,7 +660,7 @@ static int sti_cook_fonts(struct sti_cooked_rom *cooked_rom, void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f) { unsigned char *n, *p, *q; - int size = f->raw->bytes_per_char * 256 + sizeof(struct sti_rom_font); + int size = f->raw->bytes_per_char * (f->raw->last_char + 1) + sizeof(struct sti_rom_font); struct sti_rom_font *old_font; if (sti->wordmode) -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-11-12 12:14 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-12 12:02 [PATCH v3 0/5] console: Miscellaneous clean-ups, do not use FNTCHARCNT() in fbcon.c Peilin Ye 2020-11-12 12:02 ` Peilin Ye 2020-11-12 12:04 ` [PATCH 1/5] console: Delete unused con_font_copy() callback implementations Peilin Ye 2020-11-12 12:04 ` Peilin Ye 2020-11-12 12:11 ` [PATCH v3 2/5] console: Delete dummy con_font_set() and con_font_default() " Peilin Ye 2020-11-12 12:11 ` Peilin Ye 2020-11-12 12:13 ` [PATCH v3 3/5] Fonts: Add charcount field to font_desc Peilin Ye 2020-11-12 12:13 ` Peilin Ye 2020-11-12 12:14 ` Peilin Ye [this message] 2020-11-12 12:14 ` [PATCH v3 4/5] parisc/sticore: Avoid hard-coding built-in font charcount Peilin Ye 2020-11-12 12:15 ` [PATCH v3 RFC 5/5] fbcon: Avoid using FNTCHARCNT() and hard-coded " Peilin Ye 2020-11-12 12:15 ` Peilin Ye 2020-11-13 21:16 ` [PATCH v3 0/5] console: Miscellaneous clean-ups, do not use FNTCHARCNT() in fbcon.c Daniel Vetter 2020-11-13 21:16 ` Daniel Vetter 2020-11-13 22:47 ` Greg Kroah-Hartman 2020-11-13 22:47 ` Greg Kroah-Hartman 2020-11-14 8:10 ` Peilin Ye 2020-11-14 8:10 ` Peilin Ye 2020-11-14 12:18 ` Greg Kroah-Hartman 2020-11-14 12:18 ` Greg Kroah-Hartman 2020-11-14 12:22 ` Greg Kroah-Hartman 2020-11-14 12:22 ` Greg Kroah-Hartman 2020-11-14 12:47 ` Peilin Ye 2020-11-14 12:47 ` Peilin Ye 2020-11-16 10:09 ` Daniel Vetter 2020-11-16 10:09 ` Daniel Vetter 2020-11-17 6:21 ` Peilin Ye 2020-11-17 6:21 ` Peilin Ye 2020-11-19 8:32 ` Peilin Ye 2020-11-19 8:32 ` Peilin Ye 2020-11-19 15:10 ` Daniel Vetter 2020-11-19 15:10 ` Daniel Vetter 2020-11-20 8:37 ` Peilin Ye 2020-11-20 8:37 ` Peilin Ye 2020-11-16 15:33 ` Daniel Vetter 2020-11-16 15:33 ` Daniel Vetter
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=037186fb50cf3d17bb7bc9482357635b9df6076e.1605169912.git.yepeilin.cs@gmail.com \ --to=yepeilin.cs@gmail.com \ --cc=James.Bottomley@HansenPartnership.com \ --cc=daniel.vetter@ffwll.ch \ --cc=deller@gmx.de \ --cc=dri-devel@lists.freedesktop.org \ --cc=gregkh@linuxfoundation.org \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-parisc@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.