summaryrefslogtreecommitdiff
path: root/arch/mips/bcm63xx
diff options
context:
space:
mode:
authorzhouchuangao <zhouchuangao@vivo.com>2021-04-24 08:59:50 -0700
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2021-04-26 10:23:52 +0200
commit7e9be673cb1b0be0f4279a960c2ecb28a147c327 (patch)
tree1db952de1a126cc73d5f4bec00a705292b5c187f /arch/mips/bcm63xx
parentc55944cc0ec57731931987ff478a9f69fe68f157 (diff)
downloadlwn-7e9be673cb1b0be0f4279a960c2ecb28a147c327.tar.gz
lwn-7e9be673cb1b0be0f4279a960c2ecb28a147c327.zip
MIPS: BCM63XX: Use BUG_ON instead of condition followed by BUG.
BUG_ON uses unlikely in if(), it can be optimized at compile time. Usually, the condition in if() is not satisfied. In my opinion, this can improve the efficiency of the multi-stage pipeline. Signed-off-by: zhouchuangao <zhouchuangao@vivo.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/bcm63xx')
-rw-r--r--arch/mips/bcm63xx/gpio.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
index 16f353ac3441..5c4a233db55f 100644
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
@@ -43,8 +43,7 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
u32 *v;
unsigned long flags;
- if (gpio >= chip->ngpio)
- BUG();
+ BUG_ON(gpio >= chip->ngpio);
if (gpio < 32) {
reg = gpio_out_low_reg;
@@ -70,8 +69,7 @@ static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
u32 reg;
u32 mask;
- if (gpio >= chip->ngpio)
- BUG();
+ BUG_ON(gpio >= chip->ngpio);
if (gpio < 32) {
reg = gpio_out_low_reg;
@@ -92,8 +90,7 @@ static int bcm63xx_gpio_set_direction(struct gpio_chip *chip,
u32 tmp;
unsigned long flags;
- if (gpio >= chip->ngpio)
- BUG();
+ BUG_ON(gpio >= chip->ngpio);
if (gpio < 32) {
reg = GPIO_CTL_LO_REG;