summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2022-12-14 13:35:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-01-10 15:43:47 +0100
commitc0afc799fb9a19a11f651596fe23b4b755593887 (patch)
tree9c27f1533193d31757744b22b2af9186d23e67ed /common
parente70b9d7a74698f1374244b2251216428db920aed (diff)
downloadbarebox-c0afc799fb9a19a11f651596fe23b4b755593887.tar.gz
barebox-c0afc799fb9a19a11f651596fe23b4b755593887.tar.xz
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>
Diffstat (limited to 'common')
-rw-r--r--common/blspec.c10
-rw-r--r--common/boards/qemu-virt/board.c2
-rw-r--r--common/complete.c6
-rw-r--r--common/console.c4
-rw-r--r--common/console_common.c6
-rw-r--r--common/efi/payload/init.c2
-rw-r--r--common/env.c4
-rw-r--r--common/globalvar.c32
-rw-r--r--common/oftree.c2
-rw-r--r--common/partitions/efi.c3
-rw-r--r--common/reset_source.c8
-rw-r--r--common/serdev.c4
-rw-r--r--common/state/backend_bucket_circular.c4
-rw-r--r--common/state/backend_bucket_direct.c4
-rw-r--r--common/state/backend_format_dtb.c4
-rw-r--r--common/state/backend_format_raw.c4
-rw-r--r--common/state/state.h14
-rw-r--r--common/usbgadget.c2
18 files changed, 60 insertions, 55 deletions
diff --git a/common/blspec.c b/common/blspec.c
index 9ae7b49a77..e023259bac 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -622,7 +622,7 @@ err_out:
*/
static int blspec_scan_ubi(struct bootentries *bootentries, struct cdev *cdev)
{
- struct device_d *child;
+ struct device *child;
int ret, found = 0;
pr_debug("%s: %s\n", __func__, cdev->name);
@@ -696,7 +696,7 @@ static int blspec_scan_cdev(struct bootentries *bootentries, struct cdev *cdev)
*/
int blspec_scan_devices(struct bootentries *bootentries)
{
- struct device_d *dev;
+ struct device *dev;
struct block_device *bdev;
int ret, found = 0;
@@ -724,9 +724,9 @@ int blspec_scan_devices(struct bootentries *bootentries)
* Returns the number of entries found or a negative error code if some unexpected
* error occurred.
*/
-int blspec_scan_device(struct bootentries *bootentries, struct device_d *dev)
+int blspec_scan_device(struct bootentries *bootentries, struct device *dev)
{
- struct device_d *child;
+ struct device *child;
struct cdev *cdev;
int ret, found = 0;
@@ -788,7 +788,7 @@ int blspec_scan_device(struct bootentries *bootentries, struct device_d *dev)
*/
int blspec_scan_devicename(struct bootentries *bootentries, const char *devname)
{
- struct device_d *dev;
+ struct device *dev;
struct cdev *cdev;
pr_debug("%s: %s\n", __func__, devname);
diff --git a/common/boards/qemu-virt/board.c b/common/boards/qemu-virt/board.c
index bfda86569b..5062ad2c7f 100644
--- a/common/boards/qemu-virt/board.c
+++ b/common/boards/qemu-virt/board.c
@@ -36,7 +36,7 @@ static inline void arm_virt_init(void) {}
extern char __dtb_overlay_of_flash_start[];
-static int virt_probe(struct device_d *dev)
+static int virt_probe(struct device *dev)
{
struct device_node *overlay;
void (*init)(void);
diff --git a/common/complete.c b/common/complete.c
index ab3c985493..327e82dd0a 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(command_complete);
int device_complete(struct string_list *sl, char *instr)
{
- struct device_d *dev;
+ struct device *dev;
int len;
if (!instr)
@@ -154,7 +154,7 @@ int device_complete(struct string_list *sl, char *instr)
}
EXPORT_SYMBOL(device_complete);
-static int device_param_complete(struct device_d *dev, struct string_list *sl,
+static int device_param_complete(struct device *dev, struct string_list *sl,
char *instr, int eval)
{
struct param_d *param;
@@ -267,7 +267,7 @@ EXPORT_SYMBOL(tutorial_complete);
static int env_param_complete(struct string_list *sl, char *instr, int eval)
{
- struct device_d *dev;
+ struct device *dev;
struct variable_d *var;
struct env_context *c;
int len;
diff --git a/common/console.c b/common/console.c
index 56caa12b45..c09c8e7d44 100644
--- a/common/console.c
+++ b/common/console.c
@@ -309,7 +309,7 @@ static ssize_t fops_write(struct cdev* dev, const void* buf, size_t count,
int console_register(struct console_device *newcdev)
{
struct device_node *serdev_node = console_is_serdev_node(newcdev);
- struct device_d *dev = &newcdev->class_dev;
+ struct device *dev = &newcdev->class_dev;
int activate = 0, ret;
unsigned baudrate = CONFIG_BAUDRATE;
@@ -406,7 +406,7 @@ EXPORT_SYMBOL(console_register);
int console_unregister(struct console_device *cdev)
{
- struct device_d *dev = &cdev->class_dev;
+ struct device *dev = &cdev->class_dev;
int status;
/*
diff --git a/common/console_common.c b/common/console_common.c
index ca1dad0f15..866a7cbf65 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -134,7 +134,7 @@ int pr_print(int level, const char *fmt, ...)
return i;
}
-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;
@@ -284,7 +284,7 @@ int vprintf(const char *fmt, va_list args)
}
EXPORT_SYMBOL(vprintf);
-struct console_device *console_get_by_dev(struct device_d *dev)
+struct console_device *console_get_by_dev(struct device *dev)
{
struct console_device *cdev;
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(console_get_first_active);
struct console_device *of_console_get_by_alias(const char *alias)
{
struct device_node *node;
- struct device_d *dev;
+ struct device *dev;
node = of_find_node_by_alias(NULL, alias);
if (!node)
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index 6976285fb3..3ee5d66d60 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -271,7 +271,7 @@ void efi_main(efi_handle_t image, efi_system_table_t *sys_table)
static int efi_core_init(void)
{
- struct device_d *dev;
+ struct device *dev;
int ret;
dev = device_alloc("efi-cs", DEVICE_ID_SINGLE);
diff --git a/common/env.c b/common/env.c
index 9e9988e415..d673b061ab 100644
--- a/common/env.c
+++ b/common/env.c
@@ -127,7 +127,7 @@ static const char *dev_getenv(const char *name)
{
const char *pos, *val, *dot, *varname;
char *devname;
- struct device_d *dev;
+ struct device *dev;
pos = name;
@@ -215,7 +215,7 @@ static int dev_setenv(const char *name, const char *val)
{
const char *pos, *dot, *varname;
char *devname;
- struct device_d *dev;
+ struct device *dev;
pos = name;
diff --git a/common/globalvar.c b/common/globalvar.c
index 4fd6361c2f..b3a7f6d755 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -16,12 +16,12 @@
static int nv_dirty;
-struct device_d global_device = {
+struct device global_device = {
.name = "global",
.id = DEVICE_ID_SINGLE,
};
-struct device_d nv_device = {
+struct device nv_device = {
.name = "nv",
.id = DEVICE_ID_SINGLE,
};
@@ -101,7 +101,7 @@ static int nv_save(const char *name, const char *val)
* This function initializes a newly created device parameter from the corresponding
* nv.dev.<devname>.<paramname> variable.
*/
-void dev_param_init_from_nv(struct device_d *dev, const char *name)
+void dev_param_init_from_nv(struct device *dev, const char *name)
{
char *nvname;
const char *val;
@@ -142,7 +142,7 @@ void dev_param_init_from_nv(struct device_d *dev, const char *name)
* parameter name. A negative error code is returned when the incoming string belongs to
* the device namespace, but cannot be dispatched.
*/
-static int nvvar_device_dispatch(const char *name, struct device_d **dev,
+static int nvvar_device_dispatch(const char *name, struct device **dev,
const char **pname)
{
char *devname;
@@ -177,7 +177,8 @@ static int nvvar_device_dispatch(const char *name, struct device_d **dev,
return 1;
}
-static int nv_set(struct device_d *dev, struct param_d *p, const char *name, const char *val)
+static int nv_set(struct device *dev, struct param_d *p, const char *name,
+ const char *val)
{
int ret;
@@ -195,12 +196,13 @@ static int nv_set(struct device_d *dev, struct param_d *p, const char *name, con
return 0;
}
-static const char *nv_param_get(struct device_d *dev, struct param_d *p)
+static const char *nv_param_get(struct device *dev, struct param_d *p)
{
return p->value ? p->value : "";
}
-static int nv_param_set(struct device_d *dev, struct param_d *p, const char *val)
+static int nv_param_set(struct device *dev, struct param_d *p,
+ const char *val)
{
int ret;
@@ -214,7 +216,7 @@ static int nv_param_set(struct device_d *dev, struct param_d *p, const char *val
static int __nvvar_add(const char *name, const char *value)
{
struct param_d *p;
- struct device_d *dev = NULL;
+ struct device *dev = NULL;
const char *pname;
int ret;
@@ -375,7 +377,7 @@ int nvvar_load(void)
return 0;
}
-static void device_param_print(struct device_d *dev)
+static void device_param_print(struct device *dev)
{
struct param_d *param;
@@ -452,9 +454,10 @@ void globalvar_set(const char *name, const char *val)
dev_set_param(&global_device, name, val);
}
-static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
+static int globalvar_simple_set(struct device *dev, struct param_d *p,
+ const char *val)
{
- struct device_d *rdev;
+ struct device *rdev;
const char *pname = NULL;
int ret;
@@ -744,8 +747,9 @@ static void nv_exit(void)
}
predevshutdown_exitcall(nv_exit);
-static int nv_global_param_complete(struct device_d *dev, struct string_list *sl,
- char *instr, int eval)
+static int nv_global_param_complete(struct device *dev,
+ struct string_list *sl,
+ char *instr, int eval)
{
struct param_d *param;
int len;
@@ -766,7 +770,7 @@ static int nv_global_param_complete(struct device_d *dev, struct string_list *sl
int nv_complete(struct string_list *sl, char *instr)
{
- struct device_d *dev;
+ struct device *dev;
struct param_d *param;
char *str;
int len;
diff --git a/common/oftree.c b/common/oftree.c
index 4cb74067de..4beadc5aaa 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -205,7 +205,7 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
struct device_node *node;
int err;
int instance = reset_source_get_instance();
- struct device_d *dev;
+ struct device *dev;
const char *serialno;
const char *compat;
diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index 0f3f790539..ffdbd9a56f 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -249,7 +249,8 @@ is_pte_valid(const gpt_entry *pte, const u64 lastlba)
*
*/
static void
-compare_gpts(struct device_d *dev, gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
+compare_gpts(struct device *dev, gpt_header *pgpt, gpt_header *agpt,
+ u64 lastlba)
{
int error_found = 0;
if (!pgpt || !agpt)
diff --git a/common/reset_source.c b/common/reset_source.c
index 90a34f5f50..f28be90dcb 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -25,7 +25,7 @@ static const char * const reset_src_names[] = {
static enum reset_src_type reset_source;
static unsigned int reset_source_priority;
static int reset_source_instance;
-static struct device_d *reset_source_device;
+static struct device *reset_source_device;
enum reset_src_type reset_source_get(void)
{
@@ -45,13 +45,13 @@ int reset_source_get_instance(void)
}
EXPORT_SYMBOL(reset_source_get_instance);
-struct device_d *reset_source_get_device(void)
+struct device *reset_source_get_device(void)
{
return reset_source_device;
}
EXPORT_SYMBOL(reset_source_get_device);
-static void __reset_source_set(struct device_d *dev,
+static void __reset_source_set(struct device *dev,
enum reset_src_type st,
unsigned int priority, int instance)
{
@@ -74,7 +74,7 @@ void reset_source_set_prinst(enum reset_src_type st,
}
EXPORT_SYMBOL(reset_source_set_prinst);
-void reset_source_set_device(struct device_d *dev, enum reset_src_type st)
+void reset_source_set_device(struct device *dev, enum reset_src_type st)
{
unsigned int priority = RESET_SOURCE_DEFAULT_PRIORITY;
diff --git a/common/serdev.c b/common/serdev.c
index 1d328c6a33..5399a20627 100644
--- a/common/serdev.c
+++ b/common/serdev.c
@@ -132,7 +132,7 @@ static int serdev_device_reader_receive_buf(struct serdev_device *serdev,
const unsigned char *buf,
size_t size)
{
- struct device_d *dev = serdev->dev;
+ struct device *dev = serdev->dev;
struct serdev_device_reader *r = dev->priv;
const size_t room = min(r->capacity - r->len, size);
@@ -186,7 +186,7 @@ int serdev_device_reader_open(struct serdev_device *serdev, size_t capacity)
int serdev_device_read(struct serdev_device *serdev, unsigned char *buf,
size_t count, unsigned long timeout)
{
- struct device_d *dev = serdev->dev;
+ struct device *dev = serdev->dev;
struct serdev_device_reader *r = dev->priv;
int ret;
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 735510e0d3..2ac5bf6a82 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -62,7 +62,7 @@ struct state_backend_storage_bucket_circular {
#endif
/* For outputs */
- struct device_d *dev;
+ struct device *dev;
};
/*
@@ -456,7 +456,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/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 117cdfb46c..3818c6f0b0 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -29,7 +29,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 {
@@ -162,7 +162,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)
{
diff --git a/common/state/backend_format_dtb.c b/common/state/backend_format_dtb.c
index d0fc948859..b41b896aac 100644
--- a/common/state/backend_format_dtb.c
+++ b/common/state/backend_format_dtb.c
@@ -28,7 +28,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
@@ -131,7 +131,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/common/state/backend_format_raw.c b/common/state/backend_format_raw.c
index 7835f977c9..105f7dd444 100644
--- a/common/state/backend_format_raw.c
+++ b/common/state/backend_format_raw.c
@@ -32,7 +32,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;
@@ -299,7 +299,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/common/state/state.h b/common/state/state.h
index 0545cf6ac1..7eb51bbdb5 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -90,7 +90,7 @@ struct state_backend_storage {
struct list_head buckets;
/* For outputs */
- struct device_d *dev;
+ struct device *dev;
const char *name;
@@ -105,7 +105,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;
@@ -202,21 +202,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);
@@ -224,7 +224,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);
int state_storage_write(struct state_backend_storage *storage,
diff --git a/common/usbgadget.c b/common/usbgadget.c
index 7291fbf4d5..59b9e635f4 100644
--- a/common/usbgadget.c
+++ b/common/usbgadget.c
@@ -35,7 +35,7 @@ int usbgadget_register(const struct usbgadget_funcs *funcs)
{
int ret;
int flags = funcs->flags;
- struct device_d *dev;
+ struct device *dev;
struct f_multi_opts *opts;
opts = xzalloc(sizeof(*opts));