summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-21 21:09:53 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-27 09:00:59 +0100
commita7e89962df998a0d6c98806595641399f670174b (patch)
tree7f0bc0320806cf44421d934b125006a36771d8e8
parentdrvmgr: Enable build for riscv (diff)
downloadrtems-a7e89962df998a0d6c98806595641399f670174b.tar.bz2
drvmgr: Improve LP64 compatibility
-rw-r--r--cpukit/include/drvmgr/drvmgr.h4
-rw-r--r--cpukit/libdrvmgr/drvmgr_dev_by_name.c4
-rw-r--r--cpukit/libdrvmgr/drvmgr_for_each_dev.c14
-rw-r--r--cpukit/libdrvmgr/drvmgr_print.c5
-rw-r--r--cpukit/libmisc/shell/main_drvmgr.c3
5 files changed, 16 insertions, 14 deletions
diff --git a/cpukit/include/drvmgr/drvmgr.h b/cpukit/include/drvmgr/drvmgr.h
index afb9432e5d..4f4f884c45 100644
--- a/cpukit/include/drvmgr/drvmgr.h
+++ b/cpukit/include/drvmgr/drvmgr.h
@@ -512,8 +512,8 @@ RTEMS_INLINE_ROUTINE struct drvmgr_drv *drvmgr_get_drv(struct drvmgr_dev *dev)
*/
#define DRVMGR_FED_BF 1 /* Breadth-first search */
#define DRVMGR_FED_DF 0 /* Depth first search */
-extern int drvmgr_for_each_dev(
- int (*func)(struct drvmgr_dev *dev, void *arg),
+extern intptr_t drvmgr_for_each_dev(
+ intptr_t (*func)(struct drvmgr_dev *dev, void *arg),
void *arg,
int options);
diff --git a/cpukit/libdrvmgr/drvmgr_dev_by_name.c b/cpukit/libdrvmgr/drvmgr_dev_by_name.c
index c62cf0c9ad..350902497c 100644
--- a/cpukit/libdrvmgr/drvmgr_dev_by_name.c
+++ b/cpukit/libdrvmgr/drvmgr_dev_by_name.c
@@ -12,12 +12,12 @@
#include <drvmgr/drvmgr.h>
#include "drvmgr_internal.h"
-static int dev_name_compare(struct drvmgr_dev *dev, void *arg)
+static intptr_t dev_name_compare(struct drvmgr_dev *dev, void *arg)
{
const char *name = arg;
if (dev->name && (strcmp(dev->name, name) == 0))
- return (int)dev;
+ return (intptr_t)dev;
else
return 0;
}
diff --git a/cpukit/libdrvmgr/drvmgr_for_each_dev.c b/cpukit/libdrvmgr/drvmgr_for_each_dev.c
index a1c2899d91..288360bdbf 100644
--- a/cpukit/libdrvmgr/drvmgr_for_each_dev.c
+++ b/cpukit/libdrvmgr/drvmgr_for_each_dev.c
@@ -13,8 +13,8 @@
#include "drvmgr_internal.h"
/* Traverse device tree breadth-first. Supports up to 31 buses */
-static int drvmgr_for_each_dev_breadth(
- int (*func)(struct drvmgr_dev *dev, void *arg),
+static intptr_t drvmgr_for_each_dev_breadth(
+ intptr_t (*func)(struct drvmgr_dev *dev, void *arg),
void *arg
)
{
@@ -43,8 +43,8 @@ static int drvmgr_for_each_dev_breadth(
}
/* Traverse device tree depth-first. */
-static int drvmgr_for_each_dev_depth(
- int (*func)(struct drvmgr_dev *dev, void *arg),
+static intptr_t drvmgr_for_each_dev_depth(
+ intptr_t (*func)(struct drvmgr_dev *dev, void *arg),
void *arg
)
{
@@ -78,13 +78,13 @@ next_dev:
}
/* Traverse device tree depth-first or breadth-first */
-int drvmgr_for_each_dev(
- int (*func)(struct drvmgr_dev *dev, void *arg),
+intptr_t drvmgr_for_each_dev(
+ intptr_t (*func)(struct drvmgr_dev *dev, void *arg),
void *arg,
int options
)
{
- int ret;
+ intptr_t ret;
DRVMGR_LOCK_READ();
diff --git a/cpukit/libdrvmgr/drvmgr_print.c b/cpukit/libdrvmgr/drvmgr_print.c
index f53d87f18f..4b3f8c3c0f 100644
--- a/cpukit/libdrvmgr/drvmgr_print.c
+++ b/cpukit/libdrvmgr/drvmgr_print.c
@@ -13,6 +13,7 @@
*
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -78,7 +79,7 @@ void drvmgr_print_devs(unsigned int options)
printf("\n\n");
}
-static int drvmgr_topo_func(struct drvmgr_dev *dev, void *arg)
+static intptr_t drvmgr_topo_func(struct drvmgr_dev *dev, void *arg)
{
char prefix[32];
int depth = dev->parent->depth;
@@ -341,7 +342,7 @@ void drvmgr_info_drv(struct drvmgr_drv *drv, unsigned int options)
/* Print Driver */
printf(" -- DRIVER %p --\n", drv);
- printf(" DRIVER ID: 0x%llx\n", drv->drv_id);
+ printf(" DRIVER ID: 0x%" PRIx64 "\n", drv->drv_id);
printf(" NAME: %s\n", drv->name ? drv->name : "NO_NAME");
printf(" BUS TYPE: %d\n", drv->bus_type);
printf(" OPERATIONS:\n");
diff --git a/cpukit/libmisc/shell/main_drvmgr.c b/cpukit/libmisc/shell/main_drvmgr.c
index c20c49f418..bdf8d1c9ae 100644
--- a/cpukit/libmisc/shell/main_drvmgr.c
+++ b/cpukit/libmisc/shell/main_drvmgr.c
@@ -13,6 +13,7 @@
#include "config.h"
#endif
+#include <inttypes.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
@@ -196,7 +197,7 @@ static void shell_drvmgr_print_res_array(struct drvmgr_drv_res *resources)
drv_name = drv->name;
else
drv_name = "UNKNOWN";
- printf(" RESOURCES FOR DEVICE[%02d] DRIVER[0x%llx (%s)]\n",
+ printf(" RESOURCES FOR DEVICE[%02d] DRIVER[0x%" PRIu64 " (%s)]\n",
res->minor_bus, res->drv_id, drv_name);
shell_drvmgr_print_key_array(res->keys);
res++;