[PATCH 0/6] Removing dead code

Previous thread: [PATCH -next] swiotlb: make io_tlb_overflow static by FUJITA Tomonori on Monday, August 2, 2010 - 7:48 am. (2 messages)

Next thread: [GIT PULL] SWIOTLB features: separation of physical and virtual address translation for v2.6.36 by Konrad Rzeszutek Wilk on Monday, August 2, 2010 - 8:58 am. (1 message)
From: Christian Dietrich
Date: Monday, August 2, 2010 - 8:56 am

Hi all!
       
        As part of the VAMOS[0] research project at the University of
Erlangen we are looking at multiple integrity errors in linux'
configuration system.

        I've been running a check on the blackfin sourcetree for
config Items not defined in Kconfig and found many such cases. Sourcecode
blocks depending on these Items are not reachable from a vanilla
kernel -- dead code. I've seen such dead blocks made on purpose
e.g. while integrating new features into the kernel but generally
they're just useless.

        Each of the patches in this patchset removes on such dead
config Item, I'd be glad if you consider applying them. I've been
doing deeper analysis of such issues before and can do so again but
I'm not so sure they were fastly usefull.

There were many more dead flags in the vanilla kernel cause the config
options were only introduced into the blackfin.uclinux.org kernel. I
hope i just got patches for real problem flags[1]. Perhaps some
syncing here would do something good for the blackfin arch.

I wasn't able to build the kernel for blackfin, so be aware that this
patches might break the compiling process, but i don't think so cause
they (hopefully) are just removing dead code.

        Please keep me informed of this patch getting confirmed /
merged so we can keep track of it.

Regards

        Christian Dietrich

[0] http://vamos1.informatik.uni-erlangen.de/
[1] Dead Flags in vanilla kernel but not in blackfin.uclinux.org
    ## Blackfin -- blackfin.uclinux.org
    BFIN_SPI_ADC
    NET_DSA_KSZ8893M
    BFIN_TWI_LCD
    FB_BF537_LQ035
    FB_HITACHI_TX09
    INPUT_ADXL34X_SPI
    USB_NET2272
    SPI_BFIN_SPORT
    AD2S120X
    AD2S90
    INPUT_ADXL34X
    INPUT_ADXL34X_I2C
    INPUT_ADXL34X_SPI
    USB_SL811_BFIN_USE_VBUS
    JOYSTICK_AD7142
    AD7152
    SND_SOC_ADAU1361
    FB_BFIN_7393
    BACKLIGHT_ADP8870
    SND_SOC_ADAU1371
    AD7414
    SND_SOC_ADAU1761
    REGULATOR_AD5398
    AD7150
    AD7416

Christian ...
From: Christian Dietrich
Date: Monday, August 2, 2010 - 9:00 am

CONFIG_HIGHMEM can't be selected in blackfin, therefore all references
to it can be removed from the arch/blackfin.

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
 arch/blackfin/mm/init.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index bb4e8ff..07ebd3a 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -49,9 +49,6 @@ void __init paging_init(void)
 		[0] = 0,
 		[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT,
 		[ZONE_NORMAL] = 0,
-#ifdef CONFIG_HIGHMEM
-		[ZONE_HIGHMEM] = 0,
-#endif
 	};
 
 	/* Set up SFC/DFC registers (user data space) */
-- 
1.7.0.4

--

From: Mike Frysinger
Date: Saturday, August 7, 2010 - 7:05 pm

while currently we dont support highmem (as our current parts max out
at 512MiB), this should be feasible in the not-so-far future, in which
case we will have highmem support added.  so i'm inclined to leave it
be as in a highmem world, this is the code we'd want.  thanks though.
-mike
--

From: Christian Dietrich
Date: Monday, August 2, 2010 - 9:01 am

CONFIG_BF535 doesn't exist in Kconfig, therefore removing all
references to it from the source. In the past[0] there was also removed
code for this kind of CPU, reasoning, that it's not supported at all.

[0] 986d6c1e05642edac81cb8cc99f36a26d16ef220

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
 arch/blackfin/include/asm/traps.h |    2 +-
 arch/blackfin/kernel/traps.c      |   11 +----------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/arch/blackfin/include/asm/traps.h b/arch/blackfin/include/asm/traps.h
index 9fe0da6..113da1d 100644
--- a/arch/blackfin/include/asm/traps.h
+++ b/arch/blackfin/include/asm/traps.h
@@ -36,7 +36,7 @@
 #define VEC_CPLB_M	(38)
 #define VEC_CPLB_MHIT	(39)
 #define VEC_WATCH	(40)
-#define VEC_ISTRU_VL	(41)	/*ADSP-BF535 only (MH) */
+/* VEC_ISTRU_VL was defined here as (41), but BF535 is not supported */
 #define VEC_MISALI_I	(42)
 #define VEC_CPLB_I_VL	(43)
 #define VEC_CPLB_I_M	(44)
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 59c1df7..2361e67 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -280,17 +280,8 @@ asmlinkage notrace void trap_c(struct pt_regs *fp)
 			goto traps_done;
 		else
 			break;
-#ifdef CONFIG_BF535
-	/* 0x29 - Instruction fetch access error (535 only) */
-	case VEC_ISTRU_VL:      /* ADSP-BF535 only (MH) */
-		info.si_code = BUS_OPFETCH;
-		sig = SIGBUS;
-		strerror = KERN_NOTICE "BF535: VEC_ISTRU_VL\n";
-		CHK_DEBUGGER_TRAP_MAYBE();
-		break;
-#else
+
 	/* 0x29 - Reserved, Caught by default */
-#endif
 	/* 0x2A - Instruction fetch misaligned, handled here */
 	case VEC_MISALI_I:
 		info.si_code = BUS_ADRALN;
-- 
1.7.0.4

--

From: Mike Frysinger
Date: Monday, August 2, 2010 - 10:36 am

while true, i like to keep this vector in the code as a reminder that
we dont have to handle it on newer parts.  so ill pass on this patch.
-mike
--

From: Christian Dietrich
Date: Monday, August 2, 2010 - 9:01 am

MEM_GENERIC_BOARD depends on GENERIC_BOARD, but this flag was removed
in 4f25eb85d64640bc656e72917113a84701521b99, therefore all references
to it from the source can be removed

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
 arch/blackfin/Kconfig                |    5 -----
 arch/blackfin/include/asm/mem_init.h |   18 ------------------
 2 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index f66294b..8e88316 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -328,11 +328,6 @@ config BF53x
 	depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
 	default y
 
-config MEM_GENERIC_BOARD
-	bool
-	depends on GENERIC_BOARD
-	default y
-
 config MEM_MT48LC64M4A2FB_7E
 	bool
 	depends on (BFIN533_STAMP)
diff --git a/arch/blackfin/include/asm/mem_init.h b/arch/blackfin/include/asm/mem_init.h
index 7c8fe83..2375799 100644
--- a/arch/blackfin/include/asm/mem_init.h
+++ b/arch/blackfin/include/asm/mem_init.h
@@ -10,7 +10,6 @@
 #if defined(CONFIG_MEM_MT48LC16M16A2TG_75) || \
     defined(CONFIG_MEM_MT48LC64M4A2FB_7E) || \
     defined(CONFIG_MEM_MT48LC16M8A2TG_75) || \
-    defined(CONFIG_MEM_GENERIC_BOARD) || \
     defined(CONFIG_MEM_MT48LC32M8A2_75) || \
     defined(CONFIG_MEM_MT48LC8M32B2B5_7) || \
     defined(CONFIG_MEM_MT48LC32M16A2TG_75) || \
@@ -178,7 +177,6 @@
 
 #if defined(CONFIG_MEM_MT48LC32M8A2_75) || \
     defined(CONFIG_MEM_MT48LC64M4A2FB_7E) || \
-    defined(CONFIG_MEM_GENERIC_BOARD) || \
     defined(CONFIG_MEM_MT48LC32M16A2TG_75) || \
     defined(CONFIG_MEM_MT48LC16M16A2TG_75) || \
     defined(CONFIG_MEM_MT48LC32M8A2_75)
@@ -248,22 +246,6 @@
 #define DDR_tWR		DDR_TWR(MIN_DDR_SCLK(15))
 #endif
 
-#if defined(CONFIG_MEM_GENERIC_BOARD)
-#define DDR_SIZE	DEVSZ_512
-#define DDR_WIDTH	DEVWD_16
-#define DDR_MAX_tCK	13
-
-#define DDR_tRCD	DDR_TRCD(3)
-#define DDR_tWTR	DDR_TWTR(2)
-#define DDR_tWR		DDR_TWR(2)
-#define ...
From: Mike Frysinger
Date: Monday, August 2, 2010 - 10:40 am

thanks, this one is OK and i'll merge it in a bit
-mike
--

From: Christian Dietrich
Date: Monday, August 2, 2010 - 9:02 am

REGULATOR_ADP_SWITCH doesn't exist in Kconfig, therefore removing all
references for it from the source.

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
 arch/blackfin/mach-bf537/boards/stamp.c |  103 -------------------------------
 1 files changed, 0 insertions(+), 103 deletions(-)

diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 9eaf5b0..09c6b46 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -35,9 +35,6 @@
 #include <asm/reboot.h>
 #include <asm/portmux.h>
 #include <asm/dpmc.h>
-#ifdef CONFIG_REGULATOR_ADP_SWITCH
-#include <linux/regulator/adp_switch.h>
-#endif
 #ifdef CONFIG_REGULATOR_AD5398
 #include <linux/regulator/ad5398.h>
 #endif
@@ -2146,97 +2143,6 @@ static struct platform_device bfin_ac97 = {
 };
 #endif
 
-#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
-#define REGULATOR_ADP122        "adp122"
-#define REGULATOR_ADP150        "adp150"
-
-static struct regulator_consumer_supply adp122_consumers = {
-		.supply = REGULATOR_ADP122,
-};
-
-static struct regulator_consumer_supply adp150_consumers = {
-		.supply = REGULATOR_ADP150,
-};
-
-static struct regulator_init_data adp_switch_regulator_data[] = {
-	{
-		.constraints = {
-			.name = REGULATOR_ADP122,
-			.valid_ops_mask = REGULATOR_CHANGE_STATUS,
-			.min_uA = 0,
-			.max_uA = 300000,
-		},
-		.num_consumer_supplies = 1,	/* only 1 */
-		.consumer_supplies     = &adp122_consumers,
-		.driver_data	       = (void *)GPIO_PF2, /* gpio port only */
-	},
-	{
-		.constraints = {
-			.name = REGULATOR_ADP150,
-			.valid_ops_mask = REGULATOR_CHANGE_STATUS,
-			.min_uA = 0,
-			.max_uA = 150000,
-		},
-		.num_consumer_supplies = 1,	/* only 1 */
-		.consumer_supplies     = &adp150_consumers,
-		.driver_data	       = (void *)GPIO_PF3, /* gpio port only */
-	},
-};
-
-static struct adp_switch_platform_data ...
From: Mike Frysinger
Date: Monday, August 2, 2010 - 10:38 am

we have patches pending locally to take care of this in a different
way, so i'll stick with those
-mike
--

From: Christian Dietrich
Date: Monday, August 2, 2010 - 9:02 am

ADF702X doesn't exist in Kconfig, therefore removing all references to
it from the source.

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
 arch/blackfin/mach-bf537/boards/stamp.c |   59 -------------------------------
 1 files changed, 0 insertions(+), 59 deletions(-)

diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 09c6b46..ebce0d8 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -824,53 +824,6 @@ static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
 };
 #endif
 
-#if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
-static struct bfin5xx_spi_chip adf7021_spi_chip_info = {
-	.bits_per_word = 16,
-	.cs_gpio = GPIO_PF10,
-};
-
-#include <linux/spi/adf702x.h>
-#define TXREG 0x0160A470
-static const u32 adf7021_regs[] = {
-	0x09608FA0,
-	0x00575011,
-	0x00A7F092,
-	0x2B141563,
-	0x81F29E94,
-	0x00003155,
-	0x050A4F66,
-	0x00000007,
-	0x00000008,
-	0x000231E9,
-	0x3296354A,
-	0x891A2B3B,
-	0x00000D9C,
-	0x0000000D,
-	0x0000000E,
-	0x0000000F,
-};
-
-static struct adf702x_platform_data adf7021_platform_data = {
-	.regs_base = (void *)SPORT1_TCR1,
-	.dma_ch_rx = CH_SPORT1_RX,
-	.dma_ch_tx = CH_SPORT1_TX,
-	.irq_sport_err = IRQ_SPORT1_ERROR,
-	.gpio_int_rfs = GPIO_PF8,
-	.pin_req = {P_SPORT1_DTPRI, P_SPORT1_RFS, P_SPORT1_DRPRI,
-			P_SPORT1_RSCLK, P_SPORT1_TSCLK, 0},
-	.adf702x_model = MODEL_ADF7021,
-	.adf702x_regs = adf7021_regs,
-	.tx_reg = TXREG,
-};
-static inline void adf702x_mac_init(void)
-{
-	random_ether_addr(adf7021_platform_data.mac_addr);
-}
-#else
-static inline void adf702x_mac_init(void) {}
-#endif
-
 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
 #include <linux/spi/ads7846.h>
 static struct bfin5xx_spi_chip ad7873_spi_chip_info = {
@@ -1116,17 +1069,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
 		.mode = ...
From: Mike Frysinger
Date: Monday, August 2, 2010 - 10:34 am

NAK: this driver is pending for the netdev tree

btw, any ADI/Blackfin maintainer is on the uclinux-dist mailing list,
so dont need to include them directly
-mike
--

From: Christian Dietrich
Date: Monday, August 2, 2010 - 9:03 am

CONFIG_SND_BLACKFIN_AD183X doesn't exist in Kconfig, therefore removing
all references to it from the source.

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
---
 arch/blackfin/mach-bf527/boards/cm_bf527.c  |   18 ------------------
 arch/blackfin/mach-bf527/boards/ezkit.c     |   18 ------------------
 arch/blackfin/mach-bf533/boards/H8606.c     |   17 -----------------
 arch/blackfin/mach-bf533/boards/cm_bf533.c  |   17 -----------------
 arch/blackfin/mach-bf533/boards/ezkit.c     |   16 ----------------
 arch/blackfin/mach-bf533/boards/stamp.c     |   17 -----------------
 arch/blackfin/mach-bf537/boards/cm_bf537e.c |   17 -----------------
 arch/blackfin/mach-bf537/boards/cm_bf537u.c |   17 -----------------
 arch/blackfin/mach-bf537/boards/pnav10.c    |   18 ------------------
 arch/blackfin/mach-bf537/boards/tcm_bf537.c |   17 -----------------
 arch/blackfin/mach-bf548/boards/ezkit.c     |   18 ------------------
 arch/blackfin/mach-bf561/boards/cm_bf561.c  |   16 ----------------
 arch/blackfin/mach-bf561/boards/ezkit.c     |   18 ------------------
 13 files changed, 0 insertions(+), 224 deletions(-)

diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index f392af6..7747f5d 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -343,14 +343,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
 };
 #endif
 
-#if defined(CONFIG_SND_BLACKFIN_AD183X) \
-	|| defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
-	.enable_dma = 0,
-	.bits_per_word = 16,
-};
-#endif
-
 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
 static struct bfin5xx_spi_chip  mmc_spi_chip_info = {
 	.enable_dma = 0,
@@ -421,16 +413,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
 	},
 #endif
 
-#if defined(CONFIG_SND_BLACKFIN_AD183X) \
-	|| ...
From: Mike Frysinger
Date: Monday, August 2, 2010 - 10:39 am

NAK: this driver is pending for the ASoC tree
-mike
--

From: Mike Frysinger
Date: Monday, August 2, 2010 - 10:50 am

yeah, our board resources often lead the rest of the tree in the
vanilla release.  this is because it's easy for us to merge board
resources without adversely impacting anything else, and sometimes we
dont know when the actual driver will get around to being merged.
-ike
--

Previous thread: [PATCH -next] swiotlb: make io_tlb_overflow static by FUJITA Tomonori on Monday, August 2, 2010 - 7:48 am. (2 messages)

Next thread: [GIT PULL] SWIOTLB features: separation of physical and virtual address translation for v2.6.36 by Konrad Rzeszutek Wilk on Monday, August 2, 2010 - 8:58 am. (1 message)