From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 0429F43CED5 for ; Wed, 3 Jun 2026 09:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780477714; cv=none; b=YUMt6KgbQYK/qVdw7m4y1BiSnBqgKBlPNw3oAMSGHfpK0CrmQMAdpQPA4ndOzXVPD/+oBguFcEH59Eu+QROT82kgSElbGOMi8rAVerF9fNwVWAe/44bJ8aH3QlDBi5h530YiGQ2/hF7s3Kntwf7Tp0eIqnKu1MNmG+vPULa1Y30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780477714; c=relaxed/simple; bh=O0xK5K3/G53nKbyeNuBRq5NzzvrVjzhiTGzNgav0Z8A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DtBBEER2hWpXHj/ONmzU0JaKU+uYVDK9unKJ754t5vTZTTE2q4oJpLJliXyrZX6Wtjxb7rLoxUBD34DY5pg9d8vkb2nGYUTn46CBN3R5mEdzV1/erd3MPVDpK9ThksXE7ETJaySVE0cVVmIEsnchOLkDzRwOXIEEju3JyXxLu7g= 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=ZPxOuHm7; arc=none smtp.client-ip=192.198.163.11 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="ZPxOuHm7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780477713; x=1812013713; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O0xK5K3/G53nKbyeNuBRq5NzzvrVjzhiTGzNgav0Z8A=; b=ZPxOuHm719NLgxtUoqsxtpqZU+bRweNl3tOuGD9q1I2nZhtSnZR0MR06 8ii+BXSv186IQklujLYF3SCfeBjjIsEFfPXDI7k2WMFOddfLy5xkmsJny 8C2qlYj866AvddfdjHpOcUXfhkZQ3RS8QypJa9kX7RvTUbM60uC11w62+ HRTF1C551XnOKjCwdp3YCJglt0nqfGgh+iHvcU/jSlk1FzsTH+GJ8sT0G EwZ5jpbHE6AiRUWTXuiGiIgkG3ZCWKj5v+Cqn4daCAWaxptWBs+PbwBdG 4PslptBfJcyquJyAatXx5XjqXs7NWg+zNdvvIjHG/GI6GZD/acPZNjIct A==; X-CSE-ConnectionGUID: qVM9XzFsS5SGYAfexe8tVg== X-CSE-MsgGUID: SAkDSLNbT/mDy0JwfS6QaQ== X-IronPort-AV: E=McAfee;i="6800,10657,11805"; a="91852652" X-IronPort-AV: E=Sophos;i="6.24,184,1774335600"; d="scan'208";a="91852652" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2026 02:08:32 -0700 X-CSE-ConnectionGUID: cRAVE+GJSP269cCypU6rxA== X-CSE-MsgGUID: 3Xa6AlspSwadXpprSPRzzQ== X-ExtLoop1: 1 Received: from ijarvine-mobl1.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.244.137]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2026 02:08:31 -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 V5 12/17] i3c: mipi-i3c-hci: Factor out reset-and-restore helper Date: Wed, 3 Jun 2026 12:07:49 +0300 Message-ID: <20260603090754.16252-13-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260603090754.16252-1-adrian.hunter@intel.com> References: <20260603090754.16252-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 Factor the reset-and-restore sequence out of i3c_hci_rpm_resume() into a separate helper. This allows the same logic to be reused for recovery paths in subsequent changes without duplicating suspend/resume handling. No functional change. Signed-off-by: Adrian Hunter Reviewed-by: Frank Li --- Changes in V5: None Changes in V4: Add Frank's Rev'd by Changes in V3: None Changes in V2: Drop redundant i3c_hci_sync_irq_inactive(hci) from i3c_hci_reset_and_restore() because it is called by hci->io->suspend() anyway drivers/i3c/master/mipi-i3c-hci/core.c | 19 +++++++++++++++++-- drivers/i3c/master/mipi-i3c-hci/hci.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 8274c84b16be..12a0122fb709 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -798,9 +798,8 @@ int i3c_hci_rpm_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(i3c_hci_rpm_suspend); -int i3c_hci_rpm_resume(struct device *dev) +static int i3c_hci_do_reset_and_restore(struct i3c_hci *hci) { - struct i3c_hci *hci = dev_get_drvdata(dev); int ret; ret = i3c_hci_reset_and_init(hci); @@ -821,6 +820,22 @@ int i3c_hci_rpm_resume(struct device *dev) return 0; } + +int i3c_hci_reset_and_restore(struct i3c_hci *hci) +{ + i3c_hci_bus_disable(hci); + + hci->io->suspend(hci); + + return i3c_hci_do_reset_and_restore(hci); +} + +int i3c_hci_rpm_resume(struct device *dev) +{ + struct i3c_hci *hci = dev_get_drvdata(dev); + + return i3c_hci_do_reset_and_restore(hci); +} EXPORT_SYMBOL_GPL(i3c_hci_rpm_resume); static int i3c_hci_runtime_suspend(struct device *dev) diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h index 97c31a315a6e..a3151c26827e 100644 --- a/drivers/i3c/master/mipi-i3c-hci/hci.h +++ b/drivers/i3c/master/mipi-i3c-hci/hci.h @@ -175,4 +175,6 @@ int i3c_hci_process_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n); int i3c_hci_rpm_suspend(struct device *dev); int i3c_hci_rpm_resume(struct device *dev); +int i3c_hci_reset_and_restore(struct i3c_hci *hci); + #endif -- 2.51.0