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: <20150710065856.GZ28632@lukather>
Date:	Fri, 10 Jul 2015 08:58:56 +0200
From:	Maxime Ripard <maxime.ripard@...e-electrons.com>
To:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>
Cc:	Josh Wu <josh.wu@...el.com>,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	linux-arm-kernel@...ts.infradead.org,
	Guenter Roeck <linux@...ck-us.net>,
	Wei Yongjun <yongjun_wei@...ndmicro.com.cn>,
	Ben Dooks <ben.dooks@...ethink.co.uk>,
	linux-kernel@...r.kernel.org,
	Krzysztof Kozlowski <k.kozlowski.k@...il.com>,
	Sebastian Reichel <sre@...nel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>,
	Fabian Frederick <fabf@...net.be>, linux-pm@...r.kernel.org
Subject: Re: [PATCH 1/2] power: reset: at91: add sama5d3 reset function

On Fri, Jul 10, 2015 at 08:03:50AM +0200, Alexandre Belloni wrote:
> >  static const struct of_device_id at91_reset_of_match[] = {
> >  	{ .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart },
> >  	{ .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
> > +	{ .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart },
> >  	{ /* sentinel */ }
> >  };
> >  
> > @@ -181,17 +189,21 @@ static int at91_reset_of_probe(struct platform_device *pdev)
> >  		return -ENODEV;
> >  	}
> >  
> > -	for_each_matching_node(np, at91_ramc_of_match) {
> > -		at91_ramc_base[idx] = of_iomap(np, 0);
> > -		if (!at91_ramc_base[idx]) {
> > -			dev_err(&pdev->dev, "Could not map ram controller address\n");
> > -			return -ENODEV;
> > +	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
> > +	at91_restart_nb.notifier_call = match->data;
> > +
> > +	if (match->data != sama5d3_restart) {
> 
> This doesn't scale well. I would create a structure with a pointer to
> the restart function and a boolean or a bitfield to store whether the
> workaround is needed. Use that structure in your match data. Then, you
> won't need to reorder anything.

Maybe it simply doesn't need to scale (yet).

You have a single exception here. Maybe you will have only this one in
the future, maybe you won't, but for now, that solution looks a bit
overkill.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ