summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-21 20:09:53 (UTC)
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-27 08:00:59 (UTC)
commita7e89962df998a0d6c98806595641399f670174b (patch)
tree7f0bc0320806cf44421d934b125006a36771d8e8
parent6073c71d07f905e8edf709cc9e7a99574152e26a (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 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++;