[rtems commit] drvmgr: Improve LP64 compatibility
Sebastian Huber
sebh at rtems.org
Thu Dec 27 08:02:23 UTC 2018
Module: rtems
Branch: master
Commit: a7e89962df998a0d6c98806595641399f670174b
Changeset: http://git.rtems.org/rtems/commit/?id=a7e89962df998a0d6c98806595641399f670174b
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Dec 21 21:09:53 2018 +0100
drvmgr: Improve LP64 compatibility
---
cpukit/include/drvmgr/drvmgr.h | 4 ++--
cpukit/libdrvmgr/drvmgr_dev_by_name.c | 4 ++--
cpukit/libdrvmgr/drvmgr_for_each_dev.c | 14 +++++++-------
cpukit/libdrvmgr/drvmgr_print.c | 5 +++--
cpukit/libmisc/shell/main_drvmgr.c | 3 ++-
5 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/cpukit/include/drvmgr/drvmgr.h b/cpukit/include/drvmgr/drvmgr.h
index afb9432..4f4f884 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 c62cf0c..3509024 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 a1c2899..288360b 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 f53d87f..4b3f8c3 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 c20c49f..bdf8d1c 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++;
More information about the vc
mailing list