[PATCH 0/8] use semicolons rather than commas to separate statements
These patches replace commas by semicolons. This was done using the Coccinelle semantic patch (http://coccinelle.lip6.fr/) shown below.
This semantic patch ensures that commas inside for loop headers will not be transformed. It also doesn't touch macro definitions.
Coccinelle ensures that braces are added as needed when a single-statement branch turns into a multi-statement one.
This semantic patch has a few false positives, for variable delcarations such as:
LIST_HEAD(x), *y;
The semantic patch could be improved to avoid these, but for the moment they have been removed manually (2 occurrences).
// <smpl> @initialize:ocaml@ @@
let infunction p = (* avoid macros *) (List.hd p).current_element <> "something_else"
let combined p1 p2 = (List.hd p1).line_end = (List.hd p2).line || (((List.hd p1).line_end < (List.hd p2).line) && ((List.hd p1).col < (List.hd p2).col))
@bad@ statement S; declaration d; position p; @@
S@p d
// special cases where newlines are needed (hope for no more than 5) @@ expression e1,e2; statement S; position p != bad.p; position p1; position p2 : script:ocaml(p1) { infunction p1 && combined p1 p2 }; @@
- e1@p1,@S@p e2@p2; + e1; e2;
@@ expression e1,e2; statement S; position p != bad.p; position p1; position p2 : script:ocaml(p1) { infunction p1 && combined p1 p2 }; @@
- e1@p1,@S@p e2@p2; + e1; e2;
@@ expression e1,e2; statement S; position p != bad.p; position p1; position p2 : script:ocaml(p1) { infunction p1 && combined p1 p2 }; @@
- e1@p1,@S@p e2@p2; + e1; e2;
@@ expression e1,e2; statement S; position p != bad.p; position p1; position p2 : script:ocaml(p1) { infunction p1 && combined p1 p2 }; @@
- e1@p1,@S@p e2@p2; + e1; e2;
@@ expression e1,e2; statement S; position p != bad.p; position p1; position p2 : script:ocaml(p1) { infunction p1 && combined p1 p2 }; @@
- e1@p1,@S@p e2@p2; + e1; e2;
@r@ expression e1,e2; statement S; position p != bad.p; @@
e1 ,@S@p e2;
@@ expression e1,e2; position p1; position p2 : script:ocaml(p1) { infunction p1 && not(combined p1 p2) }; statement S; position r.p; @@
e1@p1 -,@S@p +; e2@p2 ... when any // </smpl>
---
sound/firewire/fireworks/fireworks_pcm.c | 2 +- sound/pci/hda/patch_ca0132.c | 2 +- sound/pci/hda/patch_hdmi.c | 2 +- sound/soc/codecs/madera.c | 4 ++-- sound/soc/codecs/wm8350.c | 3 ++- sound/soc/intel/boards/bytcr_rt5651.c | 2 +- sound/soc/samsung/snow.c | 2 +- sound/soc/soc-dapm.c | 2 +- sound/soc/sof/intel/hda-dsp.c | 2 +- 9 files changed, 11 insertions(+), 10 deletions(-)
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/codecs/wm8350.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index a6aa212fa0c8..15d42ce3b21d 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -218,7 +218,8 @@ static void wm8350_pga_work(struct work_struct *work)
/* PGA volumes have 6 bits of resolution to ramp */ for (i = 0; i <= 63; i++) { - out1_complete = 1, out2_complete = 1; + out1_complete = 1; + out2_complete = 1; if (out1->ramp != WM8350_RAMP_NONE) out1_complete = wm8350_out1_ramp_step(wm8350_data); if (out2->ramp != WM8350_RAMP_NONE)
On Sun, Oct 11, 2020 at 11:19:32AM +0200, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Acked-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/pci/hda/patch_ca0132.c | 2 +- sound/pci/hda/patch_hdmi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 9779978e4bc7..2b38b2a716a1 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -3114,7 +3114,7 @@ static int dspxfr_one_seg(struct hda_codec *codec, }
data = fls->data; - chip_addx = fls->chip_addr, + chip_addx = fls->chip_addr; words_to_write = fls->count;
if (!words_to_write) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 055440740184..0ffbfcb91256 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2451,7 +2451,7 @@ static int alloc_generic_hdmi(struct hda_codec *codec) spec->chmap.ops.get_chmap = hdmi_get_chmap; spec->chmap.ops.set_chmap = hdmi_set_chmap; spec->chmap.ops.is_pcm_attached = is_hdmi_pcm_attached; - spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc, + spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc;
codec->spec = spec; hdmi_array_init(spec, 4);
On Sun, 11 Oct 2020 11:19:33 +0200, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Applied now. Thanks.
Takashi
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/intel/boards/bytcr_rt5651.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c index 688b5e0a49e3..64d3fc4a3225 100644 --- a/sound/soc/intel/boards/bytcr_rt5651.c +++ b/sound/soc/intel/boards/bytcr_rt5651.c @@ -143,7 +143,7 @@ static int byt_rt5651_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
/* Configure the PLL before selecting it */ if (!(byt_rt5651_quirk & BYT_RT5651_MCLK_EN)) { - clk_id = RT5651_PLL1_S_BCLK1, + clk_id = RT5651_PLL1_S_BCLK1; clk_freq = rate * bclk_ratio; } else { clk_id = RT5651_PLL1_S_MCLK;
On 2020-10-11 11:19 AM, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Acked-by: Cezary Rojewski cezary.rojewski@intel.com
Thanks, Czarek
sound/soc/intel/boards/bytcr_rt5651.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c index 688b5e0a49e3..64d3fc4a3225 100644 --- a/sound/soc/intel/boards/bytcr_rt5651.c +++ b/sound/soc/intel/boards/bytcr_rt5651.c @@ -143,7 +143,7 @@ static int byt_rt5651_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
/* Configure the PLL before selecting it */ if (!(byt_rt5651_quirk & BYT_RT5651_MCLK_EN)) {
clk_id = RT5651_PLL1_S_BCLK1,
clk_freq = rate * bclk_ratio; } else { clk_id = RT5651_PLL1_S_MCLK;clk_id = RT5651_PLL1_S_BCLK1;
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/firewire/fireworks/fireworks_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/fireworks/fireworks_pcm.c b/sound/firewire/fireworks/fireworks_pcm.c index 980580dfbb39..a0d5db1d8eb2 100644 --- a/sound/firewire/fireworks/fireworks_pcm.c +++ b/sound/firewire/fireworks/fireworks_pcm.c @@ -148,7 +148,7 @@ pcm_init_hw_params(struct snd_efw *efw, }
/* limit rates */ - runtime->hw.rates = efw->supported_sampling_rate, + runtime->hw.rates = efw->supported_sampling_rate; snd_pcm_limit_hw_rates(runtime);
limit_channels(&runtime->hw, pcm_channels);
Hi,
On Sun, Oct 11, 2020 at 11:19:35AM +0200, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
sound/firewire/fireworks/fireworks_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/fireworks/fireworks_pcm.c b/sound/firewire/fireworks/fireworks_pcm.c index 980580dfbb39..a0d5db1d8eb2 100644 --- a/sound/firewire/fireworks/fireworks_pcm.c +++ b/sound/firewire/fireworks/fireworks_pcm.c @@ -148,7 +148,7 @@ pcm_init_hw_params(struct snd_efw *efw, }
/* limit rates */
- runtime->hw.rates = efw->supported_sampling_rate,
runtime->hw.rates = efw->supported_sampling_rate; snd_pcm_limit_hw_rates(runtime);
limit_channels(&runtime->hw, pcm_channels);
Oops. It seems to be my typo added at the commit aa02bb6e6078 ("ALSA: fireworks: Add PCM interface")...
Acked-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Thanks
Takashi Sakamoto
On Sun, 11 Oct 2020 11:19:35 +0200, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Applied now. Thanks.
Takashi
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/sof/intel/hda-dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 18ff1c2f5376..2b001151fe37 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -44,7 +44,7 @@ int hda_dsp_core_reset_enter(struct snd_sof_dev *sdev, unsigned int core_mask) reset = HDA_DSP_ADSPCS_CRST_MASK(core_mask); snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS, - reset, reset), + reset, reset);
/* poll with timeout to check if operation successful */ ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/samsung/snow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c index 07163f07c6d5..989af624dd11 100644 --- a/sound/soc/samsung/snow.c +++ b/sound/soc/samsung/snow.c @@ -189,7 +189,7 @@ static int snow_probe(struct platform_device *pdev) return PTR_ERR(priv->clk_i2s_bus); } } else { - link->codecs->dai_name = "HiFi", + link->codecs->dai_name = "HiFi";
link->cpus->of_node = of_parse_phandle(dev->of_node, "samsung,i2s-controller", 0);
On Sun, Oct 11, 2020 at 11:19:37AM +0200, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
sound/soc/samsung/snow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Krzysztof Kozlowski krzk@kernel.org
Best regards, Krzysztof
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/codecs/madera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index 680f31a6493a..f4ed7e04673f 100644 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -3019,11 +3019,11 @@ static int madera_hw_params_rate(struct snd_pcm_substream *substream, tar = 2 << MADERA_AIF1_RATE_SHIFT; break; case MADERA_CLK_ASYNCCLK_1: - reg = MADERA_ASYNC_SAMPLE_RATE_1, + reg = MADERA_ASYNC_SAMPLE_RATE_1; tar = 8 << MADERA_AIF1_RATE_SHIFT; break; case MADERA_CLK_ASYNCCLK_2: - reg = MADERA_ASYNC_SAMPLE_RATE_2, + reg = MADERA_ASYNC_SAMPLE_RATE_2; tar = 9 << MADERA_AIF1_RATE_SHIFT; break; default:
On Sun, Oct 11, 2020 at 11:19:38AM +0200, Julia Lawall wrote:
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Acked-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles
Replace commas with semicolons. What is done is essentially described by the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl> @@ expression e1,e2; @@ e1 -, +; e2 ... when any // </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 3273161e2787..72c84ee2847f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -4764,7 +4764,7 @@ void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm,
if (component) { dapm->dev = component->dev; - dapm->idle_bias_off = !component->driver->idle_bias_on, + dapm->idle_bias_off = !component->driver->idle_bias_on; dapm->suspend_bias_off = component->driver->suspend_bias_off; } else { dapm->dev = card->dev;
On Sun, 11 Oct 2020 11:19:31 +0200, Julia Lawall wrote:
These patches replace commas by semicolons. This was done using the Coccinelle semantic patch (http://coccinelle.lip6.fr/) shown below.
This semantic patch ensures that commas inside for loop headers will not be transformed. It also doesn't touch macro definitions.
Coccinelle ensures that braces are added as needed when a single-statement branch turns into a multi-statement one.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: wm8350: use semicolons rather than commas to separate statements commit: 2db5fa77cd7ea4bd18c7e1afb49417debc9f498a [2/6] ASoC: Intel: bytcr_rt5651: use semicolons rather than commas to separate statements commit: edc3f5b43a4446c84069e59df7e48663ec28579d [3/6] ASoC: SOF: Intel: hda: use semicolons rather than commas to separate statements commit: bed5ed644c741fd69a19a3cb811b5c1da1d50755 [4/6] ASoC: samsung: snow: use semicolons rather than commas to separate statements commit: 40faaca03bf7d7ca1480677f0c8c543016cf426d [5/6] ASoC: madera: use semicolons rather than commas to separate statements commit: 94fa760d01c21350261388f404e167d5cb752573 [6/6] ASoC: dapm: use semicolons rather than commas to separate statements commit: a1344daeab95b93dd1d19fcfbc7dbaf2a4735129
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (7)
-
Charles Keepax
-
Julia Lawall
-
Krzysztof Kozlowski
-
Mark Brown
-
Rojewski, Cezary
-
Takashi Iwai
-
Takashi Sakamoto