linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
	Martin Michlmayr <tbm@cyrius.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chaitanya Bandi <bandik@nvidia.com>
Subject: Re: [PATCH] power: reset: Add MAX77620 support
Date: Thu, 19 Jan 2017 13:23:57 +0100	[thread overview]
Message-ID: <20170119122357.GF30182@ulmo.ba.sec> (raw)
In-Reply-To: <20170113034425.7ttvc73aewtbitrk@earth>

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

On Fri, Jan 13, 2017 at 04:44:25AM +0100, Sebastian Reichel wrote:
> On Thu, Jan 12, 2017 at 05:15:07PM +0100, Thierry Reding wrote:
[...]
> > +	if (!of_property_read_bool(np, "system-power-controller"))
> > +		return 0;
> > +
> > +	power = devm_kzalloc(&pdev->dev, sizeof(*power), GFP_KERNEL);
> > +	if (!power)
> > +		return -ENOMEM;
> > +
> > +	power->regmap = max77620->rmap;
> > +	power->dev = &pdev->dev;
> > +
> > +	err = regmap_read(power->regmap, MAX77620_REG_NVERC, &value);
> > +	if (err < 0) {
> > +		dev_err(power->dev, "failed to read event recorder: %d\n", err);
> > +		return err;
> > +	}
> > +
> > +	dev_dbg(&pdev->dev, "event recorder: %#x\n", value);
> > +
> > +	system_power_controller = power;
> > +	pm_power_off = max77620_pm_power_off;
> 
> > +#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> > +	arm_pm_restart = max77620_pm_restart;
> > +#endif
> 
> Please use register_restart_handler() instead. It has support for
> priorities, is not arm specific and properly supports unregistering
> (some handler with lower priority will take over). You can check
> gpio-restart as an example for the API.
> 
> If you have some other arm_pm_restart handler (those are tried first)
> I suggest to convert that to the restart handler framework. Actually
> it may be a good idea to convert all of them and drop arm_pm_restart,
> since there are only 4 left:
> 
> $ git grep "arm_pm_restart ="
> drivers/firmware/psci.c:        arm_pm_restart = psci_sys_reset;
> arch/arm/mach-prima2/rstc.c:    arm_pm_restart = sirfsoc_restart;
> arch/arm/xen/enlighten.c:       arm_pm_restart = xen_restart;
> arch/arm/kernel/setup.c:                arm_pm_restart = mdesc->restart;
> 
> The first 3 should be easy to update and the last one could
> be solved by registering a wrapper function as restart handler,
> which calls mdesc->restart().

I remember this not being the first time that this confuses me. And from
looking around a little it seems like I'm not the only one.

Do you know if there's ever been any attempts to formalize all of this
by adding some sort of framework for this? That way some of the
confusion may be removed and architecture-specific bits could be
eliminated more easily.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-01-19 12:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 16:15 [PATCH] power: reset: Add MAX77620 support Thierry Reding
2017-01-12 16:36 ` Laxman Dewangan
2017-01-12 17:35   ` Thierry Reding
2017-01-12 17:35     ` Laxman Dewangan
2017-01-19 12:27       ` Thierry Reding
2017-01-13  3:44 ` Sebastian Reichel
2017-01-19 12:23   ` Thierry Reding [this message]
2017-01-19 23:00     ` Sebastian Reichel
2017-01-19 23:29       ` Guenter Roeck
2017-01-20  8:38         ` Thierry Reding
2017-01-20 17:53           ` Guenter Roeck
2017-01-29 20:02           ` Sebastian Reichel
2017-01-29 20:47             ` Guenter Roeck
2017-01-29 22:43               ` Sebastian Reichel
2017-01-20 12:44         ` Sebastian Reichel
2017-01-20 13:11           ` Thierry Reding
2017-01-20 13:47             ` Sebastian Reichel
2017-01-20 14:32             ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170119122357.GF30182@ulmo.ba.sec \
    --to=thierry.reding@gmail.com \
    --cc=bandik@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=tbm@cyrius.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).