[PATCH v2 15/15] ASoC: Intel: sst: Convert to PCI device IDs defines

Amadeusz Sławiński posted 15 patches 2 years, 6 months ago
There is a newer version of this series
[PATCH v2 15/15] ASoC: Intel: sst: Convert to PCI device IDs defines
Posted by Amadeusz Sławiński 2 years, 6 months ago
Use PCI device IDs from pci_ids.h header.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/soc/intel/atom/sst/sst.c     | 7 ++++---
 sound/soc/intel/atom/sst/sst.h     | 3 ---
 sound/soc/intel/atom/sst/sst_pci.c | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c
index a0d29510d2bc..74614f9b086a 100644
--- a/sound/soc/intel/atom/sst/sst.c
+++ b/sound/soc/intel/atom/sst/sst.c
@@ -16,6 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/firmware.h>
+#include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
 #include <linux/async.h>
@@ -174,9 +175,9 @@ int sst_driver_ops(struct intel_sst_drv *sst)
 {
 
 	switch (sst->dev_id) {
-	case SST_MRFLD_PCI_ID:
-	case SST_BYT_ACPI_ID:
-	case SST_CHV_ACPI_ID:
+	case PCI_DEVICE_ID_INTEL_SST_TNG:
+	case PCI_DEVICE_ID_INTEL_SST_BYT:
+	case PCI_DEVICE_ID_INTEL_SST_CHV:
 		sst->tstamp = SST_TIME_STAMP_MRFLD;
 		sst->ops = &mrfld_ops;
 		return 0;
diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h
index 4d37d39fd8f4..eab374bf0066 100644
--- a/sound/soc/intel/atom/sst/sst.h
+++ b/sound/soc/intel/atom/sst/sst.h
@@ -20,9 +20,6 @@
 
 /* driver names */
 #define SST_DRV_NAME "intel_sst_driver"
-#define SST_MRFLD_PCI_ID 0x119A
-#define SST_BYT_ACPI_ID	0x80860F28
-#define SST_CHV_ACPI_ID	0x808622A8
 
 #define SST_SUSPEND_DELAY 2000
 #define FW_CONTEXT_MEM (64*1024)
diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
index 4058b4f80a0c..7ed142bb3dc0 100644
--- a/sound/soc/intel/atom/sst/sst_pci.c
+++ b/sound/soc/intel/atom/sst/sst_pci.c
@@ -32,7 +32,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
 
 	/* map registers */
 	/* DDR base */
-	if (ctx->dev_id == SST_MRFLD_PCI_ID) {
+	if (ctx->dev_id == PCI_DEVICE_ID_INTEL_SST_TNG) {
 		ctx->ddr_base = pci_resource_start(pci, 0);
 		/* check that the relocated IMR base matches with FW Binary */
 		ddr_base = relocate_imr_addr_mrfld(ctx->ddr_base);
@@ -173,7 +173,7 @@ static void intel_sst_remove(struct pci_dev *pci)
 
 /* PCI Routines */
 static const struct pci_device_id intel_sst_ids[] = {
-	{ PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0},
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SST_TNG), 0},
 	{ 0, }
 };
 
-- 
2.34.1

Re: [PATCH v2 15/15] ASoC: Intel: sst: Convert to PCI device IDs defines
Posted by Andy Shevchenko 2 years, 6 months ago
On Fri, Jul 14, 2023 at 08:56:15PM +0200, Amadeusz Sławiński wrote:
> Use PCI device IDs from pci_ids.h header.

Perhaps one more sentence to explain why this is okay change, like:
"The ACPI IDs are used only internally and lower 16 bits uniquely define
 the device as vendor ID for Intel is 8086 for all of them."

Suggested-by: ?

...

> -	{ PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0},
> +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SST_TNG), 0},

That 0 is not needed, OTOH you may use PCI_DEVICE_DATA(..., 0).

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH v2 15/15] ASoC: Intel: sst: Convert to PCI device IDs defines
Posted by Andy Shevchenko 2 years, 6 months ago
On Fri, Jul 14, 2023 at 02:26:45PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 14, 2023 at 08:56:15PM +0200, Amadeusz Sławiński wrote:
> > Use PCI device IDs from pci_ids.h header.
> 
> Perhaps one more sentence to explain why this is okay change, like:
> "The ACPI IDs are used only internally and lower 16 bits uniquely define
>  the device as vendor ID for Intel is 8086 for all of them."
> 
> Suggested-by: ?
> 
> ...
> 
> > -	{ PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0},
> > +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SST_TNG), 0},
> 
> That 0 is not needed, OTOH you may use PCI_DEVICE_DATA(..., 0).

And you missed the patch I sent to you, i.e. replacing field and function
parameter type to be insigned short. Otherwise it won't work with ACPI.

-- 
With Best Regards,
Andy Shevchenko