lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100920002841.GF6565@core.coreip.homeip.net>
Date:	Sun, 19 Sep 2010 17:28:41 -0700
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Linux Kernel Development <linux-kernel@...r.kernel.org>,
	Mikael Starvik <starvik@...s.com>,
	Jesper Nilsson <jesper.nilsson@...s.com>,
	linux-cris-kernel@...s.com
Subject: Re: Build regressions/improvements in v2.6.36-rc4

On Wed, Sep 15, 2010 at 11:04:56PM -0700, Dmitry Torokhov wrote:
> Hi Geert,
> 
> On Wed, Sep 15, 2010 at 09:29:35PM +0200, Geert Uytterhoeven wrote:
> > 	drivers/input/gameport/lightning.c: error: invalid operands to binary & (have 'void *' and 'int'):  => 177, 141, 86
> > 	drivers/input/gameport/ns558.c: error: invalid operands to binary & (have 'void *' and 'int'):  => 84
> > 	drivers/input/touchscreen/mk712.c: error: invalid operands to binary | (have 'void *' and 'int'):  => 129
> 
> I think these (and a few more) should be fixed for the patch below (not
> even compiled)...
> 

I think this version should be a bit better (still not compiled).

-- 
Dmitry

[CRIS] Convert io macros into inline functions

From: Dmitry Torokhov <dmitry.torokhov@...il.com>

This should silence warnings such as:

drivers/input/gameport/lightning.c: error: invalid operands to binary &
(have 'void *' and 'int'):  => 177, 141, 86
drivers/input/gameport/ns558.c: error: invalid operands to binary &
(have 'void *' and 'int'):  => 84
drivers/input/touchscreen/mk712.c: error: invalid operands to binary |
(have 'void *' and 'int'):  => 129

Marco argument expansion is a bitch...

This also fixes outsl - size of an 'int' is 4 and not 3.

Reported-by: Geert Uytterhoeven <geert@...ux-m68k.org>
Signed-off-by: Dmitry Torokhov <dtor@...l.ru>
---

 arch/cris/include/asm/io.h |   44 +++++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 13 deletions(-)


diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index 32567bc..765c6e2 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -10,7 +10,7 @@ struct cris_io_operations
 	u32 (*read_mem)(void *addr, int size);
 	void (*write_mem)(u32 val, int size, void *addr);
 	u32 (*read_io)(u32 port, void *addr, int size, int count);
-	void (*write_io)(u32 port, void *addr, int size, int count);
+	void (*write_io)(u32 port, const void *addr, int size, int count);
 };
 
 #ifdef CONFIG_PCI
@@ -127,18 +127,36 @@ static inline void writel(unsigned int b, volatile void __iomem *addr)
  */
 
 #define IO_SPACE_LIMIT 0xffff
-#define inb(port) (cris_iops ? cris_iops->read_io(port,NULL,1,1) : 0)
-#define inw(port) (cris_iops ? cris_iops->read_io(port,NULL,2,1) : 0)
-#define inl(port) (cris_iops ? cris_iops->read_io(port,NULL,4,1) : 0)
-#define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0)
-#define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0)
-#define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0)
-#define outb(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,1,1)
-#define outw(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,2,1)
-#define outl(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,4,1)
-#define outsb(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,1,count)
-#define outsw(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,2,count)
-#define outsl(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,3,count)
+
+#define BUILDIO(bwl, bw, type)						\
+static inline void out##bwl(type value, int port)			\
+{									\
+	if (cris_iops)							\
+		cris_iops->write_io(port, &value, sizeof(type), 1);	\
+}									\
+									\
+static inline type in##bwl(int port)					\
+{									\
+	return cris_iops ?						\
+		cris_iops->read_io(port, NULL, sizeof(type), 1) : 0;	\
+}									\
+									\
+static inline void outs##bwl(int port,					\
+			     const void *addr, unsigned long count)	\
+{									\
+	if (cris_iops)							\
+		cris_iops->write_io(port, addr, sizeof(type), count);	\
+}									\
+									\
+static inline void ins##bwl(int port, void *addr, unsigned long count)	\
+{									\
+	if (cris_iops)							\
+		cris_iops->read_io(port, addr, sizeof(type), count);	\
+}
+
+BUILDIO(b, unsigned char)
+BUILDIO(w, unsigned short)
+BUILDIO(l, unsigned int)
 
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ