Skip to contentSkip to conversation

MIPS: kernel: traps: Remove useless BUG_ON()

PATCH In review Markos Chandras 2 participants 4 messages Sep 26, 2013 – Sep 27, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: kernel: traps: Remove useless BUG_ON()

Checking for n<0 && n>9 makes no sense because it can never be true. Moreover, we can have up to 64 vectored interrupts so BUG_ON(n>9) was wrong anyway.

---
This patch is for the upstream-sfr/mips-for-linux-next tree

---
 arch/mips/kernel/traps.c | 1 -
 1 file changed, 1 deletion(-)
arch/mips/kernel/traps.c +0 -1
index 524841f..f2ae9cb 100644
@@ -1554,7 +1554,6 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 	unsigned char *b;
 
 	BUG_ON(!cpu_has_veic && !cpu_has_vint);
-	BUG_ON((n < 0) && (n > 9));
 
 	if (addr == NULL) {
 		handler = (unsigned long) do_default_vi;
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 8 lines · Markos Chandras

Checking for n<0 && n>9 makes no sense because it can never be true. Moreover, we can have up to 64 vectored interrupts so BUG_ON(n>9) was wrong anyway.

---
This patch is for the upstream-sfr/mips-for-linux-next tree

What gem ;-)

I think the intent was

  BUG_ON(n < 0 || n > 9);

and 9 probably is the highest currently used value?

In any case that could have broken PowerTV which does the following:

        if (cpu_has_veic || cpu_has_vint) {
                int nvec = cpu_has_veic ? 64 : 8;
                for (i = 0; i < nvec; i++)
                        set_vi_handler(i, asic_irqdispatch);
        }

Nobody from PowerTV complained. Time to sharpen the axe!

Ralf

#2 lore raw

MIPS: PowerTV: Remove support code.

Nobody seems to care about this platform anymore and my attempts to find somebody willing to provide some tlc for PowerTV have failed so far.

So let's nuke the bloody thing.

---
 arch/mips/Kbuild.platforms                         |   1 -
 arch/mips/Kconfig                                  |  20 -
 arch/mips/configs/powertv_defconfig                | 136 -----
 arch/mips/include/asm/mach-powertv/asic.h          | 120 -----
 arch/mips/include/asm/mach-powertv/asic_reg_map.h  |  90 ----
 arch/mips/include/asm/mach-powertv/asic_regs.h     | 125 -----
 .../asm/mach-powertv/cpu-feature-overrides.h       |  60 ---
 arch/mips/include/asm/mach-powertv/dma-coherence.h | 107 ----
 arch/mips/include/asm/mach-powertv/interrupts.h    | 253 ---------
 arch/mips/include/asm/mach-powertv/ioremap.h       | 167 ------
 arch/mips/include/asm/mach-powertv/irq.h           |  25 -
 arch/mips/include/asm/mach-powertv/powertv-clock.h |  29 -
 arch/mips/include/asm/mach-powertv/war.h           |  27 -
 arch/mips/kernel/Makefile                          |   1 -
 arch/mips/kernel/csrc-powertv.c                    | 151 ------
 arch/mips/powertv/Kconfig                          |  12 -
 arch/mips/powertv/Makefile                         |  29 -
 arch/mips/powertv/Platform                         |   7 -
 arch/mips/powertv/asic/Makefile                    |  21 -
 arch/mips/powertv/asic/asic-calliope.c             | 101 ----
 arch/mips/powertv/asic/asic-cronus.c               | 101 ----
 arch/mips/powertv/asic/asic-gaia.c                 |  96 ----
 arch/mips/powertv/asic/asic-zeus.c                 | 101 ----
 arch/mips/powertv/asic/asic_devices.c              | 549 -------------------
 arch/mips/powertv/asic/asic_int.c                  | 125 -----
 arch/mips/powertv/asic/irq_asic.c                  | 115 ----
 arch/mips/powertv/asic/prealloc-calliope.c         | 385 --------------
 arch/mips/powertv/asic/prealloc-cronus.c           | 340 ------------
 arch/mips/powertv/asic/prealloc-cronuslite.c       | 174 ------
 arch/mips/powertv/asic/prealloc-gaia.c             | 589 ---------------------
 arch/mips/powertv/asic/prealloc-zeus.c             | 304 -----------
 arch/mips/powertv/asic/prealloc.h                  |  70 ---
 arch/mips/powertv/init.c                           |  90 ----
 arch/mips/powertv/init.h                           |  28 -
 arch/mips/powertv/ioremap.c                        | 136 -----
 arch/mips/powertv/memory.c                         | 353 ------------
 arch/mips/powertv/pci/Makefile                     |  19 -
 arch/mips/powertv/pci/fixup-powertv.c              |  37 --
 arch/mips/powertv/pci/powertv-pci.h                |  31 --
 arch/mips/powertv/powertv-clock.h                  |  26 -
 arch/mips/powertv/powertv-usb.c                    | 404 --------------
 arch/mips/powertv/powertv_setup.c                  | 319 -----------
 arch/mips/powertv/reset.c                          |  35 --
 arch/mips/powertv/reset.h                          |  26 -
 arch/mips/powertv/time.c                           |  36 --
 45 files changed, 5971 deletions(-)
arch/mips/Kbuild.platforms +0 -1
index d9d81c2..6e23912 100644
@@ -20,7 +20,6 @@ platforms += mti-sead3
 platforms += netlogic
 platforms += pmcs-msp71xx
 platforms += pnx833x
-platforms += powertv
 platforms += ralink
 platforms += rb532
 platforms += sgi-ip22
arch/mips/Kconfig +0 -20
index d244047..1f2e4ee 100644
@@ -415,23 +415,6 @@ config PMC_MSP
 	  of integrated peripherals, interfaces and DSPs in addition to
 	  a variety of MIPS cores.
 
-config POWERTV
-	bool "Cisco PowerTV"
-	select BOOT_ELF32
-	select CEVT_R4K
-	select CPU_MIPSR2_IRQ_VI
-	select CPU_MIPSR2_IRQ_EI
-	select CSRC_POWERTV
-	select DMA_NONCOHERENT
-	select HW_HAS_PCI
-	select SYS_HAS_CPU_MIPS32_R2
-	select SYS_SUPPORTS_32BIT_KERNEL
-	select SYS_SUPPORTS_BIG_ENDIAN
-	select SYS_SUPPORTS_HIGHMEM
-	select USB_OHCI_LITTLE_ENDIAN
-	help
-	  This enables support for the Cisco PowerTV Platform.
-
 config RALINK
 	bool "Ralink based machines"
 	select CEVT_R4K
@@ -893,9 +876,6 @@ config CSRC_BCM1480
 config CSRC_IOASIC
 	bool
 
-config CSRC_POWERTV
-	bool
-
 config CSRC_R4K
 	bool
 
arch/mips/configs/powertv_defconfig deleted +0 -136

136 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/asic.h deleted +0 -120

120 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/asic_reg_map.h deleted +0 -90

90 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/asic_regs.h deleted +0 -125

125 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h deleted +0 -60

60 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/dma-coherence.h deleted +0 -107

107 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/interrupts.h deleted +0 -253

253 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/ioremap.h deleted +0 -167

167 lines not on this page · raw message

arch/mips/include/asm/mach-powertv/irq.h deleted +0 -25
deleted file mode 100644
index 4bd5d0c..0000000
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2009  Cisco Systems, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef _ASM_MACH_POWERTV_IRQ_H
-#define _ASM_MACH_POWERTV_IRQ_H
-#include <asm/mach-powertv/interrupts.h>
-
-#define MIPS_CPU_IRQ_BASE	ibase
-#define NR_IRQS			127
-#endif
arch/mips/include/asm/mach-powertv/powertv-clock.h deleted +0 -29
deleted file mode 100644
index 6f3e9a0..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2009  Cisco Systems, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-/*
- * Local definitions for the powertv PCI code
- */
-
-#ifndef _POWERTV_PCI_POWERTV_PCI_H_
-#define _POWERTV_PCI_POWERTV_PCI_H_
-extern int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
-extern int asic_pcie_init(void);
-extern int asic_pcie_init(void);
-
-extern int log_level;
-#endif
arch/mips/include/asm/mach-powertv/war.h deleted +0 -27
deleted file mode 100644
index c5651c8..0000000
@@ -1,27 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * This version for the PowerTV platform copied from the Malta version.
- *
- * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <[email protected]>
- * Portions copyright (C) 2009 Cisco Systems, Inc.
- */
-#ifndef __ASM_MACH_POWERTV_WAR_H
-#define __ASM_MACH_POWERTV_WAR_H
-
-#define R4600_V1_INDEX_ICACHEOP_WAR	0
-#define R4600_V1_HIT_CACHEOP_WAR	0
-#define R4600_V2_HIT_CACHEOP_WAR	0
-#define R5432_CP0_INTERRUPT_WAR		0
-#define BCM1250_M3_WAR			0
-#define SIBYTE_1956_WAR			0
-#define MIPS4K_ICACHE_REFILL_WAR	1
-#define MIPS_CACHE_SYNC_WAR		1
-#define TX49XX_ICACHE_INDEX_INV_WAR	0
-#define ICACHE_REFILLS_WORKAROUND_WAR	1
-#define R10000_LLSC_WAR			0
-#define MIPS34K_MISSED_ITLB_WAR		0
-
-#endif /* __ASM_MACH_POWERTV_WAR_H */
arch/mips/kernel/Makefile +0 -1
index 81773a4..1c1b717 100644
@@ -26,7 +26,6 @@ obj-$(CONFIG_CEVT_TXX9)		+= cevt-txx9.o
 obj-$(CONFIG_CSRC_BCM1480)	+= csrc-bcm1480.o
 obj-$(CONFIG_CSRC_GIC)		+= csrc-gic.o
 obj-$(CONFIG_CSRC_IOASIC)	+= csrc-ioasic.o
-obj-$(CONFIG_CSRC_POWERTV)	+= csrc-powertv.o
 obj-$(CONFIG_CSRC_R4K)		+= csrc-r4k.o
 obj-$(CONFIG_CSRC_SB1250)	+= csrc-sb1250.o
 obj-$(CONFIG_SYNC_R4K)		+= sync-r4k.o
arch/mips/kernel/csrc-powertv.c deleted +0 -151

151 lines not on this page · raw message

arch/mips/powertv/Kconfig deleted +0 -12
deleted file mode 100644
index dd91fba..0000000
@@ -1,12 +0,0 @@
-config BOOTLOADER_FAMILY
-	string "POWERTV Bootloader Family string"
-	default "85"
-	depends on POWERTV
-	help
-	  This value should be specified when the bootloader driver is disabled
-	  and must be exactly two characters long. Families supported are:
-	    R1 - RNG-100  R2 - RNG-200
-	    A1 - Class A  B1 - Class B
-	    E1 - Class E  F1 - Class F
-	    44 - 45xx     46 - 46xx
-	    85 - 85xx     86 - 86xx
arch/mips/powertv/Makefile deleted +0 -29
deleted file mode 100644
index 39ca9f8..0000000
@@ -1,29 +0,0 @@
-#
-# Carsten Langgaard, [email protected]
-# Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
-#
-# Carsten Langgaard, [email protected]
-# Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
-# Portions copyright (C)  2009 Cisco Systems, Inc.
-#
-# This program is free software; you can distribute it and/or modify it
-# under the terms of the GNU General Public License (Version 2) as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
-#
-# Makefile for the Cisco PowerTV-specific kernel interface routines
-# under Linux.
-#
-
-obj-y += init.o ioremap.o memory.o powertv_setup.o reset.o time.o \
-	asic/ pci/
-
-obj-$(CONFIG_USB) += powertv-usb.o
arch/mips/powertv/Platform deleted +0 -7
deleted file mode 100644
index 4eb5af1..0000000
@@ -1,7 +0,0 @@
-#
-# Cisco PowerTV Platform
-#
-platform-$(CONFIG_POWERTV)	+= powertv/
-cflags-$(CONFIG_POWERTV)	+=					\
-		-I$(srctree)/arch/mips/include/asm/mach-powertv
-load-$(CONFIG_POWERTV)		+= 0xffffffff90800000
arch/mips/powertv/asic/Makefile deleted +0 -21
deleted file mode 100644
index 35dcc53..0000000
@@ -1,21 +0,0 @@
-#
-# Copyright (C) 2009  Scientific-Atlanta, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-obj-y += asic-calliope.o asic-cronus.o asic-gaia.o asic-zeus.o \
-	asic_devices.o asic_int.o irq_asic.o prealloc-calliope.o \
-	prealloc-cronus.o prealloc-cronuslite.o prealloc-gaia.o prealloc-zeus.o
arch/mips/powertv/asic/asic-calliope.c deleted +0 -101

101 lines not on this page · raw message

arch/mips/powertv/asic/asic-cronus.c deleted +0 -101

101 lines not on this page · raw message

arch/mips/powertv/asic/asic-gaia.c deleted +0 -96

96 lines not on this page · raw message

arch/mips/powertv/asic/asic-zeus.c deleted +0 -101

101 lines not on this page · raw message

arch/mips/powertv/asic/asic_devices.c deleted +0 -549

549 lines not on this page · raw message

arch/mips/powertv/asic/asic_int.c deleted +0 -125

125 lines not on this page · raw message

arch/mips/powertv/asic/irq_asic.c deleted +0 -115

115 lines not on this page · raw message

arch/mips/powertv/asic/prealloc-calliope.c deleted +0 -385

385 lines not on this page · raw message

arch/mips/powertv/asic/prealloc-cronus.c deleted +0 -340

22 lines not on this page · raw message

arch/mips/powertv/asic/prealloc-cronuslite.c deleted +0 -174

174 lines not on this page · raw message

arch/mips/powertv/asic/prealloc-gaia.c deleted +0 -589

589 lines not on this page · raw message

arch/mips/powertv/asic/prealloc-zeus.c deleted +0 -304

304 lines not on this page · raw message

arch/mips/powertv/asic/prealloc.h deleted +0 -70

70 lines not on this page · raw message

arch/mips/powertv/init.c deleted +0 -90

90 lines not on this page · raw message

arch/mips/powertv/init.h deleted +0 -28
deleted file mode 100644
index c1a8bd0..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/ioremap.c deleted +0 -136

136 lines not on this page · raw message

arch/mips/powertv/memory.c deleted +0 -353

353 lines not on this page · raw message

arch/mips/powertv/pci/Makefile deleted +0 -19
deleted file mode 100644
index 2610a6a..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/pci/fixup-powertv.c deleted +0 -37
deleted file mode 100644
index d7ecbae..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/pci/powertv-pci.h deleted +0 -31
deleted file mode 100644
index 1b5886b..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/powertv-clock.h deleted +0 -26
deleted file mode 100644
index d94c543..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/powertv-usb.c deleted +0 -404

404 lines not on this page · raw message

arch/mips/powertv/powertv_setup.c deleted +0 -319

319 lines not on this page · raw message

arch/mips/powertv/reset.c deleted +0 -35
deleted file mode 100644
index 11c32fb..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/reset.h deleted +0 -26
deleted file mode 100644
index 888fd09..0000000

Lines of this file are not shown. View the raw message.

arch/mips/powertv/time.c deleted +0 -36
deleted file mode 100644
index f38b0d4..0000000

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#3 lore raw
In reply to Ralf Baechle
Quoted 9 lines · Ralf Baechle

In any case that could have broken PowerTV which does the following:

        if (cpu_has_veic || cpu_has_vint) {
                int nvec = cpu_has_veic ? 64 : 8;
                for (i = 0; i < nvec; i++)
                        set_vi_handler(i, asic_irqdispatch);
        }

Nobody from PowerTV complained. Time to sharpen the axe!

Ok… Of course it didn't break PowerTV - but I was getting pretty triggerhappy about that platform anyway.

So while I've queued the patch to remove PowerTV support, I'm more than happy to remove it again if somebody shows up and promises to test and take care of the platform. And such threats seem to work most efficient with the proper patch bomb attached.

That of course doesn't affect your patch which I'm going to apply.

Ralf