Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp299155pxb; Thu, 12 Nov 2020 04:17:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcW8NgCCcHuJeHU8vti0nNVyR6K1fax5vXCoW1LiQUp0eWIueWEGchQhOcUPf7lf5YaxPi X-Received: by 2002:a17:906:1a14:: with SMTP id i20mr31373021ejf.422.1605183430041; Thu, 12 Nov 2020 04:17:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605183430; cv=none; d=google.com; s=arc-20160816; b=sq8G45dnMi6jf75ZipcylxBfdbTukQKSOiQaPtH/6KgYeSkKbrOZUYQZ+RNsk9e9kj c8zHfE6b7I/+VBMGZIHYMHllz1glCzHVZlnpcTG6pOZowFWFJ3sXIEHB2sAKJnotIcaL qK2KibVWkpOhhmnStBdbmJ9CAndhHj1Mio+FSn/scKB/macUPBV6vBfhbLVpB5rPK5M8 J55CmUpyEwhmDIwnNtWHjtseYmJND/0yeauO20UlsDkWNa2crUb53A2MuTI1WAgwQpwF XcOZNxWf2Gx9/0r1rMoGRwHL8kU1H9h434I6jOO07B5kcd1pxduIP5V9gL/M5Owy98jX rT3g== 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=Ji+otFl/WkNW1j02CrZ/ivgsssCDblUPej71NkGlu3o=; b=1Kwor39aPJrSlOxq0dA4KmaNs2t9NshignCvbPt3kQfRGW+HrDT4IjD10hqtb0w4ab K8gj0un0lYJTvkA/8K852RZEG1Yr4a2MHIgRtlhemeXMm11jhbuP/6pF3yZ9c5uI1q7+ f6rQD4qJqLF2ir3xdqq8OqOYBu5LrtnNb5546MsWttEHRUXopdG4Ewk9L9MRKab3i0wt egbf1PzFwh26vWa/UfTzCWfNMIgCX7UlJIfv4cDzTfra0CsaZGdn6IvYYRaQeI06Z561 Fv8i6AvTQEvRcA1gtD/r2k6edXIWMy3Dqp+trZ2mFRG0/30J5Ptqdg6gHIXY2n5yCjVW rxvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VAmHGapX; 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 o1si3210034eja.87.2020.11.12.04.16.46; Thu, 12 Nov 2020 04:17:10 -0800 (PST) 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=VAmHGapX; 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 S1728010AbgKLMO6 (ORCPT + 99 others); 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-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 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. 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) -- 2.25.1