From patchwork Thu Nov 12 12:13:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 11899891 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A78A697 for ; Thu, 12 Nov 2020 12:14:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 098CA22227 for ; Thu, 12 Nov 2020 12:14:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LiCAKIXo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbgKLMOL (ORCPT ); Thu, 12 Nov 2020 07:14:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727646AbgKLMOL (ORCPT ); Thu, 12 Nov 2020 07:14:11 -0500 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5840C0613D1; Thu, 12 Nov 2020 04:14:09 -0800 (PST) Received: by mail-pl1-x642.google.com with SMTP id g11so2668511pll.13; Thu, 12 Nov 2020 04:14:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qI9FK/WV51uzQ+5U+ONFL1fdnGeKCbg3gawqygIR1rw=; b=LiCAKIXoQ/iIwwnWehfp70HaCZr7hqUs5nQurinaasuuQkf5shQk2yCWppH8DeypON FzjE8L9P9rmFDKm0sxcmuuMRBV6goxWjSJMk4AXeNaCAjqGl1MYPH81SgieJGYWE336i iLgXInHsw+34YgQ8Zqr/BlP5QQ3USAvuNR32SJgYj1dIWft9aXiddAZ+6VPl+CZEPk3g ZfUochzcS6e4jOYFecwZ0z3c+q/WgoiynQA7Ooo8DXSXjnPXcHducT25lhexyv9jRv6o zObOThTte/W3XhNeOXUgFxealnGRNjSg/1Q5DCjA/kK14X1rWf9WlkUdo4SRKOUq44KP eNAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qI9FK/WV51uzQ+5U+ONFL1fdnGeKCbg3gawqygIR1rw=; b=GDBbq095NKyZZ97jwtZKg+AwApRkF22GjJklPGBrWdtAnFwLFzxKrCioDa6gNSOtDp h2okTHXVwvcRlqYWdAm9VXIolPky2Ma9w80wSIa4hGn/knlUSamkN03/dzggg/K/OGlW dIk7WKGlM/hLjZ1v2PV0dZmw8yQvxk3UZ6Cp+BfOvfQf83rBOn7fzQ6C0YG4DcSPiaE/ nF+6k6v0dRVJCx9dVE8mPd4MFk7jYTFxj8UOpaB/gpWcEK3sGs6RRdCRJMz04+Qxm8RS rzrIb50hD0qaiXQ2fteVOgFlF8+DpeGB5HrDx7360tm3Wu3gRiJ98XU5rGj9QutrfoGz Y3pw== X-Gm-Message-State: AOAM5339aPwuccgrJi5MD3INvpIhITPpzwvsvoxXgMJrO9OtZei+3Fy7 pC0NihGjdOmNJggzxZa3sw== X-Google-Smtp-Source: ABdhPJzxKGVRreaxt+hicCEYOLKxX4XkRjA1eKqizBS4+nlzy24IRoAfLir/N/deiS8Yr2k49PvPyQ== X-Received: by 2002:a17:902:7c16:b029:d8:ac5d:3e9c with SMTP id x22-20020a1709027c16b02900d8ac5d3e9cmr12467169pll.68.1605183247901; Thu, 12 Nov 2020 04:14:07 -0800 (PST) Received: from localhost.localdomain ([221.124.243.27]) by smtp.gmail.com with ESMTPSA id a20sm6062637pff.118.2020.11.12.04.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 04:14:07 -0800 (PST) From: Peilin Ye To: Daniel Vetter Cc: Greg Kroah-Hartman , "James E . J . Bottomley" , Helge Deller , Jiri Slaby , Tetsuo Handa , Bartlomiej Zolnierkiewicz , linux-parisc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye Subject: [PATCH v3 3/5] Fonts: Add charcount field to font_desc Date: Thu, 12 Nov 2020 07:13:34 -0500 Message-Id: <65952296d1d9486093bd955d1536f7dcd11112c6.1605169912.git.yepeilin.cs@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Subsystems are hard-coding the number of characters of our built-in fonts as 256. Include that information in our kernel font descriptor, `struct font_desc`. Signed-off-by: Peilin Ye Reviewed-by: Daniel Vetter --- v2: https://lore.kernel.org/lkml/20201028060533.1206307-1-yepeilin.cs@gmail.com/ Change in v3: - Rebase onto linux-next. Change in v2: - Rebase onto 5.10-rc1. include/linux/font.h | 1 + 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 + 14 files changed, 14 insertions(+) diff --git a/include/linux/font.h b/include/linux/font.h index 4f50d736ea72..abf1442ce719 100644 --- a/include/linux/font.h +++ b/include/linux/font.h @@ -17,6 +17,7 @@ struct font_desc { int idx; const char *name; unsigned int width, height; + unsigned int charcount; const void *data; int pref; }; diff --git a/lib/fonts/font_10x18.c b/lib/fonts/font_10x18.c index e02f9df24d1e..5d940db626e7 100644 --- a/lib/fonts/font_10x18.c +++ b/lib/fonts/font_10x18.c @@ -5137,6 +5137,7 @@ const struct font_desc font_10x18 = { .name = "10x18", .width = 10, .height = 18, + .charcount = 256, .data = fontdata_10x18.data, #ifdef __sparc__ .pref = 5, diff --git a/lib/fonts/font_6x10.c b/lib/fonts/font_6x10.c index 6e3c4b7691c8..e65df019e0d2 100644 --- a/lib/fonts/font_6x10.c +++ b/lib/fonts/font_6x10.c @@ -3083,6 +3083,7 @@ const struct font_desc font_6x10 = { .name = "6x10", .width = 6, .height = 10, + .charcount = 256, .data = fontdata_6x10.data, .pref = 0, }; diff --git a/lib/fonts/font_6x11.c b/lib/fonts/font_6x11.c index 2d22a24e816f..bd76b3f6b635 100644 --- a/lib/fonts/font_6x11.c +++ b/lib/fonts/font_6x11.c @@ -3346,6 +3346,7 @@ const struct font_desc font_vga_6x11 = { .name = "ProFont6x11", .width = 6, .height = 11, + .charcount = 256, .data = fontdata_6x11.data, /* Try avoiding this font if possible unless on MAC */ .pref = -2000, diff --git a/lib/fonts/font_6x8.c b/lib/fonts/font_6x8.c index e7442a0d183d..06ace7792521 100644 --- a/lib/fonts/font_6x8.c +++ b/lib/fonts/font_6x8.c @@ -2571,6 +2571,7 @@ const struct font_desc font_6x8 = { .name = "6x8", .width = 6, .height = 8, + .charcount = 256, .data = fontdata_6x8.data, .pref = 0, }; diff --git a/lib/fonts/font_7x14.c b/lib/fonts/font_7x14.c index 9cc7ae2e03f7..a2f561c9fa04 100644 --- a/lib/fonts/font_7x14.c +++ b/lib/fonts/font_7x14.c @@ -4113,6 +4113,7 @@ const struct font_desc font_7x14 = { .name = "7x14", .width = 7, .height = 14, + .charcount = 256, .data = fontdata_7x14.data, .pref = 0, }; diff --git a/lib/fonts/font_8x16.c b/lib/fonts/font_8x16.c index bab25dc59e8d..06ae14088514 100644 --- a/lib/fonts/font_8x16.c +++ b/lib/fonts/font_8x16.c @@ -4627,6 +4627,7 @@ const struct font_desc font_vga_8x16 = { .name = "VGA8x16", .width = 8, .height = 16, + .charcount = 256, .data = fontdata_8x16.data, .pref = 0, }; diff --git a/lib/fonts/font_8x8.c b/lib/fonts/font_8x8.c index 109d0572368f..69570b8c31af 100644 --- a/lib/fonts/font_8x8.c +++ b/lib/fonts/font_8x8.c @@ -2578,6 +2578,7 @@ const struct font_desc font_vga_8x8 = { .name = "VGA8x8", .width = 8, .height = 8, + .charcount = 256, .data = fontdata_8x8.data, .pref = 0, }; diff --git a/lib/fonts/font_acorn_8x8.c b/lib/fonts/font_acorn_8x8.c index fb395f0d4031..18755c33d249 100644 --- a/lib/fonts/font_acorn_8x8.c +++ b/lib/fonts/font_acorn_8x8.c @@ -270,6 +270,7 @@ const struct font_desc font_acorn_8x8 = { .name = "Acorn8x8", .width = 8, .height = 8, + .charcount = 256, .data = acorndata_8x8.data, #ifdef CONFIG_ARCH_ACORN .pref = 20, diff --git a/lib/fonts/font_mini_4x6.c b/lib/fonts/font_mini_4x6.c index 592774a90917..8d39fd447952 100644 --- a/lib/fonts/font_mini_4x6.c +++ b/lib/fonts/font_mini_4x6.c @@ -2152,6 +2152,7 @@ const struct font_desc font_mini_4x6 = { .name = "MINI4x6", .width = 4, .height = 6, + .charcount = 256, .data = fontdata_mini_4x6.data, .pref = 3, }; diff --git a/lib/fonts/font_pearl_8x8.c b/lib/fonts/font_pearl_8x8.c index a6f95ebce950..b1678ed0017c 100644 --- a/lib/fonts/font_pearl_8x8.c +++ b/lib/fonts/font_pearl_8x8.c @@ -2582,6 +2582,7 @@ const struct font_desc font_pearl_8x8 = { .name = "PEARL8x8", .width = 8, .height = 8, + .charcount = 256, .data = fontdata_pearl8x8.data, .pref = 2, }; diff --git a/lib/fonts/font_sun12x22.c b/lib/fonts/font_sun12x22.c index a5b65bd49604..91daf5ab8b6b 100644 --- a/lib/fonts/font_sun12x22.c +++ b/lib/fonts/font_sun12x22.c @@ -6156,6 +6156,7 @@ const struct font_desc font_sun_12x22 = { .name = "SUN12x22", .width = 12, .height = 22, + .charcount = 256, .data = fontdata_sun12x22.data, #ifdef __sparc__ .pref = 5, diff --git a/lib/fonts/font_sun8x16.c b/lib/fonts/font_sun8x16.c index e577e76a6a7c..81bb4eeae04e 100644 --- a/lib/fonts/font_sun8x16.c +++ b/lib/fonts/font_sun8x16.c @@ -268,6 +268,7 @@ const struct font_desc font_sun_8x16 = { .name = "SUN8x16", .width = 8, .height = 16, + .charcount = 256, .data = fontdata_sun8x16.data, #ifdef __sparc__ .pref = 10, diff --git a/lib/fonts/font_ter16x32.c b/lib/fonts/font_ter16x32.c index f7c3abb6b99e..1955d624177c 100644 --- a/lib/fonts/font_ter16x32.c +++ b/lib/fonts/font_ter16x32.c @@ -2062,6 +2062,7 @@ const struct font_desc font_ter_16x32 = { .name = "TER16x32", .width = 16, .height = 32, + .charcount = 256, .data = fontdata_ter16x32.data, #ifdef __sparc__ .pref = 5, From patchwork Thu Nov 12 12:14:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 11899895 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4832D697 for ; Thu, 12 Nov 2020 12:14:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2657D22228 for ; Thu, 12 Nov 2020 12:14:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VAmHGapX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727611AbgKLMO6 (ORCPT ); Thu, 12 Nov 2020 07:14:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727223AbgKLMO6 (ORCPT ); Thu, 12 Nov 2020 07:14:58 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B722C0613D1; Thu, 12 Nov 2020 04:14:58 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id f27so4039369pgl.1; Thu, 12 Nov 2020 04:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ji+otFl/WkNW1j02CrZ/ivgsssCDblUPej71NkGlu3o=; b=VAmHGapXMocqcjRZS1SlTPSyIL91R0FKwosP3HJ0EzX8ZCW0Vapjr+mTSHwWi4H2Hx nmYgcEsRbatUB9qIPOrObI7lrBsImUMUhbDgb2sSa8pBgzMK7qC4jlKXSgfdpv2p9Vvt CaLjIjo84AOJyk4jquop1y0edQUm4GdzLOz+QckbMb2Gw8mK9E/HJ6bOzPJyjTlXeE6H 3yd7+KsSn8tw56tLESaCPsBWWOSTwuwfQljPyzY3QCpASQZzE423pBVzFQZNI/dpcprB 0XPgfxSNR8KWyrdssDM2HF03+n7wSmJDrGy8M/bPuXQLPPBIID8ctqRlOCMQJoXYrxP6 8hpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ji+otFl/WkNW1j02CrZ/ivgsssCDblUPej71NkGlu3o=; b=V5y0w1lIlF7FvblJTCAFcxSTF7lOGEoziWCna/BokjD+l8Kw7EjNoLQGbEB/9VQijz Yw0XCjQ+CKYWCd82HK0qlLJ7f6woIlie27JhKiDlE7Q+hcl+0B7gSw4/u6yOGRDKGCsX bu9hioYJs6muvsdjpw1kz4c+lPGoVm8gdCpOJUC8q22DvhEkW+mpryQZNHwvgE2FTCHq huioRbktgt5J1eHRt4cCaSEYL9Skdpvl6DFC+Ms79fmybX/tg6LCvqhcqA/a9Uy8LDf2 ERSjdxNTF/MmNYSRFwjdr7TM2SikqiOheUI8GQag2Kq/3g2dBHl48fJ5/U90Ohj276it UZHQ== X-Gm-Message-State: AOAM530JVG7gwYj6acpyaBcd+y/LciZWdlx7eABqjcVe8cOF2AmphHrf MT4+4TcAZdilpNFheuRB22r8U56f3SMNa3g= X-Google-Smtp-Source: ABdhPJyxx19WWls1VMlKeNllLZ/re1JCrpPUArBW0x9CN4NVZKyR+t+YJw14Unb5U6Oq00zSvevmAg== X-Received: by 2002:a17:90a:4a0f:: with SMTP id e15mr8953328pjh.182.1605183297641; Thu, 12 Nov 2020 04:14:57 -0800 (PST) Received: from localhost.localdomain ([221.124.243.27]) by smtp.gmail.com with ESMTPSA id d145sm6785736pfd.136.2020.11.12.04.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 04:14:57 -0800 (PST) From: Peilin Ye To: Daniel Vetter Cc: Greg Kroah-Hartman , "James E . J . Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye Subject: [PATCH v3 4/5] parisc/sticore: Avoid hard-coding built-in font charcount Date: Thu, 12 Nov 2020 07:14:21 -0500 Message-Id: <037186fb50cf3d17bb7bc9482357635b9df6076e.1605169912.git.yepeilin.cs@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org 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 Reviewed-by: Daniel Vetter --- 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)