]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: master: Move DAA API functions after i3c_master_add_i3c_dev_locked()
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 12 Jun 2026 08:01:06 +0000 (11:01 +0300)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 14 Jun 2026 19:49:11 +0000 (21:49 +0200)
Relocate i3c_master_do_daa_ext() and i3c_master_do_daa() so they appear
after i3c_master_add_i3c_dev_locked().

This ordering is required for upcoming changes where the DAA flow will
(indirectly) rely on i3c_master_add_i3c_dev_locked() functionality.
Reordering avoids forward dependency issues and keeps related code paths
logically arranged.

No functional change.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260612080107.11606-7-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master.c

index efd940a30732c2e300803db4cd630552102de4a8..043b69c10faab5d7aa9fb607c3b71254a0a67ddc 100644 (file)
@@ -1870,70 +1870,6 @@ static void i3c_master_reg_work_fn(struct work_struct *work)
        i3c_bus_normaluse_unlock(&master->bus);
 }
 
-/**
- * i3c_master_do_daa_ext() - Dynamic Address Assignment (extended version)
- * @master: controller
- * @rstdaa: whether to first perform Reset of Dynamic Addresses (RSTDAA)
- *
- * Perform Dynamic Address Assignment with optional support for System
- * Hibernation (@rstdaa is true).
- *
- * After System Hibernation, Dynamic Addresses can have been reassigned at boot
- * time to different values. A simple strategy is followed to handle that.
- * Perform a Reset of Dynamic Addresses (RSTDAA) followed by the normal DAA
- * procedure which has provision for reassigning addresses that differ from the
- * previously recorded addresses.
- *
- * Return: a 0 in case of success, an negative error code otherwise.
- */
-int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
-{
-       int rstret = 0;
-       int ret;
-
-       ret = i3c_master_rpm_get(master);
-       if (ret)
-               return ret;
-
-       i3c_bus_maintenance_lock(&master->bus);
-
-       if (master->shutting_down) {
-               ret = -ENODEV;
-       } else {
-               if (rstdaa)
-                       rstret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
-               ret = master->ops->do_daa(master);
-       }
-
-       i3c_bus_maintenance_unlock(&master->bus);
-
-       if (ret)
-               goto out;
-
-       queue_work(master->wq, &master->reg_work);
-out:
-       i3c_master_rpm_put(master);
-
-       return rstret ?: ret;
-}
-EXPORT_SYMBOL_GPL(i3c_master_do_daa_ext);
-
-/**
- * i3c_master_do_daa() - do a DAA (Dynamic Address Assignment)
- * @master: master doing the DAA
- *
- * This function instantiates I3C device objects and adds them to the
- * I3C device list. All device information is automatically retrieved using
- * standard CCC commands.
- *
- * Return: a 0 in case of success, an negative error code otherwise.
- */
-int i3c_master_do_daa(struct i3c_master_controller *master)
-{
-       return i3c_master_do_daa_ext(master, false);
-}
-EXPORT_SYMBOL_GPL(i3c_master_do_daa);
-
 /**
  * i3c_master_dma_map_single() - Map buffer for single DMA transfer
  * @dev: device object of a device doing DMA
@@ -2476,6 +2412,70 @@ err_prevent_addr_reuse:
 }
 EXPORT_SYMBOL_GPL(i3c_master_add_i3c_dev_locked);
 
+/**
+ * i3c_master_do_daa_ext() - Dynamic Address Assignment (extended version)
+ * @master: controller
+ * @rstdaa: whether to first perform Reset of Dynamic Addresses (RSTDAA)
+ *
+ * Perform Dynamic Address Assignment with optional support for System
+ * Hibernation (@rstdaa is true).
+ *
+ * After System Hibernation, Dynamic Addresses can have been reassigned at boot
+ * time to different values. A simple strategy is followed to handle that.
+ * Perform a Reset of Dynamic Addresses (RSTDAA) followed by the normal DAA
+ * procedure which has provision for reassigning addresses that differ from the
+ * previously recorded addresses.
+ *
+ * Return: a 0 in case of success, an negative error code otherwise.
+ */
+int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
+{
+       int rstret = 0;
+       int ret;
+
+       ret = i3c_master_rpm_get(master);
+       if (ret)
+               return ret;
+
+       i3c_bus_maintenance_lock(&master->bus);
+
+       if (master->shutting_down) {
+               ret = -ENODEV;
+       } else {
+               if (rstdaa)
+                       rstret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
+               ret = master->ops->do_daa(master);
+       }
+
+       i3c_bus_maintenance_unlock(&master->bus);
+
+       if (ret)
+               goto out;
+
+       queue_work(master->wq, &master->reg_work);
+out:
+       i3c_master_rpm_put(master);
+
+       return rstret ?: ret;
+}
+EXPORT_SYMBOL_GPL(i3c_master_do_daa_ext);
+
+/**
+ * i3c_master_do_daa() - do a DAA (Dynamic Address Assignment)
+ * @master: master doing the DAA
+ *
+ * This function instantiates I3C device objects and adds them to the
+ * I3C device list. All device information is automatically retrieved using
+ * standard CCC commands.
+ *
+ * Return: a 0 in case of success, an negative error code otherwise.
+ */
+int i3c_master_do_daa(struct i3c_master_controller *master)
+{
+       return i3c_master_do_daa_ext(master, false);
+}
+EXPORT_SYMBOL_GPL(i3c_master_do_daa);
+
 #define OF_I3C_REG1_IS_I2C_DEV                 BIT(31)
 
 static int