summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-05-13 08:39:58 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-27 01:27:20 +0000
commit8e7b34f314981b16cbec2a5ce64a4165b0f3b353 (patch)
treeb02fc8307e5c79170a92513c688d25eeadc699f5 /include
parent2259e8ffb7645e0decfadd95fb4d1cdda8208095 (diff)
downloadchrome-ec-8e7b34f314981b16cbec2a5ce64a4165b0f3b353.tar.gz
Cleanup: Use compound literals for static initialization
This just makes a couple of convenience macros a little prettier using compound literals. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I2bcd846067dbbe000b0ecb36c1d8da2d8cd730b3 Reviewed-on: https://chromium-review.googlesource.com/273287 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/stream_adaptor.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/include/stream_adaptor.h b/include/stream_adaptor.h
index 93ce923f40..3074231ef3 100644
--- a/include/stream_adaptor.h
+++ b/include/stream_adaptor.h
@@ -32,8 +32,8 @@ struct in_stream_from_queue {
extern struct in_stream_ops const in_stream_from_queue_in_stream_ops;
extern struct consumer_ops const in_stream_from_queue_consumer_ops;
-#define IN_STREAM_FROM_QUEUE(NAME, QUEUE, READY) \
- struct in_stream_from_queue const NAME = { \
+#define IN_STREAM_FROM_QUEUE(QUEUE, READY) \
+ ((struct in_stream_from_queue) { \
.consumer = { \
.queue = &QUEUE, \
.ops = &in_stream_from_queue_consumer_ops, \
@@ -42,7 +42,7 @@ extern struct consumer_ops const in_stream_from_queue_consumer_ops;
.ready = READY, \
.ops = &in_stream_from_queue_in_stream_ops, \
}, \
- };
+ })
/*
* +..........+ +..........+------+............+
@@ -63,8 +63,8 @@ struct out_stream_from_queue {
extern struct out_stream_ops const out_stream_from_queue_out_stream_ops;
extern struct producer_ops const out_stream_from_queue_producer_ops;
-#define OUT_STREAM_FROM_QUEUE(NAME, QUEUE, READY) \
- struct out_stream_from_queue const NAME = { \
+#define OUT_STREAM_FROM_QUEUE(QUEUE, READY) \
+ ((struct out_stream_from_queue) { \
.producer = { \
.queue = &QUEUE, \
.ops = &out_stream_from_queue_producer_ops, \
@@ -73,7 +73,7 @@ extern struct producer_ops const out_stream_from_queue_producer_ops;
.ready = READY, \
.ops = &out_stream_from_queue_out_stream_ops, \
}, \
- };
+ })
/*
* Given a forward declared device configuration called NAME that implements
@@ -81,7 +81,6 @@ extern struct producer_ops const out_stream_from_queue_producer_ops;
* streams called <NAME>_in and <NAME>_out.
*/
#define IO_STREAM_CONFIG(NAME, RX_SIZE, TX_SIZE, IN_READY, OUT_READY) \
- \
struct in_stream_from_queue const CONCAT2(NAME, _in); \
\
struct queue const CONCAT2(NAME, _rx_queue) = \
@@ -89,9 +88,9 @@ extern struct producer_ops const out_stream_from_queue_producer_ops;
uint8_t, \
NAME.producer, \
CONCAT2(NAME, _in).consumer); \
- IN_STREAM_FROM_QUEUE(CONCAT2(NAME, _in), \
- CONCAT2(NAME, _rx_queue), \
- IN_READY) \
+ struct in_stream_from_queue const CONCAT2(NAME, _in) = \
+ IN_STREAM_FROM_QUEUE(CONCAT2(NAME, _rx_queue), \
+ IN_READY); \
\
\
struct out_stream_from_queue const CONCAT2(NAME, _out); \
@@ -101,8 +100,8 @@ extern struct producer_ops const out_stream_from_queue_producer_ops;
uint8_t, \
CONCAT2(NAME, _out).producer, \
NAME.consumer); \
- OUT_STREAM_FROM_QUEUE(CONCAT2(NAME, _out), \
- CONCAT2(NAME, _tx_queue), \
- OUT_READY)
+ struct out_stream_from_queue const CONCAT2(NAME, _out) = \
+ OUT_STREAM_FROM_QUEUE(CONCAT2(NAME, _tx_queue), \
+ OUT_READY);
#endif /* INCLUDE_STREAM_ADAPTOR_H */