From: Adrian Hunter Date: Tue, 13 Jan 2026 07:26:46 +0000 (+0200) Subject: i3c: mipi-i3c-hci: Switch DAT bitmap allocation to devm_bitmap_zalloc() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f64c1a46ea7c40bbab57a0cb1665a1c1e11da6af;p=thirdparty%2Fkernel%2Flinux.git i3c: mipi-i3c-hci: Switch DAT bitmap allocation to devm_bitmap_zalloc() The driver already uses managed resources, so convert the Device Address Table (DAT) bitmap allocation to use devm_bitmap_zalloc(). Remove the manual cleanup routine. Signed-off-by: Adrian Hunter Reviewed-by: Frank Li Link: https://patch.msgid.link/20260113072702.16268-6-adrian.hunter@intel.com Signed-off-by: Alexandre Belloni --- diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 0d3ec674878d7..c4b249fde7647 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -185,8 +185,6 @@ static void i3c_hci_bus_cleanup(struct i3c_master_controller *m) i3c_hci_bus_disable(hci); hci->io->cleanup(hci); - if (hci->cmd == &mipi_i3c_hci_cmd_v1) - mipi_i3c_hci_dat_v1.cleanup(hci); } void mipi_i3c_hci_resume(struct i3c_hci *hci) diff --git a/drivers/i3c/master/mipi-i3c-hci/dat.h b/drivers/i3c/master/mipi-i3c-hci/dat.h index 1f0f345c3daf2..5277c65fc601f 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dat.h +++ b/drivers/i3c/master/mipi-i3c-hci/dat.h @@ -17,7 +17,6 @@ struct hci_dat_ops { int (*init)(struct i3c_hci *hci); - void (*cleanup)(struct i3c_hci *hci); int (*alloc_entry)(struct i3c_hci *hci); void (*free_entry)(struct i3c_hci *hci, unsigned int dat_idx); void (*set_dynamic_addr)(struct i3c_hci *hci, unsigned int dat_idx, u8 addr); diff --git a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c index cc5d2deb23ab4..c60ef5d77ca37 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c +++ b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c @@ -55,8 +55,10 @@ static int hci_dat_v1_init(struct i3c_hci *hci) } if (!hci->DAT_data) { + struct device *dev = hci->master.dev.parent; + /* use a bitmap for faster free slot search */ - hci->DAT_data = bitmap_zalloc(hci->DAT_entries, GFP_KERNEL); + hci->DAT_data = devm_bitmap_zalloc(dev, hci->DAT_entries, GFP_KERNEL); if (!hci->DAT_data) return -ENOMEM; @@ -70,12 +72,6 @@ static int hci_dat_v1_init(struct i3c_hci *hci) return 0; } -static void hci_dat_v1_cleanup(struct i3c_hci *hci) -{ - bitmap_free(hci->DAT_data); - hci->DAT_data = NULL; -} - static int hci_dat_v1_alloc_entry(struct i3c_hci *hci) { unsigned int dat_idx; @@ -170,7 +166,6 @@ static int hci_dat_v1_get_index(struct i3c_hci *hci, u8 dev_addr) const struct hci_dat_ops mipi_i3c_hci_dat_v1 = { .init = hci_dat_v1_init, - .cleanup = hci_dat_v1_cleanup, .alloc_entry = hci_dat_v1_alloc_entry, .free_entry = hci_dat_v1_free_entry, .set_dynamic_addr = hci_dat_v1_set_dynamic_addr,