From patchwork Sun Jan 15 21:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1726828 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=dQAiGMX1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nw7Kc0nD0z23fk for ; Mon, 16 Jan 2023 08:17:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 762918555D; Sun, 15 Jan 2023 22:16:51 +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="dQAiGMX1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 57AB985595; Sun, 15 Jan 2023 22:16:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (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 52EF58554F for ; Sun, 15 Jan 2023 22:16:29 +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-xd2e.google.com with SMTP id z194so1037305iof.10 for ; Sun, 15 Jan 2023 13:16:29 -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=Jt3eyNFVHlkNPh+FEFmGTiW0nTGbpFBjQVEP+AzIn6I=; b=dQAiGMX1EJFgBvtTcWlcAuJHrGZS8505patHWwKrMs6uCVdM3jgtu8xqVi2HQLSgy2 7wM99Th0pChKL0pkTl8ltkmOo3kj44oL67/QiC4dn1OqNDMwLx06+Weipi/3LbikmMe5 KmFrNl/AhmZfVLTrrGenPwhoUEBGSi89LA1f0= 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=Jt3eyNFVHlkNPh+FEFmGTiW0nTGbpFBjQVEP+AzIn6I=; b=aNxSTmbYRh9VvRG4FGtBHIhRQziuwGUzUc3ezp/RiAg8NurclcLVYPHxl1yhZejmEL /Qih1wt/XhDuThnus2yAWLlRfcyoeeIR80lgTNOMl4y+KimXVTg4YLBFftAOf7kxbS3h oYj/+dgwU5sR8+PISMmB2dOFLVy86yS21E7gxTYcq/H5r5sAA2BXanX9R9ayU2uR/Xch TDZ+zf946q0FN5D7BVo/qqycmhCnm1JQpQHnlDTbAXdlZoxPKQJ/wfF9NWHNXVVByS/e sIUS/+ZnTCmck30iiLKBNGdDBtIXSTCnwoO6WH8t8ytcdXh+qXj9fnrc96KTyEW9lVKw tlow== X-Gm-Message-State: AFqh2krICxtfyiwfceScnUeffsONo20DGFlDjqorKimOLsk+VSGGzFlx C1cT12Yr4E6Px6tzNeOBK4KvgP/VoWHIfFVjL90= X-Google-Smtp-Source: AMrXdXuFcGdmUqNamxlQaz0DVDQ3tHGR118pR0z89ZQrkWA/pSfGpSQmNlkVOTk6/tMzv+aE3GZNog== X-Received: by 2002:a6b:7519:0:b0:6e9:b3cc:f1a with SMTP id l25-20020a6b7519000000b006e9b3cc0f1amr58748634ioh.8.1673817387809; Sun, 15 Jan 2023 13:16:27 -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 j6-20020a6bf906000000b007046e9e138esm4329107iog.22.2023.01.15.13.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 13:16:27 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass , Harald Seiler , Michael Walle , =?utf-8?q?Pali_Roh=C3=A1r?= , Stefan Roese Subject: [PATCH 06/24] time: Tidy up some unnecessary #ifdefs Date: Sun, 15 Jan 2023 14:15:43 -0700 Message-Id: <20230115211602.1127661-7-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230115211602.1127661-1-sjg@chromium.org> References: <20230115211602.1127661-1-sjg@chromium.org> MIME-Version: 1.0 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 Avoid using the preprocessor with TIMER_EARLY. Signed-off-by: Simon Glass --- lib/time.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/time.c b/lib/time.c index 0c95d12f614..1ef58f92cd1 100644 --- a/lib/time.c +++ b/lib/time.c @@ -70,15 +70,14 @@ extern unsigned long timer_read_counter(void); ulong notrace get_tbclk(void) { if (!gd->timer) { -#ifdef CONFIG_TIMER_EARLY - return timer_early_get_rate(); -#else int ret; + if (IS_ENABLED(CONFIG_TIMER_EARLY)) + return timer_early_get_rate(); + ret = dm_timer_init(); if (ret) return ret; -#endif } return timer_get_rate(gd->timer); @@ -90,15 +89,14 @@ uint64_t notrace get_ticks(void) int ret; if (!gd->timer) { -#ifdef CONFIG_TIMER_EARLY - return timer_early_get_count(); -#else int ret; + if (IS_ENABLED(CONFIG_TIMER_EARLY)) + return timer_early_get_count(); + ret = dm_timer_init(); if (ret) panic("Could not initialize timer (err %d)\n", ret); -#endif } ret = timer_get_count(gd->timer, &count);