From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 27 Feb 2024 15:26:16 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1reyPQ-00AlBc-0i for lore@lore.pengutronix.de; Tue, 27 Feb 2024 15:26:16 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1reyPO-00044M-V3; Tue, 27 Feb 2024 15:26:14 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1reyPM-00040D-N3 for oss-tools@pengutronix.de; Tue, 27 Feb 2024 15:26:12 +0100 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reyPM-003Dbf-8Z for oss-tools@pengutronix.de; Tue, 27 Feb 2024 15:26:12 +0100 Received: from mfe by dude02.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1reyPM-00AA29-0c for oss-tools@pengutronix.de; Tue, 27 Feb 2024 15:26:12 +0100 From: Marco Felsch To: oss-tools@pengutronix.de Date: Tue, 27 Feb 2024 15:26:09 +0100 Message-Id: <20240227142611.2421711-5-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240227142611.2421711-1-m.felsch@pengutronix.de> References: <20240227142611.2421711-1-m.felsch@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [OSS-Tools] [PATCH dt-utils 4/6] treewide: rename struct device_d to device X-BeenThere: oss-tools@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: Pengutronix Public Open-Source-Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "OSS-Tools" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: oss-tools-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false This ports barebox commit: | commit c0afc799fb9a19a11f651596fe23b4b755593887 | Author: Sascha Hauer | 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 | Reviewed-by: Marco Felsch | Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de | Signed-off-by: Sascha Hauer Signed-off-by: Marco Felsch --- 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