diff mbox

[11/20] sound, skylake: switch from ioremap_cache to memremap

Message ID 20151009221635.32203.30755.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams Oct. 9, 2015, 10:16 p.m. UTC
In preparation for deprecating ioremap_cache() convert its usage in
skl-nhlt to memremap.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 sound/soc/intel/skylake/skl-nhlt.c |   10 +++++-----
 sound/soc/intel/skylake/skl.h      |    6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Mark Brown Oct. 19, 2015, 3:26 p.m. UTC | #1
On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> skl-nhlt to memremap.

> -void __iomem *skl_nhlt_init(struct device *dev)
> +void *skl_nhlt_init(struct device *dev)

Why are we loosing the annotation here?
Takashi Iwai Oct. 19, 2015, 3:34 p.m. UTC | #2
On Mon, 19 Oct 2015 17:26:41 +0200,
Mark Brown wrote:
> 
> On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > In preparation for deprecating ioremap_cache() convert its usage in
> > skl-nhlt to memremap.
> 
> > -void __iomem *skl_nhlt_init(struct device *dev)
> > +void *skl_nhlt_init(struct device *dev)
> 
> Why are we loosing the annotation here?

It's the exact purpose of this patchset, as far as I understand.
memremap() allows the driver accessing the mapped memory just like a
normal memory unlike ioremap().


Takashi
Mark Brown Oct. 19, 2015, 4:08 p.m. UTC | #3
On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > > In preparation for deprecating ioremap_cache() convert its usage in
> > > skl-nhlt to memremap.

> > > -void __iomem *skl_nhlt_init(struct device *dev)
> > > +void *skl_nhlt_init(struct device *dev)

> > Why are we loosing the annotation here?

> It's the exact purpose of this patchset, as far as I understand.
> memremap() allows the driver accessing the mapped memory just like a
> normal memory unlike ioremap().

There's no mention of what the purpose of the conversion is in either
the patch or the cover letter so it's a bit unclear, some confirmation
would be good :(
Dan Williams Oct. 19, 2015, 4:59 p.m. UTC | #4
On Mon, Oct 19, 2015 at 9:08 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
>> Mark Brown wrote:
>
>> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
>> > > In preparation for deprecating ioremap_cache() convert its usage in
>> > > skl-nhlt to memremap.
>
>> > > -void __iomem *skl_nhlt_init(struct device *dev)
>> > > +void *skl_nhlt_init(struct device *dev)
>
>> > Why are we loosing the annotation here?
>
>> It's the exact purpose of this patchset, as far as I understand.
>> memremap() allows the driver accessing the mapped memory just like a
>> normal memory unlike ioremap().
>
> There's no mention of what the purpose of the conversion is in either
> the patch or the cover letter so it's a bit unclear, some confirmation
> would be good :(

The cover letter linked this article which talked through the
motivation: https://lwn.net/Articles/653585/

Essentially an "__iomem" annotation on a cached mapping is
inconsistent as __iomem indicates "may have side effects, use special
accessors" and cached means "pre-fetching, asynchronous write-backs,
and cpu determined i/o sizes are permissible".
diff mbox

Patch

diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 13036b19d7e5..b0c7bd113aac 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -25,7 +25,7 @@  static u8 OSC_UUID[16] = {0x6E, 0x88, 0x9F, 0xA6, 0xEB, 0x6C, 0x94, 0x45,
 
 #define DSDT_NHLT_PATH "\\_SB.PCI0.HDAS"
 
-void __iomem *skl_nhlt_init(struct device *dev)
+void *skl_nhlt_init(struct device *dev)
 {
 	acpi_handle handle;
 	union acpi_object *obj;
@@ -40,17 +40,17 @@  void __iomem *skl_nhlt_init(struct device *dev)
 	if (obj && obj->type == ACPI_TYPE_BUFFER) {
 		nhlt_ptr = (struct nhlt_resource_desc  *)obj->buffer.pointer;
 
-		return ioremap_cache(nhlt_ptr->min_addr, nhlt_ptr->length);
+		return memremap(nhlt_ptr->min_addr, nhlt_ptr->length,
+				MEMREMAP_WB);
 	}
 
 	dev_err(dev, "device specific method to extract NHLT blob failed\n");
 	return NULL;
 }
 
-void skl_nhlt_free(void __iomem *addr)
+void skl_nhlt_free(void *addr)
 {
-	iounmap(addr);
-	addr = NULL;
+	memunmap(addr);
 }
 
 static struct nhlt_specific_cfg *skl_get_specific_cfg(
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index f7fdbb02947f..551c6db25f34 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -55,7 +55,7 @@  struct skl {
 	unsigned int init_failed:1; /* delayed init failed */
 	struct platform_device *dmic_dev;
 
-	void __iomem *nhlt; /* nhlt ptr */
+	void *nhlt; /* nhlt ptr */
 	struct skl_sst *skl_sst; /* sst skl ctx */
 };
 
@@ -72,8 +72,8 @@  struct skl_dma_params {
 int skl_platform_unregister(struct device *dev);
 int skl_platform_register(struct device *dev);
 
-void __iomem *skl_nhlt_init(struct device *dev);
-void skl_nhlt_free(void __iomem *addr);
+void *skl_nhlt_init(struct device *dev);
+void skl_nhlt_free(void *addr);
 struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
 			u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);