Commit cfb7b8bf authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: tidyup rsnd_ssiu_busif_err_status_clear()

rsnd_ssiu_busif_err_status_clear() has very similar duplicated code.
This patch merge and tidyup the code.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Message-Id: <87tumolwy3.wl-kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 83b220cf
...@@ -88,11 +88,9 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable) ...@@ -88,11 +88,9 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable)
bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod) bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod)
{ {
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
u32 status;
bool error = false; bool error = false;
int id = rsnd_mod_id(mod); int id = rsnd_mod_id(mod);
int shift, offset;
int i; int i;
switch (id) { switch (id) {
...@@ -101,31 +99,30 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod) ...@@ -101,31 +99,30 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod)
case 2: case 2:
case 3: case 3:
case 4: case 4:
for (i = 0; i < 4; i++) { shift = id;
status = rsnd_mod_read(mod, SSI_SYS_STATUS(i * 2)); offset = 0;
status &= 0xf << (id * 4);
if (status) {
rsnd_print_irq_status(dev, "%s err status : 0x%08x\n",
rsnd_mod_name(mod), status);
error = true;
}
rsnd_mod_write(mod, SSI_SYS_STATUS(i * 2), 0xf << (id * 4));
}
break; break;
case 9: case 9:
shift = 1;
offset = 1;
break;
}
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod, SSI_SYS_STATUS((i * 2) + 1)); u32 reg = SSI_SYS_STATUS(i * 2) + offset;
status &= 0xf << 4; u32 status = rsnd_mod_read(mod, reg);
u32 val = 0xf << (shift * 4);
status &= val;
if (status) { if (status) {
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
rsnd_print_irq_status(dev, "%s err status : 0x%08x\n", rsnd_print_irq_status(dev, "%s err status : 0x%08x\n",
rsnd_mod_name(mod), status); rsnd_mod_name(mod), status);
error = true; error = true;
} }
rsnd_mod_write(mod, SSI_SYS_STATUS((i * 2) + 1), 0xf << 4); rsnd_mod_write(mod, reg, val);
}
break;
} }
return error; return error;
......
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