rh_reg_write(CR_SETUP, 0);
rh_reg_write(IBI_SETUP, 0);
+ }
+
+ rhs_reg_write(CONTROL, 0);
+}
+
+static void hci_dma_free(void *data)
+{
+ struct i3c_hci *hci = data;
+ struct hci_rings_data *rings = hci->io_data;
+ struct hci_rh_data *rh;
+
+ if (!rings)
+ return;
+
+ for (int i = 0; i < rings->total; i++) {
+ rh = &rings->headers[i];
if (rh->xfer)
dma_free_coherent(rings->sysdev,
kfree(rh->ibi_data);
}
- rhs_reg_write(CONTROL, 0);
-
kfree(rings);
hci->io_data = NULL;
}
RING_CTRL_RUN_STOP);
}
+ ret = devm_add_action(hci->master.dev.parent, hci_dma_free, hci);
+ if (ret)
+ goto err_out;
+
return 0;
err_out:
hci_dma_cleanup(hci);
+ hci_dma_free(hci);
return ret;
}