Skip to contentSkip to conversation

ARM: Convert {in,out}s[bwl] to inline functions

PATCH New Marek Vasut 4 participants 13 messages Sep 26, 2011 – Sep 28, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Convert {in,out}s[bwl] to inline functions

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

Cc Wolfgang Denk <[email protected]>
Cc Nick Thompson <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/include/asm/io.h |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)
arch/arm/include/asm/io.h +28 -6
index 61f4987..d22325d 100644
@@ -255,13 +255,35 @@ extern inline void __raw_readsl(unsigned int addr, void *data, int longlen)
 #define inw(p)	({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; })
 #define inl(p)	({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; })
 
-#define outsb(p,d,l)			__raw_writesb(__io(p),d,l)
-#define outsw(p,d,l)			__raw_writesw(__io(p),d,l)
-#define outsl(p,d,l)			__raw_writesl(__io(p),d,l)
+extern inline void outsb(unsigned int addr, const void *data, int bytelen)
+{
+	__raw_writesb(addr, data, bytelen);
+}
+
+extern inline void outsw(unsigned int addr, const void *data, int wordlen)
+{
+	__raw_writesw(addr, data, wordlen);
+}
+
+extern inline void outsl(unsigned int addr, const void *data, int longlen)
+{
+	__raw_writesl(addr, data, longlen);
+}
 
-#define insb(p,d,l)			__raw_readsb(__io(p),d,l)
-#define insw(p,d,l)			__raw_readsw(__io(p),d,l)
-#define insl(p,d,l)			__raw_readsl(__io(p),d,l)
+extern inline void insb(unsigned int addr, void *data, int bytelen)
+{
+	__raw_readsb(addr, data, bytelen);
+}
+
+extern inline void insw(unsigned int addr, void *data, int wordlen)
+{
+	__raw_readsw(addr, data, wordlen);
+}
+
+extern inline void insl(unsigned int addr, void *data, int longlen)
+{
+	__raw_readsl(addr, data, longlen);
+}
 #endif
 
 #define outb_p(val,port)		outb((val),(port))
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 7 lines · Marek Vasut

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

Cc Wolfgang Denk <[email protected]>
Cc Nick Thompson <[email protected]>
Cc Simon Glass <[email protected]>

Do you want to cc: Albert ARIBAUD <[email protected]> as well?

Quoted 9 lines
---
 arch/arm/include/asm/io.h |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)
arch/arm/include/asm/io.h +0 -0
index 61f4987..d22325d 100644

arch/arm/include/asm/io.h extern inline void __raw_readsl(unsigned int addr, void *data, int longlen) · line 260

Quoted 6 lines
arch/arm/include/asm/io.h +0 -3
@@ -255,13 +255,35 @@ extern inline void __raw_readsl(unsigned int addr, void *data, int longlen)
 #define inw(p)	({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; })
 #define inl(p)	({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; })
 
-#define outsb(p,d,l)			__raw_writesb(__io(p),d,l)
-#define outsw(p,d,l)			__raw_writesw(__io(p),d,l)
-#define outsl(p,d,l)			__raw_writesl(__io(p),d,l)

These changes are clearly related, but we started out talking about '__arch_putb', which is in the same file of course. Did I miss something?

This specific patch looks reasonable to me though.

Quoted 35 lines
arch/arm/include/asm/io.h +28 -3
+extern inline void outsb(unsigned int addr, const void *data, int bytelen)
+{
+	__raw_writesb(addr, data, bytelen);
+}
+
+extern inline void outsw(unsigned int addr, const void *data, int wordlen)
+{
+	__raw_writesw(addr, data, wordlen);
+}
+
+extern inline void outsl(unsigned int addr, const void *data, int longlen)
+{
+	__raw_writesl(addr, data, longlen);
+}
 
-#define insb(p,d,l)			__raw_readsb(__io(p),d,l)
-#define insw(p,d,l)			__raw_readsw(__io(p),d,l)
-#define insl(p,d,l)			__raw_readsl(__io(p),d,l)
+extern inline void insb(unsigned int addr, void *data, int bytelen)
+{
+	__raw_readsb(addr, data, bytelen);
+}
+
+extern inline void insw(unsigned int addr, void *data, int wordlen)
+{
+	__raw_readsw(addr, data, wordlen);
+}
+
+extern inline void insl(unsigned int addr, void *data, int longlen)
+{
+	__raw_readsl(addr, data, longlen);
+}
 #endif
 
 #define outb_p(val,port)		outb((val),(port))
#2 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

In reply to Marek Vasut

Dear Marek Vasut,

Quoted 2 lines · In message <[email protected]> you wrote:

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

And what _exactly_ are "a few bytes" ?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?"
#3 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 7 lines · Wolfgang Denk

Dear Marek Vasut,

Quoted 2 lines · In message <[email protected]> you wrote:

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

And what _exactly_ are "a few bytes" ?

Nevermind, it must have been some kind of a fluctuation yesterday. Right now, I made a new measurement and the size didn't change with/without the patch (this is more what I'd expect to happen).

Cheers

Quoted 4 lines

Best regards,

Wolfgang Denk

#4 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 4 lines · Marek Vasut
Quoted 3 lines · Wolfgang Denk

Dear Marek Vasut,

In message <[email protected]> you wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

And what _exactly_ are "a few bytes" ?

Nevermind, it must have been some kind of a fluctuation yesterday. Right now, I made a new measurement and the size didn't change with/without the patch (this is more what I'd expect to happen).

Cheers

Pure speculation on my part, but /could/ this be because ARM drivers don't tend to use these macros/functions. write[bwl] and the like are much more common. I don't know this to be a fact though.

Nick.

#5 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 5 lines · Nick Thompson
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Wolfgang Denk

Dear Marek Vasut,

In message <[email protected]> you

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

And what _exactly_ are "a few bytes" ?

Nevermind, it must have been some kind of a fluctuation yesterday. Right now, I made a new measurement and the size didn't change with/without the patch (this is more what I'd expect to happen).

Quoted 5 lines
Quoted 1 line

Cheers

Pure speculation on my part, but /could/ this be because ARM drivers don't tend to use these macros/functions. write[bwl] and the like are much more common. I don't know this to be a fact though.

No, I'm dead sure I use this macro in the test.

Quoted 2 lines

Nick.

#6 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 16 lines · Marek Vasut
Quoted 5 lines · Nick Thompson
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Wolfgang Denk

Dear Marek Vasut,

In message <[email protected]> you

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

And what _exactly_ are "a few bytes" ?

Nevermind, it must have been some kind of a fluctuation yesterday. Right now, I made a new measurement and the size didn't change with/without the patch (this is more what I'd expect to happen).

Quoted 11 lines
Quoted 5 lines
Quoted 1 line

Cheers

Pure speculation on my part, but /could/ this be because ARM drivers don't tend to use these macros/functions. write[bwl] and the like are much more common. I don't know this to be a fact though.

No, I'm dead sure I use this macro in the test.

Quoted 2 lines

Nick.

Hi,

Can't comment on the patch format, etc.

I tested this on my Seaboard, with no code size increase, and all worked as expected. I can't see why it would increase code size either.

But I have a few questions: what devices actually uses this macro? Otherwise I'm not sure if I am testing anything. Also, why not convert all the macros in this file? Seems like a good idea to me. Or is this patch just to test the waters? :-)

Regards,
Simon

#7 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 31 lines · Simon Glass
Quoted 18 lines · Marek Vasut
Quoted 6 lines · Nick Thompson
Quoted 5 lines · Marek Vasut
Quoted 4 lines · Wolfgang Denk

Dear Marek Vasut,

In message <[email protected]> you

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

And what _exactly_ are "a few bytes" ?

Nevermind, it must have been some kind of a fluctuation yesterday. Right now, I made a new measurement and the size didn't change with/without the patch (this is more what I'd expect to happen).

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

Cheers

Pure speculation on my part, but /could/ this be because ARM drivers don't tend to use these macros/functions. write[bwl] and the like are much more common. I don't know this to be a fact though.

No, I'm dead sure I use this macro in the test.

Quoted 1 line

Nick.

Hi,

Quoted 7 lines

Can't comment on the patch format, etc.

I tested this on my Seaboard, with no code size increase, and all worked as expected. I can't see why it would increase code size either.

But I have a few questions: what devices actually uses this macro?

common/cmd_ide.c for example.

Quoted 3 lines

Otherwise I'm not sure if I am testing anything. Also, why not convert all the macros in this file? Seems like a good idea to me. Or is this patch just to test the waters? :-)

We should eventually get rid of all that crap altogether and unify the hardware access. But that seems like a long-term plan :-(

Cheers

Quoted 3 lines

Regards,
Simon

#8 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

In reply to Marek Vasut

Dear Marek Vasut,

Quoted 10 lines · In message <[email protected]> you wrote:

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

Cc Wolfgang Denk <[email protected]>
Cc Nick Thompson <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/include/asm/io.h |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

And will you PLEASE get used to sticking with the rules?

There is no patch version in the Subject line.

There is no change log in the comment section either.

NAK.

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Women are more easily and more deeply terrified ...  generating  more
sheer horror than the male of the species.
	-- Spock, "Wolf in the Fold", stardate 3615.4
#9 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 12 lines · Wolfgang Denk

Dear Marek Vasut,

Quoted 9 lines · In message <[email protected]> you wrote:

The size of uboot binary grows by a few bytes, but the gain (better type checking) is worth it.

Cc Wolfgang Denk <[email protected]>
Cc Nick Thompson <[email protected]>
Cc Simon Glass <[email protected]>

---

Quoted 8 lines
Quoted 2 lines
 arch/arm/include/asm/io.h |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

And will you PLEASE get used to sticking with the rules?

There is no patch version in the Subject line.

There is no change log in the comment section either.

This is a new patch ... that's why there's no changelog and no V1.

Cheers

Quoted 7 lines

NAK.

Wolfgang Denk

#10 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Dear Marek Vasut,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines

And will you PLEASE get used to sticking with the rules?

There is no patch version in the Subject line.

There is no change log in the comment section either.

This is a new patch ... that's why there's no changelog and no V1.

Oh, is it?

And what is this, then:

09/26 Marek Vasut [PATCH] ARM: Convert {in,out}s[bwl] to inline functions

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/109509

Looks to be exactly the same, judging by the Subject: line...

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The amount of time between slipping on the peel and  landing  on  the
pavement is precisely 1 bananosecond.
#11 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Quoted 15 lines · Wolfgang Denk

Dear Marek Vasut,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines

And will you PLEASE get used to sticking with the rules?

There is no patch version in the Subject line.

There is no change log in the comment section either.

This is a new patch ... that's why there's no changelog and no V1.

Oh, is it?

And what is this, then:

Quoted 7 lines

09/26 Marek Vasut [PATCH] ARM: Convert {in,out}s[bwl] to inline
functions

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/109509

Looks to be exactly the same, judging by the Subject: line...

Well ... that's this patch, right ?

Cheers

#12 lore raw

PATCH 1/1 ARM: Convert {in, out}s[bwl] to inline functions

Dear Marek Vasut,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 10 lines
Quoted 2 lines

This is a new patch ... that's why there's no changelog and no V1.

Oh, is it?

And what is this, then:

09/26 Marek Vasut [PATCH] ARM: Convert {in,out}s[bwl] to inline
functions

Quoted 6 lines
Quoted 4 lines

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/109509

Looks to be exactly the same, judging by the Subject: line...

Well ... that's this patch, right ?

Oops. You are right. Sorry.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I often quote myself; it adds spice to my conversation.  - G. B. Shaw