From nobody Sat Nov 30 03:37:43 2024 Received: from fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (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 9703A1AB6F9 for ; Thu, 12 Sep 2024 13:30:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147851; cv=none; b=n3WriQdGmgPZasRSARbI6iTYZIxsRP6Dj2qc9/9bNU6Giwg+UExqSGXXODkB6zsHXLQ4XZYERk56AfvkT4l9LX+i1KaTkpfM8dhArsaBhirZdbN3vBYnI4vV+QzOq9qe2+AWF+HSzlcehV0/GXeDZ5ojaXASzcPclt2+PouyvaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147851; c=relaxed/simple; bh=VyCnF/sIxypxemRm/VZAiK93JGvif7eplvK5dBrfKOo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qiGXN31gM6WUTXSS9R3XbrOGkI5aMASqT3mT1/5lpd3WXLs8MAT+whMZwaWOW9h58+DpHvLvwoSx6a7lJhrvYYyz1xk6mUlwYuRawHed4k2Y2FskrVmPzi2bga+khDimLqh91Ayr11pQJCIHlbictRi24+czh1Kr6TfdbLz8v+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=VcXEnawU; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=klM+J1Ju; arc=none smtp.client-ip=103.168.172.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="VcXEnawU"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="klM+J1Ju" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.phl.internal (Postfix) with ESMTP id C29661140502; Thu, 12 Sep 2024 09:30:48 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Thu, 12 Sep 2024 09:30:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1726147848; x= 1726234248; bh=rglo+/zDD6Nc+U+Znu+G2W2jETHltYG2U4iySeRHtms=; b=V cXEnawU6hWxOCfg2MeJrzYLGRwY4mHObAOt4NW9QiUJ9CY8G51aB/iAhQJpFGpC3 Jb7kQTyp48A0NhOuFP6UcMDHmPNNPRk9tvvq/hBz5iXh5KpAKvtDU25tVYzOLajv q+t03gTwscWaX05L4yW03CDlS53XB/x3nEkhv3lnuuqo8vr3DKzDLrDL8+UXNtFC pz8YXXFxxSKPykjknpS8bEQI+vGiGDJ0Irk0SnrRoY5V4ykm/7cnLmXX+TkymGz8 J1YzpKJlDtuPjTZA7PrJTNviEQLC/+Vr7ptNf2lH4PEER3LRcMclSccwHgd5jcBa LNAQZVpLuLzlThe/Y1hyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1726147848; x= 1726234248; bh=rglo+/zDD6Nc+U+Znu+G2W2jETHltYG2U4iySeRHtms=; b=k lM+J1JuGWMvqMOt17zEf3Uf+HighWYqbfzHT/swfZEUflUmY4Vuci+HORf9OIW8O xNqz6piQFR8SXgRC51Wu9sz/d7riTzqGI2JBx1sHEznC3cZiamZ7KOrMhlc1C/ul x+mXIsgLjK/OKi7M7ULWka/1ahYeClZi8NEjJJSJ8U0yr+oA9dWYVpALjPUK2D53 LP4Z6Jx/nZTz7c7IdWeHP3oqCreAk7gi8HjIhnTCl9LGzJU3aM0F9DyFqsHhiim2 b/7RKhEQpBRIZKA15XYPNP2cFineOGzymUPpZb51J+9nGch6mybuFbJU+1jgeAjN SyAcNuYjGNLCSexpGGHEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejfedgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghm ohhtohcuoehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrg htthgvrhhnpedvjefgjeeuvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdff kedvtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopedv pdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvg hlsehlihhsthhsrdhsohhurhgtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhu gidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Sep 2024 09:30:47 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/5] firewire: core: add helper function to retire descriptors Date: Thu, 12 Sep 2024 22:30:36 +0900 Message-ID: <20240912133038.238786-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240912133038.238786-1-o-takashi@sakamocchi.jp> References: <20240912133038.238786-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Both IR/IT contexts use the same code to retire completed descriptors as AT context uses. This commit adds a helper function to reduce the duplicated codes. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 45 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 3a911cfb5ff3..4af4c9af4fe4 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -1141,9 +1141,8 @@ static struct descriptor *find_branch_descriptor(stru= ct descriptor *d, int z) return d + z - 1; } =20 -static void context_tasklet(unsigned long data) +static void context_retire_descriptors(struct context *ctx) { - struct context *ctx =3D (struct context *) data; struct descriptor *d, *last; u32 address; int z; @@ -1182,45 +1181,19 @@ static void context_tasklet(unsigned long data) } } =20 +static void context_tasklet(unsigned long data) +{ + struct context *ctx =3D (struct context *) data; + + context_retire_descriptors(ctx); +} + static void ohci_isoc_context_work(struct work_struct *work) { struct fw_iso_context *base =3D container_of(work, struct fw_iso_context,= work); struct iso_context *isoc_ctx =3D container_of(base, struct iso_context, b= ase); - struct context *ctx =3D &isoc_ctx->context; - struct descriptor *d, *last; - u32 address; - int z; - struct descriptor_buffer *desc; - - desc =3D list_entry(ctx->buffer_list.next, struct descriptor_buffer, list= ); - last =3D ctx->last; - while (last->branch_address !=3D 0) { - struct descriptor_buffer *old_desc =3D desc; - - address =3D le32_to_cpu(last->branch_address); - z =3D address & 0xf; - address &=3D ~0xf; - ctx->current_bus =3D address; - - // If the branch address points to a buffer outside of the current buffe= r, advance - // to the next buffer. - if (address < desc->buffer_bus || address >=3D desc->buffer_bus + desc->= used) - desc =3D list_entry(desc->list.next, struct descriptor_buffer, list); - d =3D desc->buffer + (address - desc->buffer_bus) / sizeof(*d); - last =3D find_branch_descriptor(d, z); - - if (!ctx->callback(ctx, d, last)) - break; =20 - if (old_desc !=3D desc) { - // If we've advanced to the next buffer, move the previous buffer to the - // free list. - old_desc->used =3D 0; - guard(spinlock_irqsave)(&ctx->ohci->lock); - list_move_tail(&old_desc->list, &ctx->buffer_list); - } - ctx->last =3D last; - } + context_retire_descriptors(&isoc_ctx->context); } =20 /* --=20 2.43.0