netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v1 1/1] treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR()
@ 2025-10-30  8:35 Andy Shevchenko
  2025-10-31 23:49 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-10-30  8:35 UTC (permalink / raw)
  To: Andy Shevchenko, Raag Jadav, Pablo Neira Ayuso, linux-kernel,
	linux-perf-users, netfilter-devel, coreteam, netdev
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Jozsef Kadlecsik, Florian Westphal,
	Phil Sutter, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman

Make the namespace of specific ERR_PTR() macro leading the thing.
This is already done for IOMEM_ERR_PTR(). Follow the same pattern
in PCPU_ERR_PTR().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

I believe taking it via net-next makes most of sense, if no objections.

 include/linux/err.h           | 2 +-
 kernel/events/hw_breakpoint.c | 4 ++--
 net/netfilter/nf_tables_api.c | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/err.h b/include/linux/err.h
index 1d60aa86db53..8aafcf9492a4 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -42,7 +42,7 @@ static inline void * __must_check ERR_PTR(long error)
 }
 
 /* Return the pointer in the percpu address space. */
-#define ERR_PTR_PCPU(error) ((void __percpu *)(unsigned long)ERR_PTR(error))
+#define PCPU_ERR_PTR(error) ((void __percpu *)(unsigned long)ERR_PTR(error))
 
 /* Cast an error pointer to __iomem. */
 #define IOMEM_ERR_PTR(error) (__force void __iomem *)ERR_PTR(error)
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 8ec2cb688903..67fc1367d649 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -849,7 +849,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 
 	cpu_events = alloc_percpu(typeof(*cpu_events));
 	if (!cpu_events)
-		return ERR_PTR_PCPU(-ENOMEM);
+		return PCPU_ERR_PTR(-ENOMEM);
 
 	cpus_read_lock();
 	for_each_online_cpu(cpu) {
@@ -868,7 +868,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 		return cpu_events;
 
 	unregister_wide_hw_breakpoint(cpu_events);
-	return ERR_PTR_PCPU(err);
+	return PCPU_ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint);
 
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index eed434e0a970..1b5286545a3c 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2228,14 +2228,14 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
 	err = nla_parse_nested_deprecated(tb, NFTA_COUNTER_MAX, attr,
 					  nft_counter_policy, NULL);
 	if (err < 0)
-		return ERR_PTR_PCPU(err);
+		return PCPU_ERR_PTR(err);
 
 	if (!tb[NFTA_COUNTER_BYTES] || !tb[NFTA_COUNTER_PACKETS])
-		return ERR_PTR_PCPU(-EINVAL);
+		return PCPU_ERR_PTR(-EINVAL);
 
 	newstats = netdev_alloc_pcpu_stats(struct nft_stats);
 	if (newstats == NULL)
-		return ERR_PTR_PCPU(-ENOMEM);
+		return PCPU_ERR_PTR(-ENOMEM);
 
 	/* Restore old counters on this cpu, no problem. Per-cpu statistics
 	 * are not exposed to userspace.
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v1 1/1] treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR()
  2025-10-30  8:35 [PATCH net-next v1 1/1] treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR() Andy Shevchenko
@ 2025-10-31 23:49 ` Jakub Kicinski
  2025-11-03  7:32   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2025-10-31 23:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Raag Jadav, Pablo Neira Ayuso, linux-kernel, linux-perf-users,
	netfilter-devel, coreteam, netdev, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	Jozsef Kadlecsik, Florian Westphal, Phil Sutter, David S. Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman

On Thu, 30 Oct 2025 09:35:53 +0100 Andy Shevchenko wrote:
> Make the namespace of specific ERR_PTR() macro leading the thing.
> This is already done for IOMEM_ERR_PTR(). Follow the same pattern
> in PCPU_ERR_PTR().

TBH I find the current naming to be typical. _PCPU() is the "flavor" of
the API. Same as we usually append _rcu() to functions which expect
to operate under RCU. All error pointer helpers end with _PCPU().

I don't feel strongly so fine if anyone else wants to apply this.
But I will not :)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v1 1/1] treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR()
  2025-10-31 23:49 ` Jakub Kicinski
@ 2025-11-03  7:32   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-11-03  7:32 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Raag Jadav, Pablo Neira Ayuso, linux-kernel, linux-perf-users,
	netfilter-devel, coreteam, netdev, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	Jozsef Kadlecsik, Florian Westphal, Phil Sutter, David S. Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman

On Fri, Oct 31, 2025 at 04:49:58PM -0700, Jakub Kicinski wrote:
> On Thu, 30 Oct 2025 09:35:53 +0100 Andy Shevchenko wrote:
> > Make the namespace of specific ERR_PTR() macro leading the thing.
> > This is already done for IOMEM_ERR_PTR(). Follow the same pattern
> > in PCPU_ERR_PTR().
> 
> TBH I find the current naming to be typical. _PCPU() is the "flavor" of
> the API. Same as we usually append _rcu() to functions which expect
> to operate under RCU. All error pointer helpers end with _PCPU().

Ah, there is also IS_ERR_PCPU()...

> I don't feel strongly so fine if anyone else wants to apply this.
> But I will not :)

OK.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-03  7:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30  8:35 [PATCH net-next v1 1/1] treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR() Andy Shevchenko
2025-10-31 23:49 ` Jakub Kicinski
2025-11-03  7:32   ` Andy Shevchenko

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).