Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 A03BB3EAC7B for ; Tue, 17 Mar 2026 14:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773759375; cv=none; b=QZwcW0AD4FAac9p1IOTi3IGq6DTTMNwP7Xwxke1T0Rw5nQjf/6np3mnUDwQoKPwIZffqiRVAtyjpYNrEIHSzmjgIYfLZeStMUxBKF+bcdY1s3RjWBZ1sjB8HNSemf99UJ8e0exoOy4WnqYjTBadnTGe5g3OXmJH8wQi7Zg26M/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773759375; c=relaxed/simple; bh=ASswkset0ZmL+yyqr4I3jG4dIZjR3uP2RM5zvDebfFk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z4b2G4PQlsDtv6dKpUVmko6w7J4ZIc4UNrkhKXYJIzZiz8WpZszi3/NC9KzNXSxW8fyxa2kY5NyojfqWzlJASsPIgY2esYr2LiiVin9P4FKv8fS61Qkdi7EuftOW9GgB9U+9BHWvoGZd4V7cGtjMTEN0B8/7G0AIHyogBmKOS+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mkXW3TEF; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mkXW3TEF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773759374; x=1805295374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ASswkset0ZmL+yyqr4I3jG4dIZjR3uP2RM5zvDebfFk=; b=mkXW3TEFYfEiMx2lPgiyVu831hhQICEp6YjykeKHAQgrjPiw1q7XGom1 TLIjNJNUWM8UWaKyiicL/HzcAefhNrtjrfFjSF4CqNa2RESmCfUCVnJrF xKOITSrj0jWJnGnq/hXFDFW5lqeVgprGTSu6G/X12WiguM8TqBqKOZcX8 fqg9U1bQF7txCuSSvLHFfydD0A6MbcpYWv8gTJL2vXYh43PXOe1D/CkRF 2NCSi/wPq4rNWykEYCerbKaoIpFEWlIHKH8j0xrYRE8l69FhmfeUc24fB o3Rg9BDuKgPrOxNLMwnrebf8T5fTXxvCidh3vVIYb4xLGhVcTtIZZtD/E w==; X-CSE-ConnectionGUID: 7MRwFuw6RdqGs5qDidxqwg== X-CSE-MsgGUID: uOEyYqWLTpW8anShLSmVFg== X-IronPort-AV: E=McAfee;i="6800,10657,11732"; a="85491184" X-IronPort-AV: E=Sophos;i="6.23,126,1770624000"; d="scan'208";a="85491184" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2026 07:56:14 -0700 X-CSE-ConnectionGUID: Ppzd9VF9SEKGylEQEkGbkA== X-CSE-MsgGUID: VbKgzGvmQqmM9ETCDoAjOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,126,1770624000"; d="scan'208";a="219394918" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa007.fm.intel.com with ESMTP; 17 Mar 2026 07:56:13 -0700 Received: by black.igk.intel.com (Postfix, from userid 1058) id A234298; Tue, 17 Mar 2026 15:56:12 +0100 (CET) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, raoxu@uniontech.com, michal.pecio@gmail.com, Niklas Neronin Subject: [RFC PATCH v2 6/9] usb: xhci: move initialization for lifetime objects Date: Tue, 17 Mar 2026 15:55:41 +0100 Message-ID: <20260317145544.2076387-7-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260317145544.2076387-1-niklas.neronin@linux.intel.com> References: <20260317145544.2076387-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Initialize objects that exist for the lifetime of the driver only once, rather than repeatedly. These objects do not require re-initialization after events such as S4 (suspend-to-disk). Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/host/xhci.c | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index ca4463eebc49..2cd6111c9707 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2009,7 +2009,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) xhci->port_caps = NULL; xhci->interrupters = NULL; - xhci->page_size = 0; xhci->usb2_rhub.bus_state.bus_suspended = 0; xhci->usb3_rhub.bus_state.bus_suspended = 0; } diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 170615dd1e93..4e811a2668e6 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -549,13 +549,6 @@ static int xhci_init(struct usb_hcd *hcd) int retval; xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Starting %s", __func__); - spin_lock_init(&xhci->lock); - - INIT_LIST_HEAD(&xhci->cmd_list); - INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout); - init_completion(&xhci->cmd_ring_stop_completion); - xhci_hcd_page_size(xhci); - memset(xhci->devs, 0, MAX_HC_SLOTS * sizeof(*xhci->devs)); retval = xhci_mem_init(xhci, GFP_KERNEL); if (retval) @@ -5525,6 +5518,14 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); } + spin_lock_init(&xhci->lock); + INIT_LIST_HEAD(&xhci->cmd_list); + INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout); + init_completion(&xhci->cmd_ring_stop_completion); + xhci_hcd_page_size(xhci); + + memset(xhci->devs, 0, MAX_HC_SLOTS * sizeof(*xhci->devs)); + xhci_dbg(xhci, "Calling HCD init\n"); /* Initialize HCD and host controller data structures. */ retval = xhci_init(hcd); -- 2.50.1