From nobody Mon Feb 9 17:22:58 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0606F33437B for ; Thu, 8 Jan 2026 21:17:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767907049; cv=none; b=GcZpYn0VVXDsqodmIUSGK+O3Sb/5QjR29oXG3xxqnxR3FPdDnVtpn8ZfSLMPC8+GK3BmmyUu8uZtWbk/BLyeUTs0oablUgmy8zXV1nelNLvlIRi7OxM88dPyAbIlsnZ0NEkt+PwmMKx4UdGJT2mTsGMkysCpTBwyGnly55qAMbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767907049; c=relaxed/simple; bh=3zRP30fGHCdFEy8G2kANYis3hdN+Sxu8ZaRLGWZxIhQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oDsJT4ux3s1WPLJB0oSJbY1CiXMH7TvzhkTaZQ7KeN41qk6GpXP7F/vCQ6JAsw9Y4YhPqYJm159sl+qpjPGfAcgSkOgkcih7HqenG90sgxcQ9iGYa8OufgkWTRh3DKbS/NYvZVWsJVOO8IRRXq+pn2aaVeqCLlUGmLBjgzxD6VY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SVQ38/+6; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ckOz3j0Z; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SVQ38/+6"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ckOz3j0Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767907038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=raRHT5WnuULt1ZgYEopiIagMqGInX7Y1nhkVtkDwgRw=; b=SVQ38/+65sRBFHI67JVqctYlcR2qzOi9lvtkPY6x+E0lZDQPM6/Fl3oLn1kj9iRDmzeqw+ Xo/WoAgiybseVhTYkWs0wYhA/dHKzwxi/S/FFhmuL8jaXiQABl9/uiEIcv3qPJfNlRXZ4Y o7SuG/6bZoqXcgOsYt7PrxeCx3M8UQA= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-232-Nf6siaTdMRCnPYTQPgNLgQ-1; Thu, 08 Jan 2026 16:17:17 -0500 X-MC-Unique: Nf6siaTdMRCnPYTQPgNLgQ-1 X-Mimecast-MFC-AGG-ID: Nf6siaTdMRCnPYTQPgNLgQ_1767907037 Received: by mail-vs1-f70.google.com with SMTP id ada2fe7eead31-5eede4bf7beso362103137.2 for ; Thu, 08 Jan 2026 13:17:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1767907037; x=1768511837; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=raRHT5WnuULt1ZgYEopiIagMqGInX7Y1nhkVtkDwgRw=; b=ckOz3j0ZXjgqNve3qsE00viyFbaz6WJECLZIrXa2caxLfNedo8QPAMknWfXehN4zA7 PVil+1VEghj5V6G8fnPWknFMhgQ0y8m2CFV4Dtbr+TPNI9fb58Z+jc0yL1LLjTbPjtSa 60s1QgGZ9/Egm9cmGwRUDlh/ikwuvsLGmslEqqwKvxpuG0BOKlO0NqEprZTiqdHZ7niC z2rL8pgcMSm6Bq0DWNUnY7XwzgmyRvh2audw8vjktJpqevIpFE7GZbsiTuCTQrA6fON4 kWqS4XiRfc1wrOUbZMfITK+3c294d5XgshC/U3LgdMQ/KQyRxjtDOwqheWqCG/DE/VKL K/7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767907037; x=1768511837; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=raRHT5WnuULt1ZgYEopiIagMqGInX7Y1nhkVtkDwgRw=; b=WM7gA2STQi67L8YcsVg9FfZErJ6fEQriH0JJ0a+p4wOPUTKkbuPW/30ejE0ODHlUty f211VovVakMyGG6oHp3khcJqiwdxHVfco0rs6qeiU43wNYk/FBz93PAbddx8RhWYLuvi EQuUHOMKeuI2LS1JMSkp/iaypaieUfWfPoCyMNmUF0MMXx8SGGSjtH6FD5hw/82L6AHq +8kYN/z0Zws/qHqseE/S2O+b9KGw5TqyX42qpeQbGHC3KI+CulM9zgM/TEL3ocIruB1Q TddB5PxLPx1INl1yW5AFyBPVFH6ntwYOSvY/R2hlRtGP1LrxUVvcvAUgIdCW6WikvId6 j7qA== X-Forwarded-Encrypted: i=1; AJvYcCX96c5H2XeRj000/6wFb/j9m/GIJ8SfISZXn6/ZKc6JoUm+m9c3BGL6L98HK+oECCz+ELNoiFL6FMRTUuc=@vger.kernel.org X-Gm-Message-State: AOJu0YxYnMJTUSsqi1VbwbAsSUZdAR50p0G6gJlrqoCik8yY1CMCxaRj kbV+T/zFGJBA5/z063HS3I7khnJTwNoa+0iJZPWkdx+4mVLJXmcs0AbjH6RGTcWjoEP5VOIrGUX 3dh2bfUhSdSaB04yLwRr1qI6YixHsXj3sM7kDzg5A/jEaMCAj+/GLfzCb2/nBkqUBow== X-Gm-Gg: AY/fxX6Abt1fQ73isY1/tHtsgwu1/nwwWoA+wvXTmjSyCw0UFlX5P7PcoGVhFhpkR1E g2JZyZuua0Ae3txgClt0a3lOBf+zhV0Pbmn8XCPmzm0PDD0Li7Ys90+QKNDvZ1hFHFijzJZSlBY F4PpKvcVcivaQ5pJlKuQy61GkwDotfNUMhxHMV5fWvEfmuyloCs9tYPR/7Fi/mgAcOKREP4+EFG 0xSnlmk33EZtcLjqFjO3PUxnDhDVP9uKQ5M2MlDKJfZxcl/IQv8iBcU/WfQa6ZvR5Q6k4aaM5iH J3Iai3Zy6izRCskKegh9sfZ+Kv9qbkLQ9Kg3iZpua/toeXEKrxDPJv+8vGz20Z6sQOo0v3m+Nns rAtKWOTg5doMcHFs= X-Received: by 2002:a05:6102:cc8:b0:5db:e32d:a3f4 with SMTP id ada2fe7eead31-5ecb5cb9399mr3364024137.2.1767907036615; Thu, 08 Jan 2026 13:17:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmHji8qpki9wdGlac1NUaaS92iNEPZxoc6SlN6mMqQXlfbPB9E4nsCuXLG4wlMPy3zayxjlw== X-Received: by 2002:a05:6102:cc8:b0:5db:e32d:a3f4 with SMTP id ada2fe7eead31-5ecb5cb9399mr3364013137.2.1767907036197; Thu, 08 Jan 2026 13:17:16 -0800 (PST) Received: from [10.30.226.224] ([2600:382:811f:d757:daa5:b867:12a3:9d12]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-5ec77064e86sm7623329137.7.2026.01.08.13.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 13:17:15 -0800 (PST) From: Brian Masney Date: Thu, 08 Jan 2026 16:16:20 -0500 Subject: [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() to divider_determine_rate() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260108-clk-divider-round-rate-v1-2-535a3ed73bf3@redhat.com> References: <20260108-clk-divider-round-rate-v1-0-535a3ed73bf3@redhat.com> In-Reply-To: <20260108-clk-divider-round-rate-v1-0-535a3ed73bf3@redhat.com> To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Brian Masney , Chen-Yu Tsai , Maxime Ripard , Jernej Skrabec , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=13075; i=bmasney@redhat.com; s=20250903; h=from:subject:message-id; bh=3zRP30fGHCdFEy8G2kANYis3hdN+Sxu8ZaRLGWZxIhQ=; b=owGbwMvMwCW2/dJd9di6A+2Mp9WSGDIT5LaunTJPPLi89OIZoffbVshMiGn9+XnXM251xXLJE /VCFlHMHaUsDGJcDLJiiixLco0KIlJX2d67o8kCM4eVCWQIAxenAEykp4rhn1KLNevdFQ1ueZsL b6V67jtq9CXhQnKU02uegOcyV98ziDEyfJeJYlAK/+86p2D78837fnptT2GXyd0eoCf0K/l90T1 TPgA= X-Developer-Key: i=bmasney@redhat.com; a=openpgp; fpr=A46D32705865AA3DDEDC2904B7D2DD275D7EC087 The divider_round_rate_parent() function is now deprecated, so let's migrate to divider_determine_rate() instead so that this deprecated API can be removed. Also go ahead and convert all of the driver from round rate type to determine rate that accepts a 'struct clk_rate_request' to simplify the overall driver code. Signed-off-by: Brian Masney Acked-by: Chen-Yu Tsai --- To: Chen-Yu Tsai To: Maxime Ripard To: Jernej Skrabec To: Samuel Holland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-sunxi@lists.linux.dev --- drivers/clk/sunxi-ng/ccu_div.c | 25 ++++++++++----------- drivers/clk/sunxi-ng/ccu_mp.c | 26 +++++++++++----------- drivers/clk/sunxi-ng/ccu_mult.c | 16 +++++++------- drivers/clk/sunxi-ng/ccu_mux.c | 49 +++++++++++++++++++++++++------------= ---- drivers/clk/sunxi-ng/ccu_mux.h | 8 +++---- drivers/clk/sunxi-ng/ccu_nkm.c | 25 +++++++++++---------- 6 files changed, 79 insertions(+), 70 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c index 916d6da6d8a3b29240e086eaebbbc620346eef91..62d680ccb524b39d54f0e908c79= 736f0619f1b4b 100644 --- a/drivers/clk/sunxi-ng/ccu_div.c +++ b/drivers/clk/sunxi-ng/ccu_div.c @@ -10,26 +10,25 @@ #include "ccu_gate.h" #include "ccu_div.h" =20 -static unsigned long ccu_div_round_rate(struct ccu_mux_internal *mux, - struct clk_hw *parent, - unsigned long *parent_rate, - unsigned long rate, - void *data) +static int ccu_div_determine_rate_helper(struct ccu_mux_internal *mux, + struct clk_rate_request *req, + void *data) { struct ccu_div *cd =3D data; + int ret; =20 if (cd->common.features & CCU_FEATURE_FIXED_POSTDIV) - rate *=3D cd->fixed_post_div; + req->rate *=3D cd->fixed_post_div; =20 - rate =3D divider_round_rate_parent(&cd->common.hw, parent, - rate, parent_rate, - cd->div.table, cd->div.width, - cd->div.flags); + ret =3D divider_determine_rate(&cd->common.hw, req, cd->div.table, + cd->div.width, cd->div.flags); + if (ret) + return ret; =20 if (cd->common.features & CCU_FEATURE_FIXED_POSTDIV) - rate /=3D cd->fixed_post_div; + req->rate /=3D cd->fixed_post_div; =20 - return rate; + return 0; } =20 static void ccu_div_disable(struct clk_hw *hw) @@ -82,7 +81,7 @@ static int ccu_div_determine_rate(struct clk_hw *hw, struct ccu_div *cd =3D hw_to_ccu_div(hw); =20 return ccu_mux_helper_determine_rate(&cd->common, &cd->mux, - req, ccu_div_round_rate, cd); + req, ccu_div_determine_rate_helper, cd); } =20 static int ccu_div_set_rate(struct clk_hw *hw, unsigned long rate, diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c index 4221b1888b38da22c16c90796abe6ffab9dc6291..7cdb0eedc69b53aacc8bfb54e30= 9f2013821377b 100644 --- a/drivers/clk/sunxi-ng/ccu_mp.c +++ b/drivers/clk/sunxi-ng/ccu_mp.c @@ -103,11 +103,9 @@ static unsigned long ccu_mp_find_best_with_parent_adj(= struct clk_hw *hw, return best_rate; } =20 -static unsigned long ccu_mp_round_rate(struct ccu_mux_internal *mux, - struct clk_hw *hw, - unsigned long *parent_rate, - unsigned long rate, - void *data) +static int ccu_mp_determine_rate_helper(struct ccu_mux_internal *mux, + struct clk_rate_request *req, + void *data) { struct ccu_mp *cmp =3D data; unsigned int max_m, max_p; @@ -115,7 +113,7 @@ static unsigned long ccu_mp_round_rate(struct ccu_mux_i= nternal *mux, bool shift =3D true; =20 if (cmp->common.features & CCU_FEATURE_FIXED_POSTDIV) - rate *=3D cmp->fixed_post_div; + req->rate *=3D cmp->fixed_post_div; =20 if (cmp->common.features & CCU_FEATURE_DUAL_DIV) shift =3D false; @@ -127,17 +125,19 @@ static unsigned long ccu_mp_round_rate(struct ccu_mux= _internal *mux, max_p =3D cmp->p.max ?: 1 << cmp->p.width; =20 if (!clk_hw_can_set_rate_parent(&cmp->common.hw)) { - rate =3D ccu_mp_find_best(*parent_rate, rate, max_m, max_p, shift, - &m, &p); + req->rate =3D ccu_mp_find_best(req->best_parent_rate, req->rate, + max_m, max_p, shift, &m, &p); } else { - rate =3D ccu_mp_find_best_with_parent_adj(hw, parent_rate, rate, - max_m, max_p, shift); + req->rate =3D ccu_mp_find_best_with_parent_adj(req->best_parent_hw, + &req->best_parent_rate, + req->rate, max_m, max_p, + shift); } =20 if (cmp->common.features & CCU_FEATURE_FIXED_POSTDIV) - rate /=3D cmp->fixed_post_div; + req->rate /=3D cmp->fixed_post_div; =20 - return rate; + return 0; } =20 static void ccu_mp_disable(struct clk_hw *hw) @@ -201,7 +201,7 @@ static int ccu_mp_determine_rate(struct clk_hw *hw, struct ccu_mp *cmp =3D hw_to_ccu_mp(hw); =20 return ccu_mux_helper_determine_rate(&cmp->common, &cmp->mux, - req, ccu_mp_round_rate, cmp); + req, ccu_mp_determine_rate_helper, cmp); } =20 static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate, diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mul= t.c index 8d5720f3dec1d4eb34bf22166277fdf5a270da42..3fc81e7de6e93d3b8efa1debe08= 566860617c166 100644 --- a/drivers/clk/sunxi-ng/ccu_mult.c +++ b/drivers/clk/sunxi-ng/ccu_mult.c @@ -29,11 +29,9 @@ static void ccu_mult_find_best(unsigned long parent, uns= igned long rate, mult->mult =3D _mult; } =20 -static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux, - struct clk_hw *parent, - unsigned long *parent_rate, - unsigned long rate, - void *data) +static int ccu_mult_determine_rate_helper(struct ccu_mux_internal *mux, + struct clk_rate_request *req, + void *data) { struct ccu_mult *cm =3D data; struct _ccu_mult _cm; @@ -45,9 +43,11 @@ static unsigned long ccu_mult_round_rate(struct ccu_mux_= internal *mux, else _cm.max =3D (1 << cm->mult.width) + cm->mult.offset - 1; =20 - ccu_mult_find_best(*parent_rate, rate, &_cm); + ccu_mult_find_best(req->best_parent_rate, req->rate, &_cm); =20 - return *parent_rate * _cm.mult; + req->rate =3D req->best_parent_rate * _cm.mult; + + return 0; } =20 static void ccu_mult_disable(struct clk_hw *hw) @@ -97,7 +97,7 @@ static int ccu_mult_determine_rate(struct clk_hw *hw, struct ccu_mult *cm =3D hw_to_ccu_mult(hw); =20 return ccu_mux_helper_determine_rate(&cm->common, &cm->mux, - req, ccu_mult_round_rate, cm); + req, ccu_mult_determine_rate_helper, cm); } =20 static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate, diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c index 74f9e98a5d355d6a26b1655c25e9e48da1f6f10d..766f27cff748edca73ccee610ce= 1e814600e6404 100644 --- a/drivers/clk/sunxi-ng/ccu_mux.c +++ b/drivers/clk/sunxi-ng/ccu_mux.c @@ -79,41 +79,46 @@ static unsigned long ccu_mux_helper_unapply_prediv(stru= ct ccu_common *common, int ccu_mux_helper_determine_rate(struct ccu_common *common, struct ccu_mux_internal *cm, struct clk_rate_request *req, - unsigned long (*round)(struct ccu_mux_internal *, - struct clk_hw *, - unsigned long *, - unsigned long, - void *), + int (*round)(struct ccu_mux_internal *, + struct clk_rate_request *, + void *), void *data) { unsigned long best_parent_rate =3D 0, best_rate =3D 0; struct clk_hw *best_parent, *hw =3D &common->hw; unsigned int i; + int ret; =20 if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) { - unsigned long adj_parent_rate; + struct clk_rate_request adj_req =3D *req; =20 best_parent =3D clk_hw_get_parent(hw); best_parent_rate =3D clk_hw_get_rate(best_parent); - adj_parent_rate =3D ccu_mux_helper_apply_prediv(common, cm, -1, - best_parent_rate); =20 - best_rate =3D round(cm, best_parent, &adj_parent_rate, - req->rate, data); + adj_req.best_parent_hw =3D best_parent; + adj_req.best_parent_rate =3D ccu_mux_helper_apply_prediv(common, cm, -1, + best_parent_rate); + + ret =3D round(cm, &adj_req, data); + if (ret) + return ret; + + best_rate =3D adj_req.rate; =20 /* - * adj_parent_rate might have been modified by our clock. + * best_parent_rate might have been modified by our clock. * Unapply the pre-divider if there's one, and give * the actual frequency the parent needs to run at. */ best_parent_rate =3D ccu_mux_helper_unapply_prediv(common, cm, -1, - adj_parent_rate); + adj_req.best_parent_rate); =20 goto out; } =20 for (i =3D 0; i < clk_hw_get_num_parents(hw); i++) { - unsigned long tmp_rate, parent_rate; + struct clk_rate_request tmp_req =3D *req; + unsigned long parent_rate; struct clk_hw *parent; =20 parent =3D clk_hw_get_parent_by_index(hw, i); @@ -123,7 +128,12 @@ int ccu_mux_helper_determine_rate(struct ccu_common *c= ommon, parent_rate =3D ccu_mux_helper_apply_prediv(common, cm, i, clk_hw_get_rate(parent)); =20 - tmp_rate =3D round(cm, parent, &parent_rate, req->rate, data); + tmp_req.best_parent_hw =3D parent; + tmp_req.best_parent_rate =3D parent_rate; + + ret =3D round(cm, &tmp_req, data); + if (ret) + continue; =20 /* * parent_rate might have been modified by our clock. @@ -131,16 +141,17 @@ int ccu_mux_helper_determine_rate(struct ccu_common *= common, * the actual frequency the parent needs to run at. */ parent_rate =3D ccu_mux_helper_unapply_prediv(common, cm, i, - parent_rate); - if (tmp_rate =3D=3D req->rate) { + tmp_req.best_parent_rate); + + if (tmp_req.rate =3D=3D req->rate) { best_parent =3D parent; best_parent_rate =3D parent_rate; - best_rate =3D tmp_rate; + best_rate =3D tmp_req.rate; goto out; } =20 - if (ccu_is_better_rate(common, req->rate, tmp_rate, best_rate)) { - best_rate =3D tmp_rate; + if (ccu_is_better_rate(common, req->rate, tmp_req.rate, best_rate)) { + best_rate =3D tmp_req.rate; best_parent_rate =3D parent_rate; best_parent =3D parent; } diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h index eb1172ebbd94b5e3515f618390a4753c7eb5be4d..c94a4bde5d01604ac2b317babd4= 368151d0d08ab 100644 --- a/drivers/clk/sunxi-ng/ccu_mux.h +++ b/drivers/clk/sunxi-ng/ccu_mux.h @@ -137,11 +137,9 @@ unsigned long ccu_mux_helper_apply_prediv(struct ccu_c= ommon *common, int ccu_mux_helper_determine_rate(struct ccu_common *common, struct ccu_mux_internal *cm, struct clk_rate_request *req, - unsigned long (*round)(struct ccu_mux_internal *, - struct clk_hw *, - unsigned long *, - unsigned long, - void *), + int (*round)(struct ccu_mux_internal *, + struct clk_rate_request *, + void *), void *data); u8 ccu_mux_helper_get_parent(struct ccu_common *common, struct ccu_mux_internal *cm); diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 784eec9ac9979b22e8f384e0abbb5c1a381ae953..401fbb752479b787092c53dfd87= 0692e9eb70dba 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -162,11 +162,9 @@ static unsigned long ccu_nkm_recalc_rate(struct clk_hw= *hw, return rate; } =20 -static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, - struct clk_hw *parent_hw, - unsigned long *parent_rate, - unsigned long rate, - void *data) +static int ccu_nkm_determine_rate_helper(struct ccu_mux_internal *mux, + struct clk_rate_request *req, + void *data) { struct ccu_nkm *nkm =3D data; struct _ccu_nkm _nkm; @@ -179,18 +177,21 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mu= x_internal *mux, _nkm.max_m =3D nkm->m.max ?: 1 << nkm->m.width; =20 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) - rate *=3D nkm->fixed_post_div; + req->rate *=3D nkm->fixed_post_div; =20 if (!clk_hw_can_set_rate_parent(&nkm->common.hw)) - rate =3D ccu_nkm_find_best(*parent_rate, rate, &_nkm, &nkm->common); + req->rate =3D ccu_nkm_find_best(req->best_parent_rate, req->rate, + &_nkm, &nkm->common); else - rate =3D ccu_nkm_find_best_with_parent_adj(&nkm->common, parent_hw, pare= nt_rate, rate, - &_nkm); + req->rate =3D ccu_nkm_find_best_with_parent_adj(&nkm->common, + req->best_parent_hw, + &req->best_parent_rate, + req->rate, &_nkm); =20 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) - rate /=3D nkm->fixed_post_div; + req->rate /=3D nkm->fixed_post_div; =20 - return rate; + return 0; } =20 static int ccu_nkm_determine_rate(struct clk_hw *hw, @@ -199,7 +200,7 @@ static int ccu_nkm_determine_rate(struct clk_hw *hw, struct ccu_nkm *nkm =3D hw_to_ccu_nkm(hw); =20 return ccu_mux_helper_determine_rate(&nkm->common, &nkm->mux, - req, ccu_nkm_round_rate, nkm); + req, ccu_nkm_determine_rate_helper, nkm); } =20 static int ccu_nkm_set_rate(struct clk_hw *hw, unsigned long rate, --=20 2.52.0