Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[CELL] spufs: fix array size of channel index

Based on a fix from Masato Noguchi <Masato.Noguchi@jp.sony.com>.

Remove the (incorrect) array size declarations in the spufs channel
arrays, and use ARRAY_SIZE rather than hardcoded values.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

authored by

Jeremy Kerr and committed by
Arnd Bergmann
daced0f7 27b1ea09

+6 -6
+6 -6
arch/powerpc/platforms/cell/spufs/switch.c
··· 616 616 static inline void save_ch_part1(struct spu_state *csa, struct spu *spu) 617 617 { 618 618 struct spu_priv2 __iomem *priv2 = spu->priv2; 619 - u64 idx, ch_indices[7] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 619 + u64 idx, ch_indices[] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 620 620 int i; 621 621 622 622 /* Save, Step 42: ··· 627 627 csa->spu_chnldata_RW[1] = in_be64(&priv2->spu_chnldata_RW); 628 628 629 629 /* Save the following CH: [0,3,4,24,25,27] */ 630 - for (i = 0; i < 7; i++) { 630 + for (i = 0; i < ARRAY_SIZE(ch_indices); i++) { 631 631 idx = ch_indices[i]; 632 632 out_be64(&priv2->spu_chnlcntptr_RW, idx); 633 633 eieio(); ··· 1091 1091 static inline void reset_ch_part1(struct spu_state *csa, struct spu *spu) 1092 1092 { 1093 1093 struct spu_priv2 __iomem *priv2 = spu->priv2; 1094 - u64 ch_indices[7] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 1094 + u64 ch_indices[] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 1095 1095 u64 idx; 1096 1096 int i; 1097 1097 ··· 1103 1103 out_be64(&priv2->spu_chnldata_RW, 0UL); 1104 1104 1105 1105 /* Reset the following CH: [0,3,4,24,25,27] */ 1106 - for (i = 0; i < 7; i++) { 1106 + for (i = 0; i < ARRAY_SIZE(ch_indices); i++) { 1107 1107 idx = ch_indices[i]; 1108 1108 out_be64(&priv2->spu_chnlcntptr_RW, idx); 1109 1109 eieio(); ··· 1563 1563 static inline void restore_ch_part1(struct spu_state *csa, struct spu *spu) 1564 1564 { 1565 1565 struct spu_priv2 __iomem *priv2 = spu->priv2; 1566 - u64 idx, ch_indices[7] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 1566 + u64 idx, ch_indices[] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 1567 1567 int i; 1568 1568 1569 1569 /* Restore, Step 59: ··· 1574 1574 out_be64(&priv2->spu_chnldata_RW, csa->spu_chnldata_RW[1]); 1575 1575 1576 1576 /* Restore the following CH: [0,3,4,24,25,27] */ 1577 - for (i = 0; i < 7; i++) { 1577 + for (i = 0; i < ARRAY_SIZE(ch_indices); i++) { 1578 1578 idx = ch_indices[i]; 1579 1579 out_be64(&priv2->spu_chnlcntptr_RW, idx); 1580 1580 eieio();