The number of the columns to be printed is computed in two different function. Add a helper function for that and remove the duplicated code. Signed-off-by: Gabor Juhos <juhosg@xxxxxxxxxxx> --- tools/initvals/initvals.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/initvals/initvals.c b/tools/initvals/initvals.c index 4413e04..94f5aba 100644 --- a/tools/initvals/initvals.c +++ b/tools/initvals/initvals.c @@ -443,17 +443,26 @@ static u32 ath9k_patch_initval(u32 idx, u32 val) return val; } -static void ath9k_hw_print_initval(const char *name, const u32 *array, u32 rows, - u32 columns, bool onedim, bool wide) +static u32 ath9k_get_p_columns(u32 columns, bool wide) { u32 p_columns; - u32 col, row; if (wide) p_columns = columns; else p_columns = columns > 5 ? 5 : columns; + return p_columns; +} + +static void ath9k_hw_print_initval(const char *name, const u32 *array, u32 rows, + u32 columns, bool onedim, bool wide) +{ + u32 p_columns; + u32 col, row; + + p_columns = ath9k_get_p_columns(columns, wide); + if (onedim) printf("static const u32 %s[] = {\n", name); else @@ -508,10 +517,7 @@ static char *ath9k_hw_check_initval(const u32 *array, u32 rows, u32 columns, u32 p_columns; u32 col, row; - if (wide) - p_columns = columns; - else - p_columns = columns > 5 ? 5 : columns; + p_columns = ath9k_get_p_columns(columns, wide); SHA1_Init(&ctx); for (row = 0; row < rows; row++) { -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html