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

sh: mach-x3proto: Improve ILSEL debugging.

At the moment ILSEL blows up with a BUG when aliased sets are handed in,
but as the enable call is able to hand back errors we opt for that path
instead. None of the ILSEL peripherals are vital to the board's
operation, so trapping a BUG is a bit excessive.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

+12 -4
+12 -4
arch/sh/boards/mach-x3proto/ilsel.c
··· 1 1 /* 2 - * arch/sh/boards/renesas/x3proto/ilsel.c 2 + * arch/sh/boards/mach-x3proto/ilsel.c 3 3 * 4 4 * Helper routines for SH-X3 proto board ILSEL. 5 5 * 6 - * Copyright (C) 2007 Paul Mundt 6 + * Copyright (C) 2007 - 2010 Paul Mundt 7 7 * 8 8 * This file is subject to the terms and conditions of the GNU General Public 9 9 * License. See the file "COPYING" in the main directory of this archive 10 10 * for more details. 11 11 */ 12 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13 + 12 14 #include <linux/init.h> 13 15 #include <linux/kernel.h> 14 16 #include <linux/module.h> ··· 66 64 unsigned int tmp, shift; 67 65 unsigned long addr; 68 66 67 + pr_notice("enabling ILSEL set %d\n", set); 68 + 69 69 addr = mk_ilsel_addr(bit); 70 70 shift = mk_ilsel_shift(bit); 71 71 ··· 96 92 { 97 93 unsigned int bit; 98 94 99 - /* Aliased sources must use ilsel_enable_fixed() */ 100 - BUG_ON(set > ILSEL_KEY); 95 + if (unlikely(set > ILSEL_KEY)) { 96 + pr_err("Aliased sources must use ilsel_enable_fixed()\n"); 97 + return -EINVAL; 98 + } 101 99 102 100 do { 103 101 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS); ··· 145 139 { 146 140 unsigned long addr; 147 141 unsigned int tmp; 142 + 143 + pr_notice("disabling ILSEL set %d\n", irq); 148 144 149 145 addr = mk_ilsel_addr(irq); 150 146