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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Apr 2019 13:24:11 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Nicolas Boichat <drinkcat@...omium.org>,
        Weiyi Lu <weiyi.lu@...iatek.com>
Cc:     Matthias Brugger <matthias.bgg@...il.com>,
        Stephen Boyd <sboyd@...eaurora.org>,
        Rob Herring <robh@...nel.org>,
        James Liao <jamesjj.liao@...iatek.com>,
        Fan Chen <fan.chen@...iatek.com>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        lkml <linux-kernel@...r.kernel.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>, linux-clk@...r.kernel.org,
        srv_heupstream <srv_heupstream@...iatek.com>,
        stable@...r.kernel.org
Subject: Re: [PATCH v5 8/9] clk: mediatek: Add MT8183 clock support

Quoting Nicolas Boichat (2019-03-08 06:46:01)
> 
> > > +
> > > +#define GATE_AUDIO0(_id, _name, _parent, _shift)               \
> > > +       GATE_MTK(_id, _name, _parent, &audio0_cg_regs, _shift,  \
> > > +               &mtk_clk_gate_ops_no_setclr)
> 
> This macro (or variants that end up being equivalent) is repeated 103
> times in drivers/clk/mediatek/*. We can probably do better. My
> suggestion is to do something like this:
> #define GATE_MTK_CLK(reg, _id, _name, _parent, _shift) \
> GATE_MTK(_id, _name, _parent, &reg##_cg_regs, _shift, \
> &mtk_clk_gate_ops_setclr_inv)
> 
> and use GATE_MTK_CLK(audio0, ...) in the gate clock arrays.

Feel free to send patches.

> 
> > > +static int clk_mt8183_audio_probe(struct platform_device *pdev)
> > > +{
> > > +       struct clk_onecell_data *clk_data;
> > > +       int r;
> > > +       struct device_node *node = pdev->dev.of_node;
> > > +
> > > +       clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
> > > +
> > > +       mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
> > > +                       clk_data);
> > > +
> > > +       r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
> > > +       if (r)
> > > +               return r;
> > > +
> > > +       r = devm_of_platform_populate(&pdev->dev);
> > > +       if (r)
> > > +               of_clk_del_provider(node);
> > > +
> > > +       return r;
> > > +}
> 
> This (almost exact) function is now repeated 33 times in
> drivers/clk/mediatek, I think it's really time for a cleanup... Maybe
> there should be a common helper in clk-gate.c (or another file, not
> sure), that fetches the clocks (and number of clocks from .data field
> in the structure below).
> 

Yeah that would be great. I only tried to fix the problem where mtk
has this duplicate code that probes platform drivers and finds things
from it. See my branch on clk.git

 https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-mtk-of-plat-probe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ