From patchwork Wed Nov 6 10:14:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 842341 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 4FA6B1DE2BA for ; Wed, 6 Nov 2024 10:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730888009; cv=none; b=lnVK0ILN3Be5LW+dcwQfLqUvssWRNalHFySCetSo9W0ZQdR6RbCjFpKAgz4UwbuXYspjg5oPrsDUmJr7gHhsxKPrPVoWhr12THHyV/fkAr5lvZYaplCdJGFDHBz0paadsTtF7iSQFwr3l7Qf4J/DabbU4sJkgiWW0ezoCGYtC0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730888009; c=relaxed/simple; bh=xPnncC2wTinnsqvRulyZjDNfjp1oi2Wkye5abU3hCPE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iAJuJXhbrrGCbZnmTXZ06WI0MA+64S7HuiG/D/O3V3sxy5pLJEqG6T8CB3HfDcjJx4UiPmbubJ/5ytKg1p2p8Q3w2uxxq+Dg1aZHzbA1QPVn8+0C5oH/7fG4As721xb5KbLovhdsdSwLnNw69aIm/5gJAxZ7QalvyK4ySYMPjmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ikmaFtrz; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none 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="ikmaFtrz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730888008; x=1762424008; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xPnncC2wTinnsqvRulyZjDNfjp1oi2Wkye5abU3hCPE=; b=ikmaFtrznzN6EQj2NyV33Q7guXiUdIUdkN0F9aJPr5So7MhMa/FLODHZ 6sbDhhDIDY89+Fz/eqzmWS63YxP2qTPcAr3q2r476FlOEzVzDFflntnt9 Meql2+lvQ7odwwFRAU45AqwBF/2mCm4cAzbo4V4NFoVlx7dTmjMc9UfTU lGe9Ax3Gstuo2StIr9v5as2JnJOCJI2i7+xUbnkX2uFEOHmZiTL4p2EMG RRvn1blvhdlYVqyPz/rIgRK+vTXJC4C9Q64+vovkyNxfES0ejXqQYiq7G 1yzhA9TKjxdpgoLEsuF+flWaGqs4o6wXunHsQtDAmHZitmbgqJdfF5AUn A==; X-CSE-ConnectionGUID: 9w8w3tBWQiKvG+IRHw9BCA== X-CSE-MsgGUID: amLOTmfYQhiWnhSFSDty7A== X-IronPort-AV: E=McAfee;i="6700,10204,11247"; a="42059467" X-IronPort-AV: E=Sophos;i="6.11,262,1725346800"; d="scan'208";a="42059467" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2024 02:13:26 -0800 X-CSE-ConnectionGUID: m3Dqe88JTaO27Dp8/n58hQ== X-CSE-MsgGUID: 39F/KqGrQSK0IRfDw/uTVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,262,1725346800"; d="scan'208";a="84813388" Received: from mattu-haswell.fi.intel.com ([10.237.72.199]) by fmviesa010.fm.intel.com with ESMTP; 06 Nov 2024 02:13:25 -0800 From: Mathias Nyman To: Cc: , Niklas Neronin , Mathias Nyman Subject: [PATCH 26/33] usb: xhci: improve xhci_clear_command_ring() Date: Wed, 6 Nov 2024 12:14:52 +0200 Message-Id: <20241106101459.775897-27-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106101459.775897-1-mathias.nyman@linux.intel.com> References: <20241106101459.775897-1-mathias.nyman@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Niklas Neronin Remove redundant TRB cycle reset, the TRB cycle is already set to zero by the preceding memset(), making the explicit reset unnecessary. Clarify ring loop start point. Change the loop start from the dequeue segment to the start segment. Both approaches achieve the same result, but starting from the start segment makes it clearer that the entire ring is being zeroed out. Signed-off-by: Niklas Neronin Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e5719fd45a38..bc477cf99805 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -778,10 +778,8 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) struct xhci_segment *seg; ring = xhci->cmd_ring; - xhci_for_each_ring_seg(ring->deq_seg, seg) { + xhci_for_each_ring_seg(ring->first_seg, seg) memset(seg->trbs, 0, sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1)); - seg->trbs[TRBS_PER_SEGMENT - 1].link.control &= cpu_to_le32(~TRB_CYCLE); - } xhci_initialize_ring_info(ring); /*