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 BC21BC7EE23 for ; Thu, 1 Jun 2023 16:26:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AF53E86362; Thu, 1 Jun 2023 18:24:51 +0200 (CEST) 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="XD8e/TYI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B0C48636B; Thu, 1 Jun 2023 18:24:39 +0200 (CEST) Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 8511086339 for ; Thu, 1 Jun 2023 18:24:34 +0200 (CEST) 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-il1-x135.google.com with SMTP id e9e14a558f8ab-33cb82122c7so3641535ab.1 for ; Thu, 01 Jun 2023 09:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685636672; x=1688228672; 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=4cOjcwwydYnzsZoT4ZGc3WOVF3z39eo2DADSTkql+kE=; b=XD8e/TYITPk4piFEpFrBH5rlGsF1Qn7KybbwJOspQL3nqtJRupQT+q4v6cNF5QYv/d D0HhmL2TONPWFcsCSnRmgMOFlhGISkzimMz1EKMTCBTiinbhrXPydGwCCOWzAOv6qayX ijfjFkIVQHsVQxeJRKsM9oGNoZBsat9Tb9sbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685636672; x=1688228672; 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=4cOjcwwydYnzsZoT4ZGc3WOVF3z39eo2DADSTkql+kE=; b=a6akFjrmTA4LtSM+ZXhiHu3FPicS7v5HM1qdQ9mrmuo5owaMd0OyATLJjZDCF8IjZR jozjeOzsTLXINndkpNQDb50S8Km0ITot6aZIQ0DnsdLAOpQn+iETsgjj0c4+Jq4fGd9b t3fZaRbhxIBt1wQB7Q6l4G6llMZWb9RGwPtAweTnRevKOS37F6hfViQb9LSBmumm0a0S uPagnrgFTzZVyvIdvH5ua1gpO78MCkinz1CCOpEg8RgTh9vNjPlQmOO9xe7GZkdJD69H A40VDdQz3fULETuzy2wywM9O4AQP6qCoAYO/n5olcCDtxE73bProfPKxvgBAtytat/fU jF4w== X-Gm-Message-State: AC+VfDyEKNf8VPUKbSjzMloNw2c+9Gtwj75bUi/XMQQN0z0BASBRRHfY hOtxa6Mcq+tWVAL/QNznnFNjuVG+nBWnlB5bB0Q= X-Google-Smtp-Source: ACHHUZ5yqRtckETnTzYUONA07JhfziOOfU3jJWFy3co4fXK700ThccU0nC+rwsyKBVV8qf5QfwXrXw== X-Received: by 2002:a92:2809:0:b0:33b:c914:a771 with SMTP id l9-20020a922809000000b0033bc914a771mr5286081ilf.6.1685636672493; Thu, 01 Jun 2023 09:24:32 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l1-20020a922901000000b0033a6e7ee4e3sm3862098ilg.1.2023.06.01.09.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 09:24:32 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass , Anatolij Gustschin Subject: [PATCH 08/40] video: Drop #ifdefs from console_truetype Date: Thu, 1 Jun 2023 10:22:32 -0600 Message-ID: <20230601162404.220488-7-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230601162404.220488-1-sjg@chromium.org> References: <20230601162404.220488-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.8 at phobos.denx.de X-Virus-Status: Clean Use if() instead to reduce the number of build paths. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 112 +++++++++++++++---------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 6b5390136a7a..0ea8a9f6215e 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -154,33 +154,33 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) end = line + met->font_size * vid_priv->line_length; switch (vid_priv->bpix) { -#ifdef CONFIG_VIDEO_BPP8 case VIDEO_BPP8: { u8 *dst; - for (dst = line; dst < (u8 *)end; ++dst) - *dst = clr; + if (IS_ENABLED(CONFIG_VIDEO_BPP8)) { + for (dst = line; dst < (u8 *)end; ++dst) + *dst = clr; + } break; } -#endif -#ifdef CONFIG_VIDEO_BPP16 case VIDEO_BPP16: { u16 *dst = line; - for (dst = line; dst < (u16 *)end; ++dst) - *dst = clr; + if (IS_ENABLED(CONFIG_VIDEO_BPP16)) { + for (dst = line; dst < (u16 *)end; ++dst) + *dst = clr; + } break; } -#endif -#ifdef CONFIG_VIDEO_BPP32 case VIDEO_BPP32: { u32 *dst = line; - for (dst = line; dst < (u32 *)end; ++dst) - *dst = clr; + if (IS_ENABLED(CONFIG_VIDEO_BPP32)) { + for (dst = line; dst < (u32 *)end; ++dst) + *dst = clr; + } break; } -#endif default: return -ENOSYS; } @@ -317,52 +317,52 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, end = dst; } break; -#ifdef CONFIG_VIDEO_BPP16 case VIDEO_BPP16: { uint16_t *dst = (uint16_t *)line + xoff; int i; - for (i = 0; i < width; i++) { - int val = *bits; - int out; - - if (vid_priv->colour_bg) - val = 255 - val; - out = val >> 3 | - (val >> 2) << 5 | - (val >> 3) << 11; - if (vid_priv->colour_fg) - *dst++ |= out; - else - *dst++ &= out; - bits++; + if (IS_ENABLED(CONFIG_VIDEO_BPP16)) { + for (i = 0; i < width; i++) { + int val = *bits; + int out; + + if (vid_priv->colour_bg) + val = 255 - val; + out = val >> 3 | + (val >> 2) << 5 | + (val >> 3) << 11; + if (vid_priv->colour_fg) + *dst++ |= out; + else + *dst++ &= out; + bits++; + } + end = dst; } - end = dst; break; } -#endif -#ifdef CONFIG_VIDEO_BPP32 case VIDEO_BPP32: { u32 *dst = (u32 *)line + xoff; int i; - for (i = 0; i < width; i++) { - int val = *bits; - int out; - - if (vid_priv->colour_bg) - val = 255 - val; - out = val | val << 8 | val << 16; - if (vid_priv->colour_fg) - *dst++ |= out; - else - *dst++ &= out; - bits++; + if (IS_ENABLED(CONFIG_VIDEO_BPP32)) { + for (i = 0; i < width; i++) { + int val = *bits; + int out; + + if (vid_priv->colour_bg) + val = 255 - val; + out = val | val << 8 | val << 16; + if (vid_priv->colour_fg) + *dst++ |= out; + else + *dst++ &= out; + bits++; + } + end = dst; } - end = dst; break; } -#endif default: free(data); return -ENOSYS; @@ -405,33 +405,33 @@ static int console_truetype_erase(struct udevice *dev, int xstart, int ystart, line = start; for (row = ystart; row < yend; row++) { switch (vid_priv->bpix) { -#ifdef CONFIG_VIDEO_BPP8 case VIDEO_BPP8: { uint8_t *dst = line; - for (i = 0; i < pixels; i++) - *dst++ = clr; + if (IS_ENABLED(CONFIG_VIDEO_BPP8)) { + for (i = 0; i < pixels; i++) + *dst++ = clr; + } break; } -#endif -#ifdef CONFIG_VIDEO_BPP16 case VIDEO_BPP16: { uint16_t *dst = line; - for (i = 0; i < pixels; i++) - *dst++ = clr; + if (IS_ENABLED(CONFIG_VIDEO_BPP16)) { + for (i = 0; i < pixels; i++) + *dst++ = clr; + } break; } -#endif -#ifdef CONFIG_VIDEO_BPP32 case VIDEO_BPP32: { uint32_t *dst = line; - for (i = 0; i < pixels; i++) - *dst++ = clr; + if (IS_ENABLED(CONFIG_VIDEO_BPP32)) { + for (i = 0; i < pixels; i++) + *dst++ = clr; + } break; } -#endif default: return -ENOSYS; } -- 2.41.0.rc0.172.g3f132b7071-goog