Skip to contentSkip to conversation

Fix multiple checkpatch issues in bcm2835-ctl.c

PATCH Superseded Aishwarya Pant 2 participants 8 messages Mar 2, 2017

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Fix multiple checkpatch issues in bcm2835-ctl.c

Fix multiple code styling warnings issued by checkpatch on file bcm2835-ctl.c in bcm2835-audio driver

Aishwarya Pant (5):
staging: bcm2835-camera: fix no space is necessary after a cast
warning
staging: bcm2835-camera: Logical continuations should be on the
previous line
staging: bcm2835-camera: fix block comment formatting
staging: bcm2835-camera: remove extra blank line
staging: bcm2835-camera: replace printk(KERN_ERR) with pr_err

 .../staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 staging: bcm2835-camera: fix no space is necessary after a cast warning

Remove instances of unnecessary blank space after cast in bcm2835-ctl.c

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +3 -3
index a4ffa1b..99e9ca3 100644
@@ -116,7 +116,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
 		return -EINTR;
 
 	if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) {
-		audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int) ucontrol->value.integer.value[0]);
+		audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]);
 		if (chip->mute == CTRL_VOL_MUTE) {
 			/* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */
 			changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */
@@ -226,7 +226,7 @@ static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol,
 		return -EINTR;
 
 	for (i = 0; i < 4; i++)
-		val |= (unsigned int) ucontrol->value.iec958.status[i] << (i * 8);
+		val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8);
 
 	change = val != chip->spdif_status;
 	chip->spdif_status = val;
@@ -289,7 +289,7 @@ static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol,
 		return -EINTR;
 
 	for (i = 0; i < 4; i++)
-		val |= (unsigned int) ucontrol->value.iec958.status[i] << (i * 8);
+		val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8);
 	change = val != chip->spdif_status;
 	chip->spdif_status = val;
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 staging: bcm2835-camera: Logical continuations should be on the previous line

In reply to Aishwarya Pant

Keep logical continuations on the same line to improve code readability

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +1 -2
index 99e9ca3..17d34c0 100644
@@ -122,8 +122,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
 			changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */
 			goto unlock;
 		}
-		if (changed
-			|| (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
+		if (changed || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
 
 			chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
 			changed = 1;
Signature · 1 line
2.7.4
#3 lore raw

Re: [Outreachy kernel] [PATCH 2/5] staging: bcm2835-camera: Logical continuations should be on the previous line

Quoted 12 lines · Aishwarya Pant

Keep logical continuations on the same line to improve code readability

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +0 -0
index 99e9ca3..17d34c0 100644

drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, · line 125

Quoted 6 lines
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +1 -2
@@ -122,8 +122,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
 			changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */
 			goto unlock;
 		}
-		if (changed
-			|| (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
+		if (changed || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {

A better solution would be to put the || on the same line as changed, line ucontrol up with the right side of the ( on the if, and drop the unneeded ()s around the != test. Then the code would come closer to fitting withn 80 chars.

julia

Quoted 13 lines
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +0 -1
 			chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
 			changed = 1;
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/3ef2134adc43bc842339c2e81db48c97a31e43fd.1488453518.git.aishpant%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

PATCH 3/5 staging: bcm2835-camera: fix block comment formatting

In reply to Aishwarya Pant

Fix block comment formatting to suppress the following warning thrown by
checkpatch: Block comments use a trailing */ on a separate line

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +4 -3
index 17d34c0..80b2062 100644
@@ -245,9 +245,10 @@ static int snd_bcm2835_spdif_mask_info(struct snd_kcontrol *kcontrol,
 static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol,
 	struct snd_ctl_elem_value *ucontrol)
 {
-	/* bcm2835 supports only consumer mode and sets all other format flags
-	 * automatically. So the only thing left is signalling non-audio
-	 * content */
+	/*
+	 * bcm2835 supports only consumer mode and sets all other format flags
+	 * automatically. So the only thing left is signalling non-audio content
+	 */
 	ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO;
 	return 0;
 }
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/5 staging: bcm2835-camera: remove extra blank line

In reply to Aishwarya Pant

Fix the warning: Blank lines aren't necessary after an open brace '{' issued by checkpatch on bcm2835-ctl.c

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +0 -1
index 80b2062..46814fd 100644
@@ -123,7 +123,6 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
 			goto unlock;
 		}
 		if (changed || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
-
 			chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
 			changed = 1;
 		}
Signature · 1 line
2.7.4
#6 lore raw

PATCH 5/5 staging: bcm2835-camera: replace printk(KERN_ERR) with pr_err

In reply to Aishwarya Pant

Fix checkpatch warning: pr_err(... to printk(KERN_ERR ... For newer drivers, the convention for printing kernel messages is to use pr_* family of macros

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +1 -1
index 46814fd..21eaba9 100644
@@ -141,7 +141,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
 
 	if (changed) {
 		if (bcm2835_audio_set_ctls(chip))
-			printk(KERN_ERR "Failed to set ALSA controls..\n");
+			pr_err("Failed to set ALSA controls..\n");
 	}
 
 unlock:
Signature · 1 line
2.7.4
#7 lore raw

Re: [Outreachy kernel] [PATCH 5/5] staging: bcm2835-camera: replace printk(KERN_ERR) with pr_err

Quoted 14 lines · Aishwarya Pant

Fix checkpatch warning: pr_err(... to printk(KERN_ERR ... For newer drivers, the convention for printing kernel messages is to use pr_* family of macros

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +0 -0
index 46814fd..21eaba9 100644

drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, · line 144

Quoted 5 lines
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +1 -1
@@ -141,7 +141,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
 
 	if (changed) {
 		if (bcm2835_audio_set_ctls(chip))
-			printk(KERN_ERR "Failed to set ALSA controls..\n");
+			pr_err("Failed to set ALSA controls..\n");

Is it possible to use dev_err?

julia

Quoted 13 lines
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +0 -1
 	}
 
 unlock:
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/873ea58099cfe40f563436342aba1ea5e0f12507.1488453518.git.aishpant%40gmail.com.
For more options, visit https://groups.google.com/d/optout.