Skip to contentSkip to conversation

treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR()

PATCH In review Andy Shevchenko 2 participants 3 messages Oct 30, 2025 – Nov 3, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 treewide: Rename ERR_PTR_PCPU() --> PCPU_ERR_PTR()

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

---

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(-)
include/linux/err.h +1 -1
index 1d60aa86db53..8aafcf9492a4 100644
@@ -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)
kernel/events/hw_breakpoint.c +2 -2
index 8ec2cb688903..67fc1367d649 100644
@@ -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);
 
net/netfilter/nf_tables_api.c +3 -3
index eed434e0a970..1b5286545a3c 100644
@@ -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.
Signature · 1 line
2.50.1
maintainer
#1 lore raw
Quoted 3 lines · 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 :)

#2 lore raw
Quoted 8 lines · Jakub Kicinski
Quoted 3 lines · 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()...

Quoted 2 lines

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

OK.

Signature · 2 lines
With Best Regards,
Andy Shevchenko