From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAE5DC4363A for ; Tue, 27 Oct 2020 19:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71A6520756 for ; Tue, 27 Oct 2020 19:20:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="jZmcXQX1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1829664AbgJ0TTw (ORCPT ); Tue, 27 Oct 2020 15:19:52 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39141 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1829603AbgJ0TST (ORCPT ); Tue, 27 Oct 2020 15:18:19 -0400 Received: by mail-wr1-f67.google.com with SMTP id y12so3168039wrp.6 for ; Tue, 27 Oct 2020 12:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=UcIHLAfMrGIWb94gFQbYez2rtiLYhxYGzbhepgOEqhg=; b=jZmcXQX1A2S40vjJo/nTH0aljwKjJuAPXb+B36lbyLEdT9egc+lxtWdJnMB+OCR1q/ z8JXGeDZMMgDs7eEoLuZcbtLb4W4PRiKB7xEFyfMBTPNVjvHVRgf0wKWDBhLE7BeF3Ee HdUsFRjxEA01mA8iefIMZVO+toudXuG7t7vSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=UcIHLAfMrGIWb94gFQbYez2rtiLYhxYGzbhepgOEqhg=; b=rLkZDmwVvam+6GzzCq9ZFU9lMzFUdexkPtCbKKQZwE8laNW90GerGTmPupvupn5j58 B6NlK7aH9gO6tfibgyliWvRPmLizc2OfcY0xm3MSiTJXL7xv5ld3zOT+eWn5RArGER9y EbuRk+joXPq5fFunAkTpsm67ms/rTPS2jsfwuiQLr/4Jwx4bzCtnijHQQ0o4c4ngQdPO IyPSta7rLxsCxL1x5KkyS4+E9NohKHTfJ656lP6XentEVoHt60lepxIoyubdjA6E62rZ GlUTMhA/8Bny/e9NG6ndkgH+N8mY1FP79StFP7wo4UkrxZ1cvqmKAGeKWWWhDha6DicO WObA== X-Gm-Message-State: AOAM530TgJWSVyBe48z1NMRHp8WOvlBSCGKUqF0A6Sv8+FH3KUN2pH2j +lYBJl2muZM4hG4te7WnJnz4Tg== X-Google-Smtp-Source: ABdhPJwcdYcb/+YbSAqoFdbmEhcuESXU1vQTf/whNx4Mk55hbq+3g75bW6OZn0DeRMXMMRK+am3X9g== X-Received: by 2002:adf:dd50:: with SMTP id u16mr4781710wrm.419.1603826296987; Tue, 27 Oct 2020 12:18:16 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b7sm3280521wrp.16.2020.10.27.12.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 12:18:16 -0700 (PDT) Date: Tue, 27 Oct 2020 20:18:14 +0100 From: Daniel Vetter To: Peilin Ye Cc: Daniel Vetter , Greg Kroah-Hartman , "James E . J . Bottomley" , Helge Deller , Bartlomiej Zolnierkiewicz , linux-parisc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] parisc/sticore: Avoid hard-coding built-in font charcount Message-ID: <20201027191814.GP401619@phenom.ffwll.local> Mail-Followup-To: Peilin Ye , Greg Kroah-Hartman , "James E . J . Bottomley" , Helge Deller , Bartlomiej Zolnierkiewicz , linux-parisc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <54f7d42e07eca2a2f13669575a9de88023ebc1ac.1603788512.git.yepeilin.cs@gmail.com> <6c28279a10dbe7a7e5ac3e3a8dd7c67f8d63a9f2.1603788512.git.yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 12:41:02PM -0400, Peilin Ye wrote: > 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 Reviewed-by: Daniel Vetter > --- > $ # 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 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch