Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D84FC636CD for ; Sun, 5 Feb 2023 19:48:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 41E188581C; Sun, 5 Feb 2023 20:47:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YOOe606K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 46FFE85776; Sun, 5 Feb 2023 20:47:06 +0100 (CET) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 317548577F for ; Sun, 5 Feb 2023 20:46:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id l7so3801938ioa.7 for ; Sun, 05 Feb 2023 11:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vma0PpsEeZc3PYCNOiOJgeLXTHwMd4UHPxTpuIow1BQ=; b=YOOe606K8BAG2/1+XV3vjySAdtHrGDcJb2x72qv+nx+YsWMfz/TyqzdGfVOORHiyOy i53v1nHy+Dr6Zgm6kd8CQA8NTdlvtHnLCIdm/7bHzqwH6FS25mYbH4dzgWbtFD5i+KVd gD8N3ELbiNzdQ0i9krff01g/a97Q22xd+eYhw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vma0PpsEeZc3PYCNOiOJgeLXTHwMd4UHPxTpuIow1BQ=; b=aWesVOQ4OLonHAl+qu+E/LcjlMh8aQScedIQ1gFvYzNTUH7Q5Br8SC8cHpDjBD2IPR H469P6yh6YLqgVUxXKWKDRDNRmnaBf/7Wqd0D9B0t29w1S6Td7sKNtDpC+O+Y5A6Nyf/ MLVh+LjfU21tP27x8c2GvgAhdRES5sBWleJ12M+wRub0zwXoarG8oIIgnc1V0szftPDA FUkblxjXc8rDZbNyCN093wopOgEjGo1C6lAv35PoGEeXzcXgfxQ9mFP5kzf6blF6e6gU /Rk5Q6cfEfNxWDJvvh9gkRpJU/KnBsQTSsuek7O7LXYEqFQySJfRUwPpAFYziNfh7iui vUGA== X-Gm-Message-State: AO0yUKWY656we2mHOW2VqVfLqQfJq3IGhSp17yrcFoB1za8zcNOoutOk Evexmvj/ffqL2EvRSNr0SB/8ng8yoy9d1Ww2 X-Google-Smtp-Source: AK7set+/Yz1VU68HB7doVa5/k1KrgwvyjdMEAN/jnraskgiLQXa7dMghT2XNJmB9XjJu8jLWMNcejw== X-Received: by 2002:a5d:8892:0:b0:72a:c7a5:6bdd with SMTP id d18-20020a5d8892000000b0072ac7a56bddmr5713304ioo.2.1675626406691; Sun, 05 Feb 2023 11:46:46 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id p13-20020a6b8d0d000000b007219624f89fsm2594282iod.11.2023.02.05.11.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Feb 2023 11:46:46 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Anatolij Gustschin , Heinrich Schuchardt , Simon Glass Subject: [PATCH 08/11] video: Remove duplicate cursor-positioning function Date: Sun, 5 Feb 2023 12:46:24 -0700 Message-Id: <20230205194627.203961-9-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog In-Reply-To: <20230205194627.203961-1-sjg@chromium.org> References: <20230205194627.203961-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean There are two functions for positioning the cursor on the console. Remove one of them. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 44 +++++++------------------------ 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 72a13d30527..9f8b8ebe8ac 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -126,26 +126,14 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y) priv->ycur = y; } -/** - * set_cursor_position() - set cursor position - * - * @priv: private data of the video console - * @row: new row - * @col: new column - */ -static void set_cursor_position(struct vidconsole_priv *priv, int row, int col) +void vidconsole_position_cursor(struct udevice *dev, uint col, uint row) { - /* - * Ensure we stay in the bounds of the screen. - */ - if (row >= priv->rows) - row = priv->rows - 1; - if (col >= priv->cols) - col = priv->cols - 1; - - priv->ycur = row * priv->y_charsize; - priv->xcur_frac = priv->xstart_frac + - VID_TO_POS(col * priv->x_charsize); + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + short x, y; + + x = min_t(short, col, priv->cols - 1) * priv->x_charsize; + y = min_t(short, row, priv->rows - 1) * priv->y_charsize; + vidconsole_set_cursor_pos(dev, x, y); } /** @@ -192,7 +180,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch) int row = priv->row_saved; int col = priv->col_saved; - set_cursor_position(priv, row, col); + vidconsole_position_cursor(dev, col, row); priv->escape = 0; return; } @@ -254,7 +242,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch) if (row < 0) row = 0; /* Right and bottom overflows are handled in the callee. */ - set_cursor_position(priv, row, col); + vidconsole_position_cursor(dev, col, row); break; } case 'H': @@ -278,7 +266,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch) if (col) --col; - set_cursor_position(priv, row, col); + vidconsole_position_cursor(dev, col, row); break; } @@ -644,15 +632,3 @@ int vidconsole_memmove(struct udevice *dev, void *dst, const void *src, return vidconsole_sync_copy(dev, dst, dst + size); } #endif - -void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row) -{ - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); - struct udevice *vid_dev = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); - short x, y; - - x = min_t(short, col * priv->x_charsize, vid_priv->xsize - 1); - y = min_t(short, row * priv->y_charsize, vid_priv->ysize - 1); - vidconsole_set_cursor_pos(dev, x, y); -} -- 2.39.1.519.gcb327c4b5f-goog