From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 393B135674D for ; Fri, 12 Jun 2026 08:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781251305; cv=none; b=M27Juv3UB599E0u1LjElzQW0jcfAGlqU1CFtKL6BjfvBXV7aa1O3J7YVv9tQ2B/LymyI1tHXPoJloSmJ2EuicqaI+8hVIYu5+T+vu298PENxdyBZqq3xm1XL2/oOJtXchoqS7jXWu+iJVykQ6TMdOYefk4FfIn79MFUUGUVzIkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781251305; c=relaxed/simple; bh=M6/UkvbYXdDeW349yvKXIELY/Wpavlkmy7Hb6vwNhmY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fV/pS5IhFfYW7Zy10ZBpDUvfAYgNfNAXlP8SpQONwyIOJpqfvTYziVd7wAVI5SSkD6HNU8O2GCCu6gtHahRZo8ZWCCpa5aDnP+SQBF13voF/z4Et0IudPO3kevbk/tm9L2Hkw33XsE/kT9UNVC2PggaOS9joEKPyiR4ylq7wzSo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=j7Q9qmEh; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="j7Q9qmEh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781251300; x=1812787300; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M6/UkvbYXdDeW349yvKXIELY/Wpavlkmy7Hb6vwNhmY=; b=j7Q9qmEhBAcZrsSs14mc1Nxg+YdAWakgSN2SQKGV6tIw6lhY1B5/vqwI ttpehQYajo0otWkQA4i4i9i2Y7KTBBBHph8tVf8WP83r3yboYTIu5Xa3p Ak4eHewPBISOCOlhWbbuD9845H/97EBYW+vqkP1MWTmIDiDpi/xQBgcNH d+G/5lHlImz9D8XeYBwB1Ckwnh7UPiYOuscE8bTWCJeMf3+qTUSFRWJiv KM794uRusapjiVT1TMxZc58Z0xXGwrL21CD/WR3e7sJmR9a2ulKwh6QEb FN8aTAOUi0mffjtjLcOp/ufmwv9iX6TiGt+H0aNGL+MRpxPszP1xVciH4 A==; X-CSE-ConnectionGUID: l6WZdC8mSZGc20tyZzN8VQ== X-CSE-MsgGUID: APVVfEf0QBuD3oYwirGJjA== X-IronPort-AV: E=McAfee;i="6800,10657,11813"; a="82186763" X-IronPort-AV: E=Sophos;i="6.24,200,1774335600"; d="scan'208";a="82186763" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2026 01:01:29 -0700 X-CSE-ConnectionGUID: qtdevnf4RWqXCbMu5RFWIA== X-CSE-MsgGUID: 6eIt50SrRCylrB1N46ftTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,200,1774335600"; d="scan'208";a="246630381" Received: from vpanait-mobl.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.245.41]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2026 01:01:28 -0700 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 6/7] i3c: master: Move DAA API functions after i3c_master_add_i3c_dev_locked() Date: Fri, 12 Jun 2026 11:01:06 +0300 Message-ID: <20260612080107.11606-7-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260612080107.11606-1-adrian.hunter@intel.com> References: <20260612080107.11606-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit 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 Reviewed-by: Frank Li --- Changes in V4: None Changes in V3: Add Frank's Rev'd-by Changes in V2: None drivers/i3c/master.c | 128 +++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 57857a3351c7..5021d25b718a 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -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 @@ void i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, u8 addr } 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 -- 2.51.0