netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "Manikanta Mylavarapu" <quic_mmanikan@quicinc.com>,
	"Marek Behún" <kabel@kernel.org>
Cc: andersson@kernel.org, mturquette@baylibre.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, konradybcio@kernel.org,
	catalin.marinas@arm.com, will@kernel.org, p.zabel@pengutronix.de,
	richardcochran@gmail.com, geert+renesas@glider.be,
	lumag@kernel.org, heiko@sntech.de, biju.das.jz@bp.renesas.com,
	quic_tdas@quicinc.com, nfraprado@collabora.com,
	elinor.montmasson@savoirfairelinux.com, ross.burton@arm.com,
	javier.carrasco@wolfvision.net, ebiggers@google.com,
	quic_anusha@quicinc.com, linux-arm-msm@vger.kernel.org,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	quic_varada@quicinc.com, quic_srichara@quicinc.com
Subject: Re: [PATCH v12 4/6] clk: qcom: Add NSS clock Controller driver for IPQ9574
Date: Tue, 18 Mar 2025 15:50:31 -0700	[thread overview]
Message-ID: <ef86ccad056bc03af7f01d5696787766.sboyd@kernel.org> (raw)
In-Reply-To: <65gl7d6qd55xrdm3as3pnqevpmakin3k4jzyocehq7wq7565jj@x35t2inlykop>

Quoting Marek Behún (2025-03-17 07:08:16)
> On Thu, Mar 13, 2025 at 04:33:57PM +0530, Manikanta Mylavarapu wrote:
> 
> > +static struct clk_rcg2 nss_cc_clc_clk_src = {
> > +     .cmd_rcgr = 0x28604,
> > +     .mnd_width = 0,
> > +     .hid_width = 5,
> > +     .parent_map = nss_cc_parent_map_6,
> > +     .freq_tbl = ftbl_nss_cc_clc_clk_src,
> > +     .clkr.hw.init = &(const struct clk_init_data) {
> > +             .name = "nss_cc_clc_clk_src",
> > +             .parent_data = nss_cc_parent_data_6,
> > +             .num_parents = ARRAY_SIZE(nss_cc_parent_data_6),
> > +             .ops = &clk_rcg2_ops,
> > +     },
> > +};
> 
> This structure definition gets repeated many times in this driver,
> with only slight changes. (This also happens in other qualcomm clock
> drivers.)
> 
> Would it be possible to refactor it into a macro, to avoid the
> insane code repetition?
> 

We have this discussion every couple years or so. The short answer is
no. The long answer is that it makes it harder to read because we don't
know what argument to the macro corresponds to the struct members.

It could probably use the CLK_HW_INIT_PARENTS_DATA macro though.

static struct clk_rcg2 nss_cc_clc_clk_src = {
     .cmd_rcgr = 0x28604,
     .mnd_width = 0,
     .hid_width = 5,
     .parent_map = nss_cc_parent_map_6,
     .freq_tbl = ftbl_nss_cc_clc_clk_src,
     .clkr.hw.init = CLK_HW_INIT_PARENTS_DATA("nss_cc_clc_clk_src",
                                              nss_cc_parent_data_6,
					      &clk_rcg2_ops, 0),
     },
};

but then we lose the const. Oh well.

The whole qcom clk driver probably needs an overhaul to just have
descriptors that populate a bunch of clks that are allocated at probe
time so that the memory footprint is smaller if you have multiple clk
drivers loaded and so that we can probe the driver again without
unloading the whole kernel module.

  reply	other threads:[~2025-03-18 22:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 11:03 [PATCH v12 0/6] Add NSS clock controller support for IPQ9574 Manikanta Mylavarapu
2025-03-13 11:03 ` [PATCH v12 1/6] dt-bindings: clock: gcc-ipq9574: Add definition for GPLL0_OUT_AUX Manikanta Mylavarapu
2025-03-13 11:03 ` [PATCH v12 2/6] clk: qcom: gcc-ipq9574: Add support for gpll0_out_aux clock Manikanta Mylavarapu
2025-03-13 11:03 ` [PATCH v12 3/6] dt-bindings: clock: Add ipq9574 NSSCC clock and reset definitions Manikanta Mylavarapu
2025-03-13 11:03 ` [PATCH v12 4/6] clk: qcom: Add NSS clock Controller driver for IPQ9574 Manikanta Mylavarapu
2025-03-17 14:08   ` Marek Behún
2025-03-18 22:50     ` Stephen Boyd [this message]
2025-03-19  9:10       ` Marek Behún
2025-03-13 11:03 ` [PATCH v12 5/6] arm64: dts: qcom: ipq9574: Add nsscc node Manikanta Mylavarapu
2025-03-13 11:03 ` [PATCH v12 6/6] arm64: defconfig: Build NSS Clock Controller driver for IPQ9574 Manikanta Mylavarapu
2025-03-13 11:13 ` [PATCH v12 0/6] Add NSS clock controller support " Geert Uytterhoeven
2025-03-17 17:04 ` (subset) " Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef86ccad056bc03af7f01d5696787766.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=andersson@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ebiggers@google.com \
    --cc=elinor.montmasson@savoirfairelinux.com \
    --cc=geert+renesas@glider.be \
    --cc=heiko@sntech.de \
    --cc=javier.carrasco@wolfvision.net \
    --cc=kabel@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_anusha@quicinc.com \
    --cc=quic_mmanikan@quicinc.com \
    --cc=quic_srichara@quicinc.com \
    --cc=quic_tdas@quicinc.com \
    --cc=quic_varada@quicinc.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=ross.burton@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).