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]
Message-ID: <153573686206.93865.11806745452503167124@swboyd.mtv.corp.google.com>
Date:   Fri, 31 Aug 2018 10:34:22 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Tony Xie <tony.xie@...k-chips.com>, heiko@...ech.de
Cc:     broonie@...nel.org, lee.jones@...aro.org, robh+dt@...nel.org,
        mark.rutland@....com, a.zummo@...ertech.it,
        alexandre.belloni@...tlin.com, linux-clk@...r.kernel.org,
        linux-rtc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-rockchip@...ts.infradead.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, chenjh@...k-chips.com,
        xsf@...k-chips.com, zhangqing@...k-chips.com,
        huangtao@...k-chips.com, tony.xie@...k-chips.com
Subject: Re: [PATCH v3 5/5] clk: RK808: add RK809 and RK817 support.

Quoting Tony Xie (2018-08-23 20:36:02)
> diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
> index 6461f28..c5d3492 100644
> --- a/drivers/clk/clk-rk808.c
> +++ b/drivers/clk/clk-rk808.c
> @@ -96,6 +96,66 @@ static int rk808_clkout2_is_prepared(struct clk_hw *hw)
> +
> +static int rk817_clkout2_is_prepared(struct clk_hw *hw)
> +{
> +       struct rk808_clkout *rk808_clkout = container_of(hw,
> +                                                        struct rk808_clkout,
> +                                                        clkout2_hw);
> +       struct rk808 *rk808 = rk808_clkout->rk808;
> +       unsigned int val;
> +
> +       int ret = regmap_read(rk808->regmap, RK817_SYS_CFG(1), &val);
> +
> +       if (ret < 0)
> +               return ret;

The clk core handles the return value here as true or false. Probably
should return 0 here.

> +
> +       return (val & RK817_CLK32KOUT2_EN) ? 1 : 0;
> +}
> +
> +static const struct clk_ops rk817_clkout2_ops = {
> +       .prepare = rk817_clkout2_prepare,
> +       .unprepare = rk817_clkout2_unprepare,
> +       .is_prepared = rk817_clkout2_is_prepared,
> +       .recalc_rate = rk808_clkout_recalc_rate,
> +};
> +
> +static const struct clk_ops *rkpmic_get_ops(long variant)

Use the enum here for 'variant'? Then the case statement here will
complain loudly for unhandled cases.

> +{
> +       switch (variant) {
> +       case RK809_ID:
> +       case RK817_ID:
> +               return &rk817_clkout2_ops;
> +       case RK805_ID:
> +       case RK808_ID:
> +       case RK818_ID:
> +               return &rk808_clkout2_ops;
> +       }
> +
> +       return &rk808_clkout2_ops;
> +}
> +
>  static int rk808_clkout_probe(struct platform_device *pdev)
>  {
>         struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
> @@ -127,7 +187,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)
>                 return ret;
>  
>         init.name = "rk808-clkout2";
> -       init.ops = &rk808_clkout2_ops;
> +       init.ops = rkpmic_get_ops(rk808->variant);
>         rk808_clkout->clkout2_hw.init = &init;
>  
>         /* optional override of the clockname */
> -- 
> 1.9.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ