public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
To: Dmitry Osipenko <digetx@gmail•com>
Cc: "Ulf Hansson" <ulf.hansson@linaro•org>,
	"Rich Felker" <dalias@libc•org>,
	linux-ia64@vger•kernel.org, "Tomer Maimon" <tmaimon77@gmail•com>,
	"Santosh Shilimkar" <ssantosh@kernel•org>,
	"Rafael J . Wysocki" <rafael@kernel•org>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle•com>,
	"Catalin Marinas" <catalin.marinas@arm•com>,
	"Linus Walleij" <linus.walleij@linaro•org>,
	"Dave Hansen" <dave.hansen@linux•intel.com>,
	x86@kernel•org, "Tali Perry" <tali.perry1@gmail•com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership•com>,
	"Thierry Reding" <thierry.reding@gmail•com>,
	"Guo Ren" <guoren@kernel•org>, "Pavel Machek" <pavel@ucw•cz>,
	"H. Peter Anvin" <hpa@zytor•com>,
	linux-riscv@lists•infradead.org,
	"Vincent Chen" <deanbo422@gmail•com>,
	"Will Deacon" <will@kernel•org>,
	"Greg Ungerer" <gerg@linux-m68k•org>,
	"Stefano Stabellini" <sstabellini@kernel•org>,
	"Benjamin Fair" <benjaminfair@google•com>,
	"Yoshinori Sato" <ysato@users•sourceforge.jp>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@canonical•com>,
	linux-sh@vger•kernel.org, "Lee Jones" <lee.jones@linaro•org>,
	"Helge Deller" <deller@gmx•de>,
	"Daniel Lezcano" <daniel.lezcano@linaro•org>,
	"Russell King" <linux@armlinux•org.uk>,
	linux-csky@vger•kernel.org,
	"Jonathan Hunter" <jonathanh@nvidia•com>,
	"Tony Lindgren" <tony@atomide•com>,
	"Chen-Yu Tsai" <wens@csie•org>, "Ingo Molnar" <mingo@redhat•com>,
	"Geert Uytterhoeven" <geert@linux-m68k•org>,
	xen-devel@lists•xenproject.org, linux-mips@vger•kernel.org,
	"Guenter Roeck" <linux@roeck-us•net>,
	"Len Brown" <lenb@kernel•org>,
	"Albert Ou" <aou@eecs•berkeley.edu>,
	linux-pm@vger•kernel.org,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx•net>,
	"Vladimir Zapolskiy" <vz@mleia•com>,
	linux-acpi@vger•kernel.org, linux-m68k@lists•linux-m68k.org,
	"Mark Brown" <broonie@kernel•org>,
	"Borislav Petkov" <bp@alien8•de>,
	"Greentime Hu" <green.hu@gmail•com>,
	"Paul Walmsley" <paul.walmsley@sifive•com>,
	linux-tegra@vger•kernel.org,
	"Thomas Gleixner" <tglx@linutronix•de>,
	linux-omap@vger•kernel.org, "Nancy Yuen" <yuenn@google•com>,
	linux-arm-kernel@lists•infradead.org,
	"Juergen Gross" <jgross@suse•com>,
	"Thomas Bogendoerfer" <tsbogend@alpha•franken.de>,
	linux-parisc@vger•kernel.org, "Nick Hu" <nickhu@andestech•com>,
	"Avi Fishman" <avifishman70@gmail•com>,
	"Patrick Venture" <venture@google•com>,
	"Liam Girdwood" <lgirdwood@gmail•com>,
	linux-kernel@vger•kernel.org,
	"Palmer Dabbelt" <palmer@dabbelt•com>,
	"Philipp Zabel" <p.zabel@pengutronix•de>,
	"Paul Mackerras" <paulus@samba•org>,
	"Andrew Morton" <akpm@linux-foundation•org>,
	linuxppc-dev@lists•ozlabs.org, openbmc@lists•ozlabs.org,
	"Joshua Thompson" <funaho@jurai•org>
Subject: Re: [PATCH v2 03/45] notifier: Add atomic/blocking_notifier_has_unique_priority()
Date: Thu, 28 Oct 2021 14:00:31 +0300	[thread overview]
Message-ID: <YXqCz/utp2DFJJ45@smile.fi.intel.com> (raw)
In-Reply-To: <20211027211715.12671-4-digetx@gmail.com>

On Thu, Oct 28, 2021 at 12:16:33AM +0300, Dmitry Osipenko wrote:
> Add atomic/blocking_notifier_has_unique_priority() helpers which return
> true if given handler has unique priority.

...

> +/**
> + *	atomic_notifier_has_unique_priority - Checks whether notifier's priority is unique
> + *	@nh: Pointer to head of the atomic notifier chain
> + *	@n: Entry in notifier chain to check
> + *
> + *	Checks whether there is another notifier in the chain with the same priority.
> + *	Must be called in process context.
> + *
> + *	Returns true if priority is unique, false otherwise.

Why this indentation?

> + */
> +bool atomic_notifier_has_unique_priority(struct atomic_notifier_head *nh,
> +		struct notifier_block *n)
> +{
> +	struct notifier_block **nl = &nh->head;
> +	unsigned long flags;
> +	bool ret = true;
> +
> +	spin_lock_irqsave(&nh->lock, flags);
> +
> +	while ((*nl) != NULL && (*nl)->priority >= n->priority) {

' != NULL' is redundant.

> +		if ((*nl)->priority == n->priority && (*nl) != n) {
> +			ret = false;
> +			break;
> +		}
> +
> +		nl = &((*nl)->next);
> +	}
> +
> +	spin_unlock_irqrestore(&nh->lock, flags);
> +
> +	return ret;
> +}

...

> +	/*
> +	 * This code gets used during boot-up, when task switching is
> +	 * not yet working and interrupts must remain disabled.  At

One space is enough.

> +	 * such times we must not call down_write().
> +	 */

> +	while ((*nl) != NULL && (*nl)->priority >= n->priority) {

' != NULL' is not needed.

> +		if ((*nl)->priority == n->priority && (*nl) != n) {
> +			ret = false;
> +			break;
> +		}
> +
> +		nl = &((*nl)->next);
> +	}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-10-28 11:19 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 21:16 [PATCH v2 00/45] Introduce power-off+restart call chain API Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 01/45] notifier: Remove extern annotation from function prototypes Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 02/45] notifier: Add blocking_notifier_call_chain_empty() Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 03/45] notifier: Add atomic/blocking_notifier_has_unique_priority() Dmitry Osipenko
2021-10-28 11:00   ` Andy Shevchenko [this message]
2021-10-28 21:32     ` Dmitry Osipenko
2021-10-28 23:28       ` Dmitry Osipenko
2021-10-28 22:10     ` Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 04/45] reboot: Correct typo in a comment Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 05/45] reboot: Warn if restart handler has duplicated priority Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 06/45] reboot: Warn if unregister_restart_handler() fails Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 07/45] reboot: Remove extern annotation from function prototypes Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 08/45] kernel: Add combined power-off+restart handler call chain API Dmitry Osipenko
2021-10-28  9:53   ` Rafael J. Wysocki
2021-10-28 21:36     ` Dmitry Osipenko
2021-10-28  9:59   ` Rafael J. Wysocki
2021-10-28 21:58     ` Dmitry Osipenko
2021-10-28 21:59     ` Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 09/45] xen/x86: Use do_kernel_power_off() Dmitry Osipenko
2021-10-28  7:35   ` Juergen Gross
2021-10-27 21:16 ` [PATCH v2 10/45] ARM: " Dmitry Osipenko
2021-10-28 12:04   ` Russell King (Oracle)
2021-10-27 21:16 ` [PATCH v2 11/45] arm64: " Dmitry Osipenko
2021-11-01 13:28   ` Catalin Marinas
2021-10-27 21:16 ` [PATCH v2 12/45] csky: " Dmitry Osipenko
2021-11-01  1:57   ` Guo Ren
2021-10-27 21:16 ` [PATCH v2 13/45] ia64: " Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 14/45] mips: " Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 15/45] nds32: " Dmitry Osipenko
2021-10-28 12:20   ` Greentime Hu
2021-10-27 21:16 ` [PATCH v2 16/45] parisc: " Dmitry Osipenko
2021-10-28  6:38   ` Helge Deller
2021-10-27 21:16 ` [PATCH v2 17/45] powerpc: " Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 18/45] riscv: " Dmitry Osipenko
2021-10-27 23:09   ` Palmer Dabbelt
2021-10-27 21:16 ` [PATCH v2 19/45] sh: " Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 20/45] x86: " Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 21/45] m68k: Switch to new power-handler API Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 22/45] memory: emif: Use kernel_can_power_off() Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 23/45] ACPI: power: Switch to power-handler API Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 24/45] regulator: pfuze100: Use devm_register_power_handler() Dmitry Osipenko
2021-10-28 11:59   ` Mark Brown
2021-10-27 21:16 ` [PATCH v2 25/45] reboot: Remove pm_power_off_prepare() Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 26/45] soc/tegra: pmc: Utilize power-handler API to power off Nexus 7 properly Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler() Dmitry Osipenko
2021-11-06 20:54   ` Jonathan Neuschäfer
2021-11-07 16:53     ` Dmitry Osipenko
2021-11-07 17:08       ` Guenter Roeck
2021-11-07 17:16         ` Dmitry Osipenko
2021-11-07 17:32           ` Guenter Roeck
2021-11-07 17:42             ` Dmitry Osipenko
2021-11-08 11:22               ` Jonathan Neuschäfer
2021-11-08 11:36                 ` Dmitry Osipenko
2021-11-10 10:43                   ` Jonathan Neuschäfer
2021-11-10 13:38                     ` Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 28/45] mfd: rn5t618: " Dmitry Osipenko
2021-11-29 11:55   ` Lee Jones
2021-11-29 12:04     ` Dmitry Osipenko
2021-10-27 21:16 ` [PATCH v2 29/45] mfd: acer-a500: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 30/45] mfd: ene-kb3930: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 31/45] mfd: axp20x: Use register_simple_power_off_handler() Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 32/45] mfd: retu: Use devm_register_simple_power_off_handler() Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 33/45] mfd: rk808: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 34/45] mfd: palmas: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 35/45] mfd: max8907: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 36/45] mfd: tps6586x: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 37/45] mfd: tps65910: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 38/45] mfd: max77620: " Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 39/45] mfd: dm355evm_msp: Use devm_register_trivial_power_off_handler() Dmitry Osipenko
2021-10-27 21:17 ` [PATCH v2 40/45] mfd: twl4030: " Dmitry Osipenko
2021-10-28 22:05 ` [PATCH v2 00/45] Introduce power-off+restart call chain API Dmitry Osipenko

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=YXqCz/utp2DFJJ45@smile.fi.intel.com \
    --to=andriy.shevchenko@linux$(echo .)intel.com \
    --cc=James.Bottomley@hansenpartnership$(echo .)com \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=aou@eecs$(echo .)berkeley.edu \
    --cc=avifishman70@gmail$(echo .)com \
    --cc=benjaminfair@google$(echo .)com \
    --cc=boris.ostrovsky@oracle$(echo .)com \
    --cc=bp@alien8$(echo .)de \
    --cc=broonie@kernel$(echo .)org \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=dalias@libc$(echo .)org \
    --cc=daniel.lezcano@linaro$(echo .)org \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=deanbo422@gmail$(echo .)com \
    --cc=deller@gmx$(echo .)de \
    --cc=digetx@gmail$(echo .)com \
    --cc=funaho@jurai$(echo .)org \
    --cc=geert@linux-m68k$(echo .)org \
    --cc=gerg@linux-m68k$(echo .)org \
    --cc=green.hu@gmail$(echo .)com \
    --cc=guoren@kernel$(echo .)org \
    --cc=hpa@zytor$(echo .)com \
    --cc=j.neuschaefer@gmx$(echo .)net \
    --cc=jgross@suse$(echo .)com \
    --cc=jonathanh@nvidia$(echo .)com \
    --cc=krzysztof.kozlowski@canonical$(echo .)com \
    --cc=lee.jones@linaro$(echo .)org \
    --cc=lenb@kernel$(echo .)org \
    --cc=lgirdwood@gmail$(echo .)com \
    --cc=linus.walleij@linaro$(echo .)org \
    --cc=linux-acpi@vger$(echo .)kernel.org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-csky@vger$(echo .)kernel.org \
    --cc=linux-ia64@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-m68k@lists$(echo .)linux-m68k.org \
    --cc=linux-mips@vger$(echo .)kernel.org \
    --cc=linux-omap@vger$(echo .)kernel.org \
    --cc=linux-parisc@vger$(echo .)kernel.org \
    --cc=linux-pm@vger$(echo .)kernel.org \
    --cc=linux-riscv@lists$(echo .)infradead.org \
    --cc=linux-sh@vger$(echo .)kernel.org \
    --cc=linux-tegra@vger$(echo .)kernel.org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=linux@roeck-us$(echo .)net \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mingo@redhat$(echo .)com \
    --cc=nickhu@andestech$(echo .)com \
    --cc=openbmc@lists$(echo .)ozlabs.org \
    --cc=p.zabel@pengutronix$(echo .)de \
    --cc=palmer@dabbelt$(echo .)com \
    --cc=paul.walmsley@sifive$(echo .)com \
    --cc=paulus@samba$(echo .)org \
    --cc=pavel@ucw$(echo .)cz \
    --cc=rafael@kernel$(echo .)org \
    --cc=ssantosh@kernel$(echo .)org \
    --cc=sstabellini@kernel$(echo .)org \
    --cc=tali.perry1@gmail$(echo .)com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=thierry.reding@gmail$(echo .)com \
    --cc=tmaimon77@gmail$(echo .)com \
    --cc=tony@atomide$(echo .)com \
    --cc=tsbogend@alpha$(echo .)franken.de \
    --cc=ulf.hansson@linaro$(echo .)org \
    --cc=venture@google$(echo .)com \
    --cc=vz@mleia$(echo .)com \
    --cc=wens@csie$(echo .)org \
    --cc=will@kernel$(echo .)org \
    --cc=x86@kernel$(echo .)org \
    --cc=xen-devel@lists$(echo .)xenproject.org \
    --cc=ysato@users$(echo .)sourceforge.jp \
    --cc=yuenn@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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