Re: [PATCH] staging: bcm2835-audio: remove more than 80 char error

2017-07-11 Thread Joe Perches
On Tue, 2017-07-11 at 16:59 +0530, Karuna Grewal wrote:
> remove the more than 80 character error as pointed out by checkpatch by
> spliting the statements at the separators in the statements .

Not every 80 column warning needs fixing.

Your selection of separators is poor.  For instance:

> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c 
> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
[]
> @@ -116,14 +116,19 @@ 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]);

Better:

audio_info("Volume change attempted.. volume = %d new_volume = 
%d\n",
   chip->volume, (int)ucontrol->value.integer.value[0]);

[]

> - if (changed || (ucontrol->value.integer.value[0] != 
> chip2alsa(chip->volume))) {
> - chip->volume = 
> alsa2chip(ucontrol->value.integer.value[0]);
> + if (changed || (ucontrol->value.integer.value[0] != chip2alsa(
> + chip->volume))) {
> + chip->volume =
> + alsa2chip(ucontrol->value.integer.value[0]);

Better:
if (changed ||
ucontrol->value.integer.value[0] != chip2alsa(chip->volume) 
{
chip->volume = 
alsa2chip(ucontrol->value.integer.value[0]);
changed = 1;
}

etc...
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: bcm2835-audio: remove more than 80 char error

2017-07-11 Thread Dan Carpenter
On Tue, Jul 11, 2017 at 04:59:14PM +0530, Karuna Grewal wrote:
> remove the more than 80 character error as pointed out by checkpatch by
> spliting the statements at the separators in the statements .
> 

Don't indent your commit log.

> - if (changed || (ucontrol->value.integer.value[0] != 
> chip2alsa(chip->volume))) {
> - chip->volume = 
> alsa2chip(ucontrol->value.integer.value[0]);
> + if (changed || (ucontrol->value.integer.value[0] != chip2alsa(
> + chip->volume))) {
> + chip->volume =
> + alsa2chip(ucontrol->value.integer.value[0]);

Don't indent like that.

> @@ -154,7 +159,9 @@ static struct snd_kcontrol_new snd_bcm2835_ctl[] = {
>   .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
>   .name = "PCM Playback Volume",
>   .index = 0,
> - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 
> SNDRV_CTL_ELEM_ACCESS_TLV_READ,
> + .access =
> +  SNDRV_CTL_ELEM_ACCESS_READWRITE |
> +   SNDRV_CTL_ELEM_ACCESS_TLV_READ,


Of this.  Just go over 80 characters if that's more readable than
breaking the line up.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: bcm2835-audio: remove more than 80 char error

2017-07-11 Thread Karuna Grewal
remove the more than 80 character error as pointed out by checkpatch by
spliting the statements at the separators in the statements .

Signed-off-by: Karuna Grewal 
---
 .../vc04_services/bcm2835-audio/bcm2835-ctl.c  | 53 ++
 1 file changed, 35 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
index 30d310b..8277c6f 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
@@ -107,7 +107,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol 
*kcontrol,
 }
 
 static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
-   struct snd_ctl_elem_value *ucontrol)
+  struct snd_ctl_elem_value *ucontrol)
 {
struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol);
int changed = 0;
@@ -116,14 +116,19 @@ 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) */
+   /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE);*/
+   /* should return 0*/
+   changed = 1; //mixers takes opposite sign that's why 1
goto unlock;
}
-   if (changed || (ucontrol->value.integer.value[0] != 
chip2alsa(chip->volume))) {
-   chip->volume = 
alsa2chip(ucontrol->value.integer.value[0]);
+   if (changed || (ucontrol->value.integer.value[0] != chip2alsa(
+   chip->volume))) {
+   chip->volume =
+   alsa2chip(ucontrol->value.integer.value[0]);
changed = 1;
}
 
@@ -154,7 +159,9 @@ static struct snd_kcontrol_new snd_bcm2835_ctl[] = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PCM Playback Volume",
.index = 0,
-   .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 
SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+   .access =
+SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
.private_value = PCM_PLAYBACK_VOLUME,
.info = snd_bcm2835_ctl_info,
.get = snd_bcm2835_ctl_get,
@@ -186,15 +193,17 @@ static struct snd_kcontrol_new snd_bcm2835_ctl[] = {
},
 };
 
-static int snd_bcm2835_spdif_default_info(struct snd_kcontrol *kcontrol,
-   struct snd_ctl_elem_info *uinfo)
+static int snd_bcm2835_spdif_default_info(
+   struct snd_kcontrol *kcontrol,
+   struct snd_ctl_elem_info *uinfo)
 {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1;
return 0;
 }
 
-static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol,
+static int snd_bcm2835_spdif_default_get(
+   struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
 {
struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol);
@@ -211,7 +220,8 @@ static int snd_bcm2835_spdif_default_get(struct 
snd_kcontrol *kcontrol,
return 0;
 }
 
-static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol,
+static int snd_bcm2835_spdif_default_put(
+   struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
 {
struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol);
@@ -222,7 +232,8 @@ 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;
@@ -231,7 +242,8 @@ static int snd_bcm2835_spdif_default_put(struct 
snd_kcontrol *kcontrol,
return change;
 }
 
-static int snd_bcm2835_spdif_mask_info(struct snd_kcontrol *kcontrol,
+static int snd_bcm2835_spdif_mask_info(
+   struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
 {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
@@ -239,7 +251,8 @@ static int snd_bcm2835_spdif_mask_info(struct