[alsa-devel] [PATCH] ASoC: Intel: Skylake: Use dev_get_drvdata where possible

Chuhong Yuan hslester96 at gmail.com
Wed Jul 24 15:17:25 CEST 2019


Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96 at gmail.com>
---
 sound/soc/intel/skylake/skl-nhlt.c |  3 +--
 sound/soc/intel/skylake/skl.c      | 12 ++++--------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 1132109cb992..46d9977224d1 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -241,8 +241,7 @@ int skl_nhlt_update_topology_bin(struct skl *skl)
 static ssize_t skl_nhlt_platform_id_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
-	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct hdac_bus *bus = dev_get_drvdata(dev);
 	struct skl *skl = bus_to_skl(bus);
 	struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
 	char platform_id[32];
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 3362e71b4563..1f625fc65307 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -141,8 +141,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
 
 void skl_update_d0i3c(struct device *dev, bool enable)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
-	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct hdac_bus *bus = dev_get_drvdata(dev);
 	u8 reg;
 	int timeout = 50;
 
@@ -274,8 +273,7 @@ static int skl_acquire_irq(struct hdac_bus *bus, int do_disconnect)
 
 static int skl_suspend_late(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
-	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct hdac_bus *bus = dev_get_drvdata(dev);
 	struct skl *skl = bus_to_skl(bus);
 
 	return skl_suspend_late_dsp(skl);
@@ -400,8 +398,7 @@ static int skl_resume(struct device *dev)
 #ifdef CONFIG_PM
 static int skl_runtime_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
-	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct hdac_bus *bus = dev_get_drvdata(dev);
 
 	dev_dbg(bus->dev, "in %s\n", __func__);
 
@@ -410,8 +407,7 @@ static int skl_runtime_suspend(struct device *dev)
 
 static int skl_runtime_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
-	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct hdac_bus *bus = dev_get_drvdata(dev);
 
 	dev_dbg(bus->dev, "in %s\n", __func__);
 
-- 
2.20.1



More information about the Alsa-devel mailing list