Patchwork [U-Boot] arm: io.h: replace writeb from macro to inline func

login
register
mail settings
Submitter Macpaul Lin
Date Oct. 25, 2011, 11:08 a.m.
Message ID <1319540923-28442-1-git-send-email-macpaul@andestech.com>
Download mbox | patch
Permalink /patch/121599/
State Rejected
Delegated to: Albert ARIBAUD
Headers show

Comments

Macpaul Lin - Oct. 25, 2011, 11:08 a.m.
Replace writeb and readb series I/O from macro to
inline function.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
---
 arch/arm/include/asm/io.h |   64 +++++++++++++++++++++++++++++++--------------
 1 files changed, 44 insertions(+), 20 deletions(-)
Macpaul Lin - Oct. 25, 2011, 11:27 a.m.
Hi all,

2011/10/25 Macpaul Lin <macpaul@andestech.com>:
> Replace writeb and readb series I/O from macro to
> inline function.
>
> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> ---
>  arch/arm/include/asm/io.h |   64 +++++++++++++++++++++++++++++++--------------
>  1 files changed, 44 insertions(+), 20 deletions(-)

Sorry I cannot cc this patch to Albert and other related custodians.
Because the mail server of my company has block most of mail domains.

Please check out if this implement is okay and give comment.
Thanks.
Marek Vasut - Oct. 25, 2011, 11:35 a.m.
> Hi all,
> 
> 2011/10/25 Macpaul Lin <macpaul@andestech.com>:
> > Replace writeb and readb series I/O from macro to
> > inline function.
> > 
> > Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> > ---
> >  arch/arm/include/asm/io.h |   64
> > +++++++++++++++++++++++++++++++-------------- 1 files changed, 44
> > insertions(+), 20 deletions(-)
> 
> Sorry I cannot cc this patch to Albert and other related custodians.
> Because the mail server of my company has block most of mail domains.
> 
> Please check out if this implement is okay and give comment.
> Thanks.

It's ok for once, just don't screw up again, ok?

Anyway, make a gmail account and you should be fine, no ?
Graeme Russ - Oct. 25, 2011, 11:45 a.m.
Hi Marek,

On 25/10/11 22:35, Marek Vasut wrote:
>> Hi all,
>>
>> 2011/10/25 Macpaul Lin <macpaul@andestech.com>:
>>> Replace writeb and readb series I/O from macro to
>>> inline function.
>>>
>>> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
>>> ---
>>>  arch/arm/include/asm/io.h |   64
>>> +++++++++++++++++++++++++++++++-------------- 1 files changed, 44
>>> insertions(+), 20 deletions(-)
>>
>> Sorry I cannot cc this patch to Albert and other related custodians.
>> Because the mail server of my company has block most of mail domains.
>>
>> Please check out if this implement is okay and give comment.
>> Thanks.
> 
> It's ok for once, just don't screw up again, ok?
> 
> Anyway, make a gmail account and you should be fine, no ?

Except trying to post patches using the gmail web interface is impossible
(it converts tabs to spaces for starters)

And I would not be surprised if Macpual's company firewall blocked outgoing
SMTP connections

Regards,

Graeme
Marek Vasut - Oct. 25, 2011, 11:51 a.m.
> Hi Marek,
> 
> On 25/10/11 22:35, Marek Vasut wrote:
> >> Hi all,
> >> 
> >> 2011/10/25 Macpaul Lin <macpaul@andestech.com>:
> >>> Replace writeb and readb series I/O from macro to
> >>> inline function.
> >>> 
> >>> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> >>> ---
> >>> 
> >>>  arch/arm/include/asm/io.h |   64
> >>> 
> >>> +++++++++++++++++++++++++++++++-------------- 1 files changed, 44
> >>> insertions(+), 20 deletions(-)
> >> 
> >> Sorry I cannot cc this patch to Albert and other related custodians.
> >> Because the mail server of my company has block most of mail domains.
> >> 
> >> Please check out if this implement is okay and give comment.
> >> Thanks.
> > 
> > It's ok for once, just don't screw up again, ok?
> > 
> > Anyway, make a gmail account and you should be fine, no ?
> 
> Except trying to post patches using the gmail web interface is impossible
> (it converts tabs to spaces for starters)

Well ...
> 
> And I would not be surprised if Macpual's company firewall blocked outgoing
> SMTP connections

Ah that's true ... then there's also the possibility to run httunnel and push 
through the firewall that way ;-D
> 
> Regards,
> 
> Graeme
Macpaul Lin - Oct. 25, 2011, 12:50 p.m.
Hi Marek,

2011/10/25 Marek Vasut <marek.vasut@gmail.com>:
>> Hi Marek,
>>
[snip]
>> > Anyway, make a gmail account and you should be fine, no ?
>>
>> Except trying to post patches using the gmail web interface is impossible
>> (it converts tabs to spaces for starters)
>
> Well ...
>>
>> And I would not be surprised if Macpual's company firewall blocked outgoing
>> SMTP connections
>
> Ah that's true ... then there's also the possibility to run httunnel and push
> through the firewall that way ;-D

Unfortunately it is also still problem to me.

Actually, I have 2 e-mail account to contribute the u-boot project.

The first one is the one I'm using which let me send patches via Linux
server with git send-email.
However, the mail will be relayed to company's mail server, then the
receiver's e-mail will be checked via e-mail firewall.
The mail will only be forwarded when all the e-mail addresses in the
mail are on the white list.
To add each individual email domain or email account to the white
list, a report and a application is necessary to security department
and need to be signed by CTO.

The second e-mail account will be activate on 2012, which is dedicated
for u-boot project.
It should not have the black/white list problem.
However, every mail send by this account will be CC-ed to managers and CTO.
(Yes, the CTO will read each patch and ask why a patch has been reject
or why the code must be rewritten).
They're afraid of to send out the driver will reveal the hardware
design then other people will copy the hardware design.
And the CTO will ask me why do you need to fix code for another companies,
this should not be a part of my task. @_@. (Although I'm glad to help on it.)

There is no outgoing SSH tunnel allowed in this company.
However, I'm the only person who have a CTO proved SSH tunnel to push
code into u-boot git.

Although I could set up SSH tunnel and to send patch via another
server outside of my company. They still probably sue me if I don't
use company's email address to contribute the code to public domain.
Hence I can only use gmail to reply but couldn't to send the patches.

Sorry for telling a lot of the mess.
I've forgot there is a restrict to add most of custodians on CC list
when sending patches and picked that task. :(

Patch

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 1fbc531..de3b2fd 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -133,13 +133,51 @@  extern inline void __raw_readsl(unsigned int addr, void *data, int longlen)
 #define __iormb()	dmb()
 #define __iowmb()	dmb()
 
-#define writeb(v,c)	({ u8  __v = v; __iowmb(); __arch_putb(__v,c); __v; })
-#define writew(v,c)	({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; })
-#define writel(v,c)	({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; })
+static inline void writeb(unsigned char val, unsigned char *addr)
+{
+	__iowmb();
+	__arch_putb(val, addr);
+}
 
-#define readb(c)	({ u8  __v = __arch_getb(c); __iormb(); __v; })
-#define readw(c)	({ u16 __v = __arch_getw(c); __iormb(); __v; })
-#define readl(c)	({ u32 __v = __arch_getl(c); __iormb(); __v; })
+static inline void writew(unsigned short val, unsigned short *addr)
+{
+	__iowmb();
+	__arch_putw(val, addr);
+
+}
+
+static inline void writel(unsigned int val, unsigned int *addr)
+{
+	__iowmb();
+	__arch_putl(val, addr);
+}
+
+static inline unsigned char readb(unsigned char *addr)
+{
+	u8	val;
+
+	val = __arch_getb(addr);
+	__iormb();
+	return val;
+}
+
+static inline unsigned short readw(unsigned short *addr)
+{
+	u16	val;
+
+	val = __arch_getw(addr);
+	__iormb();
+	return val;
+}
+
+static inline unsigned int readl(unsigned int *addr)
+{
+	u32	val;
+
+	val = __arch_getl(addr);
+	__iormb();
+	return val;
+}
 
 /*
  * The compiler seems to be incapable of optimising constants
@@ -363,20 +401,6 @@  check_signature(unsigned long io_addr, const unsigned char *signature,
 out:
 	return retval;
 }
-
-#elif !defined(readb)
-
-#define readb(addr)			(__readwrite_bug("readb"),0)
-#define readw(addr)			(__readwrite_bug("readw"),0)
-#define readl(addr)			(__readwrite_bug("readl"),0)
-#define writeb(v,addr)			__readwrite_bug("writeb")
-#define writew(v,addr)			__readwrite_bug("writew")
-#define writel(v,addr)			__readwrite_bug("writel")
-
-#define eth_io_copy_and_sum(a,b,c,d)	__readwrite_bug("eth_io_copy_and_sum")
-
-#define check_signature(io,sig,len)	(0)
-
 #endif	/* __mem_pci */
 
 /*