linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] err.h: add ERR_PTR_CONST macro
@ 2025-10-29 13:33 Christian Marangi
  2025-10-29 13:33 ` [PATCH 2/3] soc: qcom: smem: better track SMEM uninitialized state Christian Marangi
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Christian Marangi @ 2025-10-29 13:33 UTC (permalink / raw)
  To: Ilia Lin, Rafael J. Wysocki, Viresh Kumar, Bjorn Andersson,
	Konrad Dybcio, Christian Marangi, Raag Jadav, Arnd Bergmann,
	Andy Shevchenko, linux-arm-msm, linux-pm, linux-kernel

Add ERR_PTR_CONST macro to initialize global variables with error
pointers. This might be useful for specific case where there is a global
variables initialized to an error condition and then later set to the
real handle once probe finish/completes.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 include/linux/err.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/err.h b/include/linux/err.h
index 1d60aa86db53..a38071881b20 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -41,6 +41,14 @@ static inline void * __must_check ERR_PTR(long error)
 	return (void *) error;
 }
 
+/**
+ * ERR_PTR_CONST - define a const error pointer.
+ * @error: A negative error code.
+ *
+ * Like ERR_PTR(), but usable to initialize global variables.
+ */
+#define ERR_PTR_CONST(error) ((void *)(error))
+
 /* Return the pointer in the percpu address space. */
 #define ERR_PTR_PCPU(error) ((void __percpu *)(unsigned long)ERR_PTR(error))
 
-- 
2.51.0


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

end of thread, other threads:[~2025-10-30 14:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29 13:33 [PATCH 1/3] err.h: add ERR_PTR_CONST macro Christian Marangi
2025-10-29 13:33 ` [PATCH 2/3] soc: qcom: smem: better track SMEM uninitialized state Christian Marangi
2025-10-29 15:27   ` Andy Shevchenko
2025-10-29 15:32     ` Christian Marangi
2025-10-29 16:11       ` Bjorn Andersson
2025-10-29 13:33 ` [PATCH 3/3] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM Christian Marangi
2025-10-29 15:30   ` Andy Shevchenko
2025-10-30  8:56   ` Konrad Dybcio
2025-10-30 10:28     ` Christian Marangi
2025-10-30 10:54       ` Konrad Dybcio
2025-10-30 11:11         ` Christian Marangi
2025-10-30 11:16           ` Konrad Dybcio
2025-10-29 15:32 ` [PATCH 1/3] err.h: add ERR_PTR_CONST macro Andy Shevchenko
2025-10-29 15:38   ` Christian Marangi
2025-10-30  8:27     ` Andy Shevchenko
2025-10-30  8:37       ` Andy Shevchenko
2025-10-30 10:22       ` Christian Marangi
2025-10-30 14:00         ` Andy Shevchenko
2025-10-30 14:15           ` Arnd Bergmann

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