[PATCH 0/2] ufs: Rework pci_device_id initialization

Uwe Kleine-König (The Capable Hub) posted 2 patches 1 month, 1 week ago
drivers/ufs/host/tc-dwc-g210-pci.c |  4 ++--
drivers/ufs/host/ufshcd-pci.c      | 29 ++++++++++++++---------------
2 files changed, 16 insertions(+), 17 deletions(-)
[PATCH 0/2] ufs: Rework pci_device_id initialization
Posted by Uwe Kleine-König (The Capable Hub) 1 month, 1 week ago
Hello,

the patches in this series adapt the pci_device_id arrays of two ufs
drivers. These are preparing a change for making struct
pci_device_id::driver_data an anonymous union (similar to
https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@baylibre.com/).
This requires named initializers for .driver_data. But even without that
this is a nice cleanup making the array better readable and consistent.

The benefit for the union is that it allows to do:

-	{ PCI_VDEVICE(REDHAT, 0x0013), .driver_data = (kernel_ulong_t)&ufs_qemu_hba_vops },
+	{ PCI_VDEVICE(REDHAT, 0x0013), .driver_data_ptr = &ufs_qemu_hba_vops },

and

-	hba->vops = (struct ufs_hba_variant_ops *)id->driver_data;
+	hba->vops = id->driver_data_ptr;

. This involves less casting and thus makes usage of driver_data a bit
more type safe. And this will make it obvious that the ufshcd-pci driver
lacks a few consts.

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (2):
  ufs: tc-dwc-g210-pci: Simplify initialization of pci_device_id array
  ufs: ufshcd-pci: Use PCI_VDEVICE and named initializers for pci array

 drivers/ufs/host/tc-dwc-g210-pci.c |  4 ++--
 drivers/ufs/host/ufshcd-pci.c      | 29 ++++++++++++++---------------
 2 files changed, 16 insertions(+), 17 deletions(-)


base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3

Re: [PATCH 0/2] ufs: Rework pci_device_id initialization
Posted by Martin K. Petersen 3 weeks ago
On Tue, 05 May 2026 10:25:43 +0200, Uwe Kleine-König (The Capable Hub) wrote:

> the patches in this series adapt the pci_device_id arrays of two ufs
> drivers. These are preparing a change for making struct
> pci_device_id::driver_data an anonymous union (similar to
> https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@baylibre.com/).
> This requires named initializers for .driver_data. But even without that
> this is a nice cleanup making the array better readable and consistent.
> 
> [...]

Applied to 7.2/scsi-queue, thanks!

[1/2] ufs: tc-dwc-g210-pci: Simplify initialization of pci_device_id array
      https://git.kernel.org/mkp/scsi/c/2a18c57560f4
[2/2] ufs: ufshcd-pci: Use PCI_VDEVICE and named initializers for pci array
      https://git.kernel.org/mkp/scsi/c/8ef4c72dbbfd

-- 
Martin K. Petersen
Re: [PATCH 0/2] ufs: Rework pci_device_id initialization
Posted by Martin K. Petersen 4 weeks, 1 day ago
Uwe,

> the patches in this series adapt the pci_device_id arrays of two ufs
> drivers. These are preparing a change for making struct
> pci_device_id::driver_data an anonymous union (similar to
> https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@baylibre.com/).
> This requires named initializers for .driver_data. But even without
> that this is a nice cleanup making the array better readable and
> consistent.

Applied to 7.2/scsi-staging, thanks!

-- 
Martin K. Petersen