Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp259980rdh; Thu, 26 Oct 2023 01:04:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmZkvD/z0cnYUT3WoT6iP+w2NIG6+A/eDDfCpyxKZQkePxHqoTpVXUcIjKkcvzmPR7dGF7 X-Received: by 2002:a81:bb43:0:b0:5a9:27c8:edbc with SMTP id a3-20020a81bb43000000b005a927c8edbcmr12875330ywl.28.1698307462530; Thu, 26 Oct 2023 01:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698307462; cv=none; d=google.com; s=arc-20160816; b=m3HiC25GVqdcGSQ/54/lJfNg1/tIQEay2VRVUklswvKyG04/RpT8o08s50+gFNMZBp rilRhdPKOy4Owt+E7sHAM++RcUGqvh7jXN/mA0R8Rz6swPETATSaIaxa056k0WjZL61f VyDYAh3ckYs9OjBocaQ6JZY3Vc2fgtRxbXNCex1k5yG0Nw08Sn6DWO/dhTEq9PLCwfSV xozomjCyhtTpsB9ddfuaq47yoo8LOmB4P8S5jSNvWHKmso/xBF+y7DC0eQMwuYcdA7Yy 0xugdwaJUjtyPtsjD1FNNoM8so95e/F16njh4twsEXd/ASzChk41X4hWgfuaMpaJfYwD PP9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=C9M/KK7S6V54TPAAhTgGkwRpbtFP3dmWsPWI2IEcphY=; fh=AOF5OWHCVN9m0jSiDS9aVb++ojqBSKZWnH+U73xr4S0=; b=OyTzHDP7SaJZTwKFQmHPMKUlT56WnABYKdqqZp/EWdaSPu0qBHq09MW3jnmYUX7DSk rFdu4vDeCWY3RRL29zUzzaorQ2i5pwNa0e54NdBVWwqy1KHA2siDXw4fJt1MSeznh3vI mB+f770F/KIc+G90aw6CRh0SgPv72lh506cUxWqBMXbvM34uaydr1BAYMYYpxJ7Goy+P JkfEPvfKkpMBJSp4htmzQYxttZmvF28VG6B2IrxTwyJv5Y2XRdGfnJvLQESvsTUBdwcO N+foqkINotQ9qssQ3f6s/K6LnRpeswpd8+4H/TI8hPsiedFWs4iAt8lCXAe0JWmdap8Y QSTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id p2-20020a0dff02000000b005a50590c49esi13497788ywf.549.2023.10.26.01.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 01:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 979FD80DB714; Thu, 26 Oct 2023 01:04:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbjJZIEJ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 26 Oct 2023 04:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjJZIEI (ORCPT ); Thu, 26 Oct 2023 04:04:08 -0400 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 643ACAC; Thu, 26 Oct 2023 01:04:06 -0700 (PDT) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-5a7af52ee31so4622797b3.2; Thu, 26 Oct 2023 01:04:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698307445; x=1698912245; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BB0o43vI8z74zHN6iTW8mGP9lEUheGzyrHw+L3QBcAU=; b=JeA1TQpH5XF6GXKsOr36H4iFgCCgLV0o7V3peAva9X6sAt9c/S5O7CK77q5k9bcO+J HICNMC2D+8nua+W28UGgzdIlEieu4Qqw2OYxXHbCY4DKj/W8CCAjuxVrqwYaoyAibF3h P7FehwUNz7ZRxVK/2Byjov9+KsdTjSPT0P5+W2y6ll8NV/msn7MdGGNY4YDPqusf+l4X nBCb4zvcwfYoiQk9B+ILLKkaz3p2rp91/kFyjRhWw7gw64/E+tBlaTFfOnjX97PhCYs9 FaYKQ9dnCWeXDwLWhSVhHKWZJUWocnn88Iw006zchI72uKmZkaPVuL6v1lJCTztHxcBR RIQA== X-Gm-Message-State: AOJu0YyB//pSvqqNTPaLeJfpxgFrr+UEmLDEhh+XOUom2c1wr9TZjxB1 rnlpuQv7jq6TE2POMSzDXbcdSv1w5gGsrQ== X-Received: by 2002:a81:48ca:0:b0:5a7:c973:c82 with SMTP id v193-20020a8148ca000000b005a7c9730c82mr18888071ywa.13.1698307445417; Thu, 26 Oct 2023 01:04:05 -0700 (PDT) Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com. [209.85.128.169]) by smtp.gmail.com with ESMTPSA id j143-20020a819295000000b005a8a7d4f9a5sm5745999ywg.28.2023.10.26.01.04.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Oct 2023 01:04:05 -0700 (PDT) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-5a7af52ee31so4622687b3.2; Thu, 26 Oct 2023 01:04:04 -0700 (PDT) X-Received: by 2002:a0d:e84b:0:b0:589:8b55:f7f7 with SMTP id r72-20020a0de84b000000b005898b55f7f7mr17337962ywe.39.1698307444821; Thu, 26 Oct 2023 01:04:04 -0700 (PDT) MIME-Version: 1.0 References: <20231026063941.1882023-1-peng.fan@oss.nxp.com> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 26 Oct 2023 10:03:52 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] clk: clk-conf: bypass setting rate/parent if already same To: Peng Fan Cc: "Peng Fan (OSS)" , "sboyd@kernel.org" , "abelvesa@kernel.org" , "mturquette@baylibre.com" , "clement.leger@bootlin.com" , "sudeep.holla@arm.com" , "cristian.marussi@arm.com" , "kernel@pengutronix.de" , "pure.logic@nexus-software.ie" , "a.fatoum@pengutronix.de" , "aford173@gmail.com" , "absahu@codeaurora.org" , "linux-clk@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 26 Oct 2023 01:04:19 -0700 (PDT) Hi Peng, On Thu, Oct 26, 2023 at 10:01 AM Peng Fan wrote: > > Subject: Re: [PATCH] clk: clk-conf: bypass setting rate/parent if already same > > On Thu, Oct 26, 2023 at 8:35 AM Peng Fan (OSS) > > wrote: > > > From: Peng Fan > > > > > > If the original rate and parent is already the same as what users > > > wanna to configure through assigned clock rate and parent, there is no > > > need to configure them again which may cause more cpu cycles or more > > > SCMI RPC calls. > > > > > > So check the rate and parent first, and bypass when the original rate > > > and parent are same as requested by device tree node. > > > > > > Signed-off-by: Peng Fan > > /** > > * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. > > * This is only valid once the clock source has been enabled. > > * @clk: clock source > > */ > > > > So at least the second part is not guaranteed to work? > > I am not sure, but seems there is no clk enabled check in clk_get_rate > function. There is indeed no such check. On most hardware, clk_get_rate() works fine when the clock is disabled, but that is not guaranteed to work everywhere. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds