All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups
@ 2023-12-05 12:41 Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 01/13] testsuite: Migrate to ARRAY_SIZE() Florian Bezdeka
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

Hi all,

Warning, this is high altitute work ;-). I had some time on my flight back
from New Zealand, so review carefully.

Everything is compile tested and passed our internal CI already - as
usual.

I'm trying to address some comments / further cleanups mentioned by Jan
during the last testsuite cleanup series.

Best regards,
Florian

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
Florian Bezdeka (13):
      testsuite: Migrate to ARRAY_SIZE()
      demo: Migrate to ARRAY_SIZE()
      lib: Migrate to ARRAY_SIZE()
      kernel/drivers: Mirate to ARRAY_SIZE()
      demo: Cleanup includes
      lib/alchemy: Cleanup includes
      lib/analogy: Cleanup includes
      lib/boilerplate: Cleanup includes
      lib/copperplate: Cleanup includes
      lib/psos: Cleanup includes
      lib/smokey: Cleanup includes
      lib/trank: Cleanup includes
      lib/vxworks: Cleanup includes

 demo/alchemy/altency.c                                   |  2 +-
 demo/alchemy/cobalt/cross-link.c                         |  3 +--
 demo/posix/cobalt/bufp-label.c                           |  5 ++++-
 demo/posix/cobalt/bufp-readwrite.c                       |  5 ++++-
 demo/posix/cobalt/can-rtt.c                              |  2 --
 demo/posix/cobalt/eth_p_all.c                            |  2 --
 demo/posix/cobalt/gpiopwm.c                              |  3 ---
 demo/posix/cobalt/iddp-label.c                           |  5 ++++-
 demo/posix/cobalt/iddp-sendrecv.c                        |  5 ++++-
 demo/posix/cobalt/xddp-echo.c                            |  5 ++++-
 demo/posix/cobalt/xddp-label.c                           |  5 ++++-
 demo/posix/cobalt/xddp-stream.c                          |  5 ++++-
 demo/posix/cyclictest/cyclictest.c                       |  6 +++---
 include/smokey/smokey.h                                  |  2 +-
 kernel/drivers/analogy/national_instruments/mio_common.c |  6 ++----
 kernel/drivers/analogy/national_instruments/ni_670x.c    |  2 +-
 kernel/drivers/analogy/national_instruments/ni_stc.h     |  4 ++--
 kernel/drivers/analogy/national_instruments/pcimio.c     |  2 +-
 .../net/drivers/experimental/e1000/e1000_80003es2lan.c   |  3 +--
 .../drivers/net/drivers/experimental/e1000/e1000_82541.c |  3 +--
 .../drivers/net/drivers/experimental/e1000/e1000_phy.c   |  6 ++----
 kernel/drivers/net/drivers/igb/e1000_phy.c               |  6 ++----
 lib/alchemy/alarm.c                                      |  2 +-
 lib/alchemy/buffer.c                                     |  2 +-
 lib/alchemy/cond.c                                       |  2 +-
 lib/alchemy/event.c                                      |  2 +-
 lib/alchemy/heap.c                                       |  1 -
 lib/alchemy/init.c                                       |  3 +--
 lib/alchemy/internal.c                                   |  2 --
 lib/alchemy/mutex.c                                      |  2 +-
 lib/alchemy/pipe.c                                       |  3 ++-
 lib/alchemy/queue.c                                      |  2 +-
 lib/alchemy/sem.c                                        |  1 -
 lib/alchemy/task.c                                       |  2 +-
 lib/analogy/calibration.c                                |  2 +-
 lib/analogy/descriptor.c                                 |  1 -
 lib/analogy/math.c                                       |  1 -
 lib/analogy/range.c                                      |  1 -
 lib/boilerplate/ancillaries.c                            |  8 +++-----
 lib/boilerplate/avl.c                                    |  1 +
 lib/boilerplate/debug.c                                  |  7 ++-----
 lib/boilerplate/hash.c                                   |  2 +-
 lib/boilerplate/heapmem.c                                |  5 ++---
 lib/boilerplate/iniparser/dictionary.c                   |  1 -
 lib/boilerplate/init/bootstrap.c                         |  1 +
 lib/boilerplate/setup.c                                  |  7 +++----
 lib/boilerplate/time.c                                   |  1 +
 lib/boilerplate/version.c                                |  1 +
 lib/cobalt/mutex.c                                       |  2 +-
 lib/cobalt/sigshadow.c                                   |  2 +-
 lib/copperplate/clockobj.c                               |  4 ----
 lib/copperplate/cluster.c                                |  3 ---
 lib/copperplate/eventobj.c                               |  2 --
 lib/copperplate/heapobj-heapmem.c                        |  7 +++++--
 lib/copperplate/init.c                                   |  4 +---
 lib/copperplate/internal.c                               |  4 ++--
 lib/copperplate/syncobj.c                                |  2 --
 lib/copperplate/threadobj.c                              |  1 +
 lib/copperplate/traceobj.c                               |  1 +
 lib/psos/init.c                                          |  8 ++------
 lib/psos/pt.c                                            |  5 +----
 lib/psos/queue.c                                         |  7 +------
 lib/psos/rn.c                                            |  5 +----
 lib/psos/sem.c                                           |  4 +---
 lib/psos/task.c                                          |  5 +----
 lib/psos/tm.c                                            |  3 ---
 lib/smokey/helpers.c                                     |  1 +
 lib/smokey/init.c                                        |  8 +++-----
 lib/trank/init.c                                         |  1 +
 lib/trank/internal.c                                     |  4 ++--
 lib/vxworks/errnoLib.c                                   |  1 +
 lib/vxworks/init.c                                       |  3 ++-
 lib/vxworks/kernLib.c                                    |  1 +
 lib/vxworks/memPartLib.c                                 |  1 +
 lib/vxworks/msgQLib.c                                    |  1 +
 lib/vxworks/rngLib.c                                     |  1 +
 lib/vxworks/semLib.c                                     |  1 +
 lib/vxworks/sysLib.c                                     |  4 ++--
 lib/vxworks/taskHookLib.c                                |  2 ++
 lib/vxworks/taskInfo.c                                   |  1 +
 lib/vxworks/taskLib.c                                    |  6 ------
 lib/vxworks/tickLib.c                                    |  6 +-----
 lib/vxworks/wdLib.c                                      |  1 +
 testsuite/smokey/alchemytests/mq-1.c                     |  3 ++-
 testsuite/smokey/alchemytests/mq-2.c                     |  3 ++-
 testsuite/smokey/net_common/server.c                     |  8 ++++----
 testsuite/smokey/net_common/setup.c                      |  2 +-
 testsuite/smokey/posix-select/posix-select.c             |  4 ++--
 testsuite/smokey/vxworkstests/msgQ-1.c                   |  3 ++-
 testsuite/smokey/vxworkstests/msgQ-2.c                   |  3 ++-
 testsuite/switchtest/switchtest.c                        | 16 ++++++++--------
 91 files changed, 136 insertions(+), 168 deletions(-)
---
base-commit: ed69c34214f9fcf57b459e701ed4f65f6753bb8c
change-id: 20231201-flo-array-size-f30df8dd25e9

Best regards,
-- 
Florian Bezdeka <florian.bezdeka@siemens.com>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/13] testsuite: Migrate to ARRAY_SIZE()
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 02/13] demo: " Florian Bezdeka
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

Use ARRAY_SIZE() where possible. No functional change.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/smokey/smokey.h                      |  2 +-
 testsuite/smokey/alchemytests/mq-1.c         |  3 ++-
 testsuite/smokey/alchemytests/mq-2.c         |  3 ++-
 testsuite/smokey/net_common/server.c         |  8 ++++----
 testsuite/smokey/net_common/setup.c          |  2 +-
 testsuite/smokey/posix-select/posix-select.c |  4 ++--
 testsuite/smokey/vxworkstests/msgQ-1.c       |  3 ++-
 testsuite/smokey/vxworkstests/msgQ-2.c       |  3 ++-
 testsuite/switchtest/switchtest.c            | 16 ++++++++--------
 9 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/include/smokey/smokey.h b/include/smokey/smokey.h
index 0c20f5d69..cf9701966 100644
--- a/include/smokey/smokey.h
+++ b/include/smokey/smokey.h
@@ -88,7 +88,7 @@ struct smokey_test {
 	pvlist_for_each_entry((__pos), &smokey_test_list, __reserved.next)
 
 #define __smokey_arg_count(__args)	\
-	(sizeof(__args) / sizeof(__args[0]))
+	ARRAY_SIZE(__args)
 
 #define smokey_test_plugin(__plugin, __args, __desc)			\
 	static int run_ ## __plugin(struct smokey_test *t,		\
diff --git a/testsuite/smokey/alchemytests/mq-1.c b/testsuite/smokey/alchemytests/mq-1.c
index 952ff6448..8e1aa4c6d 100644
--- a/testsuite/smokey/alchemytests/mq-1.c
+++ b/testsuite/smokey/alchemytests/mq-1.c
@@ -1,13 +1,14 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <boilerplate/ancillaries.h>
 #include <copperplate/traceobj.h>
 #include <alchemy/task.h>
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
 
-#define NMESSAGES (sizeof(messages) / sizeof(messages[0]))
+#define NMESSAGES   ARRAY_SIZE(messages)
 
 static int messages[] = {
 	0xfafafafa,
diff --git a/testsuite/smokey/alchemytests/mq-2.c b/testsuite/smokey/alchemytests/mq-2.c
index acc6ec051..a389e46db 100644
--- a/testsuite/smokey/alchemytests/mq-2.c
+++ b/testsuite/smokey/alchemytests/mq-2.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <boilerplate/ancillaries.h>
 #include <copperplate/traceobj.h>
 #include <alchemy/task.h>
 #include <alchemy/queue.h>
@@ -13,7 +14,7 @@ static int tseq[] = {
 	7,
 };
 
-#define NMESSAGES (sizeof(messages) / sizeof(messages[0]))
+#define NMESSAGES   ARRAY_SIZE(messages)
 
 static int messages[] = {
 	0xfafafafa,
diff --git a/testsuite/smokey/net_common/server.c b/testsuite/smokey/net_common/server.c
index 39d59c31f..cade79fa6 100644
--- a/testsuite/smokey/net_common/server.c
+++ b/testsuite/smokey/net_common/server.c
@@ -119,7 +119,7 @@ static void server_loop_cleanup(void *cookie)
 	int *fds = cookie;
 	int i;
 
-	for (i = 0; i < sizeof(protos)/sizeof(protos[0]); i++)
+	for (i = 0; i < ARRAY_SIZE(protos); i++)
 		__RT(close(fds[i]));
 	free(fds);
 }
@@ -131,7 +131,7 @@ void smokey_net_server_loop(int net_config)
 	int i, maxfd, *fds;
 	fd_set rfds;
 
-	fds = malloc(sizeof(*fds) * sizeof(protos)/sizeof(protos[0]));
+	fds = malloc(sizeof(*fds) * ARRAY_SIZE(protos));
 	if (fds == NULL)
 		pthread_exit((void *)(long)-ENOMEM);
 
@@ -139,7 +139,7 @@ void smokey_net_server_loop(int net_config)
 
 	FD_ZERO(&rfds);
 	maxfd = 0;
-	for (i = 0; i < sizeof(protos)/sizeof(protos[0]); i++) {
+	for (i = 0; i < ARRAY_SIZE(protos); i++) {
 		p = &protos[i];
 
 		if ((net_config & p->config_flag) == 0) {
@@ -164,7 +164,7 @@ void smokey_net_server_loop(int net_config)
 
 		check_unix(__RT(select(maxfd + 1, &tfds, NULL, NULL, NULL)));
 
-		for (i = 0; i < sizeof(protos)/sizeof(protos[0]); i++) {
+		for (i = 0; i < ARRAY_SIZE(protos); i++) {
 			p = &protos[i];
 
 			if (fds[i] < 0 || !FD_ISSET(fds[i], &tfds))
diff --git a/testsuite/smokey/net_common/setup.c b/testsuite/smokey/net_common/setup.c
index f97c14823..8a3562ba9 100644
--- a/testsuite/smokey/net_common/setup.c
+++ b/testsuite/smokey/net_common/setup.c
@@ -70,7 +70,7 @@ static int option_to_modid(int option)
 {
 	unsigned i;
 
-	for (i = 0; i < sizeof(modules)/sizeof(modules[0]); i++) {
+	for (i = 0; i < ARRAY_SIZE(modules); i++) {
 		if (modules[i].option != option)
 			continue;
 
diff --git a/testsuite/smokey/posix-select/posix-select.c b/testsuite/smokey/posix-select/posix-select.c
index 1484fa639..e9f8c70d0 100644
--- a/testsuite/smokey/posix-select/posix-select.c
+++ b/testsuite/smokey/posix-select/posix-select.c
@@ -96,7 +96,7 @@ static void *mq_thread(void *cookie)
 		}
 
 		smokey_trace("received %s", buf);
-		i = (i + 1) % (sizeof(tunes) / sizeof(tunes[0]));
+		i = (i + 1) % (ARRAY_SIZE(tunes));
 	}
 
 	return NULL;
@@ -121,7 +121,7 @@ static int run_posix_select(struct smokey_test *t, int argc, char *const argv[])
 		return ret;
 
 	for (j = 0; j < 3; j++) {
-		for (i = 0; i < sizeof(tunes) / sizeof(tunes[0]); i++) {
+		for (i = 0; i < ARRAY_SIZE(tunes); i++) {
 			ret = smokey_check_errno(mq_send(mq, tunes[i], strlen(tunes[i]) + 1, 0));
 			if (ret < 0) {
 				smokey_check_status(pthread_cancel(tcb));
diff --git a/testsuite/smokey/vxworkstests/msgQ-1.c b/testsuite/smokey/vxworkstests/msgQ-1.c
index 71eedd44f..4050388a2 100644
--- a/testsuite/smokey/vxworkstests/msgQ-1.c
+++ b/testsuite/smokey/vxworkstests/msgQ-1.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <boilerplate/ancillaries.h>
 #include <copperplate/traceobj.h>
 #include <vxworks/errnoLib.h>
 #include <vxworks/taskLib.h>
@@ -8,7 +9,7 @@
 
 static struct traceobj trobj;
 
-#define NMESSAGES (sizeof(messages) / sizeof(messages[0]))
+#define NMESSAGES   ARRAY_SIZE(messages)
 
 static int messages[] = {
 	0xfafafafa,
diff --git a/testsuite/smokey/vxworkstests/msgQ-2.c b/testsuite/smokey/vxworkstests/msgQ-2.c
index d3ee1397c..008078047 100644
--- a/testsuite/smokey/vxworkstests/msgQ-2.c
+++ b/testsuite/smokey/vxworkstests/msgQ-2.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <boilerplate/ancillaries.h>
 #include <copperplate/traceobj.h>
 #include <vxworks/errnoLib.h>
 #include <vxworks/taskLib.h>
@@ -14,7 +15,7 @@ static int tseq[] = {
 	7,
 };
 
-#define NMESSAGES (sizeof(messages) / sizeof(messages[0]))
+#define NMESSAGES   ARRAY_SIZE(messages)
 
 static int messages[] = {
 	0xfafafafa,
diff --git a/testsuite/switchtest/switchtest.c b/testsuite/switchtest/switchtest.c
index cb8e956d5..91ac91303 100644
--- a/testsuite/switchtest/switchtest.c
+++ b/testsuite/switchtest/switchtest.c
@@ -173,7 +173,7 @@ static char *task_name(char *buf, size_t sz,
 			;
 
 	pos = snprintf(buf, sz, "%s", basename[param->type]);
-	for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
+	for (i = 0; i < ARRAY_SIZE(flags); i++) {
 		if (!(param->fp & flags[i].flag))
 			continue;
 
@@ -478,7 +478,7 @@ static double dot(volatile double *a, volatile double *b, int n)
 
 static void *fpu_stress(void *cookie)
 {
-	static volatile double a[10000], b[sizeof(a)/sizeof(a[0])];
+	static volatile double a[10000], b[ARRAY_SIZE(a)];
 	struct task_params *param = (struct task_params *) cookie;
 	cpu_set_t cpu_set;
 	unsigned i;
@@ -490,11 +490,11 @@ static void *fpu_stress(void *cookie)
 		clean_exit(EXIT_FAILURE);
 	}
 
-	for (i = 0; i < sizeof(a)/sizeof(a[0]); i++)
+	for (i = 0; i < ARRAY_SIZE(a); i++)
 		a[i] = b[i] = 3.14;
 
 	for (;;) {
-		double s = dot(a, b, sizeof(a)/sizeof(a[0]));
+		double s = dot(a, b, ARRAY_SIZE(a));
 		if ((unsigned) (s + 0.5) != 98596) {
 			fprintf(stderr, "fpu stress task failure! dot: %g\n", s);
 			clean_exit(EXIT_FAILURE);
@@ -1121,7 +1121,7 @@ static void usage(FILE *fd, const char *progname)
 		progname, progname);
 
 	for_each_cpu(i) {
-		for (j = 0; j < sizeof(all_fp)/sizeof(char *); j++)
+		for (j = 0; j < ARRAY_SIZE(all_fp); j++)
 			fprintf(fd, " %s%d", all_fp[j], i);
 	}
 
@@ -1130,7 +1130,7 @@ static void usage(FILE *fd, const char *progname)
 		"running:\n%s", progname);
 
 	for_each_cpu(i) {
-		for (j = 0; j < sizeof(all_nofp)/sizeof(char *); j++)
+		for (j = 0; j < ARRAY_SIZE(all_nofp); j++)
 			fprintf(fd, " %s%d", all_nofp[j], i);
 	}
 	fprintf(fd, "\n\n");
@@ -1333,10 +1333,10 @@ int main(int argc, const char *argv[])
 
 		if (use_fp) {
 			all = all_fp;
-			count = sizeof(all_fp)/sizeof(char *);
+			count = ARRAY_SIZE(all_fp);
 		} else {
 			all = all_nofp;
-			count = sizeof(all_nofp)/sizeof(char *);
+			count = ARRAY_SIZE(all_nofp);
 		}
 
 		argc = count * nr_cpus + 1;

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/13] demo: Migrate to ARRAY_SIZE()
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 01/13] testsuite: Migrate to ARRAY_SIZE() Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 03/13] lib: " Florian Bezdeka
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

Use ARRAY_SIZE() where possible. No functional change.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 demo/posix/cobalt/bufp-label.c     | 4 +++-
 demo/posix/cobalt/bufp-readwrite.c | 4 +++-
 demo/posix/cobalt/iddp-label.c     | 4 +++-
 demo/posix/cobalt/iddp-sendrecv.c  | 4 +++-
 demo/posix/cobalt/xddp-echo.c      | 4 +++-
 demo/posix/cobalt/xddp-label.c     | 4 +++-
 demo/posix/cobalt/xddp-stream.c    | 4 +++-
 demo/posix/cyclictest/cyclictest.c | 6 +++---
 8 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/demo/posix/cobalt/bufp-label.c b/demo/posix/cobalt/bufp-label.c
index 1141c8913..85984c7c7 100644
--- a/demo/posix/cobalt/bufp-label.c
+++ b/demo/posix/cobalt/bufp-label.c
@@ -30,6 +30,8 @@
 #include <string.h>
 #include <pthread.h>
 #include <errno.h>
+
+#include <boilerplate/ancillaries.h>
 #include <rtdm/ipc.h>
 
 pthread_t svtid, cltid;
@@ -163,7 +165,7 @@ static void *client(void *arg)
 		}
 		printf("%s: sent %d bytes, \"%.*s\"\n",
 		       __FUNCTION__, ret, ret, msg[n]);
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cobalt/bufp-readwrite.c b/demo/posix/cobalt/bufp-readwrite.c
index 34d761aeb..74faa5bc8 100644
--- a/demo/posix/cobalt/bufp-readwrite.c
+++ b/demo/posix/cobalt/bufp-readwrite.c
@@ -30,6 +30,8 @@
 #include <string.h>
 #include <pthread.h>
 #include <errno.h>
+
+#include <boilerplate/ancillaries.h>
 #include <rtdm/ipc.h>
 
 pthread_t svtid, cltid;
@@ -128,7 +130,7 @@ static void *client(void *arg)
 		}
 		printf("%s: sent %d bytes, \"%.*s\"\n",
 		       __FUNCTION__, ret, ret, msg[n]);
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cobalt/iddp-label.c b/demo/posix/cobalt/iddp-label.c
index 06fc8814c..fe21bf77f 100644
--- a/demo/posix/cobalt/iddp-label.c
+++ b/demo/posix/cobalt/iddp-label.c
@@ -37,6 +37,8 @@
 #include <string.h>
 #include <pthread.h>
 #include <errno.h>
+
+#include <boilerplate/ancillaries.h>
 #include <rtdm/ipc.h>
 
 pthread_t svtid, cltid;
@@ -180,7 +182,7 @@ static void *client(void *arg)
 		}
 		printf("%s: sent %d bytes, \"%.*s\"\n",
 		       __FUNCTION__, ret, ret, msg[n]);
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cobalt/iddp-sendrecv.c b/demo/posix/cobalt/iddp-sendrecv.c
index 31ee10fde..0ce6be2a9 100644
--- a/demo/posix/cobalt/iddp-sendrecv.c
+++ b/demo/posix/cobalt/iddp-sendrecv.c
@@ -32,7 +32,9 @@
 #include <string.h>
 #include <pthread.h>
 #include <errno.h>
+
 #include <rtdm/ipc.h>
+#include <boilerplate/ancillaries.h>
 
 pthread_t svtid, cltid;
 
@@ -136,7 +138,7 @@ static void *client(void *arg)
 		}
 		printf("%s: sent %d bytes, \"%.*s\"\n",
 		       __FUNCTION__, ret, ret, msg[n]);
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cobalt/xddp-echo.c b/demo/posix/cobalt/xddp-echo.c
index ba8558266..c76f9e7cc 100644
--- a/demo/posix/cobalt/xddp-echo.c
+++ b/demo/posix/cobalt/xddp-echo.c
@@ -66,6 +66,8 @@
 #include <pthread.h>
 #include <fcntl.h>
 #include <errno.h>
+
+#include <boilerplate/ancillaries.h>
 #include <rtdm/ipc.h>
 
 pthread_t rt, nrt;
@@ -164,7 +166,7 @@ static void *realtime_thread(void *arg)
 
 		printf("   => \"%.*s\" echoed by peer\n", ret, buf);
 
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cobalt/xddp-label.c b/demo/posix/cobalt/xddp-label.c
index 9de31fdea..52c898444 100644
--- a/demo/posix/cobalt/xddp-label.c
+++ b/demo/posix/cobalt/xddp-label.c
@@ -72,6 +72,8 @@
 #include <pthread.h>
 #include <fcntl.h>
 #include <errno.h>
+
+#include <boilerplate/ancillaries.h>
 #include <rtdm/ipc.h>
 
 pthread_t rt1, rt2, nrt;
@@ -235,7 +237,7 @@ static void *realtime_thread2(void *arg)
 		printf("%s: sent %d bytes, \"%.*s\"\n",
 		       __FUNCTION__, ret, ret, msg[n]);
 
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cobalt/xddp-stream.c b/demo/posix/cobalt/xddp-stream.c
index e53729462..b7934edc4 100644
--- a/demo/posix/cobalt/xddp-stream.c
+++ b/demo/posix/cobalt/xddp-stream.c
@@ -68,6 +68,8 @@
 #include <pthread.h>
 #include <fcntl.h>
 #include <errno.h>
+
+#include <boilerplate/ancillaries.h>
 #include <rtdm/ipc.h>
 
 pthread_t rt, nrt;
@@ -170,7 +172,7 @@ static void *realtime_thread(void *arg)
 
 		printf("   => \"%.*s\" echoed by peer\n", ret, buf);
 
-		n = (n + 1) % (sizeof(msg) / sizeof(msg[0]));
+		n = (n + 1) % ARRAY_SIZE(msg);
 		/*
 		 * We run in full real-time mode (i.e. primary mode),
 		 * so we have to let the system breathe between two
diff --git a/demo/posix/cyclictest/cyclictest.c b/demo/posix/cyclictest/cyclictest.c
index b92596c25..5bc6bd6fc 100644
--- a/demo/posix/cyclictest/cyclictest.c
+++ b/demo/posix/cyclictest/cyclictest.c
@@ -36,15 +36,15 @@
 #include <sys/resource.h>
 #include <sys/utsname.h>
 #include <sys/mman.h>
-#include "rt_numa.h"
 
+#include <boilerplate/ancillaries.h>
+
+#include "rt_numa.h"
 #include "rt-utils.h"
 
 #define DEFAULT_INTERVAL 1000
 #define DEFAULT_DISTANCE 500
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 /* Ugly, but .... */
 #define gettid() syscall(__NR_gettid)
 #define sigev_notify_thread_id _sigev_un._tid

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/13] lib: Migrate to ARRAY_SIZE()
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 01/13] testsuite: Migrate to ARRAY_SIZE() Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 02/13] demo: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 04/13] kernel/drivers: Mirate " Florian Bezdeka
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

Use ARRAY_SIZE() where possible. No functional change.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/boilerplate/ancillaries.c | 4 ++--
 lib/boilerplate/setup.c       | 2 +-
 lib/cobalt/mutex.c            | 2 +-
 lib/cobalt/sigshadow.c        | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/boilerplate/ancillaries.c b/lib/boilerplate/ancillaries.c
index a0754cb48..457ef0b7c 100644
--- a/lib/boilerplate/ancillaries.c
+++ b/lib/boilerplate/ancillaries.c
@@ -182,7 +182,7 @@ static const char *__esym_map[] = {
 	__esym_def(EPROTO),
 };
 
-#define __esym_max  (sizeof(__esym_map) / sizeof(__esym_map[0]))
+#define __esym_max	ARRAY_SIZE(__esym_map)
 
 const char *symerror(int errnum)
 {
@@ -472,7 +472,7 @@ char *lookup_command(const char *cmd)
 	char *path;
 	int n, ret;
 
-	for (n = 0; n < sizeof(dirs) / sizeof(dirs[0]); n++) {
+	for (n = 0; n < ARRAY_SIZE(dirs); n++) {
 		ret = asprintf(&path, "%s/%s", dirs[n], cmd);
 		if (ret < 0)
 			return NULL;
diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index 5139560e8..a9138e96b 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -304,7 +304,7 @@ static struct option *build_option_array(int *base_opt_startp)
 	const struct option *p;
 	int nopts;
 
-	nopts = sizeof(base_options) / sizeof(base_options[0]);
+	nopts = ARRAY_SIZE(base_options);
 
 	if (!pvlist_empty(&setup_list)) {
 		pvlist_for_each_entry(setup, &setup_list, __reserved.next) {
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 54f6b8461..c77d10684 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -196,7 +196,7 @@ static int __attribute__((cold))
 	};
 	int i;
 
-	for (i = sizeof(mutex_types) / sizeof(mutex_types[0]); i > 0; --i) {
+	for (i = ARRAY_SIZE(mutex_types); i > 0; --i) {
 		if (memcmp(mutex, &mutex_initializers[i - 1],
 				sizeof(mutex_initializers[0])) == 0)
 			return mutex_types[i - 1];
diff --git a/lib/cobalt/sigshadow.c b/lib/cobalt/sigshadow.c
index b03703526..092cadb08 100644
--- a/lib/cobalt/sigshadow.c
+++ b/lib/cobalt/sigshadow.c
@@ -53,7 +53,7 @@ int cobalt_sigshadow_handler(int sig, siginfo_t *si, void *ctxt)
 		break;
 	case SIGSHADOW_ACTION_BACKTRACE:
 		arg = sigshadow_arg(si->si_int);
-		nr = backtrace(frames, sizeof(frames) / sizeof(frames[0]));
+		nr = backtrace(frames, ARRAY_SIZE(frames));
 		/* Skip the sighandler context. */
 		skip = nr > 3 ? 3 : 0;
 		XENOMAI_SYSCALL3(sc_cobalt_backtrace, nr - skip, frames + skip, arg);

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/13] kernel/drivers: Mirate to ARRAY_SIZE()
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (2 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 03/13] lib: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 05/13] demo: Cleanup includes Florian Bezdeka
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

Use ARRAY_SIZE() where possible. No functional change.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/drivers/analogy/national_instruments/mio_common.c          | 6 ++----
 kernel/drivers/analogy/national_instruments/ni_670x.c             | 2 +-
 kernel/drivers/analogy/national_instruments/ni_stc.h              | 4 ++--
 kernel/drivers/analogy/national_instruments/pcimio.c              | 2 +-
 kernel/drivers/net/drivers/experimental/e1000/e1000_80003es2lan.c | 3 +--
 kernel/drivers/net/drivers/experimental/e1000/e1000_82541.c       | 3 +--
 kernel/drivers/net/drivers/experimental/e1000/e1000_phy.c         | 6 ++----
 kernel/drivers/net/drivers/igb/e1000_phy.c                        | 6 ++----
 8 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/kernel/drivers/analogy/national_instruments/mio_common.c b/kernel/drivers/analogy/national_instruments/mio_common.c
index 82b1da525..92f403d7b 100644
--- a/kernel/drivers/analogy/national_instruments/mio_common.c
+++ b/kernel/drivers/analogy/national_instruments/mio_common.c
@@ -1212,8 +1212,7 @@ static void ni_ai_fifo_read(struct a4l_subdevice *subd, int n)
 			a4l_buf_put(subd, &data[0], sizeof(sampl_t));
 		}
 	} else {
-		if (n > sizeof(devpriv->ai_fifo_buffer) /
-		    sizeof(devpriv->ai_fifo_buffer[0])) {
+		if (n > ARRAY_SIZE(devpriv->ai_fifo_buffer)) {
 			a4l_err(dev,
 				"ni_ai_fifo_read: "
 				"bug! ai_fifo_buffer too small");
@@ -1325,8 +1324,7 @@ static void ni_handle_fifo_dregs(struct a4l_subdevice *subd)
 		while (fifo_empty == 0) {
 			for (i = 0;
 			     i <
-				     sizeof(devpriv->ai_fifo_buffer) /
-				     sizeof(devpriv->ai_fifo_buffer[0]); i++) {
+				     ARRAY_SIZE(devpriv->ai_fifo_buffer); i++) {
 				fifo_empty =
 					devpriv->stc_readw(dev,
 							   AI_Status_1_Register) &
diff --git a/kernel/drivers/analogy/national_instruments/ni_670x.c b/kernel/drivers/analogy/national_instruments/ni_670x.c
index 35749be69..597e2dd2b 100644
--- a/kernel/drivers/analogy/national_instruments/ni_670x.c
+++ b/kernel/drivers/analogy/national_instruments/ni_670x.c
@@ -212,7 +212,7 @@ static const struct ni_670x_board ni_670x_boards[] = {
 	 },
 };
 
-#define n_ni_670x_boards ((sizeof(ni_670x_boards)/sizeof(ni_670x_boards[0])))
+#define n_ni_670x_boards	ARRAY_SIZE(ni_670x_boards)
 
 static const struct pci_device_id ni_670x_pci_table[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c90)},
diff --git a/kernel/drivers/analogy/national_instruments/ni_stc.h b/kernel/drivers/analogy/national_instruments/ni_stc.h
index d600a3204..85fd86f18 100644
--- a/kernel/drivers/analogy/national_instruments/ni_stc.h
+++ b/kernel/drivers/analogy/national_instruments/ni_stc.h
@@ -1027,7 +1027,7 @@ static inline int M_Offset_Static_AI_Control(int i)
 		0x262,
 		0x263,
 	};
-	if(((unsigned)i) >= sizeof(offset) / sizeof(offset[0]))
+	if(((unsigned)i) >= ARRAY_SIZE(offset))
 	{
 		rtdm_printk("%s: invalid channel=%i\n", __FUNCTION__, i);
 		return offset[0];
@@ -1043,7 +1043,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int channel)
 		0x266,
 		0x267
 	};
-	if(((unsigned)channel) >= sizeof(offset) / sizeof(offset[0]))
+	if(((unsigned)channel) >= ARRAY_SIZE(offset))
 	{
 		rtdm_printk("%s: invalid channel=%i\n", __FUNCTION__, channel);
 		return offset[0];
diff --git a/kernel/drivers/analogy/national_instruments/pcimio.c b/kernel/drivers/analogy/national_instruments/pcimio.c
index 8a3cccc81..40ca8f76d 100644
--- a/kernel/drivers/analogy/national_instruments/pcimio.c
+++ b/kernel/drivers/analogy/national_instruments/pcimio.c
@@ -1104,7 +1104,7 @@ static ni_board ni_boards[]={
 		.caldac = {ad8804_debug,ad8804_debug},
 	},
 };
-#define n_pcimio_boards ((sizeof(ni_boards)/sizeof(ni_boards[0])))
+#define n_pcimio_boards	ARRAY_SIZE(ni_boards)
 
 /* How we access STC registers */
 
diff --git a/kernel/drivers/net/drivers/experimental/e1000/e1000_80003es2lan.c b/kernel/drivers/net/drivers/experimental/e1000/e1000_80003es2lan.c
index 2ef70d67d..e8e2f1de4 100644
--- a/kernel/drivers/net/drivers/experimental/e1000/e1000_80003es2lan.c
+++ b/kernel/drivers/net/drivers/experimental/e1000/e1000_80003es2lan.c
@@ -73,8 +73,7 @@ static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw);
 static const u16 e1000_gg82563_cable_length_table[] =
          { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
 #define GG82563_CABLE_LENGTH_TABLE_SIZE \
-                (sizeof(e1000_gg82563_cable_length_table) / \
-                 sizeof(e1000_gg82563_cable_length_table[0]))
+	ARRAY_SIZE(e1000_gg82563_cable_length_table)
 
 /**
  *  e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs.
diff --git a/kernel/drivers/net/drivers/experimental/e1000/e1000_82541.c b/kernel/drivers/net/drivers/experimental/e1000/e1000_82541.c
index a0d5c8801..5103dbefa 100644
--- a/kernel/drivers/net/drivers/experimental/e1000/e1000_82541.c
+++ b/kernel/drivers/net/drivers/experimental/e1000/e1000_82541.c
@@ -66,8 +66,7 @@ static const u16 e1000_igp_cable_length_table[] =
       100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
       110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120};
 #define IGP01E1000_AGC_LENGTH_TABLE_SIZE \
-                (sizeof(e1000_igp_cable_length_table) / \
-                 sizeof(e1000_igp_cable_length_table[0]))
+	ARRAY_SIZE(e1000_igp_cable_length_table)
 
 struct e1000_dev_spec_82541 {
 	e1000_dsp_config dsp_config;
diff --git a/kernel/drivers/net/drivers/experimental/e1000/e1000_phy.c b/kernel/drivers/net/drivers/experimental/e1000/e1000_phy.c
index cec2ba360..0c7913d6e 100644
--- a/kernel/drivers/net/drivers/experimental/e1000/e1000_phy.c
+++ b/kernel/drivers/net/drivers/experimental/e1000/e1000_phy.c
@@ -37,8 +37,7 @@ static s32  e1000_acquire_phy(struct e1000_hw *hw);
 static const u16 e1000_m88_cable_length_table[] =
 	{ 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
 #define M88E1000_CABLE_LENGTH_TABLE_SIZE \
-                (sizeof(e1000_m88_cable_length_table) / \
-                 sizeof(e1000_m88_cable_length_table[0]))
+	ARRAY_SIZE(e1000_m88_cable_length_table)
 
 static const u16 e1000_igp_2_cable_length_table[] =
     { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
@@ -50,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] =
       83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
       104, 109, 114, 118, 121, 124};
 #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
-                (sizeof(e1000_igp_2_cable_length_table) / \
-                 sizeof(e1000_igp_2_cable_length_table[0]))
+	ARRAY_SIZE(e1000_igp_2_cable_length_table)
 
 /**
  *  e1000_check_reset_block_generic - Check if PHY reset is blocked
diff --git a/kernel/drivers/net/drivers/igb/e1000_phy.c b/kernel/drivers/net/drivers/igb/e1000_phy.c
index 8d740899c..fb069b0a7 100644
--- a/kernel/drivers/net/drivers/igb/e1000_phy.c
+++ b/kernel/drivers/net/drivers/igb/e1000_phy.c
@@ -38,8 +38,7 @@ static s32  igb_set_master_slave_mode(struct e1000_hw *hw);
 static const u16 e1000_m88_cable_length_table[] = {
 	0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
 #define M88E1000_CABLE_LENGTH_TABLE_SIZE \
-	(sizeof(e1000_m88_cable_length_table) / \
-	sizeof(e1000_m88_cable_length_table[0]))
+	ARRAY_SIZE(e1000_m88_cable_length_table)
 
 static const u16 e1000_igp_2_cable_length_table[] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
@@ -51,8 +50,7 @@ static const u16 e1000_igp_2_cable_length_table[] = {
 	83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
 	104, 109, 114, 118, 121, 124};
 #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
-	(sizeof(e1000_igp_2_cable_length_table) / \
-	 sizeof(e1000_igp_2_cable_length_table[0]))
+	ARRAY_SIZE(e1000_igp_2_cable_length_table)
 
 /**
  *  igb_check_reset_block - Check if PHY reset is blocked

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/13] demo: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (3 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 04/13] kernel/drivers: Mirate " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 06/13] lib/alchemy: " Florian Bezdeka
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 demo/alchemy/altency.c             | 2 +-
 demo/alchemy/cobalt/cross-link.c   | 3 +--
 demo/posix/cobalt/bufp-label.c     | 1 +
 demo/posix/cobalt/bufp-readwrite.c | 1 +
 demo/posix/cobalt/can-rtt.c        | 2 --
 demo/posix/cobalt/eth_p_all.c      | 2 --
 demo/posix/cobalt/gpiopwm.c        | 3 ---
 demo/posix/cobalt/iddp-label.c     | 1 +
 demo/posix/cobalt/iddp-sendrecv.c  | 1 +
 demo/posix/cobalt/xddp-echo.c      | 1 +
 demo/posix/cobalt/xddp-label.c     | 1 +
 demo/posix/cobalt/xddp-stream.c    | 1 +
 12 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/demo/alchemy/altency.c b/demo/alchemy/altency.c
index b15930567..072d68f8e 100644
--- a/demo/alchemy/altency.c
+++ b/demo/alchemy/altency.c
@@ -3,6 +3,7 @@
  *
  * Licensed under the LGPL v2.1.
  */
+
 #include <stdlib.h>
 #include <math.h>
 #include <stdio.h>
@@ -13,7 +14,6 @@
 #include <unistd.h>
 #include <signal.h>
 #include <alchemy/task.h>
-#include <alchemy/timer.h>
 #include <alchemy/sem.h>
 #include <rtdm/testing.h>
 #include <boilerplate/trace.h>
diff --git a/demo/alchemy/cobalt/cross-link.c b/demo/alchemy/cobalt/cross-link.c
index 9b1fb348c..0a62c074f 100644
--- a/demo/alchemy/cobalt/cross-link.c
+++ b/demo/alchemy/cobalt/cross-link.c
@@ -20,12 +20,11 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+
 #include <stdio.h>
 #include <signal.h>
 #include <unistd.h>
-#include <sys/mman.h>
 #include <alchemy/task.h>
-#include <alchemy/timer.h>
 #include <rtdm/serial.h>
 
 #define MAIN_PREFIX   "main : "
diff --git a/demo/posix/cobalt/bufp-label.c b/demo/posix/cobalt/bufp-label.c
index 85984c7c7..7ed917fa5 100644
--- a/demo/posix/cobalt/bufp-label.c
+++ b/demo/posix/cobalt/bufp-label.c
@@ -23,6 +23,7 @@
  * is bound to a real-time port and receives a stream of bytes sent to
  * this port from a client thread (writer).
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/demo/posix/cobalt/bufp-readwrite.c b/demo/posix/cobalt/bufp-readwrite.c
index 74faa5bc8..f5ff8c189 100644
--- a/demo/posix/cobalt/bufp-readwrite.c
+++ b/demo/posix/cobalt/bufp-readwrite.c
@@ -23,6 +23,7 @@
  * is bound to a real-time port and receives a stream of bytes sent to
  * this port from a client thread (writer).
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/demo/posix/cobalt/can-rtt.c b/demo/posix/cobalt/can-rtt.c
index dd212d804..13ad0bf56 100644
--- a/demo/posix/cobalt/can-rtt.c
+++ b/demo/posix/cobalt/can-rtt.c
@@ -42,9 +42,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <limits.h>
 #include <getopt.h>
-#include <memory.h>
 #include <netinet/in.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
diff --git a/demo/posix/cobalt/eth_p_all.c b/demo/posix/cobalt/eth_p_all.c
index c4cf0d696..63acbf7ef 100644
--- a/demo/posix/cobalt/eth_p_all.c
+++ b/demo/posix/cobalt/eth_p_all.c
@@ -26,8 +26,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <errno.h>
-#include <string.h>
 
 #include <signal.h>
 #include <pthread.h>
diff --git a/demo/posix/cobalt/gpiopwm.c b/demo/posix/cobalt/gpiopwm.c
index b195d7e1e..9706e6e65 100644
--- a/demo/posix/cobalt/gpiopwm.c
+++ b/demo/posix/cobalt/gpiopwm.c
@@ -1,4 +1,3 @@
-#include <xenomai/init.h>
 #include <semaphore.h>
 #include <pthread.h>
 #include <signal.h>
@@ -11,9 +10,7 @@
 #include <time.h>
 
 #include <unistd.h>
-#include <stdlib.h>
 #include <string.h>
-#include <netdb.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
diff --git a/demo/posix/cobalt/iddp-label.c b/demo/posix/cobalt/iddp-label.c
index fe21bf77f..7916a72cf 100644
--- a/demo/posix/cobalt/iddp-label.c
+++ b/demo/posix/cobalt/iddp-label.c
@@ -30,6 +30,7 @@
  * sockets to them in a more descriptive way than using plain numeric
  * port values.
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/demo/posix/cobalt/iddp-sendrecv.c b/demo/posix/cobalt/iddp-sendrecv.c
index 0ce6be2a9..6cec083a4 100644
--- a/demo/posix/cobalt/iddp-sendrecv.c
+++ b/demo/posix/cobalt/iddp-sendrecv.c
@@ -25,6 +25,7 @@
  * different port, only to provide a valid peer name; this is
  * optional.
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/demo/posix/cobalt/xddp-echo.c b/demo/posix/cobalt/xddp-echo.c
index c76f9e7cc..67eef7cc2 100644
--- a/demo/posix/cobalt/xddp-echo.c
+++ b/demo/posix/cobalt/xddp-echo.c
@@ -57,6 +57,7 @@
  *   =>  read traffic from RT domain via read()         |  |
  *   =>  echo traffic back to RT domain via write()     +--+
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/demo/posix/cobalt/xddp-label.c b/demo/posix/cobalt/xddp-label.c
index 52c898444..7ba895cc9 100644
--- a/demo/posix/cobalt/xddp-label.c
+++ b/demo/posix/cobalt/xddp-label.c
@@ -63,6 +63,7 @@
  *   =>  read traffic from RT domain via read()            |  |
  *   =>  mirror traffic to RT domain via write()           +--+
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/demo/posix/cobalt/xddp-stream.c b/demo/posix/cobalt/xddp-stream.c
index b7934edc4..575e7d9d1 100644
--- a/demo/posix/cobalt/xddp-stream.c
+++ b/demo/posix/cobalt/xddp-stream.c
@@ -59,6 +59,7 @@
  *   =>  read traffic from RT domain via read()                    |  |
  *   =>  echo traffic back to RT domain via write()                +--+
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/13] lib/alchemy: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (4 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 05/13] demo: Cleanup includes Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 07/13] lib/analogy: " Florian Bezdeka
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/alchemy/alarm.c    | 2 +-
 lib/alchemy/buffer.c   | 2 +-
 lib/alchemy/cond.c     | 2 +-
 lib/alchemy/event.c    | 2 +-
 lib/alchemy/heap.c     | 1 -
 lib/alchemy/init.c     | 3 +--
 lib/alchemy/internal.c | 2 --
 lib/alchemy/mutex.c    | 2 +-
 lib/alchemy/pipe.c     | 3 ++-
 lib/alchemy/queue.c    | 2 +-
 lib/alchemy/sem.c      | 1 -
 lib/alchemy/task.c     | 2 +-
 12 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/lib/alchemy/alarm.c b/lib/alchemy/alarm.c
index 2298114d2..14cb4e248 100644
--- a/lib/alchemy/alarm.c
+++ b/lib/alchemy/alarm.c
@@ -15,10 +15,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <errno.h>
 #include <string.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include "reference.h"
 #include "internal.h"
 #include "alarm.h"
diff --git a/lib/alchemy/buffer.c b/lib/alchemy/buffer.c
index 1fa281f3a..b9526304d 100644
--- a/lib/alchemy/buffer.c
+++ b/lib/alchemy/buffer.c
@@ -15,10 +15,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <errno.h>
 #include <string.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include "reference.h"
 #include "internal.h"
 #include "buffer.h"
diff --git a/lib/alchemy/cond.c b/lib/alchemy/cond.c
index e4ad71454..4409e3f5b 100644
--- a/lib/alchemy/cond.c
+++ b/lib/alchemy/cond.c
@@ -15,10 +15,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <errno.h>
 #include <string.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include "internal.h"
 #include "cond.h"
 #include "timer.h"
diff --git a/lib/alchemy/event.c b/lib/alchemy/event.c
index 8ccd99b86..8ba76f333 100644
--- a/lib/alchemy/event.c
+++ b/lib/alchemy/event.c
@@ -15,11 +15,11 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include <copperplate/registry-obstack.h>
 #include "reference.h"
 #include "internal.h"
diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c
index c658c46b2..140fdc656 100644
--- a/lib/alchemy/heap.c
+++ b/lib/alchemy/heap.c
@@ -19,7 +19,6 @@
 #include <errno.h>
 #include <string.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include <copperplate/registry-obstack.h>
 #include "reference.h"
 #include "internal.h"
diff --git a/lib/alchemy/init.c b/lib/alchemy/init.c
index 2efd13899..c3da26eb8 100644
--- a/lib/alchemy/init.c
+++ b/lib/alchemy/init.c
@@ -17,11 +17,10 @@
  */
 
 #include <stdio.h>
-#include <time.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <xenomai/init.h>
+
 #include "timer.h"
 #include "task.h"
 #include "sem.h"
diff --git a/lib/alchemy/internal.c b/lib/alchemy/internal.c
index 7e998ff13..8258154ea 100644
--- a/lib/alchemy/internal.c
+++ b/lib/alchemy/internal.c
@@ -17,8 +17,6 @@
  */
 
 #include <string.h>
-#include <stdio.h>
-#include <errno.h>
 #include <boilerplate/lock.h>
 #include <copperplate/cluster.h>
 #include <copperplate/heapobj.h>
diff --git a/lib/alchemy/mutex.c b/lib/alchemy/mutex.c
index 5836af59f..9681e124e 100644
--- a/lib/alchemy/mutex.c
+++ b/lib/alchemy/mutex.c
@@ -15,10 +15,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <errno.h>
 #include <string.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include "internal.h"
 #include "mutex.h"
 #include "timer.h"
diff --git a/lib/alchemy/pipe.c b/lib/alchemy/pipe.c
index c334349aa..a266a380f 100644
--- a/lib/alchemy/pipe.c
+++ b/lib/alchemy/pipe.c
@@ -15,13 +15,14 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <fcntl.h>
+
 #include "rtdm/ipc.h"
 #include "copperplate/threadobj.h"
-#include "copperplate/heapobj.h"
 #include "copperplate/cluster.h"
 #include "reference.h"
 #include "internal.h"
diff --git a/lib/alchemy/queue.c b/lib/alchemy/queue.c
index c45e42454..0dba63f2b 100644
--- a/lib/alchemy/queue.c
+++ b/lib/alchemy/queue.c
@@ -15,10 +15,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <errno.h>
 #include <string.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include <copperplate/registry-obstack.h>
 #include "reference.h"
 #include "internal.h"
diff --git a/lib/alchemy/sem.c b/lib/alchemy/sem.c
index 497756ebd..e88c6e4d6 100644
--- a/lib/alchemy/sem.c
+++ b/lib/alchemy/sem.c
@@ -20,7 +20,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
 #include <copperplate/registry-obstack.h>
 #include "reference.h"
 #include "internal.h"
diff --git a/lib/alchemy/task.c b/lib/alchemy/task.c
index 9e6101df5..ed5f2f804 100644
--- a/lib/alchemy/task.c
+++ b/lib/alchemy/task.c
@@ -19,8 +19,8 @@
 #include <sched.h>
 #include <pthread.h>
 #include <errno.h>
-#include <stdio.h>
 #include <string.h>
+
 #include "copperplate/heapobj.h"
 #include "copperplate/internal.h"
 #include "internal.h"

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/13] lib/analogy: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (5 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 06/13] lib/alchemy: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 08/13] lib/boilerplate: " Florian Bezdeka
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/analogy/calibration.c | 2 +-
 lib/analogy/descriptor.c  | 1 -
 lib/analogy/math.c        | 1 -
 lib/analogy/range.c       | 1 -
 4 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index 9fa3ff5a6..7ae5ef61c 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -19,6 +19,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -28,7 +29,6 @@
 #include <errno.h>
 #include "iniparser/iniparser.h"
 #include "boilerplate/ancillaries.h"
-#include "boilerplate/list.h"
 #include "calibration.h"
 
 #define CHK(func, ...)								\
diff --git a/lib/analogy/descriptor.c b/lib/analogy/descriptor.c
index bc4d7bd25..de3ef9e99 100644
--- a/lib/analogy/descriptor.c
+++ b/lib/analogy/descriptor.c
@@ -20,7 +20,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
-#include <stdio.h>
 #include <string.h>
 #include <rtdm/analogy.h>
 #include "internal.h"
diff --git a/lib/analogy/math.c b/lib/analogy/math.c
index 2e6e47555..8a26d2e1d 100644
--- a/lib/analogy/math.c
+++ b/lib/analogy/math.c
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
-#include <math.h>
 #include <assert.h>
 
 #include <rtdm/analogy.h>
diff --git a/lib/analogy/range.c b/lib/analogy/range.c
index d9f7a4872..573bde327 100644
--- a/lib/analogy/range.c
+++ b/lib/analogy/range.c
@@ -21,7 +21,6 @@
  */
 
 #include <errno.h>
-#include <math.h>
 #include "internal.h"
 #include <rtdm/analogy.h>
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/13] lib/boilerplate: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (6 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 07/13] lib/analogy: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 09/13] lib/copperplate: " Florian Bezdeka
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/boilerplate/ancillaries.c          | 4 +---
 lib/boilerplate/avl.c                  | 1 +
 lib/boilerplate/debug.c                | 7 ++-----
 lib/boilerplate/hash.c                 | 2 +-
 lib/boilerplate/heapmem.c              | 5 ++---
 lib/boilerplate/iniparser/dictionary.c | 1 -
 lib/boilerplate/init/bootstrap.c       | 1 +
 lib/boilerplate/setup.c                | 5 ++---
 lib/boilerplate/time.c                 | 1 +
 lib/boilerplate/version.c              | 1 +
 10 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/lib/boilerplate/ancillaries.c b/lib/boilerplate/ancillaries.c
index 457ef0b7c..9ca55a6bc 100644
--- a/lib/boilerplate/ancillaries.c
+++ b/lib/boilerplate/ancillaries.c
@@ -15,6 +15,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <stdio.h>
@@ -32,13 +33,10 @@
 #include "boilerplate/atomic.h"
 #include "boilerplate/lock.h"
 #include "boilerplate/time.h"
-#include "boilerplate/scope.h"
 #include "boilerplate/setup.h"
-#include "boilerplate/debug.h"
 #include "boilerplate/ancillaries.h"
 #include "boilerplate/signal.h"
 #include "boilerplate/namegen.h"
-#include "xenomai/init.h"
 
 pthread_mutex_t __printlock;
 
diff --git a/lib/boilerplate/avl.c b/lib/boilerplate/avl.c
index 3bf9bf134..c5cb253c0 100644
--- a/lib/boilerplate/avl.c
+++ b/lib/boilerplate/avl.c
@@ -20,6 +20,7 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+
 #include <errno.h>
 #include <memory.h>
 
diff --git a/lib/boilerplate/debug.c b/lib/boilerplate/debug.c
index 42ea8e8ef..f6df6c612 100644
--- a/lib/boilerplate/debug.c
+++ b/lib/boilerplate/debug.c
@@ -15,21 +15,18 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include <stdlib.h>
 #include <unistd.h>
 #include <assert.h>
 #include <pthread.h>
 #include <malloc.h>
-#include <errno.h>
-#include <signal.h>
+
 #include "boilerplate/ancillaries.h"
-#include "boilerplate/wrappers.h"
 #include "boilerplate/lock.h"
 #include "boilerplate/signal.h"
-#include "boilerplate/debug.h"
 
 static pthread_key_t btkey;
 
diff --git a/lib/boilerplate/hash.c b/lib/boilerplate/hash.c
index 9ce1b7cb7..055332c7e 100644
--- a/lib/boilerplate/hash.c
+++ b/lib/boilerplate/hash.c
@@ -18,9 +18,9 @@
 
 #include <string.h>
 #include <errno.h>
+
 #include "boilerplate/lock.h"
 #include "boilerplate/hash.h"
-#include "boilerplate/debug.h"
 
 /*
  * Crunching routine borrowed from:
diff --git a/lib/boilerplate/heapmem.c b/lib/boilerplate/heapmem.c
index e6369c715..8050eb7ab 100644
--- a/lib/boilerplate/heapmem.c
+++ b/lib/boilerplate/heapmem.c
@@ -23,15 +23,14 @@
  * multi-page memory ranges, and pages holding bucketed memory have a
  * fast allocation bitmap to manage their blocks internally.
  */
+
 #include <sys/types.h>
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+
 #include <boilerplate/heapmem.h>
 
 enum heapmem_pgtype {
diff --git a/lib/boilerplate/iniparser/dictionary.c b/lib/boilerplate/iniparser/dictionary.c
index cb7ccd49e..7985ab3fc 100644
--- a/lib/boilerplate/iniparser/dictionary.c
+++ b/lib/boilerplate/iniparser/dictionary.c
@@ -18,7 +18,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 
 /** Maximum value size for integers and doubles. */
 #define MAXVALSZ    1024
diff --git a/lib/boilerplate/init/bootstrap.c b/lib/boilerplate/init/bootstrap.c
index 64a11c2d2..d77f4eb5c 100644
--- a/lib/boilerplate/init/bootstrap.c
+++ b/lib/boilerplate/init/bootstrap.c
@@ -44,6 +44,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <sys/types.h>
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index a9138e96b..26c8c4cf5 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -15,8 +15,8 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <sys/types.h>
-#include <sys/mman.h>
 #include <sched.h>
 #include <getopt.h>
 #include <string.h>
@@ -24,14 +24,13 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <ctype.h>
-#include <memory.h>
 #include <malloc.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <assert.h>
+
 #include <xeno_config.h>
 #include <boilerplate/lock.h>
-#include <boilerplate/debug.h>
 #include <boilerplate/ancillaries.h>
 #include <xenomai/init.h>
 
diff --git a/lib/boilerplate/time.c b/lib/boilerplate/time.c
index d11259323..b9f5174c4 100644
--- a/lib/boilerplate/time.c
+++ b/lib/boilerplate/time.c
@@ -15,6 +15,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include "boilerplate/time.h"
 
 void timespec_sub(struct timespec *__restrict r,
diff --git a/lib/boilerplate/version.c b/lib/boilerplate/version.c
index d28c4967e..03af13cad 100644
--- a/lib/boilerplate/version.c
+++ b/lib/boilerplate/version.c
@@ -15,6 +15,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <xeno_config.h>
 #include "git-stamp.h"
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/13] lib/copperplate: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (7 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 08/13] lib/boilerplate: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 10/13] lib/psos: " Florian Bezdeka
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/copperplate/clockobj.c        | 4 ----
 lib/copperplate/cluster.c         | 3 ---
 lib/copperplate/eventobj.c        | 2 --
 lib/copperplate/heapobj-heapmem.c | 7 +++++--
 lib/copperplate/init.c            | 4 +---
 lib/copperplate/internal.c        | 4 ++--
 lib/copperplate/syncobj.c         | 2 --
 lib/copperplate/threadobj.c       | 1 +
 lib/copperplate/traceobj.c        | 1 +
 9 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/lib/copperplate/clockobj.c b/lib/copperplate/clockobj.c
index 3a771e474..e605e73b9 100644
--- a/lib/copperplate/clockobj.c
+++ b/lib/copperplate/clockobj.c
@@ -18,16 +18,13 @@
 
 #include <errno.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <assert.h>
-#include <limits.h>
 #include <time.h>
 #include <string.h>
 #include "boilerplate/lock.h"
 #include "boilerplate/time.h"
 #include "copperplate/clockobj.h"
-#include "copperplate/debug.h"
 #include "internal.h"
 
 #ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
@@ -229,7 +226,6 @@ int clockobj_set_resolution(struct clockobj *clkobj, unsigned int resolution_ns)
 #ifdef CONFIG_XENO_COBALT
 
 #include <cobalt/arith.h>
-#include <cobalt/sys/cobalt.h>
 
 #ifdef CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED
 #error "restricted CLOCK_COPPERPLATE not available"
diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c
index 754027858..76ef5d4ce 100644
--- a/lib/copperplate/cluster.c
+++ b/lib/copperplate/cluster.c
@@ -90,12 +90,9 @@
 
 #include <errno.h>
 #include <string.h>
-#include <memory.h>
 #include "copperplate/heapobj.h"
 #include "copperplate/cluster.h"
-#include "copperplate/syncobj.h"
 #include "copperplate/threadobj.h"
-#include "copperplate/debug.h"
 #include "internal.h"
 
 const static struct hash_operations hash_operations;
diff --git a/lib/copperplate/eventobj.c b/lib/copperplate/eventobj.c
index dce5bd242..28b7c167f 100644
--- a/lib/copperplate/eventobj.c
+++ b/lib/copperplate/eventobj.c
@@ -20,8 +20,6 @@
 #include <errno.h>
 #include "copperplate/threadobj.h"
 #include "copperplate/eventobj.h"
-#include "copperplate/heapobj.h"
-#include "copperplate/debug.h"
 
 #ifdef CONFIG_XENO_COBALT
 
diff --git a/lib/copperplate/heapobj-heapmem.c b/lib/copperplate/heapobj-heapmem.c
index cc3eb0aa1..85b83e12f 100644
--- a/lib/copperplate/heapobj-heapmem.c
+++ b/lib/copperplate/heapobj-heapmem.c
@@ -15,13 +15,16 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <stdlib.h>
 #include "boilerplate/heapmem.h"
 #include "copperplate/heapobj.h"
-#include "copperplate/debug.h"
-#include "copperplate/tunables.h"
 #include "xenomai/init.h"
 
+#ifndef CONFIG_XENO_PSHARED
+#include "copperplate/tunables.h"
+#endif
+
 #define MIN_HEAPMEM_HEAPSZ  (64 * 1024)
 
 struct heap_memory heapmem_main;
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index 5bfccf606..16fc59f7a 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -16,7 +16,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
-#include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -26,9 +25,8 @@
 #include <errno.h>
 #include <getopt.h>
 #include <grp.h>
+
 #include "copperplate/threadobj.h"
-#include "copperplate/heapobj.h"
-#include "copperplate/clockobj.h"
 #include "copperplate/registry.h"
 #include "copperplate/timerobj.h"
 #include "xenomai/init.h"
diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 1d965266b..ed3f2e4fa 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -15,17 +15,17 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <sys/types.h>
 #include <sys/prctl.h>
-#include <sys/syscall.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <stdarg.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <signal.h>
 #include <errno.h>
 #include <limits.h>
+
 #include <boilerplate/ancillaries.h>
 #include <copperplate/clockobj.h>
 #include <copperplate/threadobj.h>
diff --git a/lib/copperplate/syncobj.c b/lib/copperplate/syncobj.c
index 85b29c4ba..9e8252c8c 100644
--- a/lib/copperplate/syncobj.c
+++ b/lib/copperplate/syncobj.c
@@ -21,8 +21,6 @@
 #include "boilerplate/lock.h"
 #include "copperplate/threadobj.h"
 #include "copperplate/syncobj.h"
-#include "copperplate/debug.h"
-#include "internal.h"
 
 /*
  * XXX: The POSIX spec states that "Synchronization primitives that
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index b97807c8a..0782ffb11 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -17,6 +17,7 @@
  *
  * Thread object abstraction.
  */
+
 #include <signal.h>
 #include <memory.h>
 #include <errno.h>
diff --git a/lib/copperplate/traceobj.c b/lib/copperplate/traceobj.c
index 3c4d69bf8..864815bf5 100644
--- a/lib/copperplate/traceobj.c
+++ b/lib/copperplate/traceobj.c
@@ -15,6 +15,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include "boilerplate/lock.h"

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/13] lib/psos: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (8 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 09/13] lib/copperplate: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 11/13] lib/smokey: " Florian Bezdeka
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/psos/init.c  | 8 ++------
 lib/psos/pt.c    | 5 +----
 lib/psos/queue.c | 7 +------
 lib/psos/rn.c    | 5 +----
 lib/psos/sem.c   | 4 +---
 lib/psos/task.c  | 5 +----
 lib/psos/tm.c    | 3 ---
 7 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/lib/psos/init.c b/lib/psos/init.c
index 307594edb..0d8733436 100644
--- a/lib/psos/init.c
+++ b/lib/psos/init.c
@@ -15,18 +15,14 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <stdio.h>
-#include <string.h>
-#include <time.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <xenomai/init.h>
 #include <copperplate/registry.h>
 #include <copperplate/clockobj.h>
-#include <copperplate/debug.h>
-#include <psos/psos.h>
-#include "internal.h"
+
 #include "tm.h"
 #include "task.h"
 #include "sem.h"
diff --git a/lib/psos/pt.c b/lib/psos/pt.c
index 0fc7d9bb6..244d341a4 100644
--- a/lib/psos/pt.c
+++ b/lib/psos/pt.c
@@ -17,14 +17,11 @@
  */
 
 #include <stdio.h>
-#include <stdint.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <memory.h>
 #include <boilerplate/ancillaries.h>
 #include <boilerplate/lock.h>
 #include <copperplate/cluster.h>
 #include <psos/psos.h>
+
 #include "internal.h"
 #include "pt.h"
 
diff --git a/lib/psos/queue.c b/lib/psos/queue.c
index 325335a3c..a88d64be1 100644
--- a/lib/psos/queue.c
+++ b/lib/psos/queue.c
@@ -17,19 +17,14 @@
  */
 
 #include <stdio.h>
-#include <stdint.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <memory.h>
 #include <boilerplate/ancillaries.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
-#include <copperplate/clockobj.h>
 #include <copperplate/cluster.h>
 #include <psos/psos.h>
+
 #include "internal.h"
 #include "reference.h"
-#include "task.h"
 #include "queue.h"
 #include "tm.h"
 
diff --git a/lib/psos/rn.c b/lib/psos/rn.c
index fa5bb5707..4a09faebd 100644
--- a/lib/psos/rn.c
+++ b/lib/psos/rn.c
@@ -17,14 +17,11 @@
  */
 
 #include <stdio.h>
-#include <stdint.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <memory.h>
 #include <boilerplate/ancillaries.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/clockobj.h>
 #include <psos/psos.h>
+
 #include "internal.h"
 #include "tm.h"
 #include "rn.h"
diff --git a/lib/psos/sem.c b/lib/psos/sem.c
index 6f6610124..2e3376a5d 100644
--- a/lib/psos/sem.c
+++ b/lib/psos/sem.c
@@ -17,17 +17,15 @@
  */
 
 #include <stdio.h>
-#include <stdint.h>
 #include <errno.h>
-#include <stdlib.h>
 #include <string.h>
 #include <boilerplate/ancillaries.h>
 #include <copperplate/heapobj.h>
 #include <copperplate/cluster.h>
 #include <copperplate/clockobj.h>
 #include <copperplate/semobj.h>
+
 #include "reference.h"
-#include "task.h"
 #include "sem.h"
 #include "tm.h"
 #include "internal.h"
diff --git a/lib/psos/task.c b/lib/psos/task.c
index f678be61d..75965f007 100644
--- a/lib/psos/task.c
+++ b/lib/psos/task.c
@@ -17,18 +17,15 @@
  */
 
 #include <stdio.h>
-#include <memory.h>
 #include <errno.h>
 #include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
 #include <pthread.h>
 #include <sched.h>
+
 #include "boilerplate/namegen.h"
 #include "copperplate/heapobj.h"
 #include "copperplate/threadobj.h"
 #include "copperplate/syncobj.h"
-#include "copperplate/clockobj.h"
 #include "copperplate/cluster.h"
 #include "copperplate/internal.h"
 #include "psos/psos.h"
diff --git a/lib/psos/tm.c b/lib/psos/tm.c
index de7d56d1e..09cb47f6e 100644
--- a/lib/psos/tm.c
+++ b/lib/psos/tm.c
@@ -16,11 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
-#include <errno.h>
 #include <memory.h>
 #include <copperplate/threadobj.h>
-#include <copperplate/heapobj.h>
-#include <copperplate/clockobj.h>
 #include <psos/psos.h>
 #include "task.h"
 #include "tm.h"

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/13] lib/smokey: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (9 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 10/13] lib/psos: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 12/13] lib/trank: " Florian Bezdeka
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/smokey/helpers.c | 1 +
 lib/smokey/init.c    | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/smokey/helpers.c b/lib/smokey/helpers.c
index bc4b3f9bb..f4b9ee1fc 100644
--- a/lib/smokey/helpers.c
+++ b/lib/smokey/helpers.c
@@ -15,6 +15,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <ctype.h>
diff --git a/lib/smokey/init.c b/lib/smokey/init.c
index e1a133ee6..19e47f1fb 100644
--- a/lib/smokey/init.c
+++ b/lib/smokey/init.c
@@ -15,11 +15,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <stdio.h>
-#include <time.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <unistd.h>
 #include <malloc.h>
 #include <string.h>
 #include <errno.h>
@@ -27,11 +26,10 @@
 #include <fnmatch.h>
 #include <boilerplate/list.h>
 #include <boilerplate/ancillaries.h>
-#include "copperplate/internal.h"
-#include <xenomai/init.h>
-#include <xenomai/tunables.h>
 #include <smokey/smokey.h>
 
+#include "copperplate/internal.h"
+
 /**
  * @defgroup smokey Smokey API
  *

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/13] lib/trank: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (10 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 11/13] lib/smokey: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-05 12:41 ` [PATCH 13/13] lib/vxworks: " Florian Bezdeka
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/trank/init.c     | 1 +
 lib/trank/internal.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/trank/init.c b/lib/trank/init.c
index ebb592509..cbd034e03 100644
--- a/lib/trank/init.c
+++ b/lib/trank/init.c
@@ -15,6 +15,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <xenomai/init.h>
 #include "internal.h"
 
diff --git a/lib/trank/internal.c b/lib/trank/internal.c
index 585fc36ec..391fd9a06 100644
--- a/lib/trank/internal.c
+++ b/lib/trank/internal.c
@@ -15,13 +15,13 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <xeno_config.h>
-#include <stdio.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
-#include <memory.h>
 #include <boilerplate/signal.h>
+
 #include "cobalt/internal.h"
 #include "internal.h"
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/13] lib/vxworks: Cleanup includes
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (11 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 12/13] lib/trank: " Florian Bezdeka
@ 2023-12-05 12:41 ` Florian Bezdeka
  2023-12-07  2:37 ` [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Jan Kiszka
  2023-12-07  9:13 ` Jan Kiszka
  14 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2023-12-05 12:41 UTC (permalink / raw)
  To: jan.kiszka, xenomai; +Cc: Florian Bezdeka

- Add an empty line between license information and first include,
  that is what most files already did

- Cleanup unused / unnecessary includes where possible

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/vxworks/errnoLib.c    | 1 +
 lib/vxworks/init.c        | 3 ++-
 lib/vxworks/kernLib.c     | 1 +
 lib/vxworks/memPartLib.c  | 1 +
 lib/vxworks/msgQLib.c     | 1 +
 lib/vxworks/rngLib.c      | 1 +
 lib/vxworks/semLib.c      | 1 +
 lib/vxworks/sysLib.c      | 4 ++--
 lib/vxworks/taskHookLib.c | 2 ++
 lib/vxworks/taskInfo.c    | 1 +
 lib/vxworks/taskLib.c     | 6 ------
 lib/vxworks/tickLib.c     | 6 +-----
 lib/vxworks/wdLib.c       | 1 +
 13 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/lib/vxworks/errnoLib.c b/lib/vxworks/errnoLib.c
index cfb73f27c..66c91e2dd 100644
--- a/lib/vxworks/errnoLib.c
+++ b/lib/vxworks/errnoLib.c
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <vxworks/errnoLib.h>
+
 #include "taskLib.h"
 
 void printErrno(int status)
diff --git a/lib/vxworks/init.c b/lib/vxworks/init.c
index 9a3dcc4ab..4a68c9d7f 100644
--- a/lib/vxworks/init.c
+++ b/lib/vxworks/init.c
@@ -15,13 +15,14 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <stdio.h>
-#include <time.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <xenomai/init.h>
 #include <vxworks/errnoLib.h>
+
 #include "tickLib.h"
 #include "taskLib.h"
 
diff --git a/lib/vxworks/kernLib.c b/lib/vxworks/kernLib.c
index d67502730..112f2d2eb 100644
--- a/lib/vxworks/kernLib.c
+++ b/lib/vxworks/kernLib.c
@@ -18,6 +18,7 @@
 
 #include <vxworks/kernLib.h>
 #include <vxworks/errnoLib.h>
+
 #include "tickLib.h"
 #include "taskLib.h"
 
diff --git a/lib/vxworks/memPartLib.c b/lib/vxworks/memPartLib.c
index c8eeb3617..f3efb0d36 100644
--- a/lib/vxworks/memPartLib.c
+++ b/lib/vxworks/memPartLib.c
@@ -25,6 +25,7 @@
 #include <copperplate/heapobj.h>
 #include <vxworks/errnoLib.h>
 #include <vxworks/memPartLib.h>
+
 #include "memPartLib.h"
 
 #define mempart_magic	0x5a6b7c8d
diff --git a/lib/vxworks/msgQLib.c b/lib/vxworks/msgQLib.c
index aa0b71c68..7b3d59afe 100644
--- a/lib/vxworks/msgQLib.c
+++ b/lib/vxworks/msgQLib.c
@@ -24,6 +24,7 @@
 #include <copperplate/heapobj.h>
 #include <copperplate/threadobj.h>
 #include <vxworks/errnoLib.h>
+
 #include "reference.h"
 #include "taskLib.h"
 #include "msgQLib.h"
diff --git a/lib/vxworks/rngLib.c b/lib/vxworks/rngLib.c
index b11b89519..343d71baa 100644
--- a/lib/vxworks/rngLib.c
+++ b/lib/vxworks/rngLib.c
@@ -20,6 +20,7 @@
 #include <boilerplate/lock.h>
 #include <copperplate/heapobj.h>
 #include <vxworks/errnoLib.h>
+
 #include "rngLib.h"
 
 #define ring_magic 0x5432affe
diff --git a/lib/vxworks/semLib.c b/lib/vxworks/semLib.c
index 180ed2000..f2abf0f83 100644
--- a/lib/vxworks/semLib.c
+++ b/lib/vxworks/semLib.c
@@ -23,6 +23,7 @@
 #include <boilerplate/ancillaries.h>
 #include <copperplate/heapobj.h>
 #include <vxworks/errnoLib.h>
+
 #include "reference.h"
 #include "taskLib.h"
 #include "semLib.h"
diff --git a/lib/vxworks/sysLib.c b/lib/vxworks/sysLib.c
index 449cc64fb..57999db66 100644
--- a/lib/vxworks/sysLib.c
+++ b/lib/vxworks/sysLib.c
@@ -16,11 +16,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
-#include "tickLib.h"
-#include <boilerplate/lock.h>
 #include <vxworks/errnoLib.h>
 #include <vxworks/sysLib.h>
 
+#include "tickLib.h"
+
 int sysClkRateGet(void)
 {
 	unsigned int resolution;
diff --git a/lib/vxworks/taskHookLib.c b/lib/vxworks/taskHookLib.c
index 296bc72e6..8953063d3 100644
--- a/lib/vxworks/taskHookLib.c
+++ b/lib/vxworks/taskHookLib.c
@@ -15,9 +15,11 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
+
 #include <copperplate/heapobj.h>
 #include <vxworks/taskHookLib.h>
 #include <vxworks/errnoLib.h>
+
 #include "taskLib.h"
 #include "taskHookLib.h"
 
diff --git a/lib/vxworks/taskInfo.c b/lib/vxworks/taskInfo.c
index ec423d24e..c10bf27bf 100644
--- a/lib/vxworks/taskInfo.c
+++ b/lib/vxworks/taskInfo.c
@@ -22,6 +22,7 @@
 #include <copperplate/threadobj.h>
 #include <vxworks/errnoLib.h>
 #include <vxworks/taskInfo.h>
+
 #include "taskLib.h"
 
 const char *taskName(TASK_ID task_id)
diff --git a/lib/vxworks/taskLib.c b/lib/vxworks/taskLib.c
index c8723c6be..ffef7c832 100644
--- a/lib/vxworks/taskLib.c
+++ b/lib/vxworks/taskLib.c
@@ -17,11 +17,9 @@
  */
 
 #include <stdio.h>
-#include <memory.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <pthread.h>
 #include <fcntl.h>
 #include <sched.h>
@@ -30,10 +28,6 @@
 #include "msgQLib.h"
 #include "taskHookLib.h"
 #include "boilerplate/namegen.h"
-#include "copperplate/heapobj.h"
-#include "copperplate/threadobj.h"
-#include "copperplate/syncobj.h"
-#include "copperplate/cluster.h"
 #include "copperplate/internal.h"
 #include "copperplate/registry-obstack.h"
 #include "vxworks/errnoLib.h"
diff --git a/lib/vxworks/tickLib.c b/lib/vxworks/tickLib.c
index 9f7ec5aed..ac8dcda2c 100644
--- a/lib/vxworks/tickLib.c
+++ b/lib/vxworks/tickLib.c
@@ -16,13 +16,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
 #include <boilerplate/lock.h>
 #include <vxworks/tickLib.h>
+
 #include "tickLib.h"
 
 struct clockobj wind_clock;
diff --git a/lib/vxworks/wdLib.c b/lib/vxworks/wdLib.c
index beb70d567..55a830845 100644
--- a/lib/vxworks/wdLib.c
+++ b/lib/vxworks/wdLib.c
@@ -27,6 +27,7 @@
 #include <copperplate/heapobj.h>
 #include <copperplate/threadobj.h>
 #include <vxworks/errnoLib.h>
+
 #include "wdLib.h"
 #include "tickLib.h"
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (12 preceding siblings ...)
  2023-12-05 12:41 ` [PATCH 13/13] lib/vxworks: " Florian Bezdeka
@ 2023-12-07  2:37 ` Jan Kiszka
  2023-12-07  9:13 ` Jan Kiszka
  14 siblings, 0 replies; 16+ messages in thread
From: Jan Kiszka @ 2023-12-07  2:37 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai

On 05.12.23 20:41, Florian Bezdeka wrote:
> Hi all,
> 
> Warning, this is high altitute work ;-). I had some time on my flight back
> from New Zealand, so review carefully.
> 

Then let's only check this while doing something similar (on my route
back from Tokyo) :p

Jan

> Everything is compile tested and passed our internal CI already - as
> usual.
> 
> I'm trying to address some comments / further cleanups mentioned by Jan
> during the last testsuite cleanup series.
> 
> Best regards,
> Florian
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
> Florian Bezdeka (13):
>       testsuite: Migrate to ARRAY_SIZE()
>       demo: Migrate to ARRAY_SIZE()
>       lib: Migrate to ARRAY_SIZE()
>       kernel/drivers: Mirate to ARRAY_SIZE()
>       demo: Cleanup includes
>       lib/alchemy: Cleanup includes
>       lib/analogy: Cleanup includes
>       lib/boilerplate: Cleanup includes
>       lib/copperplate: Cleanup includes
>       lib/psos: Cleanup includes
>       lib/smokey: Cleanup includes
>       lib/trank: Cleanup includes
>       lib/vxworks: Cleanup includes
> 
>  demo/alchemy/altency.c                                   |  2 +-
>  demo/alchemy/cobalt/cross-link.c                         |  3 +--
>  demo/posix/cobalt/bufp-label.c                           |  5 ++++-
>  demo/posix/cobalt/bufp-readwrite.c                       |  5 ++++-
>  demo/posix/cobalt/can-rtt.c                              |  2 --
>  demo/posix/cobalt/eth_p_all.c                            |  2 --
>  demo/posix/cobalt/gpiopwm.c                              |  3 ---
>  demo/posix/cobalt/iddp-label.c                           |  5 ++++-
>  demo/posix/cobalt/iddp-sendrecv.c                        |  5 ++++-
>  demo/posix/cobalt/xddp-echo.c                            |  5 ++++-
>  demo/posix/cobalt/xddp-label.c                           |  5 ++++-
>  demo/posix/cobalt/xddp-stream.c                          |  5 ++++-
>  demo/posix/cyclictest/cyclictest.c                       |  6 +++---
>  include/smokey/smokey.h                                  |  2 +-
>  kernel/drivers/analogy/national_instruments/mio_common.c |  6 ++----
>  kernel/drivers/analogy/national_instruments/ni_670x.c    |  2 +-
>  kernel/drivers/analogy/national_instruments/ni_stc.h     |  4 ++--
>  kernel/drivers/analogy/national_instruments/pcimio.c     |  2 +-
>  .../net/drivers/experimental/e1000/e1000_80003es2lan.c   |  3 +--
>  .../drivers/net/drivers/experimental/e1000/e1000_82541.c |  3 +--
>  .../drivers/net/drivers/experimental/e1000/e1000_phy.c   |  6 ++----
>  kernel/drivers/net/drivers/igb/e1000_phy.c               |  6 ++----
>  lib/alchemy/alarm.c                                      |  2 +-
>  lib/alchemy/buffer.c                                     |  2 +-
>  lib/alchemy/cond.c                                       |  2 +-
>  lib/alchemy/event.c                                      |  2 +-
>  lib/alchemy/heap.c                                       |  1 -
>  lib/alchemy/init.c                                       |  3 +--
>  lib/alchemy/internal.c                                   |  2 --
>  lib/alchemy/mutex.c                                      |  2 +-
>  lib/alchemy/pipe.c                                       |  3 ++-
>  lib/alchemy/queue.c                                      |  2 +-
>  lib/alchemy/sem.c                                        |  1 -
>  lib/alchemy/task.c                                       |  2 +-
>  lib/analogy/calibration.c                                |  2 +-
>  lib/analogy/descriptor.c                                 |  1 -
>  lib/analogy/math.c                                       |  1 -
>  lib/analogy/range.c                                      |  1 -
>  lib/boilerplate/ancillaries.c                            |  8 +++-----
>  lib/boilerplate/avl.c                                    |  1 +
>  lib/boilerplate/debug.c                                  |  7 ++-----
>  lib/boilerplate/hash.c                                   |  2 +-
>  lib/boilerplate/heapmem.c                                |  5 ++---
>  lib/boilerplate/iniparser/dictionary.c                   |  1 -
>  lib/boilerplate/init/bootstrap.c                         |  1 +
>  lib/boilerplate/setup.c                                  |  7 +++----
>  lib/boilerplate/time.c                                   |  1 +
>  lib/boilerplate/version.c                                |  1 +
>  lib/cobalt/mutex.c                                       |  2 +-
>  lib/cobalt/sigshadow.c                                   |  2 +-
>  lib/copperplate/clockobj.c                               |  4 ----
>  lib/copperplate/cluster.c                                |  3 ---
>  lib/copperplate/eventobj.c                               |  2 --
>  lib/copperplate/heapobj-heapmem.c                        |  7 +++++--
>  lib/copperplate/init.c                                   |  4 +---
>  lib/copperplate/internal.c                               |  4 ++--
>  lib/copperplate/syncobj.c                                |  2 --
>  lib/copperplate/threadobj.c                              |  1 +
>  lib/copperplate/traceobj.c                               |  1 +
>  lib/psos/init.c                                          |  8 ++------
>  lib/psos/pt.c                                            |  5 +----
>  lib/psos/queue.c                                         |  7 +------
>  lib/psos/rn.c                                            |  5 +----
>  lib/psos/sem.c                                           |  4 +---
>  lib/psos/task.c                                          |  5 +----
>  lib/psos/tm.c                                            |  3 ---
>  lib/smokey/helpers.c                                     |  1 +
>  lib/smokey/init.c                                        |  8 +++-----
>  lib/trank/init.c                                         |  1 +
>  lib/trank/internal.c                                     |  4 ++--
>  lib/vxworks/errnoLib.c                                   |  1 +
>  lib/vxworks/init.c                                       |  3 ++-
>  lib/vxworks/kernLib.c                                    |  1 +
>  lib/vxworks/memPartLib.c                                 |  1 +
>  lib/vxworks/msgQLib.c                                    |  1 +
>  lib/vxworks/rngLib.c                                     |  1 +
>  lib/vxworks/semLib.c                                     |  1 +
>  lib/vxworks/sysLib.c                                     |  4 ++--
>  lib/vxworks/taskHookLib.c                                |  2 ++
>  lib/vxworks/taskInfo.c                                   |  1 +
>  lib/vxworks/taskLib.c                                    |  6 ------
>  lib/vxworks/tickLib.c                                    |  6 +-----
>  lib/vxworks/wdLib.c                                      |  1 +
>  testsuite/smokey/alchemytests/mq-1.c                     |  3 ++-
>  testsuite/smokey/alchemytests/mq-2.c                     |  3 ++-
>  testsuite/smokey/net_common/server.c                     |  8 ++++----
>  testsuite/smokey/net_common/setup.c                      |  2 +-
>  testsuite/smokey/posix-select/posix-select.c             |  4 ++--
>  testsuite/smokey/vxworkstests/msgQ-1.c                   |  3 ++-
>  testsuite/smokey/vxworkstests/msgQ-2.c                   |  3 ++-
>  testsuite/switchtest/switchtest.c                        | 16 ++++++++--------
>  91 files changed, 136 insertions(+), 168 deletions(-)
> ---
> base-commit: ed69c34214f9fcf57b459e701ed4f65f6753bb8c
> change-id: 20231201-flo-array-size-f30df8dd25e9
> 
> Best regards,

-- 
Siemens AG, Technology
Linux Expert Center


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups
  2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
                   ` (13 preceding siblings ...)
  2023-12-07  2:37 ` [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Jan Kiszka
@ 2023-12-07  9:13 ` Jan Kiszka
  14 siblings, 0 replies; 16+ messages in thread
From: Jan Kiszka @ 2023-12-07  9:13 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai

On 05.12.23 20:41, Florian Bezdeka wrote:
> Hi all,
> 
> Warning, this is high altitute work ;-). I had some time on my flight back
> from New Zealand, so review carefully.
> 
> Everything is compile tested and passed our internal CI already - as
> usual.
> 
> I'm trying to address some comments / further cleanups mentioned by Jan
> during the last testsuite cleanup series.
> 
> Best regards,
> Florian
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
> Florian Bezdeka (13):
>       testsuite: Migrate to ARRAY_SIZE()
>       demo: Migrate to ARRAY_SIZE()
>       lib: Migrate to ARRAY_SIZE()
>       kernel/drivers: Mirate to ARRAY_SIZE()
>       demo: Cleanup includes
>       lib/alchemy: Cleanup includes
>       lib/analogy: Cleanup includes
>       lib/boilerplate: Cleanup includes
>       lib/copperplate: Cleanup includes
>       lib/psos: Cleanup includes
>       lib/smokey: Cleanup includes
>       lib/trank: Cleanup includes
>       lib/vxworks: Cleanup includes
> 
>  demo/alchemy/altency.c                                   |  2 +-
>  demo/alchemy/cobalt/cross-link.c                         |  3 +--
>  demo/posix/cobalt/bufp-label.c                           |  5 ++++-
>  demo/posix/cobalt/bufp-readwrite.c                       |  5 ++++-
>  demo/posix/cobalt/can-rtt.c                              |  2 --
>  demo/posix/cobalt/eth_p_all.c                            |  2 --
>  demo/posix/cobalt/gpiopwm.c                              |  3 ---
>  demo/posix/cobalt/iddp-label.c                           |  5 ++++-
>  demo/posix/cobalt/iddp-sendrecv.c                        |  5 ++++-
>  demo/posix/cobalt/xddp-echo.c                            |  5 ++++-
>  demo/posix/cobalt/xddp-label.c                           |  5 ++++-
>  demo/posix/cobalt/xddp-stream.c                          |  5 ++++-
>  demo/posix/cyclictest/cyclictest.c                       |  6 +++---
>  include/smokey/smokey.h                                  |  2 +-
>  kernel/drivers/analogy/national_instruments/mio_common.c |  6 ++----
>  kernel/drivers/analogy/national_instruments/ni_670x.c    |  2 +-
>  kernel/drivers/analogy/national_instruments/ni_stc.h     |  4 ++--
>  kernel/drivers/analogy/national_instruments/pcimio.c     |  2 +-
>  .../net/drivers/experimental/e1000/e1000_80003es2lan.c   |  3 +--
>  .../drivers/net/drivers/experimental/e1000/e1000_82541.c |  3 +--
>  .../drivers/net/drivers/experimental/e1000/e1000_phy.c   |  6 ++----
>  kernel/drivers/net/drivers/igb/e1000_phy.c               |  6 ++----
>  lib/alchemy/alarm.c                                      |  2 +-
>  lib/alchemy/buffer.c                                     |  2 +-
>  lib/alchemy/cond.c                                       |  2 +-
>  lib/alchemy/event.c                                      |  2 +-
>  lib/alchemy/heap.c                                       |  1 -
>  lib/alchemy/init.c                                       |  3 +--
>  lib/alchemy/internal.c                                   |  2 --
>  lib/alchemy/mutex.c                                      |  2 +-
>  lib/alchemy/pipe.c                                       |  3 ++-
>  lib/alchemy/queue.c                                      |  2 +-
>  lib/alchemy/sem.c                                        |  1 -
>  lib/alchemy/task.c                                       |  2 +-
>  lib/analogy/calibration.c                                |  2 +-
>  lib/analogy/descriptor.c                                 |  1 -
>  lib/analogy/math.c                                       |  1 -
>  lib/analogy/range.c                                      |  1 -
>  lib/boilerplate/ancillaries.c                            |  8 +++-----
>  lib/boilerplate/avl.c                                    |  1 +
>  lib/boilerplate/debug.c                                  |  7 ++-----
>  lib/boilerplate/hash.c                                   |  2 +-
>  lib/boilerplate/heapmem.c                                |  5 ++---
>  lib/boilerplate/iniparser/dictionary.c                   |  1 -
>  lib/boilerplate/init/bootstrap.c                         |  1 +
>  lib/boilerplate/setup.c                                  |  7 +++----
>  lib/boilerplate/time.c                                   |  1 +
>  lib/boilerplate/version.c                                |  1 +
>  lib/cobalt/mutex.c                                       |  2 +-
>  lib/cobalt/sigshadow.c                                   |  2 +-
>  lib/copperplate/clockobj.c                               |  4 ----
>  lib/copperplate/cluster.c                                |  3 ---
>  lib/copperplate/eventobj.c                               |  2 --
>  lib/copperplate/heapobj-heapmem.c                        |  7 +++++--
>  lib/copperplate/init.c                                   |  4 +---
>  lib/copperplate/internal.c                               |  4 ++--
>  lib/copperplate/syncobj.c                                |  2 --
>  lib/copperplate/threadobj.c                              |  1 +
>  lib/copperplate/traceobj.c                               |  1 +
>  lib/psos/init.c                                          |  8 ++------
>  lib/psos/pt.c                                            |  5 +----
>  lib/psos/queue.c                                         |  7 +------
>  lib/psos/rn.c                                            |  5 +----
>  lib/psos/sem.c                                           |  4 +---
>  lib/psos/task.c                                          |  5 +----
>  lib/psos/tm.c                                            |  3 ---
>  lib/smokey/helpers.c                                     |  1 +
>  lib/smokey/init.c                                        |  8 +++-----
>  lib/trank/init.c                                         |  1 +
>  lib/trank/internal.c                                     |  4 ++--
>  lib/vxworks/errnoLib.c                                   |  1 +
>  lib/vxworks/init.c                                       |  3 ++-
>  lib/vxworks/kernLib.c                                    |  1 +
>  lib/vxworks/memPartLib.c                                 |  1 +
>  lib/vxworks/msgQLib.c                                    |  1 +
>  lib/vxworks/rngLib.c                                     |  1 +
>  lib/vxworks/semLib.c                                     |  1 +
>  lib/vxworks/sysLib.c                                     |  4 ++--
>  lib/vxworks/taskHookLib.c                                |  2 ++
>  lib/vxworks/taskInfo.c                                   |  1 +
>  lib/vxworks/taskLib.c                                    |  6 ------
>  lib/vxworks/tickLib.c                                    |  6 +-----
>  lib/vxworks/wdLib.c                                      |  1 +
>  testsuite/smokey/alchemytests/mq-1.c                     |  3 ++-
>  testsuite/smokey/alchemytests/mq-2.c                     |  3 ++-
>  testsuite/smokey/net_common/server.c                     |  8 ++++----
>  testsuite/smokey/net_common/setup.c                      |  2 +-
>  testsuite/smokey/posix-select/posix-select.c             |  4 ++--
>  testsuite/smokey/vxworkstests/msgQ-1.c                   |  3 ++-
>  testsuite/smokey/vxworkstests/msgQ-2.c                   |  3 ++-
>  testsuite/switchtest/switchtest.c                        | 16 ++++++++--------
>  91 files changed, 136 insertions(+), 168 deletions(-)
> ---
> base-commit: ed69c34214f9fcf57b459e701ed4f65f6753bb8c
> change-id: 20231201-flo-array-size-f30df8dd25e9
> 
> Best regards,

Thanks, applied to next.

Jan

-- 
Siemens AG, Technology
Linux Expert Center


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-12-07  9:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 12:41 [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Florian Bezdeka
2023-12-05 12:41 ` [PATCH 01/13] testsuite: Migrate to ARRAY_SIZE() Florian Bezdeka
2023-12-05 12:41 ` [PATCH 02/13] demo: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 03/13] lib: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 04/13] kernel/drivers: Mirate " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 05/13] demo: Cleanup includes Florian Bezdeka
2023-12-05 12:41 ` [PATCH 06/13] lib/alchemy: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 07/13] lib/analogy: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 08/13] lib/boilerplate: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 09/13] lib/copperplate: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 10/13] lib/psos: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 11/13] lib/smokey: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 12/13] lib/trank: " Florian Bezdeka
2023-12-05 12:41 ` [PATCH 13/13] lib/vxworks: " Florian Bezdeka
2023-12-07  2:37 ` [PATCH 00/13] Migration to ARRAY_SIZE() and further include cleanups Jan Kiszka
2023-12-07  9:13 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.