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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110406121258.GA9530@oksana.dev.rtsoft.ru>
Date:	Wed, 6 Apr 2011 16:12:58 +0400
From:	Anton Vorontsov <cbouatmailru@...il.com>
To:	Jamie Iles <jamie@...ieiles.com>
Cc:	linux-kernel@...r.kernel.org, linux@....linux.org.uk,
	tglx@...utronix.de, grant.likely@...retlab.ca, arnd@...db.de,
	nico@...xnic.net
Subject: Re: [RFC PATCH 1/7] basic_mmio_gpio: remove runtime
 width/endianness evaluation

On Wed, Apr 06, 2011 at 12:10:57PM +0100, Jamie Iles wrote:
> Remove endianness/width calculations at runtime by installing function
> pointers for bit-to-mask conversion and register accessors.
> 
> Signed-off-by: Jamie Iles <jamie@...ieiles.com>
> Cc: Anton Vorontsov <cbouatmailru@...il.com>
> Cc: Grant Likely <grant.likely@...retlab.ca>

I guess there should be Suggested-by: Thomas Gleixner <tglx@...utronix.de>

:-)

[...]
> @@ -74,7 +78,8 @@ struct bgpio_chip {
>        * Some GPIO controllers work with the big-endian bits notation,
>        * e.g. in a 8-bits register, GPIO7 is the least significant bit.
>        */
> -     int big_endian_bits;
> +     unsigned long (*pin2mask)(struct bgpio_chip *bgc, unsigned int pin);
> +
>
>       /*

No need for this new empty line, I think.

[...]
> +static unsigned long bgpio_write64(void __iomem *reg, unsigned long data)
> +{
> +	return __raw_writeq(data, reg);
> +}

I was getting this on a 64 bit machine:

  CHECK   drivers/gpio/basic_mmio_gpio.c
drivers/gpio/basic_mmio_gpio.c:138:16: warning: incorrect type in return expression (different base types)
drivers/gpio/basic_mmio_gpio.c:138:16:    expected unsigned long
drivers/gpio/basic_mmio_gpio.c:138:16:    got void
drivers/gpio/basic_mmio_gpio.c:302:33: warning: incorrect type in assignment (different base types)
drivers/gpio/basic_mmio_gpio.c:302:33:    expected void ( *write_reg )( ... )
drivers/gpio/basic_mmio_gpio.c:302:33:    got unsigned long ( static [toplevel] *<noident> )( ... )
  CC      drivers/gpio/basic_mmio_gpio.o
drivers/gpio/basic_mmio_gpio.c: In function ‘bgpio_write64’:
drivers/gpio/basic_mmio_gpio.c:138: error: void value not ignored as it ought to be
drivers/gpio/basic_mmio_gpio.c: In function ‘bgpio_setup_accessors’:
drivers/gpio/basic_mmio_gpio.c:302: warning: assignment from incompatible pointer type
make[1]: *** [drivers/gpio/basic_mmio_gpio.o] Error 1

And I fixed it with this:

diff --git a/drivers/gpio/basic_mmio_gpio.c b/drivers/gpio/basic_mmio_gpio.c
index 9dad485..3ddc4b2 100644
--- a/drivers/gpio/basic_mmio_gpio.c
+++ b/drivers/gpio/basic_mmio_gpio.c
@@ -133,9 +133,9 @@ static unsigned long bgpio_read32(void __iomem *reg)
 }
 
 #if BITS_PER_LONG >= 64
-static unsigned long bgpio_write64(void __iomem *reg, unsigned long data)
+static void bgpio_write64(void __iomem *reg, unsigned long data)
 {
-	return __raw_writeq(data, reg);
+	__raw_writeq(data, reg);
 }
 
 static unsigned long bgpio_read64(void __iomem *reg)


Otherwise, the patch looks perfect.

Acked-by: Anton Vorontsov <cbouatmailru@...il.com>

Thanks!

-- 
Anton Vorontsov
Email: cbouatmailru@...il.com

--
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