[Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] [FROMLIST] PCI: switchtec: backport upstream fixes and Gen6 support#1745
Conversation
[Upstream commit f2543da] Replace lock/unlock pairs with guards to simplify and tidy up the code. Generated-by: Coccinelle SmPL Signed-off-by: Erick Karanja <karanja99erick@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20250828093556.810911-1-karanja99erick@gmail.com Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
[Upstream commit 8a74e4e] Now that the driver core allows for struct class to be in read-only memory, we should make all 'class' structures declared at build time placing them into read-only memory, instead of having to be dynamically allocated at runtime. Link: https://lore.kernel.org/r/2024061053-online-unwound-b173@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-By: Logan Gunthorpe <logang@deltatee.com> Cc: Kurt Schwemmer <kurt.schwemmer@microsemi.com> Cc: Jon Mason <jdmason@kudzu.us> Cc: Allen Hubbe <allenbh@gmail.com> Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Add device IDs for the next generation of switchtec products. No changes to the driver were required with the new version of the hardware. [logang: rewrote commit message] Signed-off-by: Ben Reed <Ben.Reed@microchip.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20260505161633.67454-1-logang@deltatee.com Link: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=next&id=5e6c21c56998e1e58d2f314e70779989ea0fee5d Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Reviewer's GuideBackports upstream improvements to the PCI switchtec driver by converting manual mutex handling to guard helpers, making the switchtec device class a static const and adjusting registration accordingly, and adding Gen6 support via new enum and PCI Device IDs, plus wiring the NTB switchtec interface to the new class definition. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Backports three upstream PCI switchtec driver patches to the 6.18.y tree: a refactor to use guard()/scoped_guard() mutex helpers, conversion of switchtec_class to a constant struct class, and addition of Gen6 device IDs.
Changes:
- Replace manual
mutex_lock/mutex_unlockpairs withguard(mutex)andscoped_guard(mutex)inmrpc_event_work()andstdev_kill(). - Convert
switchtec_classfrom a dynamically allocatedstruct class *to a statically definedconst struct class, and update the dependent NTB driver accordingly. - Add
SWITCHTEC_GEN6enum value and 16 new Gen6 PCI device IDs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| include/linux/switchtec.h | Adds SWITCHTEC_GEN6 enum value and changes switchtec_class declaration to const struct class. |
| drivers/pci/switch/switchtec.c | Replaces manual mutex locking with guard helpers, statically defines switchtec_class, and registers new Gen6 device IDs. |
| drivers/ntb/hw/mscc/ntb_hw_switchtec.c | Updates NTB driver to use the address of the new static switchtec_class. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR backports three upstream PCI switchtec driver patches:
PCI: switchtec: Replace manual locks with guard
Replace lock/unlock pairs with guards to simplify and tidy up the code.
PCI: switchtec: Make switchtec_class constant
Place 'class' structures into read-only memory instead of dynamically
allocating them at runtime.
PCI: switchtec: Add Gen6 Device IDs
Add device IDs for the next generation of switchtec products.
No driver changes were required for the new hardware version.
Summary by Sourcery
Backport upstream improvements to the PCI switchtec driver, including const-ifying its device class, adopting scoped mutex guards, and adding support for Gen6 devices.
New Features:
Enhancements: