Skip to content

Commit c5a31ae

Browse files
jfischer-nofabiobaltieri
authored andcommitted
usb: device: cleanup CDC ACM UART rx_ready, tx_ready and is_pending
Align the irq_tx_ready and irq_rx_ready implementations and use them from irq_rx_pending. Signed-off-by: Johann Fischer <[email protected]>
1 parent 0f03221 commit c5a31ae

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

subsys/usb/device/class/cdc_acm.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ static int cdc_acm_irq_rx_ready(const struct device *dev)
666666
{
667667
struct cdc_acm_dev_data_t * const dev_data = dev->data;
668668

669-
if (dev_data->rx_ready) {
669+
if (dev_data->rx_ready && dev_data->rx_irq_ena) {
670670
return 1;
671671
}
672672

@@ -682,15 +682,11 @@ static int cdc_acm_irq_rx_ready(const struct device *dev)
682682
*/
683683
static int cdc_acm_irq_is_pending(const struct device *dev)
684684
{
685-
struct cdc_acm_dev_data_t * const dev_data = dev->data;
686-
687-
if (dev_data->tx_ready && dev_data->tx_irq_ena) {
685+
if (cdc_acm_irq_rx_ready(dev) || cdc_acm_irq_tx_ready(dev)) {
688686
return 1;
689-
} else if (dev_data->rx_ready && dev_data->rx_irq_ena) {
690-
return 1;
691-
} else {
692-
return 0;
693687
}
688+
689+
return 0;
694690
}
695691

696692
/**

0 commit comments

Comments
 (0)