mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: oss-tools@pengutronix.de
Subject: [OSS-Tools] [PATCH dt-utils 4/6] treewide: rename struct device_d to device
Date: Tue, 27 Feb 2024 15:26:09 +0100	[thread overview]
Message-ID: <20240227142611.2421711-5-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20240227142611.2421711-1-m.felsch@pengutronix.de>

This ports barebox commit:

| commit c0afc799fb9a19a11f651596fe23b4b755593887
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date:   Wed Dec 14 13:35:09 2022 +0100
|
|     Rename struct device_d to device
|
|     The '_d' suffix was originally introduced in case we want to import
|     Linux struct device as a separate struct into barebox. Over time it
|     became clear that this won't happen, instead barebox struct device_d
|     is basically the same as Linux struct device. Rename the struct name
|     accordingly to make porting Linux code easier.
|
|     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|     Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
|     Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de
|     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 src/barebox-state/backend_bucket_circular.c |  4 ++--
 src/barebox-state/backend_bucket_direct.c   |  4 ++--
 src/barebox-state/backend_format_dtb.c      |  4 ++--
 src/barebox-state/backend_format_raw.c      |  4 ++--
 src/barebox-state/state.h                   | 14 ++++++-------
 src/dt/common.h                             | 22 ++++++++++-----------
 src/dt/dt.h                                 |  8 ++++----
 src/libdt.c                                 |  2 +-
 8 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c
index 0906268f5e7c..b84463c4be5e 100644
--- a/src/barebox-state/backend_bucket_circular.c
+++ b/src/barebox-state/backend_bucket_circular.c
@@ -63,7 +63,7 @@ struct state_backend_storage_bucket_circular {
 #endif
 
 	/* For outputs */
-	struct device_d *dev;
+	struct device *dev;
 };
 
 /*
@@ -457,7 +457,7 @@ static int bucket_circular_is_block_bad(struct state_backend_storage_bucket_circ
 }
 #endif
 
-int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
+int state_backend_bucket_circular_create(struct device *dev, const char *path,
 					 struct state_backend_storage_bucket **bucket,
 					 unsigned int eraseblock,
 					 ssize_t writesize,
diff --git a/src/barebox-state/backend_bucket_direct.c b/src/barebox-state/backend_bucket_direct.c
index dd9c8570ad3d..cf77c3f6a0df 100644
--- a/src/barebox-state/backend_bucket_direct.c
+++ b/src/barebox-state/backend_bucket_direct.c
@@ -30,7 +30,7 @@ struct state_backend_storage_bucket_direct {
 
 	int fd;
 
-	struct device_d *dev;
+	struct device *dev;
 };
 
 struct __attribute__((__packed__)) state_backend_storage_bucket_direct_meta {
@@ -163,7 +163,7 @@ static void state_backend_bucket_direct_free(struct
 	free(direct);
 }
 
-int state_backend_bucket_direct_create(struct device_d *dev, const char *path,
+int state_backend_bucket_direct_create(struct device *dev, const char *path,
 				       struct state_backend_storage_bucket **bucket,
 				       off_t offset, ssize_t max_size, bool readonly)
 {
diff --git a/src/barebox-state/backend_format_dtb.c b/src/barebox-state/backend_format_dtb.c
index 1d701efb3709..ab57990a8dc5 100644
--- a/src/barebox-state/backend_format_dtb.c
+++ b/src/barebox-state/backend_format_dtb.c
@@ -29,7 +29,7 @@ struct state_backend_format_dtb {
 	struct device_node *root;
 
 	/* For outputs */
-	struct device_d *dev;
+	struct device *dev;
 };
 
 static inline struct state_backend_format_dtb *get_format_dtb(struct
@@ -132,7 +132,7 @@ static void state_backend_format_dtb_free(struct state_backend_format *format)
 }
 
 int backend_format_dtb_create(struct state_backend_format **format,
-			      struct device_d *dev)
+			      struct device *dev)
 {
 	struct state_backend_format_dtb *dtb;
 
diff --git a/src/barebox-state/backend_format_raw.c b/src/barebox-state/backend_format_raw.c
index 686eb983bfba..8127a27e5732 100644
--- a/src/barebox-state/backend_format_raw.c
+++ b/src/barebox-state/backend_format_raw.c
@@ -33,7 +33,7 @@ struct state_backend_format_raw {
 	unsigned int digest_length;
 
 	/* For outputs */
-	struct device_d *dev;
+	struct device *dev;
 
 	char *secret_name;
 	int needs_secret;
@@ -301,7 +301,7 @@ static int backend_format_raw_init_digest(struct state_backend_format_raw *raw,
 
 int backend_format_raw_create(struct state_backend_format **format,
 			      struct device_node *node, const char *secret_name,
-			      struct device_d *dev)
+			      struct device *dev)
 {
 	struct state_backend_format_raw *raw;
 	int ret;
diff --git a/src/barebox-state/state.h b/src/barebox-state/state.h
index 8d279fb4cc11..c8217a382070 100644
--- a/src/barebox-state/state.h
+++ b/src/barebox-state/state.h
@@ -91,7 +91,7 @@ struct state_backend_storage {
 	struct list_head buckets;
 
 	/* For outputs */
-	struct device_d *dev;
+	struct device *dev;
 
 	const char *name;
 
@@ -106,7 +106,7 @@ struct state_backend_storage {
 struct state {
 	struct list_head list; /* Entry to enqueue on list of states */
 
-	struct device_d dev;
+	struct device dev;
 	char *of_path;
 	const char *name;
 	uint32_t magic;
@@ -203,21 +203,21 @@ struct device_node *state_to_node(struct state *state,
 				  enum state_convert conv);
 int backend_format_raw_create(struct state_backend_format **format,
 			      struct device_node *node, const char *secret_name,
-			      struct device_d *dev);
+			      struct device *dev);
 int backend_format_dtb_create(struct state_backend_format **format,
-			      struct device_d *dev);
+			      struct device *dev);
 int state_storage_init(struct state *state, const char *path,
 		       off_t offset, size_t max_size, uint32_t stridesize,
 		       const char *storagetype);
 void state_storage_set_readonly(struct state_backend_storage *storage);
 void state_add_var(struct state *state, struct state_variable *var);
 struct variable_type *state_find_type_by_name(const char *name);
-int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
+int state_backend_bucket_circular_create(struct device *dev, const char *path,
 					 struct state_backend_storage_bucket **bucket,
 					 unsigned int eraseblock,
 					 ssize_t writesize,
 					 struct mtd_info_user *mtd_uinfo);
-int state_backend_bucket_cached_create(struct device_d *dev,
+int state_backend_bucket_cached_create(struct device *dev,
 				       struct state_backend_storage_bucket *raw,
 				       struct state_backend_storage_bucket **out);
 struct state_variable *state_find_var(struct state *state, const char *name);
@@ -225,7 +225,7 @@ struct digest *state_backend_format_raw_get_digest(struct state_backend_format
 						   *format);
 void state_backend_set_readonly(struct state *state);
 void state_storage_free(struct state_backend_storage *storage);
-int state_backend_bucket_direct_create(struct device_d *dev, const char *path,
+int state_backend_bucket_direct_create(struct device *dev, const char *path,
 				       struct state_backend_storage_bucket **bucket,
 				       off_t offset, ssize_t max_size, bool readonly);
 int state_storage_write(struct state_backend_storage *storage,
diff --git a/src/dt/common.h b/src/dt/common.h
index 7ba1bed1d475..a3c2642c0ec8 100644
--- a/src/dt/common.h
+++ b/src/dt/common.h
@@ -45,14 +45,14 @@ typedef uint64_t u64;
 	(void) (&_min1 == &_min2);		\
 	_min1 < _min2 ? _min1 : _min2; })
 
-struct device_d;
+struct device;
 
 void pr_level_set(int level);
 int pr_level_get(void);
 
 int pr_printf(int level, const char *format, ...)
         __attribute__ ((format(__printf__, 2, 3)));
-int dev_printf(int level, const struct device_d *dev, const char *format, ...)
+int dev_printf(int level, const struct device *dev, const char *format, ...)
         __attribute__ ((format(__printf__, 3, 4)));
 
 #define pr_err(fmt, arg...)	pr_printf(3, fmt, ##arg)
@@ -372,13 +372,13 @@ static inline int is_zero_ether_addr(const u8 *addr)
 #define MAX_DRIVER_NAME		32
 #define DEVICE_ID_SINGLE	-1
 
-struct device_d {
+struct device {
 	char name[MAX_DRIVER_NAME];
 	int id;
 	struct device_node *device_node;
 };
 
-static inline struct param_d *dev_add_param_enum(struct device_d *dev, const char *name,
+static inline struct param_d *dev_add_param_enum(struct device *dev, const char *name,
 		int (*set)(struct param_d *p, void *priv),
 		int (*get)(struct param_d *p, void *priv),
 		uint32_t *value, const char * const *names, int max, void *priv)
@@ -387,7 +387,7 @@ static inline struct param_d *dev_add_param_enum(struct device_d *dev, const cha
 	return NULL;
 }
 
-static inline struct param_d *dev_add_param_bool(struct device_d *dev, const char *name,
+static inline struct param_d *dev_add_param_bool(struct device *dev, const char *name,
 		int (*set)(struct param_d *p, void *priv),
 		int (*get)(struct param_d *p, void *priv),
 		uint32_t *value, void *priv)
@@ -395,7 +395,7 @@ static inline struct param_d *dev_add_param_bool(struct device_d *dev, const cha
 	return NULL;
 }
 
-static inline struct param_d *dev_add_param_mac(struct device_d *dev, const char *name,
+static inline struct param_d *dev_add_param_mac(struct device *dev, const char *name,
 		int (*set)(struct param_d *p, void *priv),
 		int (*get)(struct param_d *p, void *priv),
 		u8 *mac, void *priv)
@@ -403,7 +403,7 @@ static inline struct param_d *dev_add_param_mac(struct device_d *dev, const char
 	return NULL;
 }
 
-static inline struct param_d *dev_add_param_string(struct device_d *dev, const char *name,
+static inline struct param_d *dev_add_param_string(struct device *dev, const char *name,
 		int (*set)(struct param_d *p, void *priv),
 		int (*get)(struct param_d *p, void *priv),
 		char **value, void *priv)
@@ -411,7 +411,7 @@ static inline struct param_d *dev_add_param_string(struct device_d *dev, const c
 	return NULL;
 }
 
-static inline struct param_d *dev_add_param_uint32(struct device_d *dev, const char *name,
+static inline struct param_d *dev_add_param_uint32(struct device *dev, const char *name,
 		int (*set)(struct param_d *p, void *priv),
 		int (*get)(struct param_d *p, void *priv),
 		uint32_t *value, const char *format, void *priv)
@@ -424,7 +424,7 @@ static inline struct param_d *dev_add_param_uint32(struct device_d *dev, const c
  * @dev: device
  * @fmt: format string for the device's name
  */
-static inline int dev_set_name(struct device_d *dev, const char *fmt, ...)
+static inline int dev_set_name(struct device *dev, const char *fmt, ...)
 {
 	char newname[MAX_DRIVER_NAME];
 	va_list vargs;
@@ -454,11 +454,11 @@ static inline int register_driver(struct driver_d *d)
 	return 0;
 }
 
-static inline int register_device(struct device_d *d)
+static inline int register_device(struct device *d)
 {
 	return 0;
 }
-static inline int unregister_device(struct device_d *d)
+static inline int unregister_device(struct device *d)
 {
 	return 0;
 }
diff --git a/src/dt/dt.h b/src/dt/dt.h
index e473b4e7cea5..a5a2da269a24 100644
--- a/src/dt/dt.h
+++ b/src/dt/dt.h
@@ -62,10 +62,10 @@ struct of_reserve_map *of_get_reserve_map(void);
 void of_clean_reserve_map(void);
 void fdt_add_reserve_map(void *fdt);
 
-struct device_d;
+struct device;
 struct driver_d;
 
-int of_match(struct device_d *dev, struct driver_d *drv);
+int of_match(struct device *dev, struct driver_d *drv);
 
 struct fdt_header *fdt_get_tree(void);
 
@@ -222,9 +222,9 @@ extern int of_set_root_node(struct device_node *node);
 
 extern int of_platform_populate(struct device_node *root,
 				const struct of_device_id *matches,
-				struct device_d *parent);
+				struct device *parent);
 
-int of_device_is_stdout_path(struct device_d *dev);
+int of_device_is_stdout_path(struct device *dev);
 const char *of_get_model(void);
 void *of_flatten_dtb(struct device_node *node);
 int of_add_memory(struct device_node *node, bool dump);
diff --git a/src/libdt.c b/src/libdt.c
index 72e8ab41e09b..0cfce4af9b39 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -74,7 +74,7 @@ int pr_printf(int level, const char *format, ...)
 	return ret;
 }
 
-int dev_printf(int level, const struct device_d *dev, const char *format, ...)
+int dev_printf(int level, const struct device *dev, const char *format, ...)
 {
 	va_list args;
 	int ret = 0;
-- 
2.39.2




  parent reply	other threads:[~2024-02-27 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 14:26 [OSS-Tools] [PATCH dt-utils 0/6] barebox-state sync Marco Felsch
2024-02-27 14:26 ` [OSS-Tools] [PATCH dt-utils 1/6] state: align state_backend_bucket_direct_create with barebox Marco Felsch
2024-02-27 14:26 ` [OSS-Tools] [PATCH dt-utils 2/6] state: don't mix goto labels and statements on same line Marco Felsch
2024-02-27 14:26 ` [OSS-Tools] [PATCH dt-utils 3/6] state: drop null pointer checks around of_delete_node Marco Felsch
2024-02-27 14:26 ` Marco Felsch [this message]
2024-02-27 14:26 ` [OSS-Tools] [PATCH dt-utils 5/6] state: make uninitialized state less verbose Marco Felsch
2024-02-27 14:26 ` [OSS-Tools] [PATCH dt-utils 6/6] state: backend_bucket_direct: add debug prints on read/write Marco Felsch

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=20240227142611.2421711-5-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=oss-tools@pengutronix.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