summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-12-14 13:32:43 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-18 20:32:58 -0800
commitbbb40ce21d7a972c812621091390a994c6fce4b6 (patch)
treec4dd22d3473e7324a62bf00cf975721c432b264a
parent6aa967e4bbbdf28e0d9f5e537ccf4cbd76665b68 (diff)
downloadchrome-ec-bbb40ce21d7a972c812621091390a994c6fce4b6.tar.gz
consumer: Remove flush operation
Nobody is calling the flush function for consumer_ops structure, so let's remove it to save flash space, until we find a use for it. CQ-DEPEND=CL:*529221 BRANCH=none BUG=chromium:795624 TEST=make buildall -j, saves from 40 to 128 bytes on some boards. Change-Id: Iad18b30f419ccebc54a90914ec46da84b8d19601 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/826905 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/g/blob.c5
-rw-r--r--chip/g/usart.c9
-rw-r--r--chip/g/usb-stream.c10
-rw-r--r--chip/g/usb_spi.c5
-rw-r--r--chip/g/usb_upgrade.c5
-rw-r--r--chip/stm32/usart_tx_dma.c15
-rw-r--r--chip/stm32/usart_tx_dma.h1
-rw-r--r--chip/stm32/usart_tx_interrupt.c16
-rw-r--r--chip/stm32/usb-stream.c10
-rw-r--r--chip/stm32/usb_dwc_stream.c12
-rw-r--r--common/queue_policies.c1
-rw-r--r--common/usb_i2c.c5
-rw-r--r--common/usb_update.c5
-rw-r--r--include/consumer.h6
14 files changed, 0 insertions, 105 deletions
diff --git a/chip/g/blob.c b/chip/g/blob.c
index fde66aac9a..f288b2aacf 100644
--- a/chip/g/blob.c
+++ b/chip/g/blob.c
@@ -61,14 +61,9 @@ static void blob_written(struct consumer const *consumer, size_t count)
CPRINTS("Sending: count=%d buf=((%s))", count, buf);
}
-static void blob_flush(struct consumer const *consumer)
-{
-}
-
struct consumer const blob_consumer = {
.queue = &usb_to_blob,
.ops = &((struct consumer_ops const) {
.written = blob_written,
- .flush = blob_flush,
}),
};
diff --git a/chip/g/usart.c b/chip/g/usart.c
index 667a891e42..5236acf202 100644
--- a/chip/g/usart.c
+++ b/chip/g/usart.c
@@ -158,21 +158,12 @@ static void uart_written(struct consumer const *consumer, size_t count)
uartn_tx_start(config->uart);
}
-static void uart_flush(struct consumer const *consumer)
-{
- struct usart_config const *config =
- DOWNCAST(consumer, struct usart_config, consumer);
-
- uartn_tx_flush(config->uart);
-}
-
struct producer_ops const uart_producer_ops = {
.read = uart_read,
};
struct consumer_ops const uart_consumer_ops = {
.written = uart_written,
- .flush = uart_flush,
};
#if USE_UART_INTERRUPTS
diff --git a/chip/g/usb-stream.c b/chip/g/usb-stream.c
index 025f71e7fc..a0ccf5b940 100644
--- a/chip/g/usb-stream.c
+++ b/chip/g/usb-stream.c
@@ -176,20 +176,10 @@ static void usb_written(struct consumer const *consumer, size_t count)
hook_call_deferred(config->deferred_tx, 0);
}
-static void usb_flush(struct consumer const *consumer)
-{
- struct usb_stream_config const *config =
- DOWNCAST(consumer, struct usb_stream_config, consumer);
-
- while (tx_fifo_is_ready(config) && queue_count(consumer->queue))
- ;
-}
-
struct producer_ops const usb_stream_producer_ops = {
.read = usb_read,
};
struct consumer_ops const usb_stream_consumer_ops = {
.written = usb_written,
- .flush = usb_flush,
};
diff --git a/chip/g/usb_spi.c b/chip/g/usb_spi.c
index a5f6ddd175..d7f7ff031f 100644
--- a/chip/g/usb_spi.c
+++ b/chip/g/usb_spi.c
@@ -133,13 +133,8 @@ static void usb_spi_written(struct consumer const *consumer, size_t count)
hook_call_deferred(config->deferred, 0);
}
-static void usb_spi_flush(struct consumer const *consumer)
-{
-}
-
struct consumer_ops const usb_spi_consumer_ops = {
.written = usb_spi_written,
- .flush = usb_spi_flush,
};
void usb_spi_enable(struct usb_spi_config const *config, int enabled)
diff --git a/chip/g/usb_upgrade.c b/chip/g/usb_upgrade.c
index acbec230b7..aeafd819fa 100644
--- a/chip/g/usb_upgrade.c
+++ b/chip/g/usb_upgrade.c
@@ -400,14 +400,9 @@ static void upgrade_out_handler(struct consumer const *consumer, size_t count)
block_buffer = NULL;
}
-static void upgrade_flush(struct consumer const *consumer)
-{
-}
-
struct consumer const upgrade_consumer = {
.queue = &usb_to_upgrade,
.ops = &((struct consumer_ops const) {
.written = upgrade_out_handler,
- .flush = upgrade_flush,
}),
};
diff --git a/chip/stm32/usart_tx_dma.c b/chip/stm32/usart_tx_dma.c
index c17f2ae1bb..5989ccaa56 100644
--- a/chip/stm32/usart_tx_dma.c
+++ b/chip/stm32/usart_tx_dma.c
@@ -19,21 +19,6 @@ void usart_tx_dma_written(struct consumer const *consumer, size_t count)
task_trigger_irq(config->hw->irq);
}
-void usart_tx_dma_flush(struct consumer const *consumer)
-{
- struct usart_config const *config =
- DOWNCAST(consumer, struct usart_config, consumer);
-
- /*
- * Enable the USART interrupt. This causes the USART interrupt handler
- * to start fetching from the TX queue if it wasn't already.
- */
- task_trigger_irq(config->hw->irq);
-
- while (queue_count(consumer->queue))
- ;
-}
-
void usart_tx_dma_init(struct usart_config const *config)
{
struct usart_tx_dma const *dma_config =
diff --git a/chip/stm32/usart_tx_dma.h b/chip/stm32/usart_tx_dma.h
index 33a97395ad..e517aa847b 100644
--- a/chip/stm32/usart_tx_dma.h
+++ b/chip/stm32/usart_tx_dma.h
@@ -34,7 +34,6 @@
.usart_tx = { \
.consumer_ops = { \
.written = usart_tx_dma_written,\
- .flush = usart_tx_dma_flush, \
}, \
\
.init = usart_tx_dma_init, \
diff --git a/chip/stm32/usart_tx_interrupt.c b/chip/stm32/usart_tx_interrupt.c
index ef2443ec96..8527e6c064 100644
--- a/chip/stm32/usart_tx_interrupt.c
+++ b/chip/stm32/usart_tx_interrupt.c
@@ -32,21 +32,6 @@ static void usart_written(struct consumer const *consumer, size_t count)
STM32_USART_CR1(config->hw->base) |= STM32_USART_CR1_TXEIE;
}
-static void usart_flush(struct consumer const *consumer)
-{
- struct usart_config const *config =
- DOWNCAST(consumer, struct usart_config, consumer);
-
- /*
- * Enable USART interrupt. This causes the USART interrupt handler to
- * start fetching from the TX queue if it wasn't already.
- */
- STM32_USART_CR1(config->hw->base) |= STM32_USART_CR1_TXEIE;
-
- while (queue_count(consumer->queue))
- ;
-}
-
static void usart_tx_interrupt_handler(struct usart_config const *config)
{
intptr_t base = config->hw->base;
@@ -82,7 +67,6 @@ static void usart_tx_interrupt_handler(struct usart_config const *config)
struct usart_tx const usart_tx_interrupt = {
.consumer_ops = {
.written = usart_written,
- .flush = usart_flush,
},
.init = usart_tx_init,
diff --git a/chip/stm32/usb-stream.c b/chip/stm32/usb-stream.c
index 35df5f6f8c..d66a5ae2a0 100644
--- a/chip/stm32/usb-stream.c
+++ b/chip/stm32/usb-stream.c
@@ -78,22 +78,12 @@ static void usb_written(struct consumer const *consumer, size_t count)
hook_call_deferred(config->deferred, 0);
}
-static void usb_flush(struct consumer const *consumer)
-{
- struct usb_stream_config const *config =
- DOWNCAST(consumer, struct usb_stream_config, consumer);
-
- while (tx_valid(config) || queue_count(consumer->queue))
- ;
-}
-
struct producer_ops const usb_stream_producer_ops = {
.read = usb_read,
};
struct consumer_ops const usb_stream_consumer_ops = {
.written = usb_written,
- .flush = usb_flush,
};
void usb_stream_deferred(struct usb_stream_config const *config)
diff --git a/chip/stm32/usb_dwc_stream.c b/chip/stm32/usb_dwc_stream.c
index bf3f37c37b..2f20d88dda 100644
--- a/chip/stm32/usb_dwc_stream.c
+++ b/chip/stm32/usb_dwc_stream.c
@@ -90,22 +90,10 @@ static void usb_written(struct consumer const *consumer, size_t count)
hook_call_deferred(config->deferred_tx, 0);
}
-static void usb_flush(struct consumer const *consumer)
-{
- struct usb_stream_config const *config =
- DOWNCAST(consumer, struct usb_stream_config, consumer);
-
- while (queue_count(consumer->queue)) {
- tx_stream_handler(config);
- usleep(10);
- }
-}
-
struct producer_ops const usb_stream_producer_ops = {
.read = usb_read,
};
struct consumer_ops const usb_stream_consumer_ops = {
.written = usb_written,
- .flush = usb_flush,
};
diff --git a/common/queue_policies.c b/common/queue_policies.c
index 85395fec15..090c837fae 100644
--- a/common/queue_policies.c
+++ b/common/queue_policies.c
@@ -38,6 +38,5 @@ struct consumer const null_consumer = {
.queue = NULL,
.ops = &((struct consumer_ops const) {
.written = NULL,
- .flush = NULL,
}),
};
diff --git a/common/usb_i2c.c b/common/usb_i2c.c
index 5fa04e0ba1..cd67f68a7a 100644
--- a/common/usb_i2c.c
+++ b/common/usb_i2c.c
@@ -141,11 +141,6 @@ static void usb_i2c_written(struct consumer const *consumer, size_t count)
hook_call_deferred(config->deferred, 0);
}
-static void usb_i2c_flush(struct consumer const *consumer)
-{
-}
-
struct consumer_ops const usb_i2c_consumer_ops = {
.written = usb_i2c_written,
- .flush = usb_i2c_flush,
};
diff --git a/common/usb_update.c b/common/usb_update.c
index a97541dd9c..0ab7a3e2c6 100644
--- a/common/usb_update.c
+++ b/common/usb_update.c
@@ -552,14 +552,9 @@ static void update_out_handler(struct consumer const *consumer, size_t count)
rx_state_ = rx_outside_block;
}
-static void update_flush(struct consumer const *consumer)
-{
-}
-
struct consumer const update_consumer = {
.queue = &usb_to_update,
.ops = &((struct consumer_ops const) {
.written = update_out_handler,
- .flush = update_flush,
}),
};
diff --git a/include/consumer.h b/include/consumer.h
index e66d2e769e..f6d164649e 100644
--- a/include/consumer.h
+++ b/include/consumer.h
@@ -27,12 +27,6 @@ struct consumer_ops {
* no need for this information it can set this to NULL.
*/
void (*written)(struct consumer const *consumer, size_t count);
-
- /*
- * Flush (read) everything from the associated queue. This call blocks
- * until the consumer has flushed the queue.
- */
- void (*flush)(struct consumer const *consumer);
};
struct consumer {