diff mbox series

[v7,03/37] sparc: io: To use the define of ioremap_[nocache|wc|wb] in asm-generic/io.h

Message ID 4bb01fd533c66c357f3dc23a64f56414109a2aad.1518505384.git.greentime@andestech.com
State Not Applicable, archived
Delegated to: David Miller
Headers show
Series Andes(nds32) Linux Kernel Port | expand

Commit Message

Greentime Hu Feb. 13, 2018, 9:09 a.m. UTC
A commit for the nds32 architecture bootstrap("asm-generic/io.h: move
ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of	ifndef CONFIG_MMU")
will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
in order to suppress re-definition errors we need to remove the #define
in io_32.h.

Also, the change adds a prototype for ioremap where size is size_t and
offset is phys_addr_t so fix that as well.

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/sparc/include/asm/io_32.h | 5 -----
 arch/sparc/kernel/ioport.c     | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

Comments

Arnd Bergmann Feb. 14, 2018, 2:43 p.m. UTC | #1
On Tue, Feb 13, 2018 at 10:09 AM, Greentime Hu <green.hu@gmail.com> wrote:
> A commit for the nds32 architecture bootstrap("asm-generic/io.h: move
> ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU")
> will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
> in order to suppress re-definition errors we need to remove the #define
> in io_32.h.
>
> Also, the change adds a prototype for ioremap where size is size_t and
> offset is phys_addr_t so fix that as well.
>
> Signed-off-by: Greentime Hu <greentime@andestech.com>

This patch should have been addressed to the sparclinux mailing list to
the maintainers can see it, otherwise they are unlikely to notice.

Added it to Cc now.

Can you confirm that the patches are ordered correctly in your series so that
at no point, sparc is in a state that fails to be build cleanly?

If not, this may have to get merged into the other patch.

        Arnd

> ---
>  arch/sparc/include/asm/io_32.h | 5 -----
>  arch/sparc/kernel/ioport.c     | 4 ++--
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
> index cd51a89b393c..df2dc1784673 100644
> --- a/arch/sparc/include/asm/io_32.h
> +++ b/arch/sparc/include/asm/io_32.h
> @@ -127,12 +127,7 @@ static inline void sbus_memcpy_toio(volatile void __iomem *dst,
>   * Bus number may be embedded in the higher bits of the physical address.
>   * This is why we have no bus number argument to ioremap().
>   */
> -void __iomem *ioremap(unsigned long offset, unsigned long size);
> -#define ioremap_nocache(X,Y)   ioremap((X),(Y))
> -#define ioremap_wc(X,Y)                ioremap((X),(Y))
> -#define ioremap_wt(X,Y)                ioremap((X),(Y))
>  void iounmap(volatile void __iomem *addr);
> -
>  /* Create a virtual mapping cookie for an IO port range */
>  void __iomem *ioport_map(unsigned long port, unsigned int nr);
>  void ioport_unmap(void __iomem *);
> diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
> index 7eeef80c02f7..3bcef9ce74df 100644
> --- a/arch/sparc/kernel/ioport.c
> +++ b/arch/sparc/kernel/ioport.c
> @@ -122,12 +122,12 @@ static void xres_free(struct xresource *xrp) {
>   *
>   * Bus type is always zero on IIep.
>   */
> -void __iomem *ioremap(unsigned long offset, unsigned long size)
> +void __iomem *ioremap(phys_addr_t offset, size_t size)
>  {
>         char name[14];
>
>         sprintf(name, "phys_%08x", (u32)offset);
> -       return _sparc_alloc_io(0, offset, size, name);
> +       return _sparc_alloc_io(0, (unsigned long)offset, size, name);
>  }
>  EXPORT_SYMBOL(ioremap);
>
> --
> 2.16.1
>
Greentime Hu Feb. 21, 2018, 8:05 a.m. UTC | #2
2018-02-14 22:43 GMT+08:00 Arnd Bergmann <arnd@arndb.de>:
> On Tue, Feb 13, 2018 at 10:09 AM, Greentime Hu <green.hu@gmail.com> wrote:
>> A commit for the nds32 architecture bootstrap("asm-generic/io.h: move
>> ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU")
>> will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
>> in order to suppress re-definition errors we need to remove the #define
>> in io_32.h.
>>
>> Also, the change adds a prototype for ioremap where size is size_t and
>> offset is phys_addr_t so fix that as well.
>>
>> Signed-off-by: Greentime Hu <greentime@andestech.com>
>
> This patch should have been addressed to the sparclinux mailing list to
> the maintainers can see it, otherwise they are unlikely to notice.
>
> Added it to Cc now.
>
> Can you confirm that the patches are ordered correctly in your series so that
> at no point, sparc is in a state that fails to be build cleanly?
>
> If not, this may have to get merged into the other patch.

Hi, Arnd:

These 2 patch will cause sparc building error in any order.

commit af84603e339a6832052071aca1f2a16b8963cc2e
Author: Greentime Hu <green.hu@gmail.com>
Date:   Tue Feb 13 17:09:07 2018 +0800

    sparc: io: To use the define of ioremap_[nocache|wc|wb] in asm-generic/io.h

    A commit for the nds32 architecture bootstrap("asm-generic/io.h: move
    ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of     ifndef
CONFIG_MMU")
    will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
    in order to suppress re-definition errors we need to remove the #define
    in io_32.h.

    Also, the change adds a prototype for ioremap where size is size_t and
    offset is phys_addr_t so fix that as well.

    Signed-off-by: Greentime Hu <greentime@andestech.com>

commit 1995b30ea6628b261192662741940c22ac978884
Author: Greentime Hu <green.hu@gmail.com>
Date:   Tue Feb 13 17:09:06 2018 +0800

    asm-generic/io.h: move
ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef
CONFIG_MMU

    It allows some architectures to use this generic macro instead of
    defining theirs.

    Signed-off-by: Vincent Chen <vincentc@andestech.com>
    Signed-off-by: Greentime Hu <greentime@andestech.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>

Should I merge them together like this?

asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of
ifndef CONFIG_MMU

It allows some architectures to use this generic macro instead of
defining theirs.

sparc: io: To use the define of ioremap_[nocache|wc|wb] in asm-generic/io.h
It will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
in order to suppress re-definition errors we need to remove the #define
in arch/sparc/include/asm/io_32.h. Also, the change adds a prototype for
ioremap where size is size_t and offset is phys_addr_t so fix that as well.

Signed-off-by: Greentime Hu <greentime@andestech.com>
Arnd Bergmann Feb. 21, 2018, 12:27 p.m. UTC | #3
On Wed, Feb 21, 2018 at 9:05 AM, Greentime Hu <green.hu@gmail.com> wrote:
> 2018-02-14 22:43 GMT+08:00 Arnd Bergmann <arnd@arndb.de>:
>> On Tue, Feb 13, 2018 at 10:09 AM, Greentime Hu <green.hu@gmail.com> wrote:
>>> A commit for the nds32 architecture bootstrap("asm-generic/io.h: move
>>> ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU")
>>> will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
>>> in order to suppress re-definition errors we need to remove the #define
>>> in io_32.h.
>>>
>>> Also, the change adds a prototype for ioremap where size is size_t and
>>> offset is phys_addr_t so fix that as well.
>>>
>>> Signed-off-by: Greentime Hu <greentime@andestech.com>
>>
>> This patch should have been addressed to the sparclinux mailing list to
>> the maintainers can see it, otherwise they are unlikely to notice.
>>
>> Added it to Cc now.
>>
>> Can you confirm that the patches are ordered correctly in your series so that
>> at no point, sparc is in a state that fails to be build cleanly?
>>
>> If not, this may have to get merged into the other patch.
>
> Hi, Arnd:
>
> These 2 patch will cause sparc building error in any order.


>
> Should I merge them together like this?
>
> asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of
> ifndef CONFIG_MMU
>
> It allows some architectures to use this generic macro instead of
> defining theirs.
>
> sparc: io: To use the define of ioremap_[nocache|wc|wb] in asm-generic/io.h
> It will move the ioremap_nocache out of the CONFIG_MMU ifdef. This means that
> in order to suppress re-definition errors we need to remove the #define
> in arch/sparc/include/asm/io_32.h. Also, the change adds a prototype for
> ioremap where size is size_t and offset is phys_addr_t so fix that as well.
>
> Signed-off-by: Greentime Hu <greentime@andestech.com>

That looks reasonable since both patches are fairly small, yes.

For a more complex patch that requires interdependent changes
in different areas of the kernel, it may be necessary instead to
come up with a way to stage out the changes differently so they
are truly independent. Getting that right requires a bit practice
but is usually possible.

       Arnd
diff mbox series

Patch

diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index cd51a89b393c..df2dc1784673 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -127,12 +127,7 @@  static inline void sbus_memcpy_toio(volatile void __iomem *dst,
  * Bus number may be embedded in the higher bits of the physical address.
  * This is why we have no bus number argument to ioremap().
  */
-void __iomem *ioremap(unsigned long offset, unsigned long size);
-#define ioremap_nocache(X,Y)	ioremap((X),(Y))
-#define ioremap_wc(X,Y)		ioremap((X),(Y))
-#define ioremap_wt(X,Y)		ioremap((X),(Y))
 void iounmap(volatile void __iomem *addr);
-
 /* Create a virtual mapping cookie for an IO port range */
 void __iomem *ioport_map(unsigned long port, unsigned int nr);
 void ioport_unmap(void __iomem *);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 7eeef80c02f7..3bcef9ce74df 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -122,12 +122,12 @@  static void xres_free(struct xresource *xrp) {
  *
  * Bus type is always zero on IIep.
  */
-void __iomem *ioremap(unsigned long offset, unsigned long size)
+void __iomem *ioremap(phys_addr_t offset, size_t size)
 {
 	char name[14];
 
 	sprintf(name, "phys_%08x", (u32)offset);
-	return _sparc_alloc_io(0, offset, size, name);
+	return _sparc_alloc_io(0, (unsigned long)offset, size, name);
 }
 EXPORT_SYMBOL(ioremap);