Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp451608pxx; Wed, 28 Oct 2020 08:38:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHJ2M7FlMBYPGIb2pMfwoMGeSvdfX5f37OeaZuNOMl+ftDr6t2zSPA+oD2xanbn7Y9Pr4u X-Received: by 2002:aa7:cd98:: with SMTP id x24mr8120227edv.237.1603899533092; Wed, 28 Oct 2020 08:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603899533; cv=none; d=google.com; s=arc-20160816; b=hBnuz/wG2Dv7TF+NhZrXJduE2t+edBG5edkcnGTfhZSUTTqrlh3uz3iMrt50moCnOj pEz8d8FNmDS3s7n8G7uyqMoGg8mpy/FvTNQB7wY1L3U40Diz63hTBgFJ66rLPUL0Izxf WKVm6rC4iA62D/gV8T6b0wu+Re+ak7cviQODf902bxa/IC1Db6omVgqxyeMEZ1tnpuPv WK3re20jB0EY5myelf2JKgQEfTiq0VIQ3jUeTJOPEBHqcI0pgqqVcoJRQDjCP2JhpGCY rKhQJ2n4ySBGeRnfUOM5zz+pU9bdYwbw6hbCpO/wKOEWgASY0+ZzO9+Wl0dtIDfBGkEc uTMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ebBfe6g+xIwA0Tw7T7ptAhswGHI+h9atRQ+wtk5eLJM=; b=bbQuK25gagDjjPzROGvdOUhtjJuRWtGmspOrontyWWId0lwRfoW2g5onxMzPJk5DNv MOj7tSA9KBMSaq3av+xTauqvpwi/YDltuaZfnre7faD1v65sbUbzoM0tteIBd5YW72VZ jHEquuwB/JJMdCb7q7fS2Ez1YaZ6CojnT1Fu2/uY3CPofi0V/IKRSOgFs//jppa6AR9u kUZ9+uq6cZZ1IvaLtNcRsU5ot0+KN844vAcrYrHMaMN/R41Mu7nyn1m6/4/R2Uc2Tzlp LuHT54LMW4TyzSh+ceVSSP6Kj7IS7wNaTZc8qNHdJYTkp1RW7FGImcjhVIncOrxMMz1Q 5AZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vFw9A52v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si2897729edy.300.2020.10.28.08.38.31; Wed, 28 Oct 2020 08:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vFw9A52v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1811774AbgJ0QmA (ORCPT + 99 others); Tue, 27 Oct 2020 12:42:00 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:51663 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1811767AbgJ0Qlz (ORCPT ); Tue, 27 Oct 2020 12:41:55 -0400 Received: by mail-pj1-f65.google.com with SMTP id a17so1075010pju.1; Tue, 27 Oct 2020 09:41:55 -0700 (PDT) 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=ebBfe6g+xIwA0Tw7T7ptAhswGHI+h9atRQ+wtk5eLJM=; b=vFw9A52vUPt+Z6azESaiWaj6f6RnK6WmgcZfmCdqg30ygptQfXqoaWHeScuoNsMUcL LFBrxcc3UK6ZrcRlK5yMWQydC4uSY8bXOQANfqwRP1eXlykw3jV58ZyR58sIXBm+HRfy vYQZ8hSojiimEwm6a2/Jpl+5twHC88GdAmxu3wHGuRHWue5fVcJY1DPUHhnpeRigSGZc VrPVUTeS6NGaTlPe7onOvCg10lX1FXx8QdW4QCJZ8DwsAcTcxh7dq+42zHm6DOHOPN6X Fkze0CaGWSHSGRhOa+UQSIkAV+OUv4T06N/Yptxodpi2pNzEzDFOn+8yW6ly7Lth7XwK QnvQ== 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=ebBfe6g+xIwA0Tw7T7ptAhswGHI+h9atRQ+wtk5eLJM=; b=Q8Kd+sN7HomaenbnTvvS5gUMFf3tlKOGVrAj40SqMC7e70n0cqQTfR2BUuiiHo0L69 lJ0U9/Ihse+Z4ivQZ4NPKRnkLPG8lj6d+cuZQkrPQzSsF+kQWujy1BBF3dWxJcn553o+ nKJQl9i0GhEC5et+Gc6aokZw2iJy/0EkkAjSu5vZFELyOur9yNnqTRRX8uO+HQ5PMXgQ CDwZIFPmvdT9Gpn+V5QhL3fTvkTfZraqWNL64sJrA3+tpFdpFGZ6KWw0VxQUjo/au9Om ILXf4yQ008zZG5ixEld+98QLLrkbRyh0FTH+5nEmhq61twoKkaU3GhB2r0n/BbStA3b+ NHXQ== X-Gm-Message-State: AOAM531wWCmECJyFETBJcDAeOI/1Rlj8kKPVmVXRdAWrhRvZcbCiY2FN T1m7BAvWi5qL5Zerw0s4wQ== X-Received: by 2002:a17:902:b488:b029:d4:dbdf:c6a5 with SMTP id y8-20020a170902b488b02900d4dbdfc6a5mr3312027plr.42.1603816915108; Tue, 27 Oct 2020 09:41:55 -0700 (PDT) Received: from localhost.localdomain (n11212042025.netvigator.com. [112.120.42.25]) by smtp.gmail.com with ESMTPSA id gx20sm2459230pjb.1.2020.10.27.09.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 09:41:54 -0700 (PDT) From: Peilin Ye To: Daniel Vetter , Greg Kroah-Hartman , "James E . J . Bottomley" , Helge Deller Cc: 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 5/5] parisc/sticore: Avoid hard-coding built-in font charcount Date: Tue, 27 Oct 2020 12:41:02 -0400 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: <54f7d42e07eca2a2f13669575a9de88023ebc1ac.1603788512.git.yepeilin.cs@gmail.com> <6c28279a10dbe7a7e5ac3e3a8dd7c67f8d63a9f2.1603788512.git.yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. This patch depends on patch "Fonts: Add charcount field to font_desc". Signed-off-by: Peilin Ye --- $ # Build-tested (Ubuntu 20.04) $ sudo apt-get install binutils-hppa64-linux-gnu gcc-7-hppa64-linux-gnu $ cp arch/parisc/configs/generic-64bit_defconfig .config $ make -j`nproc` ARCH=parisc CROSS_COMPILE=hppa64-linux-gnu- all 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