From patchwork Mon Mar 25 13:32:53 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: 782338 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp1176821wrt; Mon, 25 Mar 2024 06:35:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVXqz4OIt2I30MXWfXpoNy8UtfmafIpvv3H4YhmLeHzPPBFzH5yG8Vc80QyRQfpQwBs0T3fHhMbx7TUEYm5n7ji X-Google-Smtp-Source: AGHT+IHPWoAKUxcfeSfqF/8eYANHhL1R7SGQAIF2e+/5njDFdTG9MlMoQqTOuWMS41P4V1pL4qGD X-Received: by 2002:a05:620a:1248:b0:789:f353:d963 with SMTP id a8-20020a05620a124800b00789f353d963mr7453803qkl.68.1711373736470; Mon, 25 Mar 2024 06:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711373736; cv=none; d=google.com; s=arc-20160816; b=TROKZ2C1C/fjsGGbSZ0dmZNrd3WsSSpQgHe+xJgGOnX1G8D04yXXOTU3jI436FoIdc UetZQPMhenDwixq/EvaDnkTgSj5sVWnf/1OpCMcFoxpAOdzHNVXT4vMtHh+cj6HnRS9K ++uDURhb48vObZeGMFUBFdK0z5BRAkQpbl1Rv+WSYyeRg/2q2OvRa0eZM/VmzvaZE2mP HV2pdTm/Ymf/dK2VOlONue1bTrUJAyOaONLzR0GL21ye8V0uqcw+rM1fJBtQvugCMP9m kTTrBDa0Y7yJ1/7jeSZG21qPx2SFwcp898mgxvg/ZkjpOqynRYiNXE7T4a5+Dgugsn2C wwfQ== 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=vr/+Morh4LGFnprtkK6/DvsiuzOF19rNj0hIhqL5OAo=; fh=Z6ebApcLFJbaZHsWuXWH2AHWI2xWYXqDDJv2NwjBOYY=; b=q0S45IVIctWD20EFhiSyZbQi+mrcjRIJg4O1W17ZDShrX8MLNHSDMEQXOf7GftgQeY 3WsYa4wBQbyVavs/xQsYhLPS/SJNU0q5mmCLwEaWCRGS70m6TPGyFaQTwrl1uc2T5f4c g4zXOVkHnK0HzlTrwNK/wmJb45fbNGz74z8jGVL1OZJT6bygUto0nx/h1rZAYSb/47Hp iDRpC7+PykO00/NN0y+6V0nJ5JjITkHYMIT2X/2CAhGyOrrBpexM/YVtd0GjI1ClBjyB WJaDEsuRKg3qFab+UCuxMJRx7SqA27xTIaPu0QBjvBUCIp2w7/Bup8GH9ENUlplQDUWe FAwQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xm5WvVT8; 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 pa24-20020a05620a831800b0078a2a88b9d0si5129920qkn.562.2024.03.25.06.35.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2024 06:35:36 -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=xm5WvVT8; 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 1rokSE-0002dm-P3; Mon, 25 Mar 2024 09:33:35 -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 1rokS8-0002Z6-Ql for qemu-devel@nongnu.org; Mon, 25 Mar 2024 09:33:29 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rokS6-0007MV-1p for qemu-devel@nongnu.org; Mon, 25 Mar 2024 09:33:28 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4148c607f31so627475e9.0 for ; Mon, 25 Mar 2024 06:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711373601; x=1711978401; 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=vr/+Morh4LGFnprtkK6/DvsiuzOF19rNj0hIhqL5OAo=; b=xm5WvVT86UmmiSruPKgvLpQVLZ5a3Tjk95kVLYdHenbXU7tQQo2fDmzpIarGQ3TcCE xK//4Aw3cLSQXwx9omv2xCZffOlomtXeC6Aq+Oft8Qsmfi1Q68KEgV38x27NTxHKD/uw au/E3rwOUC82tbBdcho+97rPb+LUJJy721rFqowZ3xRjgrUi1Xz+gEkH6FREOj1hYvHe MnzKTzodMpp/66bGxM1ifhNaVp3IOSQMrpg4SebTBYlh4OOhIeu3CDk8o2e8sCpTm868 fIEEHv/G1mB5m6fAqal5S9aRIxiPAfVRDD8gvg7MegdV+qzkdr6uWzQUJ2eaZ5KVJlEi 4CfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711373601; x=1711978401; 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=vr/+Morh4LGFnprtkK6/DvsiuzOF19rNj0hIhqL5OAo=; b=FiDTi1l+fpLjKxlV/+0WKdHso/vBmEJm05blI4FMgwaUJi1MCKEy7FEKerdINUYe04 PR+mdDjvrkTrh+kcr4TwqjQ+NtKo9ak1TtPqyqkd33u/dFdIKDohzvpP5C/2OGDYfO3v fmKIn+Ytv8RGLk3TvUDVhiMlMQNsXS1q1c9ezZyUs7V6ha45D+cbjlZP14RhxbiNOWLJ X/GDPCwo+hhdlq5K2S4nN6xxReYtXwvzp0Q/Ul3TqtqpiFJblmsJgn1MhFUiicTqt75W uvcEgOqIOmkYvsYbQZ7ZnAw75FMC3Yri9T/p3dWFNX3ZBIKZOnmfRhbtBHZefPoFiTLJ tvdQ== X-Gm-Message-State: AOJu0YxC+Aw627jrtGZpD8kRKdf/sScBIWXE0nmL0f4O3d+zpanoah/L J5UkZMaoBSMM6xVwbPhiDlAzmSw19MQyjP5793JJ8eJdDGg9RPe8QXxXleZvH9RDrgK0/RzhP09 6zdU= X-Received: by 2002:a05:600c:56ca:b0:412:f572:5318 with SMTP id ju10-20020a05600c56ca00b00412f5725318mr5388419wmb.11.1711373601371; Mon, 25 Mar 2024 06:33:21 -0700 (PDT) Received: from m1x-phil.lan ([176.187.208.214]) by smtp.gmail.com with ESMTPSA id g14-20020a05600c310e00b004147ec48845sm8405542wmo.26.2024.03.25.06.33.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 25 Mar 2024 06:33:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?In=C3=A8s_Varhol?= , Arnaud Minier , Damien Hedde , qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0? v2 3/8] hw/clock: Pass optional &bool argument to clock_set_ns() Date: Mon, 25 Mar 2024 14:32:53 +0100 Message-ID: <20240325133259.57235-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240325133259.57235-1-philmd@linaro.org> References: <20240325133259.57235-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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 Pass optional &bool argument to clock_set_ns(). Since all callers ignore the return value, have them use NULL. Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/clocks.rst | 2 +- include/hw/clock.h | 8 ++------ hw/arm/stellaris.c | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/devel/clocks.rst b/docs/devel/clocks.rst index c4d14bde04..3360e5616d 100644 --- a/docs/devel/clocks.rst +++ b/docs/devel/clocks.rst @@ -298,7 +298,7 @@ object during device instance init. For example: clk = qdev_init_clock_in(DEVICE(dev), "clk-in", clk_in_callback, dev, ClockUpdate); /* set initial value to 10ns / 100MHz */ - clock_set_ns(clk, 10); + clock_set_ns(clk, 10, NULL); To enforce that the clock is wired up by the board code, you can call ``clock_has_source()`` in your device's realize method: diff --git a/include/hw/clock.h b/include/hw/clock.h index 474bbc07fe..94ed5ba6e6 100644 --- a/include/hw/clock.h +++ b/include/hw/clock.h @@ -195,13 +195,9 @@ static inline bool clock_set_hz(Clock *clk, unsigned hz) return changed; } -static inline bool clock_set_ns(Clock *clk, unsigned ns) +static inline void clock_set_ns(Clock *clk, unsigned ns, bool *changed) { - bool changed = false; - - clock_set(clk, CLOCK_PERIOD_FROM_NS(ns), &changed); - - return changed; + clock_set(clk, CLOCK_PERIOD_FROM_NS(ns), changed); } /** diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index a2f998bf9e..d4381beeb7 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -279,7 +279,7 @@ static void ssys_calculate_system_clock(ssys_state *s, bool propagate_clock) } else { period_ns = 5 * (((s->rcc >> 23) & 0xf) + 1); } - clock_set_ns(s->sysclk, period_ns); + clock_set_ns(s->sysclk, period_ns, NULL); if (propagate_clock) { clock_propagate(s->sysclk); }