Here's a possible rewrite of the given code:
int itcs_timer_irq(int idx, void *arg) {
timer_priv_t *timer_priv = (timer_priv_t *)arg;
uint32_t tempregisr = 0;
switch (timer_priv->timeridx) {
case 1:
tempregisr = readl(timer_priv->base + TIMER_ISR_C1);