Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [2.6 patch] mips/sgi-ip22/ip28-berr.c: fix the build
@ 2008-07-16 16:25 Adrian Bunk
  2008-07-16 16:31 ` Robert P. J. Day
  2008-07-18 14:46 ` Ralf Baechle
  0 siblings, 2 replies; 3+ messages in thread
From: Adrian Bunk @ 2008-07-16 16:25 UTC (permalink / raw)
  To: Robert P. J. Day, Ralf Baechle; +Cc: linux-mips

Commit 52f4f6bbcff5510f662a002ec1219660ea25af62
([MIPS] Use kernel-supplied ARRAY_SIZE() macro.)
causes the following compile error:

<--  snip  -->

...
  CC      arch/mips/sgi-ip22/ip28-berr.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c: In function 'ip28_be_interrupt':
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:415: error: subscripted value is neither array nor pointer
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:415: error: subscripted value is neither array nor pointer
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:415: warning: type defaults to 'int' in declaration of 'type name'
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:424: error: subscripted value is neither array nor pointer
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:424: error: subscripted value is neither array nor pointer
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:424: warning: type defaults to 'int' in declaration of 'type name'
make[2]: *** [arch/mips/sgi-ip22/ip28-berr.o] Error 1

<--  snip  -->

Using ARRAY_SIZE in these places in arch/mips/sgi-ip22/ip28-berr.c was 
bogus, and therefore gets reverted by this patch.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

 arch/mips/sgi-ip22/ip28-berr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -412,7 +412,7 @@ static int ip28_be_interrupt(const struct pt_regs *regs)
 	 * Now we have an asynchronous bus error, speculatively or DMA caused.
 	 * Need to search all DMA descriptors for the error address.
 	 */
-	for (i = 0; i < ARRAY_SIZE(hpc3); ++i) {
+	for (i = 0; i < sizeof(hpc3)/sizeof(struct hpc3_stat); ++i) {
 		struct hpc3_stat *hp = (struct hpc3_stat *)&hpc3 + i;
 		if ((cpu_err_stat & CPU_ERRMASK) &&
 		    (cpu_err_addr == hp->ndptr || cpu_err_addr == hp->cbp))
@@ -421,7 +421,7 @@ static int ip28_be_interrupt(const struct pt_regs *regs)
 		    (gio_err_addr == hp->ndptr || gio_err_addr == hp->cbp))
 			break;
 	}
-	if (i < ARRAY_SIZE(hpc3)) {
+	if (i < sizeof(hpc3)/sizeof(struct hpc3_stat)) {
 		struct hpc3_stat *hp = (struct hpc3_stat *)&hpc3 + i;
 		printk(KERN_ERR "at DMA addresses: HPC3 @ %08lx:"
 		       " ctl %08x, ndp %08x, cbp %08x\n",

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [2.6 patch] mips/sgi-ip22/ip28-berr.c: fix the build
  2008-07-16 16:25 [2.6 patch] mips/sgi-ip22/ip28-berr.c: fix the build Adrian Bunk
@ 2008-07-16 16:31 ` Robert P. J. Day
  2008-07-18 14:46 ` Ralf Baechle
  1 sibling, 0 replies; 3+ messages in thread
From: Robert P. J. Day @ 2008-07-16 16:31 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ralf Baechle, linux-mips

On Wed, 16 Jul 2008, Adrian Bunk wrote:

> Commit 52f4f6bbcff5510f662a002ec1219660ea25af62
> ([MIPS] Use kernel-supplied ARRAY_SIZE() macro.)
> causes the following compile error:
>
> <--  snip  -->
>
> ...
>   CC      arch/mips/sgi-ip22/ip28-berr.o
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c: In function 'ip28_be_interrupt':
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:415: error: subscripted value is neither array nor pointer
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:415: error: subscripted value is neither array nor pointer
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:415: warning: type defaults to 'int' in declaration of 'type name'
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:424: error: subscripted value is neither array nor pointer
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:424: error: subscripted value is neither array nor pointer
> /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/mips/sgi-ip22/ip28-berr.c:424: warning: type defaults to 'int' in declaration of 'type name'
> make[2]: *** [arch/mips/sgi-ip22/ip28-berr.o] Error 1
>
> <--  snip  -->
>
> Using ARRAY_SIZE in these places in arch/mips/sgi-ip22/ip28-berr.c was
> bogus, and therefore gets reverted by this patch.
>
> Signed-off-by: Adrian Bunk <bunk@kernel.org>
>
> ---
>
>  arch/mips/sgi-ip22/ip28-berr.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/arch/mips/sgi-ip22/ip28-berr.c
> +++ b/arch/mips/sgi-ip22/ip28-berr.c
> @@ -412,7 +412,7 @@ static int ip28_be_interrupt(const struct pt_regs *regs)
>  	 * Now we have an asynchronous bus error, speculatively or DMA caused.
>  	 * Need to search all DMA descriptors for the error address.
>  	 */
> -	for (i = 0; i < ARRAY_SIZE(hpc3); ++i) {
> +	for (i = 0; i < sizeof(hpc3)/sizeof(struct hpc3_stat); ++i) {
>  		struct hpc3_stat *hp = (struct hpc3_stat *)&hpc3 + i;
>  		if ((cpu_err_stat & CPU_ERRMASK) &&
>  		    (cpu_err_addr == hp->ndptr || cpu_err_addr == hp->cbp))
> @@ -421,7 +421,7 @@ static int ip28_be_interrupt(const struct pt_regs *regs)
>  		    (gio_err_addr == hp->ndptr || gio_err_addr == hp->cbp))
>  			break;
>  	}
> -	if (i < ARRAY_SIZE(hpc3)) {
> +	if (i < sizeof(hpc3)/sizeof(struct hpc3_stat)) {
>  		struct hpc3_stat *hp = (struct hpc3_stat *)&hpc3 + i;
>  		printk(KERN_ERR "at DMA addresses: HPC3 @ %08lx:"
>  		       " ctl %08x, ndp %08x, cbp %08x\n",

quite right, that was a really dumb transformation.  my bad.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [2.6 patch] mips/sgi-ip22/ip28-berr.c: fix the build
  2008-07-16 16:25 [2.6 patch] mips/sgi-ip22/ip28-berr.c: fix the build Adrian Bunk
  2008-07-16 16:31 ` Robert P. J. Day
@ 2008-07-18 14:46 ` Ralf Baechle
  1 sibling, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2008-07-18 14:46 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Robert P. J. Day, linux-mips

Thanks, applied.

  Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-18 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16 16:25 [2.6 patch] mips/sgi-ip22/ip28-berr.c: fix the build Adrian Bunk
2008-07-16 16:31 ` Robert P. J. Day
2008-07-18 14:46 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox