Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp934147rdb; Thu, 15 Feb 2024 23:10:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX98c5VFIH2RAlp5cz8LL+8Wu3L2QhKeR8TYrf8z8tCSX3BoJIJ+jyFRc4lEY9d73ebUSRCNOi9IcE+9ReUEP25RePdhj35P4L6X516/A== X-Google-Smtp-Source: AGHT+IFKPt2wxgayAp1mpd/2clGf8zmQVaIe7E1G3v5NyEfoEv7cHop9JIrGMaXy67E8X+BEZJqK X-Received: by 2002:a0c:ca91:0:b0:68c:cdd5:64d9 with SMTP id a17-20020a0cca91000000b0068ccdd564d9mr3781833qvk.54.1708067427116; Thu, 15 Feb 2024 23:10:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708067427; cv=pass; d=google.com; s=arc-20160816; b=ai353+daBu+Vf2SAL+OMhrvI6GK4srprOdcZfSrLlMvqvwcTsOugje9NYt2XCUmgri Kpd/BXF0hm+q4u7ICDMzAlCGEphpkcm/lDV9hK4B/QQdfL8DDRJ6w06LqeE9q4lzphF1 HFiRVoHRo23wa00UnuIA+XOUlZr87UitbRRXN98K4kmIe4XTyVjmNyh0WkW1dMYkSibM aI97YjfExEkKmzgYLWw/2jNemrBXGLhZtMgV/sS9ql2rvC7WxfxrK3VsItVvPRABrMbe Z0VV03CKuGLk5rHpXQHQbC9DhbxixOSnc1Khd0I3jRIzgnaZkPA4XMGTNdm/ESpMYFZD 6cFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=p6mcSeC2R4ZO4kgXf8K+cFxo0Sfe2JaXXvLGQvOlQKs=; fh=s6NkQwahV700yAu/5wsZICn0X7pSR+RTJHHLvyJillo=; b=rTfTXRkmUcgune7Is5hGm7pixi5mUPQGqXNbTH9QEw0lHLfEIrRKrzvVz6eSJtFPok 1ymeHsPIjvpFPbTk/sIV7M22mH7mUS4IldZmgXgnFcWnBtJ1geoRppSiiBeZliLX4C35 GMoaQrZguJiHetDVlx33fnIB9SlXUqC3gnweVIuwVhgoIyQqsNnEG9YPVW/s8sf9tq/6 2wtpoMBDc/crojs5sHkrxfFxaikMmEYbSInKHR+bF6SnE4voHIUtzeKCmafNhJAUd2fC 8jNmFspTC9ad678TdH7+Db4TpU/Geaaly1iq179P7ApVJuThkq06lRY4aLloEI5/pgmD DnYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-68156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pt20-20020a056214049400b0068ce1672608si3274204qvb.574.2024.02.15.23.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 23:10:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-68156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CC9C11C2287D for ; Fri, 16 Feb 2024 07:10:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4293514AA8; Fri, 16 Feb 2024 07:10:21 +0000 (UTC) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0115C8BFB for ; Fri, 16 Feb 2024 07:10:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708067420; cv=none; b=SX1LVyqDgyX61h+wJXGYk+9WASCYsLKBJJntavur58UDb/EHem5IqtnEyW+xRd3b/uTR4uKgyQRi7h198zPusa+wJMdMp/NOnh+A7sldIbhxe4+beosBYKf3XMQImDtgq+LUviQJAT4EciT2ZF3kc1oJJipljO1NHxxKGxwTKN4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708067420; c=relaxed/simple; bh=ZpQqi58OvqeE7dGvb/+B7nxPR7gxUwvW+MZu87p5Ckw=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=jJh0hmm2tNASz8EzxIzk8Ju6ySR8MBwge7OXU7CsxlBtatB2GgdbVXkAq5gajWjS4iojfawRbWlAygrHA0cF0gI3dMDZjKfYZ/cR0GWNPNhX/ehIWGHVxd2/faEqFVl8KHhxvvKqzTe5rutAKuPp9WZW5l++aiPp9vq4Bc2l5UM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a3d0d26182dso178772766b.1 for ; Thu, 15 Feb 2024 23:10:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708067417; x=1708672217; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p6mcSeC2R4ZO4kgXf8K+cFxo0Sfe2JaXXvLGQvOlQKs=; b=kfLhIn+ljVhwKgZG1rbuIWgjpMUnPREGy3seL/+cBmS3whw/sVeLGYZFb01ThwMcvf hyW6ekk3u/bh9lItHCa5Y1o7u0NumHffalIsA7TGkdXi7l77Ucp7zIJZifw3SM/yznfh ZYLeVZEna3I62U0GqKPw+bPA02Wp1aPS4UROzvzBSXVB1m7ZqocKOwTesoqP87J4FI1o L6Nnzdpp18oXDGelSBBOkjO1NpNW5mJCadPtVoRTowig0Dw6vumyeJ5tzGnz5GT8B1te czbIlUKjgfivl/jt8gDLn3Oz65I0HXGawO8Z6GWFxEZg15CIammtUii+y/T1MW4qcodi c4Eg== X-Forwarded-Encrypted: i=1; AJvYcCVwZ1pMLVON3kJqvyPM9oZXQw5V3g0ywv12Rxnzfhab+RTkt+JW88y395qBbDOovH7xAeaqbNKIe7V1RLr78xC1SPltXYpcV1c9Zimp X-Gm-Message-State: AOJu0Yzg/qBsHh4CnKmbEwdzOBQxAxjgYLSvJTq6cnq6nZyKIX+hGt2v WsaNcCPRlsqP531NWLyB4wEGK+jAbCiXYb5CegIWBYt5SHL5Hpv+yBm2R9Xz X-Received: by 2002:a17:906:2b09:b0:a3c:f4e8:ac38 with SMTP id a9-20020a1709062b0900b00a3cf4e8ac38mr2664058ejg.9.1708067416938; Thu, 15 Feb 2024 23:10:16 -0800 (PST) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:59? ([2a0b:e7c0:0:107::aaaa:59]) by smtp.gmail.com with ESMTPSA id a7-20020a170906670700b00a3d2d81daafsm1284405ejp.172.2024.02.15.23.10.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 23:10:16 -0800 (PST) Message-ID: <7c91e5e0-a6eb-4d53-89ed-efde04f57c7c@kernel.org> Date: Fri, 16 Feb 2024 08:10:15 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 3/5] sticon: Allow to get max font width and height Content-Language: en-US To: Alexey Gladkov , LKML , Greg Kroah-Hartman References: <0c724c30a36aefe2cb4470182cf868d256fbabcd.1708011391.git.legion@kernel.org> From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL9stHyvTGw0Fjsualwb0Gwdx ReTZzMgheAyoy/umIOKrSEpWouVoBt5FFSZUyjuDdlPPYyPav+hpI6ggmCTld3u2hyiHji2H cDpcLM2LMhlHBipu80s9anNeZhCANDhbC5E+NZmuwgzHBcan8WC7xsPXPaiZSIm7TKaVoOcL 9tE5aN3jQmIlrT7ZUX52Ff/hS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dh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <0c724c30a36aefe2cb4470182cf868d256fbabcd.1708011391.git.legion@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 15. 02. 24, 16:37, Alexey Gladkov wrote: > Signed-off-by: Alexey Gladkov > --- > drivers/video/console/sticon.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c > index 992a4fa431aa..63368b3ff9c5 100644 > --- a/drivers/video/console/sticon.c > +++ b/drivers/video/console/sticon.c > @@ -56,6 +56,11 @@ > #define BLANK 0 > static int vga_is_gfx; > > +#define STICON_MIN_FONT_WIDTH 6 > +#define STICON_MIN_FONT_HEIGHT 6 > +#define STICON_MAX_FONT_WIDTH 32 > +#define STICON_MAX_FONT_HEIGHT 32 > + > #define STI_DEF_FONT sticon_sti->font > > /* borrowed from fbcon.c */ > @@ -180,8 +185,10 @@ static int sticon_set_font(struct vc_data *vc, struct console_font *op, > struct sti_cooked_font *cooked_font; > unsigned char *data = op->data, *p; > > - if ((w < 6) || (h < 6) || (w > 32) || (h > 32) || (vpitch != 32) > - || (op->charcount != 256 && op->charcount != 512)) > + if ((w < STICON_MIN_FONT_WIDTH) || (h < STICON_MIN_FONT_HEIGHT) || > + (w > STICON_MAX_FONT_WIDTH) || (h > STICON_MAX_FONT_HEIGHT) || Will !in_range(w, STICON_MIN_FONT_WIDTH, STICON_MAX_FONT_WIDTH) look better? > + (vpitch != 32) || > + (op->charcount != 256 && op->charcount != 512)) > return -EINVAL; > pitch = ALIGN(w, 8) / 8; > bpc = pitch * h; > @@ -273,6 +280,15 @@ static int sticon_font_set(struct vc_data *vc, struct console_font *font, > return sticon_set_font(vc, font, vpitch); > } > > +static int sticon_font_info(struct vc_data *vc, struct console_font *font) > +{ > + font->width = STICON_MAX_FONT_WIDTH; > + font->height = STICON_MAX_FONT_HEIGHT; > + font->charcount = 512; Why not to have a macro for this constant? > + > + return 0; > +} > + > static void sticon_init(struct vc_data *c, int init) > { > struct sti_struct *sti = sticon_sti; > @@ -371,6 +387,7 @@ static const struct consw sti_con = { > .con_scroll = sticon_scroll, > .con_switch = sticon_switch, > .con_blank = sticon_blank, > + .con_font_info = sticon_font_info, > .con_font_set = sticon_font_set, > .con_font_default = sticon_font_default, > .con_build_attr = sticon_build_attr, -- js suse labs