Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp96292rdb; Wed, 21 Feb 2024 19:03:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXlvuTI6InT7eIJbxagNY46AVRhVTV3lcvzLM/skta8LULoDEyNMQzh36XdEYfSKKLJGiYNOUSPXLIy7ajdfBk6xHU1jgas8Z5h0FHGww== X-Google-Smtp-Source: AGHT+IFDKqw/+XCBornYjeQSVOhenKFZnmaIN4bAm+s3WNKa2C/HZ1rnZFSGaHQTFgYZG8rJ00Lb X-Received: by 2002:a0c:f503:0:b0:68f:736b:1fb8 with SMTP id j3-20020a0cf503000000b0068f736b1fb8mr10168191qvm.3.1708571005946; Wed, 21 Feb 2024 19:03:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708571005; cv=pass; d=google.com; s=arc-20160816; b=TtMqnkePR46trtGngz2KGM1XJ/itMv/OiMROoTwi3R27ekoLSU6pEdtFEwPvZoHG1p bvlbi3NcL7WP/S4zK7QPtEkYtegpzHH9zDDO0SnIKQLnSNIb20L4+O9glb+mltLofY8n z6FtoANIjJv1PjM1ElAwZ4BXFb0gKiTodSxtejd+7SNe8hmosKKFN6WICNaQqSMAJVh5 3M54C85mjItpjokWFq/mMTy2mnOSfbxJvahS/mEzJNaw2H0AnqkZnhKyLNoCupJnM9p8 GgcINzRunSW/Etu8/OXrL4s+J1qTabu5oqgQQoW8mUVR0sXOdBteXGtpsM3cu+773dga umTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ID9ZSTbHJR/LMatneT/X93cat75UpJiqh+CbEK1RNJ4=; fh=ObhX6WvNQV+ok7G42YhF5FrR79E6+5t9D2SJFUfrqAU=; b=ZOH2IGfZZrcufJ9r6pTBTUan+04UHq67TGwYF/8MNA2ZYOfkt/dfukSSKcmA0flt0f xsdRonlI27f9R48o7BWquw5icdAXx5ExRI1CJoX3/A6tBsG3W2dAfGzIQ68/i7J8XudB +03HLxk0AGmDcasG8SUTvkhqYj+VIGVXRgHKDni6n2XmCReE3Oy0C8bqeXDHADIrUDfX Mc3UXgwzdn5Df3b6Duu59eVvbSPM3zQU/I9kBU8dN72d18oT25KXCTLWM9lPD9pOmGCh fWeiF/CMbwXXTImxW9vNSb/pzvb5UsW6QMmtDTZqMIcuVI0UwBAM5MjIU30fmgaroew6 Q//Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FkcT+Tfr; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-75819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75819-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id im12-20020a056214246c00b0068cb0f6bc39si12169776qvb.431.2024.02.21.19.03.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:03:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FkcT+Tfr; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-75819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75819-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A4E461C21BF9 for ; Thu, 22 Feb 2024 03:03:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 167AB1775F; Thu, 22 Feb 2024 03:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FkcT+Tfr" Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AFBC17593 for ; Thu, 22 Feb 2024 03:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708570962; cv=none; b=fKNpyb6WzgFfJpvFnVlfxSMG3EeqBcS4CE/vew1vGG9T1GEccJDumXUCCJ3rHZ5/pwpqr/np7iA0IgMLcLO5RO8LvYs8PZ/u0Z81PqtxtlNsTH+B3l7J0JJf7hQAleOVai5gSbv6dxRmGAXcYFcacKj80YvvuCm1aONMbyFzWfE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708570962; c=relaxed/simple; bh=4BIYBpub7umaVofmnwjSmDMnZ8tN6z9wJoCkm2qteKE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xl1vfiJd07B+/xgBShAJCdl43tSncLvfiBFgWZOepH8m9RitZx1YrQua5PX9668hW0EItHmWwQki2IItrTpvVFPILCyxMF554/K21PvCKxULeQX6cmY5HOPDqZlwnwztnVhMT7zWckIj4LbYbHffgKYFvwGc0qX97wCa2um1x4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FkcT+Tfr; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-59a87156cb8so2295654eaf.2 for ; Wed, 21 Feb 2024 19:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708570959; x=1709175759; darn=vger.kernel.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=ID9ZSTbHJR/LMatneT/X93cat75UpJiqh+CbEK1RNJ4=; b=FkcT+TfrXwxutwEmc3pwnaI5ojB5v+W7lYJWCJjzyhGSsDZPhD70QjRReQO0kNdq01 Q2ZtIhMLpuCs/bsFsUDdw3893aS2CcwB1+TZ1J8qYbV1GcUtDZ4VKi+p5zp9aKvAyBTd sajIOsGy8mdtmAvVRAKDAR5U5VKAT60AaqHnPdw5kIFXZpqRgi/ydetPlxcXtq6/0C7A A3GuljOjqMywEaTdAZcLPArNupc+78dlq0hvYiPyrrGj2wVUeq1farQYViF4fZ5P8xN/ udpEozjcDijpqPERHlJIMPVg8fLPJrJi0bkVrPXJZZUSJFgN3BGg52pEI3mIpZptOXgi eZ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708570959; x=1709175759; 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=ID9ZSTbHJR/LMatneT/X93cat75UpJiqh+CbEK1RNJ4=; b=AHNLssJZ21cFHjZFjdHepO7uV67ofi2AHhzUwNpJfpdtW9/T3i9DyEhD8Hrfv2bRzz MX2gvc74ynCMk7Gi7hJ3SIgnOLOxOyMU20wQzDZNQKLb0RzwxRqxGtP0OtJ/9oAh3rgF PfHVnwPQFfv2eUUKKjPiCjzuYUr9okZZA/0edEPE2fJyH7GcScal8aeBtIMe5wYqR5n2 8/YYRtdaHwMghkjNlAkNETZY/Jf1kKiHGiI27CdKfpmKp6h9cUa6JCEGXCHVeKM/pgaR cacTeHlW8tZ969RHJw1HpgZQIQ6HXKOWWw1eDSywvKz0hjMiY05CEFmcoKr0z8bybXmV mMjw== X-Forwarded-Encrypted: i=1; AJvYcCXHQPGkTZgAgxZmm1TXStRGlVBDVa52StYq9+4UZs2s5YT7/cMTPxgnLjlsHzGJdJddjauRyS4HDyjjJUUNl+iVVIjXs02FKl1iDSQx X-Gm-Message-State: AOJu0YzeB4kQC5S4p9MfKELZyH8KzttQc4AdY9Gu+kjiUOMV8w7dqY6m z9HHcbgo5x36eZq5GwXDPzXKPY5uy95w0sjFrMZU1tFXCR8xL0YGRvs4Ta46OcQ= X-Received: by 2002:a4a:9d09:0:b0:59f:9910:45ed with SMTP id w9-20020a4a9d09000000b0059f991045edmr18355684ooj.1.1708570959437; Wed, 21 Feb 2024 19:02:39 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id l15-20020a4a350f000000b0059d7a60e4a6sm107750ooa.44.2024.02.21.19.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:02:39 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi Cc: Alim Akhtar , Michael Turquette , Stephen Boyd , Rob Herring , Conor Dooley , Tomasz Figa , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/15] clk: samsung: Reduce params count in exynos_register_cpu_clock() Date: Wed, 21 Feb 2024 21:02:24 -0600 Message-Id: <20240222030235.27815-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222030235.27815-1-semen.protsenko@linaro.org> References: <20240222030235.27815-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Pass CPU clock data structure to exynos_register_cpu_clock() instead of passing its fields separately there. That simplifies the signature of exynos_register_cpu_clock() and makes it easier to add more fields to struct samsung_cpu_clock later. This style follows the example of samsung_clk_register_pll(). No functional change. Signed-off-by: Sam Protsenko --- Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 6412fd2580e0..7b6fd331a7ec 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -432,16 +432,19 @@ static int exynos5433_cpuclk_notifier_cb(struct notifier_block *nb, /* helper function to register a CPU clock */ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, - unsigned int lookup_id, const char *name, - const struct clk_hw *parent, const struct clk_hw *alt_parent, - unsigned long offset, const struct exynos_cpuclk_cfg_data *cfg, - unsigned long num_cfgs, unsigned long flags) + const struct samsung_cpu_clock *clk_data) { + const struct clk_hw *parent, *alt_parent; + struct clk_hw **hws; struct exynos_cpuclk *cpuclk; struct clk_init_data init; const char *parent_name; + unsigned int num_cfgs; int ret = 0; + hws = ctx->clk_data.hws; + parent = hws[clk_data->parent_id]; + alt_parent = hws[clk_data->alt_parent_id]; if (IS_ERR(parent) || IS_ERR(alt_parent)) { pr_err("%s: invalid parent clock(s)\n", __func__); return -EINVAL; @@ -453,7 +456,7 @@ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, parent_name = clk_hw_get_name(parent); - init.name = name; + init.name = clk_data->name; init.flags = CLK_SET_RATE_PARENT; init.parent_names = &parent_name; init.num_parents = 1; @@ -461,10 +464,10 @@ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, cpuclk->alt_parent = alt_parent; cpuclk->hw.init = &init; - cpuclk->ctrl_base = ctx->reg_base + offset; + cpuclk->ctrl_base = ctx->reg_base + clk_data->offset; cpuclk->lock = &ctx->lock; - cpuclk->flags = flags; - if (flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) + cpuclk->flags = clk_data->flags; + if (clk_data->flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) cpuclk->clk_nb.notifier_call = exynos5433_cpuclk_notifier_cb; else cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb; @@ -472,11 +475,16 @@ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, ret = clk_notifier_register(parent->clk, &cpuclk->clk_nb); if (ret) { pr_err("%s: failed to register clock notifier for %s\n", - __func__, name); + __func__, clk_data->name); goto free_cpuclk; } - cpuclk->cfg = kmemdup(cfg, sizeof(*cfg) * num_cfgs, GFP_KERNEL); + /* Find count of configuration rates in cfg */ + for (num_cfgs = 0; clk_data->cfg[num_cfgs].prate != 0; ) + num_cfgs++; + + cpuclk->cfg = kmemdup(clk_data->cfg, sizeof(*clk_data->cfg) * num_cfgs, + GFP_KERNEL); if (!cpuclk->cfg) { ret = -ENOMEM; goto unregister_clk_nb; @@ -484,11 +492,12 @@ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, ret = clk_hw_register(NULL, &cpuclk->hw); if (ret) { - pr_err("%s: could not register cpuclk %s\n", __func__, name); + pr_err("%s: could not register cpuclk %s\n", __func__, + clk_data->name); goto free_cpuclk_data; } - samsung_clk_add_lookup(ctx, &cpuclk->hw, lookup_id); + samsung_clk_add_lookup(ctx, &cpuclk->hw, clk_data->id); return 0; free_cpuclk_data: @@ -504,16 +513,7 @@ void __init samsung_clk_register_cpu(struct samsung_clk_provider *ctx, const struct samsung_cpu_clock *list, unsigned int nr_clk) { unsigned int idx; - unsigned int num_cfgs; - struct clk_hw **hws = ctx->clk_data.hws; - for (idx = 0; idx < nr_clk; idx++, list++) { - /* find count of configuration rates in cfg */ - for (num_cfgs = 0; list->cfg[num_cfgs].prate != 0; ) - num_cfgs++; - - exynos_register_cpu_clock(ctx, list->id, list->name, - hws[list->parent_id], hws[list->alt_parent_id], - list->offset, list->cfg, num_cfgs, list->flags); - } + for (idx = 0; idx < nr_clk; idx++) + exynos_register_cpu_clock(ctx, &list[idx]); } -- 2.39.2