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: <CAP6Zq1htXxpBR-=FW=8grzspGcLPDM5qiMUPNqh7wNiO=0=HAA@mail.gmail.com>
Date:   Thu, 30 Jun 2022 14:20:44 +0300
From:   Tomer Maimon <tmaimon77@...il.com>
To:     Philipp Zabel <p.zabel@...gutronix.de>
Cc:     Avi Fishman <avifishman70@...il.com>,
        Tali Perry <tali.perry1@...il.com>,
        Joel Stanley <joel@....id.au>,
        Patrick Venture <venture@...gle.com>,
        Nancy Yuen <yuenn@...gle.com>,
        Benjamin Fair <benjaminfair@...gle.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>,
        Guenter Roeck <linux@...ck-us.net>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        Olof Johansson <olof@...om.net>,
        Jiri Slaby <jirislaby@...nel.org>,
        Shawn Guo <shawnguo@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Marcel Ziswiler <marcel.ziswiler@...adex.com>,
        Vinod Koul <vkoul@...nel.org>,
        Biju Das <biju.das.jz@...renesas.com>,
        Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@...hiba.co.jp>,
        Robert Hancock <robert.hancock@...ian.com>,
        Jonathan Neuschäfer <j.neuschaefer@....net>,
        Lubomir Rintel <lkundrak@...sk>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-clk <linux-clk@...r.kernel.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        LINUXWATCHDOG <linux-watchdog@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v6 08/17] reset: npcm: using syscon instead of device data

Hi Philipp,

Thanks for your comment.

On Thu, 30 Jun 2022 at 13:59, Philipp Zabel <p.zabel@...gutronix.de> wrote:
>
> Hi Tomer,
>
> On Do, 2022-06-30 at 13:35 +0300, Tomer Maimon wrote:
> Using syscon device tree property instead of device data to handle the
> NPCM general control registers.
>
> In case the syscon not found the code still search for nuvoton,npcm750-gcr
> to support DTS backward compatibility.
>
> Signed-off-by: Tomer Maimon <tmaimon77@...il.com>
> ---
>  drivers/reset/reset-npcm.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/reset/reset-npcm.c b/drivers/reset/reset-npcm.c
> index 2ea4d3136e15..431ff2b602c5 100644
> --- a/drivers/reset/reset-npcm.c
> +++ b/drivers/reset/reset-npcm.c
> @@ -138,8 +138,7 @@ static int npcm_reset_xlate(struct reset_controller_dev *rcdev,
>  }
>
>
>  static const struct of_device_id npcm_rc_match[] = {
> -       { .compatible = "nuvoton,npcm750-reset",
> -               .data = (void *)"nuvoton,npcm750-gcr" },
> +       { .compatible = "nuvoton,npcm750-reset"},
>
> Add a space.                                  ^^
Will modify in V7
>
>         { }
>  };
>
>
> @@ -155,15 +154,15 @@ static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc)
>         u32 ipsrst1_bits = 0;
>         u32 ipsrst2_bits = NPCM_IPSRST2_USB_HOST;
>         u32 ipsrst3_bits = 0;
> -       const char *gcr_dt;
>
>
> -       gcr_dt = (const char *)
> -       of_match_device(dev->driver->of_match_table, dev)->data;
> -
> -       gcr_regmap = syscon_regmap_lookup_by_compatible(gcr_dt);
> +       gcr_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "nuvoton,sysgcr");
>         if (IS_ERR(gcr_regmap)) {
> -               dev_err(&pdev->dev, "Failed to find %s\n", gcr_dt);
> -               return PTR_ERR(gcr_regmap);
> +               dev_warn(&pdev->dev, "Failed to find nuvoton,sysgcr search for nuvoton,npcm750-gcr for Poleg backward compatibility");
>
> Is this warning useful to the user? Maybe add suggestion like "please
> update the device tree". Also there is no further message if
> nuvoton,npcm750-gcr is found and all is well.

O.K.
I think about two options:

1. Modify the message "Failed to find nuvoton,sysgcr property, please
update the device tree\n Search for nuvoton,npcm750-gcr for Poleg
backward compatibility"

OR

2.
        if (IS_ERR(rc->gcr_regmap)) {
                dev_warn(&pdev->dev, "Failed to find nuvoton,sysgcr
please update the device tree");
                rc->gcr_regmap =
syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
                if (IS_ERR(rc->gcr_regmap)) {
                        dev_err(&pdev->dev, "Failed to find
nuvoton,npcm750-gcr");
                        return PTR_ERR(rc->gcr_regmap);
                }
                 dev_info(&pdev->dev, "found nuvoton,npcm750-gcr for
Poleg backward compatibility");
        }

The only problem that I have with option 2 is if our customers will
use the latest reset driver and they will not update their device tree
they will see all the time the dev_info message.

What do you think?
>
> regards
> Philipp

Best regards,

Tomer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ