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

[PATCH] Optimize qe_brg struct to use an array

The qe_brg structure manually defined each of the 16 BRG registers, which
made any code that used them cumbersome. This patch replaces the fields
with a single 16-element array.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Timur Tabi and committed by
Paul Mackerras
fc9e8b4e 0613ffbf

+2 -18
+1 -2
arch/powerpc/sysdev/qe_lib/qe.c
··· 175 175 u32 divisor, tempval; 176 176 int div16 = 0; 177 177 178 - bp = &qe_immr->brg.brgc1; 179 - bp += brg; 178 + bp = &qe_immr->brg.brgc[brg]; 180 179 181 180 divisor = (get_brg_clk() / rate); 182 181 if (divisor > QE_BRGC_DIVISOR_MAX + 1) {
+1 -16
include/asm-powerpc/immap_qe.h
··· 136 136 137 137 /* BRG */ 138 138 struct qe_brg { 139 - __be32 brgc1; /* BRG1 configuration register */ 140 - __be32 brgc2; /* BRG2 configuration register */ 141 - __be32 brgc3; /* BRG3 configuration register */ 142 - __be32 brgc4; /* BRG4 configuration register */ 143 - __be32 brgc5; /* BRG5 configuration register */ 144 - __be32 brgc6; /* BRG6 configuration register */ 145 - __be32 brgc7; /* BRG7 configuration register */ 146 - __be32 brgc8; /* BRG8 configuration register */ 147 - __be32 brgc9; /* BRG9 configuration register */ 148 - __be32 brgc10; /* BRG10 configuration register */ 149 - __be32 brgc11; /* BRG11 configuration register */ 150 - __be32 brgc12; /* BRG12 configuration register */ 151 - __be32 brgc13; /* BRG13 configuration register */ 152 - __be32 brgc14; /* BRG14 configuration register */ 153 - __be32 brgc15; /* BRG15 configuration register */ 154 - __be32 brgc16; /* BRG16 configuration register */ 139 + __be32 brgc[16]; /* BRG configuration registers */ 155 140 u8 res0[0x40]; 156 141 } __attribute__ ((packed)); 157 142