From patchwork Mon Mar 25 15:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 782341 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp1235367wrt; Mon, 25 Mar 2024 08:29:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUFecEZhFxK4iNOLZ4EkM7txT9FyAIeJU6k8kvjoeCn9lPG1OEu8SxJTqXL1yzVyBobL40666Nn+vlrEVucEj6x X-Google-Smtp-Source: AGHT+IHjW+D0WjkN1yPXYOB+Tzc3h2pq641GCReAvk4jKbgULILfeSwrd0I4VzE1v+7RwJMcr8UZ X-Received: by 2002:a05:6830:22cc:b0:6e6:8c6d:68a5 with SMTP id q12-20020a05683022cc00b006e68c6d68a5mr8941778otc.21.1711380558238; Mon, 25 Mar 2024 08:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711380558; cv=none; d=google.com; s=arc-20160816; b=W/v1nnTY/vqTlUgZ06REqiTKApWpOnl+kv8Jskeqw6OajDXtN3ijrbvw3UiUsstLii 9j0nYPAFeblVuk+7U0hKsHu2uwyNwpuwGJZT4fNeJ9JoA8FfZ7DmhQ6tzl33gDija4AR XdJzLoxc8WHoQ8WZ4KDnfyFezilDFUKt3xTMg/EzfCmPS2XoF5LSyc0m7niP3BcWX9gJ Wbv85ukSOY4I7NZXLBtw8FOR/g97FDZJLcU/HjJqD1NQwT4hDF4iI6ukqEyce7UtUIBY wARoLEXsCM7GwloL/4i3400Lw6PucHsetvZxBV4FJeUmOYHz2DQ7OaRaDQ1SxpadUJqk qMAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8n9QPEOuM1pBugupKeEtDOMCt4itsUe/QSxWC8eJVGs=; fh=Vnpc6sAZ683hqmTcdvG596lAL6GFS9SeeG7OE8u/W1Q=; b=k8ubl1oDCdRABSfZqy4eqBJL2X7aAEqIVKZSC/ZchOBWo/YKhf7XPfNpmZDRH9nmYY tIz/S5TGcT0pTR/MGpvcK0JCbMwFHamElMqgoIxN81D/jKHP8CG3pJjmqLrIpQVvJb32 iA1bVUxYFa1G+tAV7/H6QCND6NnS16sWcC1exhCCnvP9iSwXFzNAsSSxU17WVqaWG91D MzOhnMmSbvZLFGAr2dKUH+Sgr5oMq9ZdvqvfFeIovQJXXgiG/3oJn8lOO+tzR9u/Fry/ TvmDhuW5NawIsqIRHV3R0VGYdQ7krSPQfG95R54os0/Qk5tFE1sWjlpckrhjKcgL9Jrc w67Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q09GVRf8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gd14-20020a05622a5c0e00b004311ea48155si5943401qtb.389.2024.03.25.08.29.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2024 08:29:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q09GVRf8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1romFj-0002kd-4t; Mon, 25 Mar 2024 11:28:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1romFh-0002jz-5w for qemu-devel@nongnu.org; Mon, 25 Mar 2024 11:28:45 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1romFf-0000FN-Jf for qemu-devel@nongnu.org; Mon, 25 Mar 2024 11:28:44 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4148c2a3a3fso2442715e9.3 for ; Mon, 25 Mar 2024 08:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711380521; x=1711985321; darn=nongnu.org; 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=8n9QPEOuM1pBugupKeEtDOMCt4itsUe/QSxWC8eJVGs=; b=q09GVRf8AwVxR5MS0TPchAdJaDRMzVURCtc9cuYVI+V+V1Hg1z7+d47Ux37CrcjbLo Ow9pNs+gf/pL9cwyaueMJzKdXtT45PRMLM45Rh+cpqR4VEffLaP2f4c6J6w4uikfNezX LwlRzbqaXfOHV9YNHmqpjNFVdRqEUrD0+V56rCNhqFW4dV5kK41Q/64JdZe2RGs9GPQ2 nbN/vIjhFBxPYR+ROB7Q4w/H5T2ki0GJbrVf6528KhZY+WC0NjbRAaKjnVW1SkHBV5SC NtQvMUSb10uqj8dMgmYfvpza5eY022zTiahARWLeRHlSmtAbb4eQKtZGeEqo8gRCqh+I fGqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380521; x=1711985321; 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=8n9QPEOuM1pBugupKeEtDOMCt4itsUe/QSxWC8eJVGs=; b=oOg9xlK8Y6DrAWGvDVfJAJ72qtB8jnPGr/YJTUrd231o4Zikq+p0KbusPi8qBBhuNs izYCFgyGGBb1XpolDBSKw86I6TRWrcnP3Y18NYoHYLPRw5d8/ikD5CQp9O1qcSDS9tDw oi2bq0HHJW+7RuZqI3eyn0yRLnGHZqslDdapuGk07lHgt4QnAE613ik8r1pn+VWhPWDI 0B8b1R81Ga/sX4dWq1cTzCAjvLzy+q/iNvKhvUIdd0jh4Pe5+QmdgJQGNturT4wn5ddZ EFJQQzTePy7QlyhwoZ4aJsxI76dyBEiaR8D0rDtQe2KMYQVIARwTWYbKJ5ks/tVnyGSn nnoA== X-Gm-Message-State: AOJu0YyPYS1/djUawDTjG2NP5qBA1AswTzs26ov+K//5atp/UboC1ZHs WH48TRUsD3uEEW6BZpPuyw24YieaXWnIqzcX09eucwVhROfHK+aQlxv2jOYJO5el/vVl3/dkGKg W+RU= X-Received: by 2002:a05:600c:1395:b0:413:133c:b9c8 with SMTP id u21-20020a05600c139500b00413133cb9c8mr5519116wmf.33.1711380521437; Mon, 25 Mar 2024 08:28:41 -0700 (PDT) Received: from m1x-phil.lan ([176.187.208.214]) by smtp.gmail.com with ESMTPSA id fc19-20020a05600c525300b0041401eb021asm8763725wmb.24.2024.03.25.08.28.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 25 Mar 2024 08:28:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?In=C3=A8s_Varhol?= , Alistair Francis , qemu-arm@nongnu.org, Arnaud Minier , Damien Hedde , Peter Maydell , Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 v3 2/3] hw/misc/stm32l4x5_rcc: Inline clock_update() in clock_mux_update() Date: Mon, 25 Mar 2024 16:28:25 +0100 Message-ID: <20240325152827.73817-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240325152827.73817-1-philmd@linaro.org> References: <20240325152827.73817-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Trivial inlining in preliminary patch to make the next one easier to review. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- hw/misc/stm32l4x5_rcc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/misc/stm32l4x5_rcc.c b/hw/misc/stm32l4x5_rcc.c index bc2d63528b..49b90afdf0 100644 --- a/hw/misc/stm32l4x5_rcc.c +++ b/hw/misc/stm32l4x5_rcc.c @@ -48,6 +48,8 @@ static void clock_mux_update(RccClockMuxState *mux, bool bypass_source) uint64_t src_freq; Clock *current_source = mux->srcs[mux->src]; uint32_t freq_multiplier = 0; + bool clk_changed = false; + /* * To avoid rounding errors, we use the clock period instead of the * frequency. @@ -60,7 +62,10 @@ static void clock_mux_update(RccClockMuxState *mux, bool bypass_source) } clock_set_mul_div(mux->out, freq_multiplier, mux->multiplier); - clock_update(mux->out, clock_get(current_source)); + clk_changed |= clock_set(mux->out, clock_get(current_source)); + if (clk_changed) { + clock_propagate(mux->out); + } src_freq = clock_get_hz(current_source); /* TODO: can we simply detect if the config changed so that we reduce log spam ? */