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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Message-Id: <87tumolwy3.wl-kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2021-05-27 11:41:56 +09:00 коммит произвёл Mark Brown
Родитель 83b220cf8e
Коммит cfb7b8bf1e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 22 добавлений и 25 удалений

Просмотреть файл

@ -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)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
u32 status;
bool error = false;
int id = rsnd_mod_id(mod);
int shift, offset;
int i;
switch (id) {
@ -101,33 +99,32 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod)
case 2:
case 3:
case 4:
for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod, SSI_SYS_STATUS(i * 2));
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));
}
shift = id;
offset = 0;
break;
case 9:
for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod, SSI_SYS_STATUS((i * 2) + 1));
status &= 0xf << 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) + 1), 0xf << 4);
}
shift = 1;
offset = 1;
break;
}
for (i = 0; i < 4; i++) {
u32 reg = SSI_SYS_STATUS(i * 2) + offset;
u32 status = rsnd_mod_read(mod, reg);
u32 val = 0xf << (shift * 4);
status &= val;
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_mod_name(mod), status);
error = true;
}
rsnd_mod_write(mod, reg, val);
}
return error;
}