From mboxrd@z Thu Jan 1 00:00:00 1970 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 EBD18ECAAD4 for ; Tue, 30 Aug 2022 08:34:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23027848B8; Tue, 30 Aug 2022 10:34:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="nJosq7Mj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A9E08494C; Tue, 30 Aug 2022 10:34:44 +0200 (CEST) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 C874F8482E for ; Tue, 30 Aug 2022 10:34:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmasson@baylibre.com Received: by mail-wm1-x331.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so5698789wms.5 for ; Tue, 30 Aug 2022 01:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc; bh=FPJOgsctG84SgtKwG8dglZVmwnIlSdb/6hvmbmY0lk0=; b=nJosq7Mj59bQ0FRf8qeq1bxrAUot5TW3rxPa60IKNIYt+HBYfSz/RPZZn/gQfu/GDK JJLM0AtzhjP5TW7hicMTN+qY+j+DyIRZhzpbFFiYcvLSPFsHQsDSz01cxFEF5ttP8+l2 RTJFv90Xtf7LSrIKB+dgk2PPKyeaHrD12/sVbs+ble1JFWQhAIRpuXCuA6yxvyqHWobc 9TKsm0iyZ7sZEDVHPvZWv4gIZelhez515pjxOrvTwdKcmwlzfUqzvrFfMlDkxz4ZD41t zvItB2ou78PPA9kC9eVXVv0voWKhhRPmY8JKtYz+Gs17amE2yZhd2KAeB3q/xn+ppVY7 zAoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=FPJOgsctG84SgtKwG8dglZVmwnIlSdb/6hvmbmY0lk0=; b=A8CrVVj7kilCj/TNZtHYSvsaAOOcdEHqt94zTKgy7xSgfx61YF+96FlAV5skRGB61d AjCW8jyjHcxXIBut4tj86xIwF6UrpMkgGLOUkspi41+/xi7uAazJk1pNf0S8BfjECwDw zr3Ua6iEXr4SqrsgbNVopV9WHMDJmLjM81FlN81aKWmbyWAjEgjPMT0Pe9lJ/eLaxRUG kzkI2bylsxegpRyb3VZD1abHjA2QbOiYkWxtZll3QTQiNqURu/r8IrXVqWQf5patATQs c6PADVrCqCYAKKM33WblefZBqNCQOWma4EVQm1hcl+8bVFvc04vW+zsRapclYG8lbppg YoYA== X-Gm-Message-State: ACgBeo1GruZkZCO4BmX+9DJND/5oIHOSQxVrt6xrA5pN/BBzI8ypMxAu BEPsT7Ed5TkEI8w9W5U3NfPqTQ== X-Google-Smtp-Source: AA6agR6m/8ds6Dp1v6eSw2p5ILU5qr3jsnwQbx4RgdIPuERmaOf7aZAeTCIgJC6v/KnCIa0xmBoKCw== X-Received: by 2002:a1c:4c0d:0:b0:3a5:98fa:3a4a with SMTP id z13-20020a1c4c0d000000b003a598fa3a4amr9040189wmf.92.1661848481255; Tue, 30 Aug 2022 01:34:41 -0700 (PDT) Received: from localhost ([82.66.159.240]) by smtp.gmail.com with ESMTPSA id bt3-20020a056000080300b0021f0ff1bc6csm1184231wrb.41.2022.08.30.01.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 01:34:40 -0700 (PDT) From: Julien Masson To: Simon Glass Cc: U-Boot Mailing List , Sean Anderson , Lukasz Majewski Subject: Re: [RFC PATCH v2] clk: fix clk_get_rate() always return ulong In-Reply-To: Date: Tue, 30 Aug 2022 10:34:40 +0200 Message-ID: <87o7w2gme7.fsf@fedora.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain 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 Hi Simon, On Tue 30 Aug 2022 at 10:32, Simon Glass wrote: > Hi Julien, > > On Mon, 29 Aug 2022 at 06:06, Julien Masson wrote: >> >> According to clk_ops struct definition, the callback `get_rate()` >> return current clock rate value as ulong. >> `clk_get_rate()` should handle the clock rate returned as ulong also. >> >> Otherwise we may have invalid/truncated clock rate value returned by >> `clk_get_rate()`. >> >> `log_ret` has also been removed since it use an `int` in the macro >> definition. >> >> Signed-off-by: Julien Masson >> --- >> drivers/clk/clk-uclass.c | 8 ++------ >> 1 file changed, 2 insertions(+), 6 deletions(-) > > Reviewed-by: Simon Glass Thanks for the review, I appreciate it. > > I would prefer to create a new log_rete() to handle this, with a long > argument and return value. But this is OK, I suppose. Yes and I guess that could be used in other functions in clk-uclass.c > >> >> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c >> index b89c77bf79..c351fa97d1 100644 >> --- a/drivers/clk/clk-uclass.c >> +++ b/drivers/clk/clk-uclass.c >> @@ -469,7 +469,7 @@ void clk_free(struct clk *clk) >> ulong clk_get_rate(struct clk *clk) >> { >> const struct clk_ops *ops; >> - int ret; >> + ulong ret; >> >> debug("%s(clk=%p)\n", __func__, clk); >> if (!clk_valid(clk)) >> @@ -479,11 +479,7 @@ ulong clk_get_rate(struct clk *clk) >> if (!ops->get_rate) >> return -ENOSYS; >> >> - ret = ops->get_rate(clk); >> - if (ret) >> - return log_ret(ret); >> - >> - return 0; >> + return ops->get_rate(clk); >> } >> >> struct clk *clk_get_parent(struct clk *clk) >> -- >> 2.37.2 >> > > Regards, > Simon -- Julien Masson