]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: mipi-i3c-hci: Switch DAT bitmap allocation to devm_bitmap_zalloc()
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 13 Jan 2026 07:26:46 +0000 (09:26 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 14 Jan 2026 16:21:09 +0000 (17:21 +0100)
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 <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260113072702.16268-6-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/core.c
drivers/i3c/master/mipi-i3c-hci/dat.h
drivers/i3c/master/mipi-i3c-hci/dat_v1.c

index 0d3ec674878d7037e65a10f5c46081a6bdda4231..c4b249fde76479ab05cabe8b202087c1e7447b39 100644 (file)
@@ -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)
index 1f0f345c3daf210adee45f4f736b1547d447bafe..5277c65fc601f8a71dfecb024c15f000382cc414 100644 (file)
@@ -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);
index cc5d2deb23ab48c9da1057b37f8db3e35817406e..c60ef5d77ca37a233488efca7aa0bcd9a97d4d92 100644 (file)
@@ -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,