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: <CAMuHMdX97ESvg-htynOJC5408Hf1bKN46ji-fnuzr94wBcZSXw@mail.gmail.com>
Date: Mon, 30 Sep 2024 15:23:37 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Herve Codina <herve.codina@...tlin.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>, Simon Horman <horms@...nel.org>, 
	Lee Jones <lee@...nel.org>, Arnd Bergmann <arnd@...db.de>, Derek Kiernan <derek.kiernan@....com>, 
	Dragan Cvetic <dragan.cvetic@....com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	Bjorn Helgaas <bhelgaas@...gle.com>, Philipp Zabel <p.zabel@...gutronix.de>, 
	Lars Povlsen <lars.povlsen@...rochip.com>, Steen Hegelund <Steen.Hegelund@...rochip.com>, 
	Daniel Machon <daniel.machon@...rochip.com>, UNGLinuxDriver@...rochip.com, 
	Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, 
	Saravana Kannan <saravanak@...gle.com>, "David S. Miller" <davem@...emloft.net>, 
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Horatiu Vultur <horatiu.vultur@...rochip.com>, Andrew Lunn <andrew@...n.ch>, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	netdev@...r.kernel.org, linux-pci@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, 
	Allan Nielsen <allan.nielsen@...rochip.com>, Luca Ceresoli <luca.ceresoli@...tlin.com>, 
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v6 2/7] reset: mchp: sparx5: Use the second reg item when
 cpu-syscon is not present

Hi Hervé,

On Mon, Sep 30, 2024 at 2:16 PM Herve Codina <herve.codina@...tlin.com> wrote:
> In the LAN966x PCI device use case, syscon cannot be used as syscon
> devices do not support removal [1]. A syscon device is a core "system"
> device and not a device available in some addon boards and so, it is not
> supposed to be removed.
>
> In order to remove the syscon usage, use a local mapping of a reg
> address range when cpu-syscon is not present.
>
> Link: https://lore.kernel.org/all/20240923100741.11277439@bootlin.com/ [1]
> Signed-off-by: Herve Codina <herve.codina@...tlin.com>

Thanks for your patch!

> --- a/drivers/reset/reset-microchip-sparx5.c
> +++ b/drivers/reset/reset-microchip-sparx5.c
> @@ -114,8 +114,22 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>
>         err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl);
> -       if (err)
> +       switch (err) {
> +       case 0:
> +               break;
> +       case -ENODEV:
> +               /*
> +                * The cpu-syscon device is not available.
> +                * Fall back with IO mapping (i.e. mapping from reg property).
> +                */
> +               err = mchp_sparx5_map_io(pdev, 1, &ctx->cpu_ctrl);
> +               if (err)
> +                       return err;
> +               break;
> +       default:
>                 return err;
> +       }
> +

This can be shortened to:

    if (err == -ENODEV) {
            /*
             * The cpu-syscon device is not available.
             * Fall back with IO mapping (i.e. mapping from reg property).
             */
            err = mchp_sparx5_map_io(pdev, 1, &ctx->cpu_ctrl);
    }
    if (err)
            return err;

>         err = mchp_sparx5_map_io(pdev, 0, &ctx->gcb_ctrl);
>         if (err)
>                 return err;

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ