summaryrefslogtreecommitdiff
path: root/drivers/firewire
AgeCommit message (Collapse)Author
2026-06-13firewire: core: Open-code topology list walkKaitao Cheng
A later change will make list_for_each_entry() cache the next element before entering the loop body. for_each_fw_node() intentionally appends newly discovered child nodes to the temporary walk list while the list is being traversed. Keep the loop open-coded so the next node is looked up only after children have been appended. This preserves the current breadth-first traversal semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Link: https://lore.kernel.org/r/20260609061347.93688-3-kaitao.cheng@linux.dev Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-21firewire: core: cancel using delayed work for iso_resource_once managementTakashi Sakamoto
There is no need to use deferrable type of work for iso_resource_once management because the work is queued to run immediately. Link: https://lore.kernel.org/r/20260520130840.629934-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-21firewire: core: rename member name for channel mask of isoc resourceTakashi Sakamoto
The iso_resource_params structure has a member for channel mask, while the name of field is easy to misinterpret. Append _mask to the member name. Link: https://lore.kernel.org/r/20260520130840.629934-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-21firewire: core: minor code refactoring for case-dependent parameters of iso ↵Takashi Sakamoto
resources management The generation parameter is specific to the auto case of iso resources management, while it is in the common parameter structure. Move the generation member to the structure specific to auto case. Link: https://lore.kernel.org/r/20260520130840.629934-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-03firewire: core: move allocation/reallocation paths into specific branch ↵Takashi Sakamoto
after isoc resource management in cdev After managing the actual isochronous resources, there is post-processing logic to determine what type of event should be notified. However, there is room for improvement. This commit refactors the logic. Link: https://lore.kernel.org/r/20260501135823.241940-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-03firewire: core: refactor notification type determination after isoc resource ↵Takashi Sakamoto
management in cdev After managing the actual isochronous resources, there is post-processing logic to determine what type of event should be notified. However, there is room for improvement. This commit refactors the logic. Link: https://lore.kernel.org/r/20260501135823.241940-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-03firewire: core: use switch statement for post-processing of isoc resource ↵Takashi Sakamoto
management in cdev The iso_resource_auto structure object has three states. The current implementation of state evaluation before managing the actual isochronous resources can be improved. This commit refactors the evaluation logic using a switch statement. Link: https://lore.kernel.org/r/20260501135823.241940-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-05-03firewire: core: reduce critical section duration in pre-processing of isoc ↵Takashi Sakamoto
resource management in cdev It is preferable for the critical section to be as small as possible. Current implementation of iso_resource_auto_work() function uses a spinlock to control concurrent access to members of fw_card, fw_device, iso_resource_auto structures, however the locking duration could be reduced. This commit refactors to shorten that duration. Link: https://lore.kernel.org/r/20260501135823.241940-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: code cleanup for iso resource auto creationTakashi Sakamoto
The init_iso_resource function is only called by ioctl_allocate_iso_resource(), thus no need to be unique. This commit unifies them with minor code refactoring. Link: https://lore.kernel.org/r/20260429093449.160545-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: append _auto suffix for non-once iso resource operationsTakashi Sakamoto
The functions for iso_resource once operations are carefully split from another type of operation. This commit adds _auto suffix to functions for the another type so that it is easily to distinguish them. Link: https://lore.kernel.org/r/20260429093449.160545-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: code cleanup to remove old implementations for once operationTakashi Sakamoto
The helper functions for iso_resource allocation and work item still include codes for once operation. This commit refactors them to remove the old implementations. Link: https://lore.kernel.org/r/20260429093449.160545-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: split functions for iso_resource once operationTakashi Sakamoto
Unlike FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE operation, the operations of FW_CDEV_IOC_[DE]ALLOCATE_ISO_RESOURCE_ONCE require no client resource, thus they keeps no handle value. This commit adds the series of functions to separate these operations, according to divide-and-conquer methodology. Link: https://lore.kernel.org/r/20260429093449.160545-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: code refactoring for helper function to fill iso_resource ↵Takashi Sakamoto
parameters This change is a preparation for future changes. The added helper function will be reused in the changes to fill iso_resource parameters according to the users' request. Link: https://lore.kernel.org/r/20260429093449.160545-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: code refactoring to queue work item for iso_resourceTakashi Sakamoto
The add_client_resource() function checks the type of client resource every time to be called. If the type is for iso_resource, it schedules work item. However, the iso_resource client resource is only added by the call of init_iso_resource(). There is no need to check the type every time adding any client resource. Link: https://lore.kernel.org/r/20260429093449.160545-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-04-29firewire: core: code refactoring for early return at client resource allocationTakashi Sakamoto
The add_client_resource() function returns zero at success or negative value at error. The critical section is already protected by scoped_guard() macro. In this case, the programming pattern of early return improves code readability. Link: https://lore.kernel.org/r/20260429093449.160545-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-03-16bonding: prevent potential infinite loop in bond_header_parse()Eric Dumazet
bond_header_parse() can loop if a stack of two bonding devices is setup, because skb->dev always points to the hierarchy top. Add new "const struct net_device *dev" parameter to (struct header_ops)->parse() method to make sure the recursion is bounded, and that the final leaf parse method is called. Fixes: 950803f72547 ("bonding: fix type confusion in bond_setup_by_slave()") Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jiayuan Chen <jiayuan.chen@shopee.com> Tested-by: Jiayuan Chen <jiayuan.chen@shopee.com> Cc: Jay Vosburgh <jv@jvosburgh.net> Cc: Andrew Lunn <andrew+netdev@lunn.ch> Link: https://patch.msgid.link/20260315104152.1436867-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-02-28firewire: ohci: initialize page array to use alloc_pages_bulk() correctlyTakashi Sakamoto
The call of alloc_pages_bulk() skips to fill entries of page array when the entries already have values. While, 1394 OHCI PCI driver passes the page array without initializing. It could cause invalid state at PFN validation in vmap(). Fixes: f2ae92780ab9 ("firewire: ohci: split page allocation from dma mapping") Reported-by: John Ogness <john.ogness@linutronix.de> Reported-and-tested-by: Harald Arnesen <linux@skogtun.org> Reported-and-tested-by: David Gow <david@davidgow.net> Closes: https://lore.kernel.org/lkml/87tsv1vig5.fsf@jogness.linutronix.de/ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-22Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesKees Cook
Conversion performed via this Coccinelle script: // SPDX-License-Identifier: GPL-2.0-only // Options: --include-headers-for-types --all-includes --include-headers --keep-comments virtual patch @gfp depends on patch && !(file in "tools") && !(file in "samples")@ identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex, kzalloc_obj,kzalloc_objs,kzalloc_flex, kvmalloc_obj,kvmalloc_objs,kvmalloc_flex, kvzalloc_obj,kvzalloc_objs,kvzalloc_flex}; @@ ALLOC(... - , GFP_KERNEL ) $ make coccicheck MODE=patch COCCI=gfp.cocci Build and boot tested x86_64 with Fedora 42's GCC and Clang: Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21Convert 'alloc_flex' family to use the new default GFP_KERNEL argumentLinus Torvalds
This is the exact same thing as the 'alloc_obj()' version, only much smaller because there are a lot fewer users of the *alloc_flex() interface. As with alloc_obj() version, this was done entirely with mindless brute force, using the same script, except using 'flex' in the pattern rather than 'objs*'. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentLinus Torvalds
This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21treewide: Replace kmalloc with kmalloc_obj for non-scalar typesKees Cook
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-12Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds
Pull SCSI updates from James Bottomley: "Usual driver updates (qla2xxx, mpi3mr, mpt3sas, ufs) plus assorted cleanups and fixes. The biggest core change is the massive code motion in the sd driver to remove forward declarations and the most significant change is to enumify the queuecommand return" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (78 commits) scsi: csiostor: Fix dereference of null pointer rn scsi: buslogic: Reduce stack usage scsi: ufs: host: mediatek: Require CONFIG_PM scsi: ufs: mediatek: Fix page faults in ufs_mtk_clk_scale() trace event scsi: smartpqi: Fix memory leak in pqi_report_phys_luns() scsi: mpi3mr: Make driver probing asynchronous scsi: ufs: core: Flush exception handling work when RPM level is zero scsi: efct: Use IRQF_ONESHOT and default primary handler scsi: ufs: core: Use a host-wide tagset in SDB mode scsi: qla2xxx: target: Add WQ_PERCPU to alloc_workqueue() users scsi: qla2xxx: Add WQ_PERCPU to alloc_workqueue() users scsi: qla4xxx: Add WQ_PERCPU to alloc_workqueue() users scsi: mpi3mr: Driver version update to 8.17.0.3.50 scsi: mpi3mr: Fixed the W=1 compilation warning scsi: mpi3mr: Record and report controller firmware faults scsi: mpi3mr: Update MPI Headers to revision 39 scsi: mpi3mr: Use negotiated link rate from DevicePage0 scsi: mpi3mr: Avoid redundant diag-fault resets scsi: mpi3mr: Rename log data save helper to reflect threaded/BH context scsi: mpi3mr: Add module parameter to control threaded IRQ polling ...
2026-02-11Merge tag 'firewire-updates-7.0' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394 Pull firewire updates from Takashi Sakamoto: - Refactor page allocation dedicated to 1394 OHCI IR/IT/AR DMA contexts Although 1394 OHCI specification does not impose any restriction on the memory size dedicated to these DMA contexts, 1394 OHCI PCI driver allocates pages for convenience when mapping them into either kernel space or userspace VMA. The driver previously used dma_alloc_pages() for both page allocation and mapping creation, even though this kernel API is rarely used. Following discussions questioning the page-oriented kernel API in the DMA layer, the driver has been refactored to avoid using this API. In addition, the use of private members in the allocated pages has been removed following long-standing concern. - Allocate variable-sized buffer for isochronous context header 1394 OHCI PCI driver previously allocated a single page for isochronous context header. As a result, the buffer size for the header was fixed to PAGE_SIZE, which imposed a limitation on IEC 61883-1/6 packet streaming engine. Consequently, the ALSA PCM devices provided by drivers for audio and music units in IEEE 1394 bus were constrained in the maximum size of buffer period (64 ms in most cases). This limitation is resolved by dynamically allocating the header buffer with an arbitrary size. * tag 'firewire-updates-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: ALSA: firewire: remove PCM buffer size constraint from isoc context header firewire: core: add fw_iso_context_create() variant with header storage size firewire: core: provide isoc header buffer size outside card driver firewire: ohci: allocate isoc context header by kvmalloc() firewire: core: add flags member for isochronous context structure firewire: ohci: use cleanup helper for isoc context header allocation firewire: ohci: code refactoring to use union for isoc multiple channel state firewire: ohci: refactor isoc single-channel state using a union firewire: core: add function variants for isochronous context creation firewire: ohci: fix index of pages for dma address to 1394 OHCI IT context firewire: ohci: stop using page private to store DMA mapping address firewire: ohci: split page allocation from dma mapping firewire: ohci: use MAX macro to guarantee minimum count of pages for AR contexts firewire: core: stop using page private to store DMA mapping address firewire: core: use common kernel API to allocate and release a batch of pages firewire: core: code refactoring with cleanup function for isoc pages firewire: core: use mutex instead of spinlock for client isochronous context firewire: core: move private function declaration from public header to internal header
2026-01-29firewire: core: fix race condition against transaction listTakashi Sakamoto
The list of transaction is enumerated without acquiring card lock when processing AR response event. This causes a race condition bug when processing AT request completion event concurrently. This commit fixes the bug by put timer start for split transaction expiration into the scope of lock. The value of jiffies in card structure is referred before acquiring the lock. Cc: stable@vger.kernel.org # v6.18 Fixes: b5725cfa4120 ("firewire: core: use spin lock specific to timer for split transaction") Reported-by: Andreas Persson <andreasp56@outlook.com> Closes: https://github.com/alsa-project/snd-firewire-ctl-services/issues/209 Tested-by: Andreas Persson <andreasp56@outlook.com> Link: https://lore.kernel.org/r/20260127223413.22265-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-23scsi: Change the return type of the .queuecommand() callbackBart Van Assche
In clang version 21.1 and later the -Wimplicit-enum-enum-cast warning option has been introduced. This warning is enabled by default and can be used to catch .queuecommand() implementations that return another value than 0 or one of the SCSI_MLQUEUE_* constants. Hence this patch that changes the return type of the .queuecommand() implementations from 'int' into 'enum scsi_qc_status'. No functionality has been changed. Cc: Damien Le Moal <dlemoal@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20260115210357.2501991-6-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2026-01-18firewire: core: provide isoc header buffer size outside card driverTakashi Sakamoto
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. Link: https://lore.kernel.org/r/20260117142823.440811-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-18firewire: ohci: allocate isoc context header by kvmalloc()Takashi Sakamoto
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. Link: https://lore.kernel.org/r/20260117142823.440811-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-18firewire: core: add flags member for isochronous context structureTakashi Sakamoto
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. Link: https://lore.kernel.org/r/20260117142823.440811-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-18firewire: ohci: use cleanup helper for isoc context header allocationTakashi Sakamoto
Some cleanup helpers are useful in error path after memory allocation for header storage. Link: https://lore.kernel.org/r/20260117142823.440811-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-18firewire: ohci: code refactoring to use union for isoc multiple channel stateTakashi Sakamoto
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. Link: https://lore.kernel.org/r/20260117142823.440811-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-18firewire: ohci: refactor isoc single-channel state using a unionTakashi Sakamoto
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. Link: https://lore.kernel.org/r/20260117142823.440811-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-18firewire: core: add function variants for isochronous context creationTakashi Sakamoto
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. Link: https://lore.kernel.org/r/20260117142823.440811-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-15firewire: ohci: fix index of pages for dma address to 1394 OHCI IT contextTakashi Sakamoto
The index of pages for dma address was changed wrongly. This commit corrents it. Fixes: ef6bdffbb88d ("firewire: core: stop using page private to store DMA mapping address") Link: https://lore.kernel.org/r/20260114131729.16133-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: ohci: stop using page private to store DMA mapping addressTakashi Sakamoto
There is a long discussion about the use of private field in page structure between Linux kernel developers. This commit stop using page private to store DMA mapping address for AR context, to prepare for mm future change. Link: https://lore.kernel.org/r/20260110013911.19160-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: ohci: split page allocation from dma mappingTakashi Sakamoto
1394 OHCI PCI driver had long been the only user of dma_alloc_pages(). Although tee subsystem recently started using it, they are still a few users of the infrequently-used function. In the discussion for dma-mapping function, Jason Gunthorpe shows his opinion about the design of public API for the function. According to it, the users provide physical address to the function, then receive DMA mapping address, regardless of the location of mapping target. With the above aspects, this commit eliminates the use of dma_alloc_pages() from this subsystem. Link: https://lore.kernel.org/lkml/20250905174324.GI616306@nvidia.com/ Link: https://lore.kernel.org/r/20260110013911.19160-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: ohci: use MAX macro to guarantee minimum count of pages for AR ↵Takashi Sakamoto
contexts The computation of page size for AR DMA context can be simplified by MAX macro. Link: https://lore.kernel.org/r/20260110013911.19160-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: core: stop using page private to store DMA mapping addressTakashi Sakamoto
There is a long discussion about the use of private field in page structure between Linux kernel developers. This commit stop using page private to store DMA mapping address for isochronous context, to prepare for mm future change. Link: https://lore.kernel.org/r/20260110013911.19160-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: core: use common kernel API to allocate and release a batch of pagesTakashi Sakamoto
The pair of alloc_pages_bulk() and release_pages() are convenient to allocate and release a batch of pages. This commit utilizes the pair to maintain pages for isochronous DMA context. Link: https://lore.kernel.org/r/20260110013911.19160-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: core: code refactoring with cleanup function for isoc pagesTakashi Sakamoto
This commit refactors the implementation to allocate pages for isochronous DMA contexts with cleanup function. Link: https://lore.kernel.org/r/20260110013911.19160-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: core: use mutex instead of spinlock for client isochronous contextTakashi Sakamoto
There is a restriction that the userspace client associated to a file descriptor can hold one isochronous context. The client-level spinning lock is used to guarantee it, however the lock is also used for multi-purposes. Additionally, there is no need to use this type of lock, and the mutex is available, instead. Link: https://lore.kernel.org/r/20260110013911.19160-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2026-01-12firewire: core: move private function declaration from public header to ↵Takashi Sakamoto
internal header The fw_iso_buffer_lookup function is used by core module only, thus no need to describe its prototype in kernel internal header. Link: https://lore.kernel.org/r/20260110013911.19160-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-12-26firewire: nosy: Fix dma_free_coherent() sizeThomas Fourier
It looks like the buffer allocated and mapped in add_card() is done with size RCV_BUFFER_SIZE which is 16 KB and 4KB. Fixes: 286468210d83 ("firewire: new driver: nosy - IEEE 1394 traffic sniffer") Co-developed-by: Thomas Fourier <fourier.thomas@gmail.com> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com> Co-developed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20251216165420.38355-2-fourier.thomas@gmail.com Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-12-04Merge tag 'firewire-updates-6.19' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394 Pull firewire updates from Takashi Sakamoto: "This includes two changes for core functions, which affects all use cases of this subsystem: - Handle per-device interoperability quirks Some devices have quirks affecting interoperability. To identify such quirks at an early stages of device detection, the step for reading the configuration ROM contents has been changed. As a side effect, the entire detection process is now performed at the basic transaction speed (S100), without a trial to probe higher supported speeds. With this change, the following devices should now work with fewer issues: - TASCAM FW-1884, FW-1804, and FW-1082 - MOTU Audio Express - Safer removals of host card There was a race condition between host card removal and handling of bus reset events in the workqueue. This appears to be a long standing issue, and recent changes to use more workqueues escalate it. To solve it, a new callback has been added to the 1394 OHCI PCI driver to unregister the interrupt sources and wait for workqueue completions when removing a card instance" * tag 'firewire-updates-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: firewire: core: abort pending transactions at card removal firewire: core: add WQ_UNBOUND to alloc_workqueue users firewire: core: clear sources of hardware interrupt at card removal firewire: core: code refactoring to find and pop transaction entry firewire: core: code refactoring to remove transaction entry firewire: core: use cleanup function to release cached configuration ROM ALSA: firewire-tascam: reserve resources for transferred isochronous packets at S400 firewire: core: handle device quirk of TASCAM FW-1884/FW-1804/FW-1082 firewire: core: determine transaction speed after detecting quirks firewire: core: code refactoring to compute transaction speed firewire: core: handle device quirk of MOTU Audio Express firewire: core: detect device quirk when reading configuration ROM
2025-11-16firewire: core: fix to update generation field in topology mapTakashi Sakamoto
The generation field of topology map is updated after initialized by zero. The updated value of generation field is always zero, and is against specification. This commit fixes the bug. Fixes: 7d138cb269db ("firewire: core: use spin lock specific to topology map") Link: https://lore.kernel.org/r/20251114144421.415278-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-11-14firewire: core: Initialize topology_map.lockVille Syrjälä
Lockdep barfs on the new uninitialized spinlock. Initialize it. protip: enable lockdep (CONFIG_PROVE_LOCKING=y) when doing locking changes firewire_ohci 0000:02:01.1: added OHCI v1.10 device as card 0, 4 IR + 4 IT contexts, quirks 0x11 INFO: trying to register non-static key. The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator. CPU: 0 UID: 0 PID: 1042 Comm: irq/17-firewire Not tainted 6.17.0-rc2-cl-bisect2-00026-g7d138cb269db #136 PREEMPT Hardware name: Dell Inc. Latitude E5400 /0D695C, BIOS A19 06/13/2013 Call Trace: <TASK> dump_stack_lvl+0x6d/0xa0 register_lock_class+0x783/0x790 ? find_held_lock+0x2b/0x80 ? __mod_timer+0x110/0x320 ? __mod_timer+0x110/0x320 __lock_acquire+0x405/0x2600 lock_acquire+0xca/0x2e0 ? fw_core_handle_bus_reset+0x888/0xca0 [firewire_core] ? fw_core_handle_bus_reset+0x878/0xca0 [firewire_core] ? fw_core_handle_bus_reset+0x878/0xca0 [firewire_core] _raw_spin_lock+0x2e/0x40 ? fw_core_handle_bus_reset+0x888/0xca0 [firewire_core] fw_core_handle_bus_reset+0x888/0xca0 [firewire_core] handle_selfid_complete_event+0x35c/0x7a0 [firewire_ohci] ? irq_thread+0x8d/0x280 irq_thread_fn+0x18/0x50 irq_thread+0x15a/0x280 ? irq_check_status_bit+0x100/0x100 ? lockdep_hardirqs_on+0x78/0x100 ? irq_finalize_oneshot.part.0+0xc0/0xc0 ? irq_forced_thread_fn+0x60/0x60 kthread+0x114/0x200 ? kthreads_online_cpu+0x110/0x110 ret_from_fork+0x158/0x1e0 ? kthreads_online_cpu+0x110/0x110 ret_from_fork_asm+0x11/0x20 </TASK> Reported-by: Erhard Furtner <erhard_f@mailbox.org> Fixes: 7d138cb269db ("firewire: core: use spin lock specific to topology map") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-11-14firewire: core: abort pending transactions at card removalTakashi Sakamoto
IEEE 1394 defines the split, concatenated, and unified transaction. To support the split transaction, core function uses linked list to maintain the transactions waiting for acknowledge packet. After clearing sources of hardware interrupts, the acknowledge packet is no longer handled, therefore it is required to abort the pending transactions. This commit executes callback with RCODE_CANCELLED for the pending transactions at card removal. Link: https://lore.kernel.org/r/20251111223834.311287-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-11-12firewire: core: add WQ_UNBOUND to alloc_workqueue usersMarco Crivellari
Currently if a user enqueues a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND. This lack of consistency cannot be addressed without refactoring the API. alloc_workqueue() treats all queues as per-CPU by default, while unbound workqueues must opt-in via WQ_UNBOUND. This default is suboptimal: most workloads benefit from unbound queues, allowing the scheduler to place worker threads where they’re needed and reducing noise when CPUs are isolated. This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") This change adds the WQ_UNBOUND flag to explicitly request alloc_workqueue() to be unbound, because this specific workload has no benefit being per-cpu. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND must now use WQ_PERCPU. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. Suggested-by: Tejun Heo <tj@kernel.org> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com> Link: https://lore.kernel.org/r/20251112120125.124578-1-marco.crivellari@suse.com Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-11-09firewire: core: clear sources of hardware interrupt at card removalTakashi Sakamoto
Due to the factors external to the system, hardware events may still be handled while a card instance is being removed. The sources of hardware IRQs should be cleared during card removal so that workqueues can be safely destroyed. This commit adds a disable callback to the underlying driver operations. After this callback returns, the underlying driver guarantees that it will no longer handle hardware events. Link: https://lore.kernel.org/r/20251109065525.163464-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-11-01firewire: core: code refactoring to find and pop transaction entryTakashi Sakamoto
The list operation to find and pop transaction entry appears several times in transaction implementation, and can be replaced with a helper functional macro. Link: https://lore.kernel.org/r/20251101102131.925071-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2025-11-01firewire: core: code refactoring to remove transaction entryTakashi Sakamoto
The list operation to remove transaction entry appears several times in transaction implementation and can be replaced with a helper function. Link: https://lore.kernel.org/r/20251101102131.925071-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>