From cdd696a13601e9be138430a0fe843384c6dcbb8f Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Tue, 4 Dec 2018 17:44:42 +0800 Subject: [PATCH] ASoC: SOF: Intel: optimize write64() / read64() For write64() and read64(), switch to use writeq() and readq(). And apply these changes to all BYT/HSW/BDW/SKL+ platforms. Signed-off-by: Keyon Jie Signed-off-by: Bard liao --- sound/soc/sof/intel/bdw.c | 8 +++----- sound/soc/sof/intel/byt.c | 8 +++----- sound/soc/sof/intel/hda.c | 8 +++----- sound/soc/sof/intel/hsw.c | 8 +++----- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index 46833e90ae26d1..4fc9b24f703701 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -141,15 +142,12 @@ static u32 bdw_read(struct snd_sof_dev *sdev, void __iomem *addr) static void bdw_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value) { - memcpy_toio(addr, &value, sizeof(value)); + writeq(value, addr); } static u64 bdw_read64(struct snd_sof_dev *sdev, void __iomem *addr) { - u64 val; - - memcpy_fromio(&val, addr, sizeof(val)); - return val; + return readq(addr); } /* diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 2d360f7e7ecbb0..51292e66782309 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -116,15 +117,12 @@ static u32 byt_read(struct snd_sof_dev *sdev, void __iomem *addr) static void byt_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value) { - memcpy_toio(addr, &value, sizeof(value)); + writeq(value, addr); } static u64 byt_read64(struct snd_sof_dev *sdev, void __iomem *addr) { - u64 val; - - memcpy_fromio(&val, addr, sizeof(val)); - return val; + return readq(addr); } /* diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 160974bcd3c911..31d6108d3bff9f 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -57,15 +58,12 @@ u32 hda_dsp_read(struct snd_sof_dev *sdev, void __iomem *addr) void hda_dsp_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value) { - memcpy_toio(addr, &value, sizeof(value)); + writeq(value, addr); } u64 hda_dsp_read64(struct snd_sof_dev *sdev, void __iomem *addr) { - u64 val; - - memcpy_fromio(&val, addr, sizeof(val)); - return val; + return readq(addr); } /* diff --git a/sound/soc/sof/intel/hsw.c b/sound/soc/sof/intel/hsw.c index 3b3f59a73a298c..1fed7232c2ba54 100644 --- a/sound/soc/sof/intel/hsw.c +++ b/sound/soc/sof/intel/hsw.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -141,15 +142,12 @@ static u32 hsw_read(struct snd_sof_dev *sdev, void __iomem *addr) static void hsw_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value) { - memcpy_toio(addr, &value, sizeof(value)); + writeq(value, addr); } static u64 hsw_read64(struct snd_sof_dev *sdev, void __iomem *addr) { - u64 val; - - memcpy_fromio(&val, addr, sizeof(val)); - return val; + return readq(addr); } /*