Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STABLE-v2.7] drivers: hda: insert an empty ";" statement before switch() labels #73

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions drivers/dma/dma_intel_adsp_hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,19 @@ int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel,
#endif
switch (cfg->direction) {
case HOST_TO_MEMORY:
uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
; /* Only statements can be labeled in C, a declaration is not valid */
const uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
const uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);

intel_adsp_hda_set_buffer_segment_ptr(cfg->base, cfg->regblock_size,
channel, next_rp);
intel_adsp_hda_enable_buffer_interrupt(cfg->base, cfg->regblock_size, channel);
break;
case MEMORY_TO_HOST:
uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
;
const uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
const uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so mixing code with declaration is not all roses ;)

While recognizing that this is pickled from upstream, I would have addressed this issue differently.

diff --git a/drivers/dma/dma_intel_adsp_hda.c b/drivers/dma/dma_intel_adsp_hda.c
index 14768e7531a5..2d62ee1c38b0 100644
--- a/drivers/dma/dma_intel_adsp_hda.c
+++ b/drivers/dma/dma_intel_adsp_hda.c
@@ -187,6 +187,7 @@ int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel,
 #endif
 	switch (cfg->direction) {
 	case HOST_TO_MEMORY:
+	{
 		uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
 		uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
 			intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);
@@ -195,7 +196,9 @@ int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel,
 						      channel, next_rp);
 		intel_adsp_hda_enable_buffer_interrupt(cfg->base, cfg->regblock_size, channel);
 		break;
+	}
 	case MEMORY_TO_HOST:
+	{
 		uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
 		uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
 			intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);
@@ -204,6 +207,7 @@ int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel,
 						      channel, next_wp);
 		intel_adsp_hda_enable_buffer_interrupt(cfg->base, cfg->regblock_size, channel);
 		break;
+	}
 	default:
 		break;
 	}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so mixing code with declaration is not all roses ;)

Someone forgot to update the formal language grammar in 1999. sparse seems to be the only one which cares.

BTW sparse is also unmaintained, can't do exit codes and has infinite loops:

I would have addressed this issue differently.

Feel free to send a patch upstream. If anyone cares enough we can then cherry-pick it on top of this one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's handle this in upstream, I can pick this one for the stable series as this is already upstream.

intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);

intel_adsp_hda_set_buffer_segment_ptr(cfg->base, cfg->regblock_size,
Expand Down
Loading