Skip to contentSkip to conversation

apparently, numerous unused header files under arch/arm

DISCUSSION Robert P. J. Day 3 participants 5 messages Sep 30, 2009

lore
Share & tools
lore
#0 lore raw

as part of a new tree scan with one of my scripts, i located what
*appear* to be numerous header files under arch/arm that no one seems to be including. the first few in that list, accompanied by a full tree scan of any use of the filename:

===== at91_adc.h =====
./arch/arm/mach-at91/include/mach/at91_adc.h arch/arm/mach-at91/include/mach/at91_adc.h: * arch/arm/mach-at91/include/mach/at91_adc.h ===== at91_spi.h =====
./arch/arm/mach-at91/include/mach/at91_spi.h arch/arm/mach-at91/include/mach/at91_spi.h: * arch/arm/mach-at91/include/mach/at91_spi.h ===== at91_ssc.h =====
./arch/arm/mach-at91/include/mach/at91_ssc.h arch/arm/mach-at91/include/mach/at91_ssc.h: * arch/arm/mach-at91/include/mach/at91_ssc.h ===== aux_reg.h =====
./arch/arm/mach-l7200/include/mach/aux_reg.h arch/arm/mach-l7200/include/mach/aux_reg.h: * arch/arm/mach-l7200/include/mach/aux_reg.h ===== bast-pmu.h =====
./arch/arm/mach-s3c2410/include/mach/bast-pmu.h arch/arm/mach-s3c2410/include/mach/bast-pmu.h:/* arch/arm/mach-s3c2410/include/mach/bast-pmu.h ===== board-mx35pdk.h =====
./arch/arm/plat-mxc/include/mach/board-mx35pdk.h
===== board-pcm043.h =====
./arch/arm/plat-mxc/include/mach/board-pcm043.h
===== board-voiceblue.h ===== ./arch/arm/plat-omap/include/mach/board-voiceblue.h

... etc etc ...

so, for example, nothing seems to include that last listed
board-voiceblue.h header, not even the source file that's the obvious
candidate: arch/arm/mach-omap1/board-voiceblue.c. and there's lots more of those. (they're listed in alphabetical order, and i was only up to the "b"s, but it's almost certain that i'll have some false positives in there somewhere, perhaps because of Makefile-based includes.)

is there any interest in my posting that arm-specific list somewhere
and people can peruse it and decide what, if anything, they want to do with it?

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday

========================================================================

#1 lore raw
Quoted 3 lines · Robert P. J. Day

is there any interest in my posting that arm-specific list somewhere and people can peruse it and decide what, if anything, they want to do with it?

Any chance the script itself could be made available? I would find this useful as I'm working through large amounts of code to get it to a state where it can be sent out as patches.

David

#2 lore raw
Quoted 9 lines · David Brown
Quoted 3 lines · Robert P. J. Day

is there any interest in my posting that arm-specific list somewhere and people can peruse it and decide what, if anything, they want to do with it?

Any chance the script itself could be made available? I would find this useful as I'm working through large amounts of code to get it to a state where it can be sent out as patches.

an embarrassingly brute force approach -- most of my scripts are
just tweaked variations of the following. run from whatever location you want, and customize to taste:

===== start script =====

#!/bin/sh

# This script should always be run from the *top* of the kernel

# source tree.
#
#  Typical usage:
#
#  $ find_unused_headers.sh sound
#
#  Make sure you run some version of "make clean" before running
# this script.

DIR=${1-*} # optional dir to scan, otherwise "."

# Make a list of all of the header files in the given directory # structure, and rip off their basenames.

LONGHDRS=$(find ${DIR} -name "*.h")

HDRS=""

for h in ${LONGHDRS} ; do

	HDRS="${HDRS} $(basename ${h})"

done

#
# just for fun, process them in sorted order
#

HDRS=$(for h in ${HDRS} ; do echo $h ; done | sort -u)

# echo "${HDRS}"

#
# Test that each header file is included from *somewhere*. #

for h in ${HDRS} ; do

	# echo "Testing $h ..."
	egrep -rwq " *# *include.*\b${h}\b" * || {
		echo "===== ${h} ====="
		find . -name "${h}"
		grep -rwH ${h} *
	}
done

===== end script =====

that last "grep" is simply to scan the *entire* source tree, looking
for that header file name *anywhere*, and that's what might reveal that it's being used by something somewhere else, like in a Makefile.

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday

========================================================================

#3 lore raw
In reply to Robert P. J. Day
Quoted 5 lines · Robert P. J. Day

as part of a new tree scan with one of my scripts, i located what
*appear* to be numerous header files under arch/arm that no one seems to be including. the first few in that list, accompanied by a full tree scan of any use of the filename:

Would any of those files be of use to user applications?

b.g.

Signature · 2 lines
Bill Gatliff
bgat at billgatliff.com
#4 lore raw
Quoted 7 lines · Bill Gatliff
Quoted 4 lines · Robert P. J. Day

as part of a new tree scan with one of my scripts, i located
what *appear* to be numerous header files under arch/arm that no one seems to be including. the first few in that list, accompanied by a full tree scan of any use of the filename:

Would any of those files be of use to user applications?

don't know -- the script doesn't filter based on any Kbuild files,
so it's entirely possible that there are false positives. give me a few minutes and i'll post the list. it contains 58 files, sorted by subdirectory so, really, it's not *overwhelmingly* long.

i can post the script as well, but give me a chance to clean it up a
bit first.

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday

========================================================================