From: Andrew Morton <akpm@linux-foundation.org> To: Brian Starkey <brian.starkey@arm.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Catalin Marinas <catalin.marinas@arm.com>, Dan Williams <dan.j.williams@intel.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND2 PATCH 1/3] memremap: add MEMREMAP_WC flag Date: Mon, 8 Feb 2016 12:03:17 -0800 [thread overview] Message-ID: <20160208120317.313409dc0ae7634c25d3f021@linux-foundation.org> (raw) In-Reply-To: <9085d37fa97a762a46b9d58719c085368682c64f.1454950917.git.brian.starkey@arm.com> On Mon, 8 Feb 2016 17:30:50 +0000 Brian Starkey <brian.starkey@arm.com> wrote: > Add a flag to memremap() for writecombine mappings. Mappings satisfied > by this flag will not be cached, however writes may be delayed or > combined into more efficient bursts. This is most suitable for > buffers written sequentially by the CPU for use by other DMA devices. > > ... The patch generally looks OK to me. It generates rejects against linux-next because of some janitorial changes in memremap.c. > @@ -101,6 +107,11 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags) > addr = ioremap_wt(offset, size); > } > > + if (!addr && (flags & MEMREMAP_WC)) { > + flags &= ~MEMREMAP_WC; > + addr = ioremap_wc(offset, size); > + } > + > return addr; > } The modifications of `flags' is unneeded (and the compiler will remove it). And generally the modification of incoming args is a bit nasty IMO - I find it's better to treat them as const - part of the calling environment which can be relied upon to be unaltered as the code evolves.
WARNING: multiple messages have this Message-ID (diff)
From: akpm@linux-foundation.org (Andrew Morton) To: linux-arm-kernel@lists.infradead.org Subject: [RESEND2 PATCH 1/3] memremap: add MEMREMAP_WC flag Date: Mon, 8 Feb 2016 12:03:17 -0800 [thread overview] Message-ID: <20160208120317.313409dc0ae7634c25d3f021@linux-foundation.org> (raw) In-Reply-To: <9085d37fa97a762a46b9d58719c085368682c64f.1454950917.git.brian.starkey@arm.com> On Mon, 8 Feb 2016 17:30:50 +0000 Brian Starkey <brian.starkey@arm.com> wrote: > Add a flag to memremap() for writecombine mappings. Mappings satisfied > by this flag will not be cached, however writes may be delayed or > combined into more efficient bursts. This is most suitable for > buffers written sequentially by the CPU for use by other DMA devices. > > ... The patch generally looks OK to me. It generates rejects against linux-next because of some janitorial changes in memremap.c. > @@ -101,6 +107,11 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags) > addr = ioremap_wt(offset, size); > } > > + if (!addr && (flags & MEMREMAP_WC)) { > + flags &= ~MEMREMAP_WC; > + addr = ioremap_wc(offset, size); > + } > + > return addr; > } The modifications of `flags' is unneeded (and the compiler will remove it). And generally the modification of incoming args is a bit nasty IMO - I find it's better to treat them as const - part of the calling environment which can be relied upon to be unaltered as the code evolves.
next prev parent reply other threads:[~2016-02-08 20:03 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-02-08 17:30 [RESEND2 PATCH 0/3] Fix kernel panic in dma-coherent Brian Starkey 2016-02-08 17:30 ` Brian Starkey 2016-02-08 17:30 ` [RESEND2 PATCH 1/3] memremap: add MEMREMAP_WC flag Brian Starkey 2016-02-08 17:30 ` Brian Starkey 2016-02-08 18:30 ` Greg Kroah-Hartman 2016-02-08 18:30 ` Greg Kroah-Hartman 2016-02-09 9:15 ` Brian Starkey 2016-02-09 9:15 ` Brian Starkey 2016-02-16 11:14 ` Brian Starkey 2016-02-16 11:14 ` Brian Starkey 2016-02-17 0:43 ` Greg Kroah-Hartman 2016-02-17 0:43 ` Greg Kroah-Hartman 2016-02-17 10:07 ` Brian Starkey 2016-02-17 10:07 ` Brian Starkey 2016-02-08 20:03 ` Andrew Morton [this message] 2016-02-08 20:03 ` Andrew Morton 2016-02-09 10:23 ` Brian Starkey 2016-02-09 10:23 ` Brian Starkey 2016-02-17 11:53 ` Brian Starkey 2016-02-17 11:53 ` Brian Starkey 2016-02-17 19:02 ` Andrew Morton 2016-02-17 19:02 ` Andrew Morton 2016-02-08 17:30 ` [RESEND2 PATCH 2/3] drivers: dma-coherent: use MEMREMAP_WC for DMA_MEMORY_MAP Brian Starkey 2016-02-08 17:30 ` Brian Starkey 2016-02-08 17:30 ` [RESEND2 PATCH 3/3] drivers: dma-coherent: use memset_io for DMA_MEMORY_IO mappings Brian Starkey 2016-02-08 17:30 ` Brian Starkey 2016-02-08 17:50 ` [RESEND2 PATCH 0/3] Fix kernel panic in dma-coherent Mark Rutland 2016-02-08 17:50 ` Mark Rutland 2016-02-08 17:59 ` Robin Murphy 2016-02-08 17:59 ` Robin Murphy 2016-02-08 18:04 ` Mark Rutland 2016-02-08 18:04 ` Mark Rutland
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20160208120317.313409dc0ae7634c25d3f021@linux-foundation.org \ --to=akpm@linux-foundation.org \ --cc=brian.starkey@arm.com \ --cc=catalin.marinas@arm.com \ --cc=dan.j.williams@intel.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.