Commit e0f17c75 authored by Peter Senna Tschudin's avatar Peter Senna Tschudin Committed by Takashi Iwai

ALSA: Fix assignment of 0/1 to bool variables

Convert 0 to false and 1 to true when assigning values to bool
variables. Inspired by commit 3db1cd5c.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@@
bool b;
@@
(
-b = 0
+b = false
|
-b = 1
+b = true
)
Signed-off-by: default avatarPeter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 43cdd088
...@@ -715,14 +715,14 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97) ...@@ -715,14 +715,14 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97)
const struct snd_azf3328 *chip = ac97->private_data; const struct snd_azf3328 *chip = ac97->private_data;
unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97); unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97);
unsigned short reg_val = 0; unsigned short reg_val = 0;
bool unsupported = 0; bool unsupported = false;
snd_azf3328_dbgmixer( snd_azf3328_dbgmixer(
"snd_azf3328_mixer_ac97_read reg_ac97 %u\n", "snd_azf3328_mixer_ac97_read reg_ac97 %u\n",
reg_ac97 reg_ac97
); );
if (reg_azf & AZF_AC97_REG_UNSUPPORTED) if (reg_azf & AZF_AC97_REG_UNSUPPORTED)
unsupported = 1; unsupported = true;
else { else {
if (reg_azf & AZF_AC97_REG_REAL_IO_READ) if (reg_azf & AZF_AC97_REG_REAL_IO_READ)
reg_val = snd_azf3328_mixer_inw(chip, reg_val = snd_azf3328_mixer_inw(chip,
...@@ -759,7 +759,7 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97) ...@@ -759,7 +759,7 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97)
reg_val = azf_emulated_ac97_vendor_id & 0xffff; reg_val = azf_emulated_ac97_vendor_id & 0xffff;
break; break;
default: default:
unsupported = 1; unsupported = true;
break; break;
} }
} }
...@@ -776,14 +776,14 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97, ...@@ -776,14 +776,14 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97,
{ {
const struct snd_azf3328 *chip = ac97->private_data; const struct snd_azf3328 *chip = ac97->private_data;
unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97); unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97);
bool unsupported = 0; bool unsupported = false;
snd_azf3328_dbgmixer( snd_azf3328_dbgmixer(
"snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n", "snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n",
reg_ac97, val reg_ac97, val
); );
if (reg_azf & AZF_AC97_REG_UNSUPPORTED) if (reg_azf & AZF_AC97_REG_UNSUPPORTED)
unsupported = 1; unsupported = true;
else { else {
if (reg_azf & AZF_AC97_REG_REAL_IO_WRITE) if (reg_azf & AZF_AC97_REG_REAL_IO_WRITE)
snd_azf3328_mixer_outw( snd_azf3328_mixer_outw(
...@@ -808,7 +808,7 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97, ...@@ -808,7 +808,7 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97,
*/ */
break; break;
default: default:
unsupported = 1; unsupported = true;
break; break;
} }
} }
...@@ -1559,7 +1559,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1559,7 +1559,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
struct snd_azf3328_codec_data *codec = runtime->private_data; struct snd_azf3328_codec_data *codec = runtime->private_data;
int result = 0; int result = 0;
u16 flags1; u16 flags1;
bool previously_muted = 0; bool previously_muted = false;
bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type); bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type);
snd_azf3328_dbgcalls("snd_azf3328_pcm_trigger cmd %d\n", cmd); snd_azf3328_dbgcalls("snd_azf3328_pcm_trigger cmd %d\n", cmd);
......
...@@ -1151,14 +1151,14 @@ static void check_no_speaker_on_headset(struct snd_kcontrol *kctl, ...@@ -1151,14 +1151,14 @@ static void check_no_speaker_on_headset(struct snd_kcontrol *kctl,
const char *names_to_check[] = { const char *names_to_check[] = {
"Headset", "headset", "Headphone", "headphone", NULL}; "Headset", "headset", "Headphone", "headphone", NULL};
const char **s; const char **s;
bool found = 0; bool found = false;
if (strcmp("Speaker", kctl->id.name)) if (strcmp("Speaker", kctl->id.name))
return; return;
for (s = names_to_check; *s; s++) for (s = names_to_check; *s; s++)
if (strstr(card->shortname, *s)) { if (strstr(card->shortname, *s)) {
found = 1; found = true;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment