mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christian Eggers <ceggers@arri.de>
To: barebox@lists.infradead.org
Cc: Christian Eggers <ceggers@arri.de>, ceggers@gmx.de
Subject: [PATCH 5/5] parameter: Return NULL instead of ENOSYS if CONFIG_PARAMETER is disabled
Date: Thu, 23 Jan 2020 13:20:45 +0100	[thread overview]
Message-ID: <20200123122045.25507-5-ceggers@arri.de> (raw)
In-Reply-To: <20200123122045.25507-1-ceggers@arri.de>

This reverts 03b59bdb64 ("paramter: The dev_add_param_*() return
ERR_PTR(), change no-ops to return ERR_PTR(-ENOSYS) instead of NULL").

Most callers of dev_add_param_*() don't care about whether
CONFIG_PARAMETER is enabled or not. The remaining ones have already been
prepared for getting a NULL pointer. As a result, these callers will not
fail itself, only because CONFIG_PARAMETER (which is always optional) is
disabled.

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 include/param.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/param.h b/include/param.h
index f1166eb28..c79b908b1 100644
--- a/include/param.h
+++ b/include/param.h
@@ -118,7 +118,7 @@ static inline struct param_d *dev_add_param(struct device_d *dev, const char *na
 		const char *(*get)(struct device_d *, struct param_d *p),
 		unsigned long flags)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_string(struct device_d *dev, const char *name,
@@ -126,7 +126,7 @@ static inline struct param_d *dev_add_param_string(struct device_d *dev, const c
 		int (*get)(struct param_d *p, void *priv),
 		char **value, void *priv)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *__dev_add_param_int(struct device_d *dev, const char *name,
@@ -134,7 +134,7 @@ static inline struct param_d *__dev_add_param_int(struct device_d *dev, const ch
 		int (*get)(struct param_d *p, void *priv),
 		void *value, enum param_type type, const char *format, void *priv)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_enum(struct device_d *dev, const char *name,
@@ -143,7 +143,7 @@ static inline struct param_d *dev_add_param_enum(struct device_d *dev, const cha
 		int *value, const char * const *names, int max, void *priv)
 
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_bitmask(struct device_d *dev, const char *name,
@@ -151,7 +151,7 @@ static inline struct param_d *dev_add_param_bitmask(struct device_d *dev, const
                 int (*get)(struct param_d *p, void *priv),
                 unsigned long *value, const char * const *names, int max, void *priv)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_tristate(struct device_d *dev, const char *name,
@@ -159,13 +159,13 @@ static inline struct param_d *dev_add_param_tristate(struct device_d *dev, const
 		int (*get)(struct param_d *p, void *priv),
 		int *value, void *priv)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_tristate_ro(struct device_d *dev, const char *name,
 		int *value)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
@@ -173,7 +173,7 @@ static inline struct param_d *dev_add_param_ip(struct device_d *dev, const char
 		int (*get)(struct param_d *p, void *priv),
 		IPaddr_t *ip, void *priv)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_mac(struct device_d *dev, const char *name,
@@ -181,13 +181,13 @@ static inline struct param_d *dev_add_param_mac(struct device_d *dev, const char
 		int (*get)(struct param_d *p, void *priv),
 		u8 *mac, void *priv)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline struct param_d *dev_add_param_fixed(struct device_d *dev, const char *name,
 						  const char *value)
 {
-	return ERR_PTR(-ENOSYS);
+	return NULL;
 }
 
 static inline void dev_remove_param(struct param_d *p) {}
-- 
Christian Eggers
Embedded software developer

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918
Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477
Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-01-23 12:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 12:20 [PATCH 1/5] state: remove param member from struct state_string Christian Eggers
2020-01-23 12:20 ` [PATCH 2/5] mci: remove param_probe member from struct mci Christian Eggers
2020-01-23 12:20 ` [PATCH 3/5] state: remove param member from state_uint32, state_enum32, state_mac Christian Eggers
2020-01-23 12:20 ` [PATCH 4/5] globalvar: Allow NULL pointers to be returned by dev_add_param() Christian Eggers
2020-01-23 12:20 ` Christian Eggers [this message]
2020-01-27  9:58 ` [PATCH 1/5] state: remove param member from struct state_string Sascha Hauer

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=20200123122045.25507-5-ceggers@arri.de \
    --to=ceggers@arri.de \
    --cc=barebox@lists.infradead.org \
    --cc=ceggers@gmx.de \
    /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