From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 8F9271D88AC; Sat, 17 Jan 2026 14:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660111; cv=none; b=ADE1A95I+VKe9SGzat51rxN+L0pTbjJ2p/29HEaQ1TOCf5lIb7Z/KiZ+9j3/aHofQQhTMjgib940n7MpKiKjEawHcrThtApmifRBC6jzM31rYzJ8Dq9AV9Ptn2BzVlPpw6KRMniq6Fu74ciMQS17fT6W6Sk1FevUjBkh3NuGWDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660111; c=relaxed/simple; bh=BjX8tShMFcgljL7k3pwerBXxrX4O530tKJ8Pyh2bj38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VVmi9pd9XDgDdHGawT3WBkX29vOrKUjslUGYvGaeBpulXQ34i8l3iZEYMmf8bReb89pKOojnweEuXePHwNeSIHG7LUiPSMCgYvcvEv4nVNDM5fp0M59l9Cz9EHfJ8OG+8v3H7zEPM/pve/kJ+fm1DPSZK1c4AClkmu2+6jhZiNc= 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=pat3ZSGW; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=KYCU2dw4; arc=none smtp.client-ip=202.12.124.157 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="pat3ZSGW"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="KYCU2dw4" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id D66AA7A0322; Sat, 17 Jan 2026 09:28:28 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sat, 17 Jan 2026 09:28:28 -0500 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=fm2; t=1768660108; x= 1768746508; bh=lvRfBrlvRRPoHNtRWkEdJUuLKtA3LQo+I81Hje9C4Ek=; b=p at3ZSGWYJoqfjj+8HLBCJcqZbtaXosidI4p7eUG9d6qBn91nuSjPgov2Io3gXcMe CRSZek8jhAG+nk6NjZMplIegfHDwQ4lI9WoCZEiYjUoMH+gPm4lEY56GjKa9sTXQ dumjoB8VCubvEslnbzo0qv6AXoSsOUiPF+1XtTIs6O+shmXqt+7p29NlfSlxtZUm b+sBZ1bb654xn9hKU/ki2x9TONsyGzVz1vaD+WIfxnwlbtHOD2JGDSZcVs+JHB38 U0XONvF8YyqjOkKaXn6nZB7E8Pv1JoUEUlHr2oC9j4tBRVp95/hOc3TCcGxzwVG2 Mov2+ruqNdERhnwADKS/A== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660108; x=1768746508; bh=l vRfBrlvRRPoHNtRWkEdJUuLKtA3LQo+I81Hje9C4Ek=; b=KYCU2dw4epwJHCeiP PXAQ1qehluCjiAg+TfUPOr/L1ys9ghAzn8BpQB/42IyAQvbPAkemFN0ZanyGNDYK 0z7975gr46Jqo6Tso9ipvBQlJ+MmGlVHeVCthYnEWV4166TIquA/m9doGyqwN+RX pyTF3jJOqxbN37YLfrQ2DscB3R3SpJtCDry/3vKvjcbZbqO/WGrKN58y1SNr8NPN Zd96RQwhJhqvekTC/0LxgKWzd7ddHY3YXtK74X9L+pJmH/RAWw+nnRoUpCO3uZrh RYr7bjvH7NlWe/fiy9SUwwxYvgOTR2NzMsitwLp6nMT5w5f9t9aHqooEkAVxI9Jj EvDcw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:27 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 1/9] firewire: core: add function variants for isochronous context creation Date: Sat, 17 Jan 2026 23:28:14 +0900 Message-ID: <20260117142823.440811-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" The fw_iso_callback union was added by a commit ebe4560ed5c ("firewire: Remove function callback casts") to remove function pointer cast. That change affected the cdev layer of the core code, but it is more convenient for fw_iso_context_create() to accept the union directly. This commit renames and changes the existing function to take the union argument, and add static inline wrapper functions as variants. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-cdev.c | 28 +++------------------------- drivers/firewire/core-iso.c | 9 ++++----- drivers/firewire/core.h | 9 +++++++++ include/linux/firewire.h | 14 +++++++++++--- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index bb4d0f938f5b..c26bea253208 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1026,25 +1026,10 @@ static enum dma_data_direction iso_dma_direction(st= ruct fw_iso_context *context) return DMA_FROM_DEVICE; } =20 -static struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *car= d, - fw_iso_mc_callback_t callback, - void *callback_data) -{ - struct fw_iso_context *ctx; - - ctx =3D fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, - 0, 0, 0, NULL, callback_data); - if (!IS_ERR(ctx)) - ctx->callback.mc =3D callback; - - return ctx; -} - static int ioctl_create_iso_context(struct client *client, union ioctl_arg= *arg) { struct fw_cdev_create_iso_context *a =3D &arg->create_iso_context; struct fw_iso_context *context; - union fw_iso_callback cb; int ret; =20 BUILD_BUG_ON(FW_CDEV_ISO_CONTEXT_TRANSMIT !=3D FW_ISO_CONTEXT_TRANSMIT || @@ -1056,20 +1041,15 @@ static int ioctl_create_iso_context(struct client *= client, union ioctl_arg *arg) case FW_ISO_CONTEXT_TRANSMIT: if (a->speed > SCODE_3200 || a->channel > 63) return -EINVAL; - - cb.sc =3D iso_callback; break; =20 case FW_ISO_CONTEXT_RECEIVE: if (a->header_size < 4 || (a->header_size & 3) || a->channel > 63) return -EINVAL; - - cb.sc =3D iso_callback; break; =20 case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: - cb.mc =3D iso_mc_callback; break; =20 default: @@ -1077,12 +1057,10 @@ static int ioctl_create_iso_context(struct client *= client, union ioctl_arg *arg) } =20 if (a->type =3D=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) - context =3D fw_iso_mc_context_create(client->device->card, cb.mc, - client); + context =3D fw_iso_mc_context_create(client->device->card, iso_mc_callba= ck, client); else - context =3D fw_iso_context_create(client->device->card, a->type, - a->channel, a->speed, - a->header_size, cb.sc, client); + context =3D fw_iso_context_create(client->device->card, a->type, a->chan= nel, a->speed, + a->header_size, iso_callback, client); if (IS_ERR(context)) return PTR_ERR(context); if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW) diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index 3f36243ec0c1..d9b8896c8ce1 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c @@ -137,9 +137,8 @@ size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffe= r, dma_addr_t completed) return 0; } =20 -struct fw_iso_context *fw_iso_context_create(struct fw_card *card, - int type, int channel, int speed, size_t header_size, - fw_iso_callback_t callback, void *callback_data) +struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int t= ype, int channel, + int speed, size_t header_size, union fw_iso_callback callback, void *cal= lback_data) { struct fw_iso_context *ctx; =20 @@ -153,7 +152,7 @@ struct fw_iso_context *fw_iso_context_create(struct fw_= card *card, ctx->channel =3D channel; ctx->speed =3D speed; ctx->header_size =3D header_size; - ctx->callback.sc =3D callback; + ctx->callback =3D callback; ctx->callback_data =3D callback_data; =20 trace_isoc_outbound_allocate(ctx, channel, speed); @@ -162,7 +161,7 @@ struct fw_iso_context *fw_iso_context_create(struct fw_= card *card, =20 return ctx; } -EXPORT_SYMBOL(fw_iso_context_create); +EXPORT_SYMBOL(__fw_iso_context_create); =20 void fw_iso_context_destroy(struct fw_iso_context *ctx) { diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index 26868f007131..e0ae948605e1 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h @@ -173,6 +173,15 @@ static inline void fw_iso_context_init_work(struct fw_= iso_context *ctx, work_fun INIT_WORK(&ctx->work, func); } =20 +static inline struct fw_iso_context *fw_iso_mc_context_create(struct fw_ca= rd *card, + fw_iso_mc_callback_t callback, void *callback_data) +{ + union fw_iso_callback cb =3D { .mc =3D callback }; + + return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL,= 0, 0, 0, cb, + callback_data); +} + =20 /* -topology */ =20 diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 09c8484f7430..68161b8a8a58 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -558,9 +558,8 @@ struct fw_iso_context { void *callback_data; }; =20 -struct fw_iso_context *fw_iso_context_create(struct fw_card *card, - int type, int channel, int speed, size_t header_size, - fw_iso_callback_t callback, void *callback_data); +struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int t= ype, int channel, + int speed, size_t header_size, union fw_iso_callback callback, void *cal= lback_data); int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels); int fw_iso_context_queue(struct fw_iso_context *ctx, struct fw_iso_packet *packet, @@ -569,6 +568,15 @@ int fw_iso_context_queue(struct fw_iso_context *ctx, void fw_iso_context_queue_flush(struct fw_iso_context *ctx); int fw_iso_context_flush_completions(struct fw_iso_context *ctx); =20 +static inline struct fw_iso_context *fw_iso_context_create(struct fw_card = *card, int type, + int channel, int speed, size_t header_size, fw_iso_callback_t callback, + void *callback_data) +{ + union fw_iso_callback cb =3D { .sc =3D callback }; + + return __fw_iso_context_create(card, type, channel, speed, header_size, c= b, callback_data); +} + /** * fw_iso_context_schedule_flush_completions() - schedule work item to pro= cess isochronous context. * @ctx: the isochronous context --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 440CE21E08D; Sat, 17 Jan 2026 14:28:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660113; cv=none; b=IMTrS6awkvk/X7ZiN8CxvrSRU6lvSf2S6ewneVV7w4zSpSVL7Y8+bSyCQdRbbr8UWWrb8tFXZN8QqlY1luAC4HeTJBRkIaX7HdsMYyqvrj8oFNZ4NgwFPDYYrKxyDX3wZiVjNUoLZRiT0mPrWNeuXiRHYNcAW6ObBSaBra5g1Qs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660113; c=relaxed/simple; bh=uhmzfy/U3W0+vrRfmgfHocfSSppizny5a1dgRbQteJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YiM+SpVPhr/ZSDertDdQFrEeCichqUoR5Nowl3w9sJzdTYQ7+DPpwMD51R8sNqUzEs5JDunQkipHOhXq/XTZbOvq5tJoVbZj9ULl5fWwC0KMCj4jLNe50oCIqlus5i4cysICXoFBnSf8p5r2fzmQuVkdQkmEVnOStejROhgVthc= 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=Z94nX7l4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=CbIOu900; arc=none smtp.client-ip=202.12.124.157 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="Z94nX7l4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CbIOu900" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9047A7A0336; Sat, 17 Jan 2026 09:28:30 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sat, 17 Jan 2026 09:28:30 -0500 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=fm2; t=1768660110; x= 1768746510; bh=L69nTUKr80md3xIu1CjiVgzag8CMaupxPGCGNgA0l6Y=; b=Z 94nX7l4G4KPUaPNYckbndQCY8CzRstwE8Pa3GNa3f+huSrI89k5esbaLPZAQFkKS vIQgHEQe8e0uElLgNgp28QgD/ovAESFgGYzzXfVsHNmjzGnuy5+bpVUHxDJDg5H+ AreG+andu8WKvrmMI2frVi2vyoovJcOi4dspb3RVXuSgA88R5JJtPpsoARRcdgeH icAkka3ktWfgT6/qrCpjuE3qy0BhES/MEJNMX+5mujQqmW/IWkYu7cu/iRmSnxdL J0+CebITCa+xpKtitFNdf7vAnlkYOGMme8R8oYWLRaXev99IRlR7vjyDxhIRa24k JWxNkxHdTJX0cPtTQ4EvA== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660110; x=1768746510; bh=L 69nTUKr80md3xIu1CjiVgzag8CMaupxPGCGNgA0l6Y=; b=CbIOu9003/AETFFAY s4eTgXlWrfDiRkCIg+tFQdGW1vp8V0VN/Uu7pIMkUjD17MKskhKtShE0o0NxHOes C6MLzQTAKSU6/gtvJxCzWKL4LW7Nmt8fpE788w9ioHIH2YNMgpBDy+rQwobE7n5b D+H6/92ZJkoDrz97pEAfLQWL8QQVTlNZmW/cP9ZYVTxiUb3ynfYk5negNpAxgA3S R2mtvTgFK4ufzQ8Rv9u1et3ejuqAetdhwWS3foFq0jj7zxutwn4rh+MIfK4lsEOt /GlfSn5vKPzib0c+5kF58JSnngcJNc3tOB50p/Z+A+vkzv/ZfhTzhKUWCXp48V0Z 2fBBg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeelueffudduhf ffkeffvdefvdekheefjefggeegieehkedutdevkeefgefggeekffenucffohhmrghinhep tggrlhhlsggrtghkrdhstgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhppdhnsggp rhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlihhnuhigud efleegqdguvghvvghlsehlihhsthhsrdhsohhurhgtvghfohhrghgvrdhnvghtpdhrtghp thhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshhouhhnugesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:29 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 2/9] firewire: ohci: refactor isoc single-channel state using a union Date: Sat, 17 Jan 2026 23:28:15 +0900 Message-ID: <20260117142823.440811-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" In 1394 OHCI driver, some members of struct iso_context are only used for single-channel isochronous contexts. This commit groups these members into a union. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 68 +++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 339047a2e768..b1dc0c4feb86 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -168,14 +168,18 @@ struct at_context { struct iso_context { struct fw_iso_context base; struct context context; - void *header; - size_t header_length; unsigned long flushing_completions; u32 mc_buffer_bus; u16 mc_completed; - u16 last_timestamp; u8 sync; u8 tags; + union { + struct { + u16 last_timestamp; + size_t header_length; + void *header; + } sc; + }; }; =20 #define CONFIG_ROM_SIZE (CSR_CONFIG_ROM_END - CSR_CONFIG_ROM) @@ -2735,29 +2739,28 @@ static void ohci_write_csr(struct fw_card *card, in= t csr_offset, u32 value) =20 static void flush_iso_completions(struct iso_context *ctx, enum fw_iso_con= text_completions_cause cause) { - trace_isoc_inbound_single_completions(&ctx->base, ctx->last_timestamp, ca= use, ctx->header, - ctx->header_length); - trace_isoc_outbound_completions(&ctx->base, ctx->last_timestamp, cause, c= tx->header, - ctx->header_length); + trace_isoc_inbound_single_completions(&ctx->base, ctx->sc.last_timestamp,= cause, + ctx->sc.header, ctx->sc.header_length); + trace_isoc_outbound_completions(&ctx->base, ctx->sc.last_timestamp, cause= , ctx->sc.header, + ctx->sc.header_length); =20 - ctx->base.callback.sc(&ctx->base, ctx->last_timestamp, - ctx->header_length, ctx->header, - ctx->base.callback_data); - ctx->header_length =3D 0; + ctx->base.callback.sc(&ctx->base, ctx->sc.last_timestamp, ctx->sc.header_= length, + ctx->sc.header, ctx->base.callback_data); + ctx->sc.header_length =3D 0; } =20 static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr) { u32 *ctx_hdr; =20 - if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) { + if (ctx->sc.header_length + ctx->base.header_size > PAGE_SIZE) { if (ctx->base.drop_overflow_headers) return; flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERF= LOW); } =20 - ctx_hdr =3D ctx->header + ctx->header_length; - ctx->last_timestamp =3D (u16)le32_to_cpu((__force __le32)dma_hdr[0]); + ctx_hdr =3D ctx->sc.header + ctx->sc.header_length; + ctx->sc.last_timestamp =3D (u16)le32_to_cpu((__force __le32)dma_hdr[0]); =20 /* * The two iso header quadlets are byteswapped to little @@ -2770,7 +2773,7 @@ static void copy_iso_headers(struct iso_context *ctx,= const u32 *dma_hdr) ctx_hdr[1] =3D swab32(dma_hdr[0]); /* timestamp */ if (ctx->base.header_size > 8) memcpy(&ctx_hdr[2], &dma_hdr[2], ctx->base.header_size - 8); - ctx->header_length +=3D ctx->base.header_size; + ctx->sc.header_length +=3D ctx->base.header_size; } =20 static int handle_ir_packet_per_buffer(struct context *context, @@ -2920,18 +2923,18 @@ static int handle_it_packet(struct context *context, =20 sync_it_packet_for_cpu(context, d); =20 - if (ctx->header_length + 4 > PAGE_SIZE) { + if (ctx->sc.header_length + 4 > PAGE_SIZE) { if (ctx->base.drop_overflow_headers) return 1; flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERF= LOW); } =20 - ctx_hdr =3D ctx->header + ctx->header_length; - ctx->last_timestamp =3D le16_to_cpu(last->res_count); + ctx_hdr =3D ctx->sc.header + ctx->sc.header_length; + ctx->sc.last_timestamp =3D le16_to_cpu(last->res_count); /* Present this value as big-endian to match the receive code */ *ctx_hdr =3D cpu_to_be32((le16_to_cpu(pd->transfer_status) << 16) | le16_to_cpu(pd->res_count)); - ctx->header_length +=3D 4; + ctx->sc.header_length +=3D 4; =20 if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT); @@ -3008,12 +3011,16 @@ static struct fw_iso_context *ohci_allocate_iso_con= text(struct fw_card *card, } =20 memset(ctx, 0, sizeof(*ctx)); - ctx->header_length =3D 0; - ctx->header =3D (void *) __get_free_page(GFP_KERNEL); - if (ctx->header =3D=3D NULL) { - ret =3D -ENOMEM; - goto out; + + if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { + ctx->sc.header_length =3D 0; + ctx->sc.header =3D (void *) __get_free_page(GFP_KERNEL); + if (!ctx->sc.header) { + ret =3D -ENOMEM; + goto out; + } } + ret =3D context_init(&ctx->context, ohci, regs, callback); if (ret < 0) goto out_with_header; @@ -3027,7 +3034,10 @@ static struct fw_iso_context *ohci_allocate_iso_cont= ext(struct fw_card *card, return &ctx->base; =20 out_with_header: - free_page((unsigned long)ctx->header); + if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { + free_page((unsigned long)ctx->sc.header); + ctx->sc.header =3D NULL; + } out: scoped_guard(spinlock_irq, &ohci->lock) { switch (type) { @@ -3127,7 +3137,11 @@ static void ohci_free_iso_context(struct fw_iso_cont= ext *base) =20 ohci_stop_iso(base); context_release(&ctx->context); - free_page((unsigned long)ctx->header); + + if (base->type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { + free_page((unsigned long)ctx->sc.header); + ctx->sc.header =3D NULL; + } =20 guard(spinlock_irqsave)(&ohci->lock); =20 @@ -3475,7 +3489,7 @@ static int ohci_flush_iso_completions(struct fw_iso_c= ontext *base) switch (base->type) { case FW_ISO_CONTEXT_TRANSMIT: case FW_ISO_CONTEXT_RECEIVE: - if (ctx->header_length !=3D 0) + if (ctx->sc.header_length !=3D 0) flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH); break; case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 AD1092192F9; Sat, 17 Jan 2026 14:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660114; cv=none; b=jcWauAsCOz2TQafdwTUmTkboAtu5DDF7/zUSh/weRf3rfHE4tJ/sZwRN8zA7R7JZy3dI1yqp7ogVBcb6UTWozdQqCPZrbPsOef0aGZ4LwM6bdXbHAT3dW9rraHN9bBFzq0w2IW50Cy4+kDYYdD0o37rr0mHUnHo+PEHYzqU3gTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660114; c=relaxed/simple; bh=vT4XBFgmn62OWQk+xdLjGTfn790Ix7GElrrHxjZvVxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l7Eht8zWkcNuUW2jNEZf3fWzjcgpq4NZcebRpK82bIdliwauzArXE48sZydk18sLOjO/kRfy4eyqU1fac56FYv88AY+e2ks1vw3V8nqipbmWfe4+hm7GQ/+hhPgr6O0wN07gak/YPpDiBd0N+NJkh2lDPOpHCh8AcFkk352vXhM= 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=KYzR9tej; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=lNAyQaWf; arc=none smtp.client-ip=202.12.124.157 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="KYzR9tej"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lNAyQaWf" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 284D77A033C; Sat, 17 Jan 2026 09:28:32 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Sat, 17 Jan 2026 09:28:32 -0500 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=fm2; t=1768660112; x= 1768746512; bh=VMX5ShBHt4OP18/iflgnZCqJDvVfJ7oyQB4KemlPwQg=; b=K YzR9tejNMEtFDSptsT9Z6B+DsFbssAM8Mtj5PQU6QRRbc+1X00okPSZTg7doztm4 SS6x4qUpUzM47+yM1OztB5xvbCgBfy+Nv2kuTcY9IMX2OguYd12Lzu6Pt5rFgImK TuZOdZQly6BV8Wh8NG4RDHbTtgw7d8L0lD0nc1Z6eN9RKFhNf9zYwtW1OSFemu2L Z7SJ2M9lHUNTCPeigjdOgXzaU5fJM9K6r1koZx5ZJVd6NMHFsOb98OKDv7DuvjCi X8DRd6Vp5hamMpawfcxzBa59nizXDh2jPv0ezEEyYqui825yLUkb/NH+1nG8FrmC XlIQHolsc6pa8KjmzHuGw== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660112; x=1768746512; bh=V MX5ShBHt4OP18/iflgnZCqJDvVfJ7oyQB4KemlPwQg=; b=lNAyQaWfW8BSEh5yj 07MIuq4Vf1mut0ZTHm+K6UpDAIM2f2r5Ls9jYsJtuaEOkh63mNd4okjqajsSdWdP ugpp1XBObvmWS9WwqKE/frR22KIjJlVr6KKbPsktBE7ufL6dKk4IAbbsvaegg4gS k3boZLB/CwAqPijC4Jrs67mwl+YWLVEzc1/tUQu1BPVAFMSV5SurUw0HkufESnT8 ecIzC+5qkY0ngw4iwJnNA5cb4yU1DFNdkddTMdSnZF72nuN8ZYn39672bXwhOHTL 2+yau3DnR2Y0FHRG4Y78mBudllO+ShgiAwBSJ1ueVhppCz3j9S/l5ibsmz5JY0ki VlthA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeeulefhkefghf ekveevvdefgfekhfeftdduhfegheegffdtudeuvdekffduhefgveenucffohhmrghinhep tggrlhhlsggrtghkrdhmtgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhppdhnsggp rhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlihhnuhigud efleegqdguvghvvghlsehlihhsthhsrdhsohhurhgtvghfohhrghgvrdhnvghtpdhrtghp thhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshhouhhnugesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:30 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 3/9] firewire: ohci: code refactoring to use union for isoc multiple channel state Date: Sat, 17 Jan 2026 23:28:16 +0900 Message-ID: <20260117142823.440811-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" In 1394 OHCI driver, some members of struct iso_context are only used for multi-channel isochronous contexts. This commit uses a union for these members to clearly separate multi-channel specific state. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index b1dc0c4feb86..5d9857cbbd24 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -169,8 +169,6 @@ struct iso_context { struct fw_iso_context base; struct context context; unsigned long flushing_completions; - u32 mc_buffer_bus; - u16 mc_completed; u8 sync; u8 tags; union { @@ -179,6 +177,10 @@ struct iso_context { size_t header_length; void *header; } sc; + struct { + u32 buffer_bus; + u16 completed; + } mc; }; }; =20 @@ -2826,8 +2828,8 @@ static int handle_ir_buffer_fill(struct context *cont= ext, buffer_dma =3D le32_to_cpu(last->data_address); =20 if (completed > 0) { - ctx->mc_buffer_bus =3D buffer_dma; - ctx->mc_completed =3D completed; + ctx->mc.buffer_bus =3D buffer_dma; + ctx->mc.completed =3D completed; } =20 if (res_count !=3D 0) @@ -2846,7 +2848,7 @@ static int handle_ir_buffer_fill(struct context *cont= ext, ctx->base.callback.mc(&ctx->base, buffer_dma + completed, ctx->base.callback_data); - ctx->mc_completed =3D 0; + ctx->mc.completed =3D 0; } =20 return 1; @@ -2855,17 +2857,16 @@ static int handle_ir_buffer_fill(struct context *co= ntext, static void flush_ir_buffer_fill(struct iso_context *ctx) { dma_sync_single_range_for_cpu(ctx->context.ohci->card.device, - ctx->mc_buffer_bus & PAGE_MASK, - ctx->mc_buffer_bus & ~PAGE_MASK, - ctx->mc_completed, DMA_FROM_DEVICE); + ctx->mc.buffer_bus & PAGE_MASK, + ctx->mc.buffer_bus & ~PAGE_MASK, + ctx->mc.completed, DMA_FROM_DEVICE); =20 - trace_isoc_inbound_multiple_completions(&ctx->base, ctx->mc_completed, + trace_isoc_inbound_multiple_completions(&ctx->base, ctx->mc.completed, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH); =20 - ctx->base.callback.mc(&ctx->base, - ctx->mc_buffer_bus + ctx->mc_completed, + ctx->base.callback.mc(&ctx->base, ctx->mc.buffer_bus + ctx->mc.completed, ctx->base.callback_data); - ctx->mc_completed =3D 0; + ctx->mc.completed =3D 0; } =20 static inline void sync_it_packet_for_cpu(struct context *context, @@ -3028,7 +3029,7 @@ static struct fw_iso_context *ohci_allocate_iso_conte= xt(struct fw_card *card, =20 if (type =3D=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { set_multichannel_mask(ohci, 0); - ctx->mc_completed =3D 0; + ctx->mc.completed =3D 0; } =20 return &ctx->base; @@ -3493,7 +3494,7 @@ static int ohci_flush_iso_completions(struct fw_iso_c= ontext *base) flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH); break; case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: - if (ctx->mc_completed !=3D 0) + if (ctx->mc.completed !=3D 0) flush_ir_buffer_fill(ctx); break; default: --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 6419F221FC6; Sat, 17 Jan 2026 14:28:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660119; cv=none; b=o8dfVSWIoOKE5qKpFBevX6kgZwI/+QsKnU7ZrhhuwCvhVjQPeVoo71sZ+eF+aD11m1YbkcUKm6741in132Xit+NN0rlqIiWEgkCXu1nxEakEBrFs5/8UAza0kL36EVGQxPfjVKHtcxJDcnP8TR+qyrgcc0lBbsAcsvW+5S/REIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660119; c=relaxed/simple; bh=0+o2VUJZCtz+1vW5MXV3p0A2ZklLTq8sPKz4FULbB3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cQQlkfeahj3JH8kbXH2Fp5nadWa5LgYz2hSUwNVBni5DtEttxcsX8IL85meZUB/cknZbPgVrnRTcYk31R4RQkoXGkniqlVpZqcHBGCMjo7a+XLReaawGfOtwMd7Sbg0HyFMRMwi1KnQM+5OBpX//6AipMGd8uOBbAUEHNAHMoSg= 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=Fe3DTnyw; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=uWQoWBsU; arc=none smtp.client-ip=202.12.124.157 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="Fe3DTnyw"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="uWQoWBsU" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id B7F6C7A0325; Sat, 17 Jan 2026 09:28:33 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sat, 17 Jan 2026 09:28:33 -0500 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=fm2; t=1768660113; x= 1768746513; bh=IbJBZ5DJy42Pr9Dh1QiqdxTjMOBG5eXgGleQ0l9+Tew=; b=F e3DTnyw9a5IeQEngaBqLMwIwiSzFSmfmPJDdl+pDPmj4igv6lQwrB02bDTOlEHHq JKl4GsTLKz3VkHtSNGYb0UF3JmCnZwOIL6zRgGCOOkc1YIWGysGHDhTo3+FS8aCh VoVQdU+UTd1f7gqSSsjtH6Hc3o8b71AaX6uPEeGybBOWwdC40R0/ssvSAgwh+P0W 7K7PZXGMm7VaJ9+RHNn7cZnRGIUUiQe50n8sYwAuBmUMsJZzG6QSb8bKlA4k5iyI 8f5fCSM0q1Sp15ZzYW3G/BYkXDeegBlRGQMosko74Vv9f/U8BMCB8GRuDZmfHpP9 UCqx6oZ8CY71ydGAbfdqg== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660113; x=1768746513; bh=I bJBZ5DJy42Pr9Dh1QiqdxTjMOBG5eXgGleQ0l9+Tew=; b=uWQoWBsU4Xsuvt+tV HGelxHPO6snXd8CVeoay3pLGwALGQ/sZaWNhcZilaEzJ3Zt/3OVrUCNanTr6WBXS rSEjx6F8y+hXVIrk7HArCz7h8TTuze4kQknpv+kH+Qo1lEo0Hnw4eVfCDyJLdZmm 1xK4FKe3XxEHdTlnp1+y8A/O/7a1Vvfa62hg5AfxLZ/vLYVF8LhXy9O/q5l4Hug5 /7zN/LNRqCQ7vcZo1GXCANMBYivGfelK00tSy6RMsFDNQ5Lnhyz3y7PdDculcT63 3g5kpbkLIgSF8Ydo8fAw9yvkCKKdisXVmyz/fsthM8HHq1Zxpah/ckwwztDWgTnD ZHVIQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:32 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 4/9] firewire: ohci: use cleanup helper for isoc context header allocation Date: Sat, 17 Jan 2026 23:28:17 +0900 Message-ID: <20260117142823.440811-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" Some cleanup helpers are useful in error path after memory allocation for header storage. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 5d9857cbbd24..6760c8d12637 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -2958,6 +2958,7 @@ static struct fw_iso_context *ohci_allocate_iso_conte= xt(struct fw_card *card, int type, int channel, size_t header_size) { struct fw_ohci *ohci =3D fw_ohci(card); + void *header __free(free_page) =3D NULL; struct iso_context *ctx; descriptor_callback_t callback; u64 *channels; @@ -3015,8 +3016,8 @@ static struct fw_iso_context *ohci_allocate_iso_conte= xt(struct fw_card *card, =20 if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { ctx->sc.header_length =3D 0; - ctx->sc.header =3D (void *) __get_free_page(GFP_KERNEL); - if (!ctx->sc.header) { + header =3D (void *) __get_free_page(GFP_KERNEL); + if (!header) { ret =3D -ENOMEM; goto out; } @@ -3024,21 +3025,17 @@ static struct fw_iso_context *ohci_allocate_iso_con= text(struct fw_card *card, =20 ret =3D context_init(&ctx->context, ohci, regs, callback); if (ret < 0) - goto out_with_header; + goto out; fw_iso_context_init_work(&ctx->base, ohci_isoc_context_work); =20 - if (type =3D=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { + if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { + ctx->sc.header =3D no_free_ptr(header); + } else { set_multichannel_mask(ohci, 0); ctx->mc.completed =3D 0; } =20 return &ctx->base; - - out_with_header: - if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { - free_page((unsigned long)ctx->sc.header); - ctx->sc.header =3D NULL; - } out: scoped_guard(spinlock_irq, &ohci->lock) { switch (type) { --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 EFFDC22FF22; Sat, 17 Jan 2026 14:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660125; cv=none; b=aYmgER7Il9zun/dOjKcqzV25mMXSS1kyuINFAAJW4PwpirLmG88DXefEAEQGwFHLeVgcd7AWXY7eTTcD9p6U9VdrVFbu0OEMIznBMSkUMSm97wB7505DsYhHcby8R8MYSDsO0IMMF543W9X1JlFLRss//iQTD/nL8l9afHRgupE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660125; c=relaxed/simple; bh=6wYB4JF4q7CukRJnoats1fi+4EH3G8wMtpb8UBFZlcI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AEsKb5fhweHglXs9Gxa6ys6fHsD2GREULcw9gs5fUYiRHuphJS/T5Z87NM7EZZHHQoLw/kTUxXgn6nThe7r4H4VePY7LH0SSiDyNzFIPeUKeJzy8CF/6/SRMrZ5V3f+Sv14Ljo7QxmfNR8Ncd0X3ns5/Pkx8ZUh09w/pSdw2g0U= 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=d5FnrnQw; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=YQF4BhNt; arc=none smtp.client-ip=202.12.124.157 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="d5FnrnQw"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="YQF4BhNt" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 58BC97A0333; Sat, 17 Jan 2026 09:28:35 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sat, 17 Jan 2026 09:28:35 -0500 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=fm2; t=1768660115; x= 1768746515; bh=0o98L6X7Ww81vUo8K0bKIgUHwJe62JrsMwr69W87+Ws=; b=d 5FnrnQwCbfIu2IKsAbOzm0N65IIEjnYjSQlx7BEFWrry1vveaB0DlQRmLPhZ5S+6 JzJ2/WTsoZnyIM4dLn8OznI5s3NloK1V/o8ltEEZLkiyEoLyld0NlHU2Y/S39vw3 QHYFvKhhkDuSJlIGw7mJg5mUBl0+Fn0bB9ib2yMXU+lCghIamAvIB2m1oxOZPkpo dz/jqNKd2V4EnSs3UKCRKj25hWIk3N/jsQpoohWtqkWUaR0q/ggtWSvZy/soM3SN CAuzmucrYjRXICOqJgsAehGgfo0e6094oDxtuM+pO+l+iC4SpBW8kP9AgwXQiqBs ta4Q4SUhVFHg/bYuoBNvA== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660115; x=1768746515; bh=0 o98L6X7Ww81vUo8K0bKIgUHwJe62JrsMwr69W87+Ws=; b=YQF4BhNt/vzyJC7Hb GQGfb6gkBAmUCRnkCmnjGiNBonFCkSeta/fmmrfS9hO1Se8dSspi9DOR18FncD+J 95RIoSkncTK37n4VHyY+wGxm4BLVbEFFFbCGT3MnmHS2mXw5rOgDbAOfX2xDQDq9 g3EKC18KhzcDDHDCdPdpqXuf07F98ykm3t4gu88aYJHEqLCpGZNaeEafCdXma38e Iajyz8Di+YqKOqie72My0UKussGei1nRbxsOWcyBq4yKdjso94nsAcWjGaxwLQ3+ 0d4Y3ARys1kj/EScX+J6SYCK9RKTq7aQX4mYEXCQ0aB7zSWyYT+9Cr8ZtYy9v11X WY+Bw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:34 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 5/9] firewire: core: add flags member for isochronous context structure Date: Sat, 17 Jan 2026 23:28:18 +0900 Message-ID: <20260117142823.440811-6-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" This is minor code refactoring to add a flag member to the isochronous context structure. At present, it is used only for the option to drop packets when the context header overflows. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-iso.c | 1 + drivers/firewire/ohci.c | 4 ++-- include/linux/firewire.h | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index c26bea253208..9e964fdd175c 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1064,7 +1064,7 @@ static int ioctl_create_iso_context(struct client *cl= ient, union ioctl_arg *arg) if (IS_ERR(context)) return PTR_ERR(context); if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW) - context->drop_overflow_headers =3D true; + context->flags |=3D FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS; =20 // We only support one context at this time. scoped_guard(mutex, &client->iso_context_mutex) { diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index d9b8896c8ce1..fbbd14d21ca4 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c @@ -151,6 +151,7 @@ struct fw_iso_context *__fw_iso_context_create(struct f= w_card *card, int type, i ctx->type =3D type; ctx->channel =3D channel; ctx->speed =3D speed; + ctx->flags =3D 0; ctx->header_size =3D header_size; ctx->callback =3D callback; ctx->callback_data =3D callback_data; diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 6760c8d12637..8bba70b65ad7 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -2756,7 +2756,7 @@ static void copy_iso_headers(struct iso_context *ctx,= const u32 *dma_hdr) u32 *ctx_hdr; =20 if (ctx->sc.header_length + ctx->base.header_size > PAGE_SIZE) { - if (ctx->base.drop_overflow_headers) + if (ctx->base.flags & FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS) return; flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERF= LOW); } @@ -2925,7 +2925,7 @@ static int handle_it_packet(struct context *context, sync_it_packet_for_cpu(context, d); =20 if (ctx->sc.header_length + 4 > PAGE_SIZE) { - if (ctx->base.drop_overflow_headers) + if (ctx->base.flags & FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS) return 1; flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERF= LOW); } diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 68161b8a8a58..71d5cc8f28ce 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -546,13 +546,17 @@ union fw_iso_callback { fw_iso_mc_callback_t mc; }; =20 +enum fw_iso_context_flag { + FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS =3D BIT(0), +}; + struct fw_iso_context { struct fw_card *card; struct work_struct work; int type; int channel; int speed; - bool drop_overflow_headers; + int flags; size_t header_size; union fw_iso_callback callback; void *callback_data; --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 833342248BE; Sat, 17 Jan 2026 14:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660119; cv=none; b=OXZYaDot9kSGGufWZpmWK0ECLxko6idVaHmOMRaC9lkvDG9Iu/0JP+0Y62gjPtS6bWh+BC92X/7JWrsTxt/mZZS2CQzzNYp+fDjOSv6st9W8HfXmyjZ47lkTk2LvOg2+S6BWFA0EpfPlIErDIn3+z5etbaoVZK6VDkl1X1P/zag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660119; c=relaxed/simple; bh=YuX+M6FPXemZou4h9sfOmMbgSVEb9zcLaqNyTn0KwmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ElMLlHRU4TROPgEja39oA6b7UE3woGVQps4ClvCLjwrmo7n0iSrBxLqH88gjsi9vxT9Cc3aQGwumIMOPkjKHab8jIGLSf4kkJhHOSZqDz3hj/tWT1Br7kmZVkKIYWD8yXyyPimxR/SesRNFFjaQ5RbiPugorFc68V3gtlj1xA3Q= 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=abHEFIUY; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TocXxC8A; arc=none smtp.client-ip=202.12.124.149 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="abHEFIUY"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TocXxC8A" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id EBA221D002D0; Sat, 17 Jan 2026 09:28:36 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sat, 17 Jan 2026 09:28:37 -0500 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=fm2; t=1768660116; x= 1768746516; bh=NVzj8Ql53jQtPGC8rxKPSYOxdrumrOkAudNJ+7K/T/0=; b=a bHEFIUYLcp2VMn6JSp7Z0UuVHRSTZBktaHwCk+OVK7DKlLQvwl+kCCcsA7F14Awa gMCNODz/9z1US9uXzrauppSGaPAn5PsDicmfibaP0krZPytffQzy5wtJkXK4dp2a ySGu9wyHbgEN64hUq9uyWJYO/Qd/HOSHODTIiMAVmHnwzQp4ESs0goB1JKASpp9O k2vjQls+HRkhnLNy2H6K4ohSjcODRleNc4UdKryOW+jxQOZZhqfwicAyZyMs04KN hxy+Bu56FmbtJSnqV6cig2jqsszDKIEnAchLJn+DHKSKL0AmTmyUEjQCREMKJMH+ 3c9FryHNDxDYXRSN/wMiw== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660116; x=1768746516; bh=N Vzj8Ql53jQtPGC8rxKPSYOxdrumrOkAudNJ+7K/T/0=; b=TocXxC8AfnK0WoD11 QFr6ucbbAG1qZ2QzlAt2aXq6QSZieE58iN4cCQYIzpfe+NiGs3kY7+AUq5Mg7O6d h8NXdc0MQ2SQgY0UHcszMfF/MVpBVKxXwkm1jHw0xW4WKo5bZ9bBsQS4bFtiBuX7 2/KGf48fx6UR52nG8k6NBeDZDGnKKxJ7Sx+CRVXEdL2OUwM0Ox+VgH/Vb47mYeMW JuMg2oPSLZVWz0U9hln/i119JruG6zgp/B+Uuz2GAx0m4BYigf9gjoI27xa0peRm 0XpL9HlTow96b8mpsJ/npuSthy8DCf86Kjv8rJbygyV6e+1g98Dhz1ePTeEoL36k 5YJYQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:35 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 6/9] firewire: ohci: allocate isoc context header by kvmalloc() Date: Sat, 17 Jan 2026 23:28:19 +0900 Message-ID: <20260117142823.440811-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" Isochronous packet handling now runs in a workqueue context, where page faults is acceptable. This commit replaces __get_free_page() with kvmalloc() when allocating the isochronous context header buffer. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 8bba70b65ad7..888c43940999 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -2958,7 +2958,7 @@ static struct fw_iso_context *ohci_allocate_iso_conte= xt(struct fw_card *card, int type, int channel, size_t header_size) { struct fw_ohci *ohci =3D fw_ohci(card); - void *header __free(free_page) =3D NULL; + void *header __free(kvfree) =3D NULL; struct iso_context *ctx; descriptor_callback_t callback; u64 *channels; @@ -3016,7 +3016,7 @@ static struct fw_iso_context *ohci_allocate_iso_conte= xt(struct fw_card *card, =20 if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { ctx->sc.header_length =3D 0; - header =3D (void *) __get_free_page(GFP_KERNEL); + header =3D kvmalloc(PAGE_SIZE, GFP_KERNEL); if (!header) { ret =3D -ENOMEM; goto out; @@ -3137,7 +3137,7 @@ static void ohci_free_iso_context(struct fw_iso_conte= xt *base) context_release(&ctx->context); =20 if (base->type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { - free_page((unsigned long)ctx->sc.header); + kvfree(ctx->sc.header); ctx->sc.header =3D NULL; } =20 --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 EFF5322D7B6; Sat, 17 Jan 2026 14:28:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660124; cv=none; b=eOYITgJU0R4+9MdOEZmjXHCoX04GkD0MoRjQ5sCmolbg8pJZH8LzjMyIE/zbgY34JKiP+TXjMMfGdvLm9TCDwHmkbLXsO0fQsrVIm8jB979tJd+jc8pFpo5Kn2633CQvdfYiAdD+IhGNjrNDApQy7afv3iAaBRz5y3xOSQPd4PM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660124; c=relaxed/simple; bh=2fpSded8DV2zo3EcRCIuAv40PL286xZPQpAgxmWoBNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rJX+jCD+zXSxom3ykVaLECfnwpV/gIdQyeP1221c6X7CAmCzxiprwqplH8SFSgNP1Sg6McunJ0EQvBvU0L5XWT+h1EWBU+AUCipE43Kb44eE6llFXYklmhKgOwP51rHMhaWewBBhqtnC+qJP41KRPiYR+LpfVvagUXQuh7BUSeQ= 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=DxN/I+Ku; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=g6PQOzyW; arc=none smtp.client-ip=202.12.124.157 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="DxN/I+Ku"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="g6PQOzyW" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 861717A0322; Sat, 17 Jan 2026 09:28:38 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sat, 17 Jan 2026 09:28:38 -0500 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=fm2; t=1768660118; x= 1768746518; bh=sXsLq3IZoGvB6vceJiH6t/T7rkt89IB3p1KmJSv+MW8=; b=D xN/I+KuhHoq/GU4pOPOwzT4YYP4r9+hxzbkEk2JU/mhwIZ+JId1ZQON1vSD7DWu0 UXLUqxHpfVKTu1jwl2QCPoAgDkjA/5600LS5x8v5R5m8NdJ9gs5K6RMw/voMiGYz JE6dCHSI3L+Urwc2SbP59AJ44zTPbyjO65R4RWQb3eP1Mkcwx6EtOTBv7Wp+Gxyn f7Dz89egbYlvcMH6Hotcp1ZqXlC8XZF1u6c51RGby1R0S+YqOGttrrvLKxgeVZSt XMThyvxWIJHtjBoN5rthbzB9yjT/TVUUQ18RAMQgJtYmLtH6vgP2tEjb0WrJHoTG kGD9KY/YVCWCjELtN8K0g== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660118; x=1768746518; bh=s XsLq3IZoGvB6vceJiH6t/T7rkt89IB3p1KmJSv+MW8=; b=g6PQOzyWc+kbNinuu N4SLuf6iPgyt77DoYvAuZVRMxGnVxp86iY6ApA8QiV250xYwcmoXjGyXy2+Gdfc8 WU48CoSQ0RCCcarH/OC5WgTiP2ZUUPWDFZRc6XkF5snar2q62Qt0Z/2MMFX9N9O+ 1eprt48vsBGJ/UsTJHIl79wRbz5CxmBS0wZDo85z1ktAdnJ41tQSDyUPvI7WX66E ZFp1MVjnMFVvFeGnrvXamWWIZ0+qewqPOezg7ux+V07Ei8X4eC/dTemC+JdLp7Tj XX/S9FdCxF7gQFZhhORKVENBz3uZ2/Z75MEAIjw9C8YSY4B7se0fnxFwpM5ZiuEm P0Heg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:37 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 7/9] firewire: core: provide isoc header buffer size outside card driver Date: Sat, 17 Jan 2026 23:28:20 +0900 Message-ID: <20260117142823.440811-8-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" For single-channel isochronous contexts, the header storage size is hard-coded to PAGE_SIZE. which is inconvenient for protocol implementations requiring more space. This commit refactors the code to obtain the header storage size outside the 1394 OHCI driver. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-card.c | 4 ++-- drivers/firewire/core-iso.c | 8 +++++--- drivers/firewire/core.h | 6 +++--- drivers/firewire/ohci.c | 10 +++++----- include/linux/firewire.h | 7 +++++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 0462d7b9e547..a754c6366b97 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c @@ -704,8 +704,8 @@ static int dummy_enable_phys_dma(struct fw_card *card, return -ENODEV; } =20 -static struct fw_iso_context *dummy_allocate_iso_context(struct fw_card *c= ard, - int type, int channel, size_t header_size) +static struct fw_iso_context *dummy_allocate_iso_context(struct fw_card *c= ard, int type, + int channel, size_t header_size, size_t header_storage_size) { return ERR_PTR(-ENODEV); } diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index fbbd14d21ca4..3190b2ca1298 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c @@ -138,12 +138,13 @@ size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buf= fer, dma_addr_t completed) } =20 struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int t= ype, int channel, - int speed, size_t header_size, union fw_iso_callback callback, void *cal= lback_data) + int speed, size_t header_size, size_t header_storage_size, + union fw_iso_callback callback, void *callback_data) { struct fw_iso_context *ctx; =20 - ctx =3D card->driver->allocate_iso_context(card, - type, channel, header_size); + ctx =3D card->driver->allocate_iso_context(card, type, channel, header_si= ze, + header_storage_size); if (IS_ERR(ctx)) return ctx; =20 @@ -153,6 +154,7 @@ struct fw_iso_context *__fw_iso_context_create(struct f= w_card *card, int type, i ctx->speed =3D speed; ctx->flags =3D 0; ctx->header_size =3D header_size; + ctx->header_storage_size =3D header_storage_size; ctx->callback =3D callback; ctx->callback_data =3D callback_data; =20 diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index e0ae948605e1..8b49d7480c37 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h @@ -100,8 +100,8 @@ struct fw_card_driver { void (*write_csr)(struct fw_card *card, int csr_offset, u32 value); =20 struct fw_iso_context * - (*allocate_iso_context)(struct fw_card *card, - int type, int channel, size_t header_size); + (*allocate_iso_context)(struct fw_card *card, int type, int channel, size= _t header_size, + size_t header_storage_size); void (*free_iso_context)(struct fw_iso_context *ctx); =20 int (*start_iso)(struct fw_iso_context *ctx, @@ -178,7 +178,7 @@ static inline struct fw_iso_context *fw_iso_mc_context_= create(struct fw_card *ca { union fw_iso_callback cb =3D { .mc =3D callback }; =20 - return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL,= 0, 0, 0, cb, + return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL,= 0, 0, 0, 0, cb, callback_data); } =20 diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 888c43940999..1c868c1e4a49 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -2755,7 +2755,7 @@ static void copy_iso_headers(struct iso_context *ctx,= const u32 *dma_hdr) { u32 *ctx_hdr; =20 - if (ctx->sc.header_length + ctx->base.header_size > PAGE_SIZE) { + if (ctx->sc.header_length + ctx->base.header_size > ctx->base.header_stor= age_size) { if (ctx->base.flags & FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS) return; flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERF= LOW); @@ -2924,7 +2924,7 @@ static int handle_it_packet(struct context *context, =20 sync_it_packet_for_cpu(context, d); =20 - if (ctx->sc.header_length + 4 > PAGE_SIZE) { + if (ctx->sc.header_length + 4 > ctx->base.header_storage_size) { if (ctx->base.flags & FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS) return 1; flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERF= LOW); @@ -2954,8 +2954,8 @@ static void set_multichannel_mask(struct fw_ohci *ohc= i, u64 channels) ohci->mc_channels =3D channels; } =20 -static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *ca= rd, - int type, int channel, size_t header_size) +static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *ca= rd, int type, int channel, + size_t header_size, size_t header_storage_size) { struct fw_ohci *ohci =3D fw_ohci(card); void *header __free(kvfree) =3D NULL; @@ -3016,7 +3016,7 @@ static struct fw_iso_context *ohci_allocate_iso_conte= xt(struct fw_card *card, =20 if (type !=3D FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { ctx->sc.header_length =3D 0; - header =3D kvmalloc(PAGE_SIZE, GFP_KERNEL); + header =3D kvmalloc(header_storage_size, GFP_KERNEL); if (!header) { ret =3D -ENOMEM; goto out; diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 71d5cc8f28ce..8bf568471588 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -558,12 +558,14 @@ struct fw_iso_context { int speed; int flags; size_t header_size; + size_t header_storage_size; union fw_iso_callback callback; void *callback_data; }; =20 struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int t= ype, int channel, - int speed, size_t header_size, union fw_iso_callback callback, void *cal= lback_data); + int speed, size_t header_size, size_t header_storage_size, + union fw_iso_callback callback, void *callback_data); int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels); int fw_iso_context_queue(struct fw_iso_context *ctx, struct fw_iso_packet *packet, @@ -578,7 +580,8 @@ static inline struct fw_iso_context *fw_iso_context_cre= ate(struct fw_card *card, { union fw_iso_callback cb =3D { .sc =3D callback }; =20 - return __fw_iso_context_create(card, type, channel, speed, header_size, c= b, callback_data); + return __fw_iso_context_create(card, type, channel, speed, header_size, P= AGE_SIZE, cb, + callback_data); } =20 /** --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 AA659230BDB; Sat, 17 Jan 2026 14:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660124; cv=none; b=jDbp/837pZNxXz99Ll9bnW0ovngXeEQY/GOugZUz9qiDT0DwVH42EDfsYSBst64lMfihTaLMijS9JZ7Srae4n0UbC8r5rnTlwQXIt2ulEGyfFrrinLB3OI0eSkDiYOI5SCNtrMxL5uX/TLRb3odxJWrl7H4VvsofAoVAidHEZEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660124; c=relaxed/simple; bh=fjZR6yargD3nDj94X9AMbJXU3XBRW4omxn7yGhrIu9g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OreWOAso1KYTqqK3FQuWXwww3W9DRRofrg6UuGTsdDwfdA/oyGnb5Tl80ng4enQGD8BWxfQ9ypjqks2ttE4zbluX4opckEWwm43+s8FHJpcEEZC+QhhlnfsJptqgKg+NDOIN1nq7ZpQgyYUek64VURA4SZnwxsobPfnKwcXbrUk= 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=ilY/IKmE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=QGhzMXmn; arc=none smtp.client-ip=202.12.124.157 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="ilY/IKmE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="QGhzMXmn" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 1FB1E7A0340; Sat, 17 Jan 2026 09:28:40 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sat, 17 Jan 2026 09:28:40 -0500 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=fm2; t=1768660119; x= 1768746519; bh=bmtKD0BMvRMurgFJtQDY2EADTGUqOWOcdT7XHkmQz0k=; b=i lY/IKmEmS03Z2SbgAKMtCmKtxea9Qn3jTpxkq0WZwZovOHuMtJTujwIkK3G7PWnw gsusw1kvoZQyCt9bErZQeYm7/fr1e/E+OgMzGJDD5NA0KpFph78emRVQKYnU5r/9 WXvwuIgeJYUW5t1D67KwH3MfZbOJvGo7G7IczBTIGJeNZLRb3GbgHwwdrjxMShb6 hXdLn5FZLyL8FwazpGu8WIMl6+aaB8MBbfy1+BjHa5l+4J9bYZZGXmSarTYxTjrG zwWz3P5FQt0u0h3xtUQdDEAi1FGAMI+lGzg/SHjPTmb398t096J8+fhaFWY/y/1Z hi8oUdrcTRXUDQEyPOxzg== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660119; x=1768746519; bh=b mtKD0BMvRMurgFJtQDY2EADTGUqOWOcdT7XHkmQz0k=; b=QGhzMXmndiYNzdtQX 3JNrKoHuSi8enxctRFiYA9lOtjmNyS8C5rOR3B6g9tAtLsQbJGWRsDa3ZELe19MF O2vBsZTGAWnsV/hoRzrdwUH1ozZb7m4tSY+mEng0vzqpcGeCOhdw2zXO0O3dNCyz QlaiRX0gx0kUEc8W4tlhhSF1dmVeYk6j0U5zMmmgk15qiazkILzcc3zetE6/lHiD kpW3iBXf1R002f3sOJ8Nmq9niyl8W0gJg8yiMHc7vYh8VOCX90Pfxk5bTFNMWD5X ptbK6kqSuEZThWQUAbfi7wC1fybD37l6vxIjFt4KoqRixlp92YbogOMY8JAZ/pNq ozNnA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:38 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 8/9] firewire: core: add fw_iso_context_create() variant with header storage size Date: Sat, 17 Jan 2026 23:28:21 +0900 Message-ID: <20260117142823.440811-9-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" This commit adds a new variant of fw_iso_context_create() that allows specifying the size of the isochronous context header storage at allocation time. Signed-off-by: Takashi Sakamoto --- include/linux/firewire.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 8bf568471588..986d712e4d94 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -584,6 +584,16 @@ static inline struct fw_iso_context *fw_iso_context_cr= eate(struct fw_card *card, callback_data); } =20 +static inline struct fw_iso_context *fw_iso_context_create_with_header_sto= rage_size( + struct fw_card *card, int type, int channel, int speed, size_t header_si= ze, + size_t header_storage_size, fw_iso_callback_t callback, void *callback_d= ata) +{ + union fw_iso_callback cb =3D { .sc =3D callback }; + + return __fw_iso_context_create(card, type, channel, speed, header_size, h= eader_storage_size, + cb, callback_data); +} + /** * fw_iso_context_schedule_flush_completions() - schedule work item to pro= cess isochronous context. * @ctx: the isochronous context --=20 2.51.0 From nobody Mon Feb 9 19:09:27 2026 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 7474C1D88AC; Sat, 17 Jan 2026 14:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660124; cv=none; b=bJfB0j2uBnATgUIbgIEeYTbr+TQwlXeI9zaIteAcb3YIKASD9p1xVy/dPGFakjwfX35kjRJBZTZCto7zNf9jYwN/BmNELs66T7INlpBnIJ5k7ZXx0/NGbX2aTmBSs5deEoPPUEs14aDhUEJl/umsHBBvlov1pKWuNN+US7H63U8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768660124; c=relaxed/simple; bh=FXDzsTyEDrOCDoe1FuBGPqltI1yoo6g4v8q8GdA+zi0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NumlhBF6/kUs48RfecVHyi3BLhOugpVZe9LWhBxughelqHehoPf2p6HSdTwY1vLkzT5XchnWLrGTF84YtfYS4U3Y6nDZX4N6/0iaklELJOVmXjWCNFms6/rRPyWUEHDpEHtBHpnXyDMwf1xcFwAX9tP1FjPB605UDLt69XpcqA0= 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=LYJ+Kf2C; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=zcW3RvX+; arc=none smtp.client-ip=202.12.124.149 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="LYJ+Kf2C"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="zcW3RvX+" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id AF16B1D002EB; Sat, 17 Jan 2026 09:28:41 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sat, 17 Jan 2026 09:28:41 -0500 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=fm2; t=1768660121; x= 1768746521; bh=EpU7s6MYPGtj7LZ20r796f5THbt7CSmvMGny3xKCmVQ=; b=L YJ+Kf2CFW42n3qvT5ItPotE/Rm1ae1ymqS8yXwATdJNTrmCTGmxNUy9CZwe0frgm UhCKOamq8hBSe00V0BWG+Ui29XfV3krb3szzKW6jES8yxsd8dDwFqiQFywU2hL7u ELovGAYdUuJtE4rOgLRsXdGUYUpOeORqHxnGbN6idW9uf6XbEwc98dL6cHyfg/0q J4Spr2HjihvWC/r9kDUmM4jhi+Lhmeaj12VaEq7hLQEKsDB0YP88DUPdiZdjBfce lveB1qNv3vFerEcjBVyVGuuvNaEnrEajVxqmIM+olSVY1DSeffLggLWGvCiBPt7h HSreNGBHxaLEwMynAAU0g== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768660121; x=1768746521; bh=E pU7s6MYPGtj7LZ20r796f5THbt7CSmvMGny3xKCmVQ=; b=zcW3RvX+fJg9w1fdQ d/DiNY7ROkEi23J2Q1iS50dIenLUfcrF8jbqUEUAWOJCn4TI+5XcbWYDTwmM1DWB R0Vb2PCu1/RdLhaiUYZQjnxm6Keylss7WbdahGUDOtO7Vc/SWq0+g9eZ9Za1FOup 85MnFqj2b8hLnbKc1qS1i8fI6pAGYqd2rxRZsvRj0PMbiNEn3jq8cYF8vNBxaZFD PZFscUrhIEt4B09fNmUZY1/zt0w98+deUU48sOG004dt+paX8qWshfEESIW2icCo Cee2zqeVDk5xxEs1nk9npNLs/7wrLWwI8Y3aAwB8HfAnMUJMP60yy2OmKG7qcZW/ EcLdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jan 2026 09:28:40 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 9/9] ALSA: firewire: remove PCM buffer size constraint from isoc context header Date: Sat, 17 Jan 2026 23:28:22 +0900 Message-ID: <20260117142823.440811-10-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260117142823.440811-1-o-takashi@sakamocchi.jp> References: <20260117142823.440811-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" In the IEC 61883-1/6 packet streaming engine, the isochronous context header stores CIP headers. Previously, the header storage was limited to PAGE_SIZE, which constrained the maximum PCM buffer size. There is a function with configurable header size. Now the limitation is removed. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 5cdc34877fc1..223c880af802 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -191,8 +191,6 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_st= ream *s, struct snd_pcm_runtime *runtime) { struct snd_pcm_hardware *hw =3D &runtime->hw; - unsigned int ctx_header_size; - unsigned int maximum_usec_per_period; int err; =20 hw->info =3D SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -212,21 +210,6 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_s= tream *s, hw->period_bytes_max =3D hw->period_bytes_min * 2048; hw->buffer_bytes_max =3D hw->period_bytes_max * hw->periods_min; =20 - // Linux driver for 1394 OHCI controller voluntarily flushes isoc - // context when total size of accumulated context header reaches - // PAGE_SIZE. This kicks work for the isoc context and brings - // callback in the middle of scheduled interrupts. - // Although AMDTP streams in the same domain use the same events per - // IRQ, use the largest size of context header between IT/IR contexts. - // Here, use the value of context header in IR context is for both - // contexts. - if (!(s->flags & CIP_NO_HEADER)) - ctx_header_size =3D IR_CTX_HEADER_SIZE_CIP; - else - ctx_header_size =3D IR_CTX_HEADER_SIZE_NO_CIP; - maximum_usec_per_period =3D USEC_PER_SEC * PAGE_SIZE / - CYCLES_PER_SECOND / ctx_header_size; - // In IEC 61883-6, one isoc packet can transfer events up to the value // of syt interval. This comes from the interval of isoc cycle. As 1394 // OHCI controller can generate hardware IRQ per isoc packet, the @@ -239,9 +222,10 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_s= tream *s, // Due to the above protocol design, the minimum PCM frames per // interrupt should be double of the value of syt interval, thus it is // 250 usec. + // There is no reason, but up to 250 msec to avoid consuming resources so= much. err =3D snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, - 250, maximum_usec_per_period); + 250, USEC_PER_SEC / 4); if (err < 0) goto end; =20 @@ -261,6 +245,7 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_st= ream *s, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) goto end; + err =3D snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, apply_constraint_to_size, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, @@ -1715,7 +1700,9 @@ static int amdtp_stream_start(struct amdtp_stream *s,= int channel, int speed, } else { dir =3D DMA_TO_DEVICE; type =3D FW_ISO_CONTEXT_TRANSMIT; - ctx_header_size =3D 0; // No effect for IT context. + // Although no effect for IT context, this value is required to compute = the size + // of header storage correctly. + ctx_header_size =3D sizeof(__be32); } max_ctx_payload_size =3D amdtp_stream_get_max_ctx_payload_size(s); =20 @@ -1724,9 +1711,9 @@ static int amdtp_stream_start(struct amdtp_stream *s,= int channel, int speed, return err; s->queue_size =3D queue_size; =20 - s->context =3D fw_iso_context_create(fw_parent_device(s->unit)->card, - type, channel, speed, ctx_header_size, - amdtp_stream_first_callback, s); + s->context =3D fw_iso_context_create_with_header_storage_size( + fw_parent_device(s->unit)->card, type, channel, speed, ctx_header_size, + ctx_header_size * queue_size, amdtp_stream_first_callback, s); if (IS_ERR(s->context)) { err =3D PTR_ERR(s->context); if (err =3D=3D -EBUSY) --=20 2.51.0