Commit 3635f862 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ice1712: Fix assignment in if condition

PCI ICE1712 driver code contains a few assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.

This patch is merely for coding-style fixes, no functional changes.

Link: https://lore.kernel.org/r/20210608140540.17885-43-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9031f938
...@@ -676,13 +676,15 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice) ...@@ -676,13 +676,15 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
case ICE1712_SUBDEVICE_DELTA1010LT: case ICE1712_SUBDEVICE_DELTA1010LT:
case ICE1712_SUBDEVICE_VX442: case ICE1712_SUBDEVICE_VX442:
case ICE1712_SUBDEVICE_DELTA66E: case ICE1712_SUBDEVICE_DELTA66E:
if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c);
if (err < 0) {
dev_err(ice->card->dev, "unable to create I2C bus\n"); dev_err(ice->card->dev, "unable to create I2C bus\n");
return err; return err;
} }
ice->i2c->private_data = ice; ice->i2c->private_data = ice;
ice->i2c->ops = &ap_cs8427_i2c_ops; ice->i2c->ops = &ap_cs8427_i2c_ops;
if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0) err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR);
if (err < 0)
return err; return err;
break; break;
case ICE1712_SUBDEVICE_DELTA1010: case ICE1712_SUBDEVICE_DELTA1010:
......
...@@ -442,7 +442,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice) ...@@ -442,7 +442,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
ice->spec = spec; ice->spec = spec;
/* create i2c */ /* create i2c */
if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c);
if (err < 0) {
dev_err(ice->card->dev, "unable to create I2C bus\n"); dev_err(ice->card->dev, "unable to create I2C bus\n");
return err; return err;
} }
...@@ -483,7 +484,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice) ...@@ -483,7 +484,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
if (err < 0) if (err < 0)
return err; return err;
/* Check if the front module is connected */ /* Check if the front module is connected */
if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0) err = snd_ice1712_ews88mt_chip_select(ice, 0x0f);
if (err < 0)
return err; return err;
break; break;
case ICE1712_SUBDEVICE_EWS88D: case ICE1712_SUBDEVICE_EWS88D:
...@@ -498,12 +500,14 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice) ...@@ -498,12 +500,14 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
/* set up SPDIF interface */ /* set up SPDIF interface */
switch (ice->eeprom.subvendor) { switch (ice->eeprom.subvendor) {
case ICE1712_SUBDEVICE_EWX2496: case ICE1712_SUBDEVICE_EWX2496:
if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0) err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR);
if (err < 0)
return err; return err;
snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR); snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
break; break;
case ICE1712_SUBDEVICE_DMX6FIRE: case ICE1712_SUBDEVICE_DMX6FIRE:
if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0) err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR);
if (err < 0)
return err; return err;
snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR); snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
break; break;
...@@ -853,7 +857,8 @@ static int snd_ice1712_6fire_control_get(struct snd_kcontrol *kcontrol, struct s ...@@ -853,7 +857,8 @@ static int snd_ice1712_6fire_control_get(struct snd_kcontrol *kcontrol, struct s
int invert = (kcontrol->private_value >> 8) & 1; int invert = (kcontrol->private_value >> 8) & 1;
int data; int data;
if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT);
if (data < 0)
return data; return data;
data = (data >> shift) & 1; data = (data >> shift) & 1;
if (invert) if (invert)
...@@ -869,7 +874,8 @@ static int snd_ice1712_6fire_control_put(struct snd_kcontrol *kcontrol, struct s ...@@ -869,7 +874,8 @@ static int snd_ice1712_6fire_control_put(struct snd_kcontrol *kcontrol, struct s
int invert = (kcontrol->private_value >> 8) & 1; int invert = (kcontrol->private_value >> 8) & 1;
int data, ndata; int data, ndata;
if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT);
if (data < 0)
return data; return data;
ndata = data & ~(1 << shift); ndata = data & ~(1 << shift);
if (ucontrol->value.integer.value[0]) if (ucontrol->value.integer.value[0])
...@@ -896,7 +902,8 @@ static int snd_ice1712_6fire_select_input_get(struct snd_kcontrol *kcontrol, str ...@@ -896,7 +902,8 @@ static int snd_ice1712_6fire_select_input_get(struct snd_kcontrol *kcontrol, str
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int data; int data;
if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT);
if (data < 0)
return data; return data;
ucontrol->value.integer.value[0] = data & 3; ucontrol->value.integer.value[0] = data & 3;
return 0; return 0;
...@@ -907,7 +914,8 @@ static int snd_ice1712_6fire_select_input_put(struct snd_kcontrol *kcontrol, str ...@@ -907,7 +914,8 @@ static int snd_ice1712_6fire_select_input_put(struct snd_kcontrol *kcontrol, str
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int data, ndata; int data, ndata;
if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT);
if (data < 0)
return data; return data;
ndata = data & ~3; ndata = data & ~3;
ndata |= (ucontrol->value.integer.value[0] & 3); ndata |= (ucontrol->value.integer.value[0] & 3);
......
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