lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <qf36kofpouii3m5bdihy5fizmsnnd7pzxltuhorynql57ivvey@uxplo7joejsd>
Date: Wed, 19 Mar 2025 10:10:26 +0100
From: Marek Behún <kabel@...nel.org>
To: Stephen Boyd <sboyd@...nel.org>
Cc: Manikanta Mylavarapu <quic_mmanikan@...cinc.com>, 
	Marek Behún <kabel@...nel.org>, andersson@...nel.org, mturquette@...libre.com, robh@...nel.org, 
	krzk+dt@...nel.org, conor+dt@...nel.org, konradybcio@...nel.org, 
	catalin.marinas@....com, will@...nel.org, p.zabel@...gutronix.de, 
	richardcochran@...il.com, geert+renesas@...der.be, lumag@...nel.org, heiko@...ech.de, 
	biju.das.jz@...renesas.com, quic_tdas@...cinc.com, nfraprado@...labora.com, 
	elinor.montmasson@...oirfairelinux.com, ross.burton@....com, javier.carrasco@...fvision.net, 
	ebiggers@...gle.com, quic_anusha@...cinc.com, linux-arm-msm@...r.kernel.org, 
	linux-clk@...r.kernel.org, devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org, quic_varada@...cinc.com, 
	quic_srichara@...cinc.com
Subject: Re: [PATCH v12 4/6] clk: qcom: Add NSS clock Controller driver for
 IPQ9574

On Tue, Mar 18, 2025 at 03:50:31PM -0700, Stephen Boyd wrote:
> 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.

Okay then, in that case just ignore me :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ