2014-04-17 14:12:19

by Peter Foley

[permalink] [raw]
Subject: [PATCH 1/4] Documentation: use subdir-y to avoid unnecessary built-in.o files

Change the Documentation makefiles from obj-m to subdir-y
to avoid generating unnecessary built-in.o files since nothing
in Documentation/ is ever linked in to vmlinux.

Signed-off-by: Peter Foley <[email protected]>
---
Documentation/Makefile | 6 +++---
Documentation/accounting/Makefile | 3 ---
Documentation/auxdisplay/Makefile | 3 ---
Documentation/filesystems/Makefile | 3 ---
Documentation/ia64/Makefile | 3 ---
Documentation/laptops/Makefile | 3 ---
Documentation/misc-devices/Makefile | 1 +
Documentation/misc-devices/mei/Makefile | 3 ---
Documentation/networking/Makefile | 8 +-------
Documentation/networking/timestamping/Makefile | 3 ---
Documentation/pcmcia/Makefile | 3 ---
Documentation/spi/Makefile | 3 ---
Documentation/timers/Makefile | 3 ---
Documentation/watchdog/Makefile | 1 +
Documentation/watchdog/src/Makefile | 3 ---
15 files changed, 6 insertions(+), 43 deletions(-)
create mode 100644 Documentation/misc-devices/Makefile
create mode 100644 Documentation/watchdog/Makefile

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 31d302b..605f84f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,3 +1,3 @@
-obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
- filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \
- pcmcia/ spi/ timers/ watchdog/src/ misc-devices/mei/
+subdir-y := DocBook accounting auxdisplay connector \
+ filesystems filesystems ia64 laptops networking \
+ pcmcia spi timers watchdog misc-devices
diff --git a/Documentation/accounting/Makefile b/Documentation/accounting/Makefile
index 31929eb..7e232cb 100644
--- a/Documentation/accounting/Makefile
+++ b/Documentation/accounting/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := getdelays

diff --git a/Documentation/auxdisplay/Makefile b/Documentation/auxdisplay/Makefile
index 51fe233..ada4dac 100644
--- a/Documentation/auxdisplay/Makefile
+++ b/Documentation/auxdisplay/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := cfag12864b-example

diff --git a/Documentation/filesystems/Makefile b/Documentation/filesystems/Makefile
index a5dd114..883010c 100644
--- a/Documentation/filesystems/Makefile
+++ b/Documentation/filesystems/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := dnotify_test

diff --git a/Documentation/ia64/Makefile b/Documentation/ia64/Makefile
index b75db69..d493163 100644
--- a/Documentation/ia64/Makefile
+++ b/Documentation/ia64/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := aliasing-test

diff --git a/Documentation/laptops/Makefile b/Documentation/laptops/Makefile
index 5cb144a..0abe44f 100644
--- a/Documentation/laptops/Makefile
+++ b/Documentation/laptops/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := dslm

diff --git a/Documentation/misc-devices/Makefile b/Documentation/misc-devices/Makefile
new file mode 100644
index 0000000..e2b7aa4
--- /dev/null
+++ b/Documentation/misc-devices/Makefile
@@ -0,0 +1 @@
+subdir-y := mei
diff --git a/Documentation/misc-devices/mei/Makefile b/Documentation/misc-devices/mei/Makefile
index 00e8c3e..d758047 100644
--- a/Documentation/misc-devices/mei/Makefile
+++ b/Documentation/misc-devices/mei/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := mei-amt-version
HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include
diff --git a/Documentation/networking/Makefile b/Documentation/networking/Makefile
index 0aa1ac9..4c5d7c4 100644
--- a/Documentation/networking/Makefile
+++ b/Documentation/networking/Makefile
@@ -1,7 +1 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
-
-obj-m := timestamping/
+subdir-y := timestamping
diff --git a/Documentation/networking/timestamping/Makefile b/Documentation/networking/timestamping/Makefile
index d934afc..bbe6f81 100644
--- a/Documentation/networking/timestamping/Makefile
+++ b/Documentation/networking/timestamping/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := timestamping hwtstamp_config

diff --git a/Documentation/pcmcia/Makefile b/Documentation/pcmcia/Makefile
index accde87..47a8fa1 100644
--- a/Documentation/pcmcia/Makefile
+++ b/Documentation/pcmcia/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := crc32hash

diff --git a/Documentation/spi/Makefile b/Documentation/spi/Makefile
index a5b03c8..efa2558 100644
--- a/Documentation/spi/Makefile
+++ b/Documentation/spi/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := spidev_test spidev_fdx

diff --git a/Documentation/timers/Makefile b/Documentation/timers/Makefile
index 73f75f8..6c09ee6 100644
--- a/Documentation/timers/Makefile
+++ b/Documentation/timers/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-$(CONFIG_X86) := hpet_example

diff --git a/Documentation/watchdog/Makefile b/Documentation/watchdog/Makefile
new file mode 100644
index 0000000..6018f45
--- /dev/null
+++ b/Documentation/watchdog/Makefile
@@ -0,0 +1 @@
+subdir-y := src
diff --git a/Documentation/watchdog/src/Makefile b/Documentation/watchdog/src/Makefile
index 40e5f46..4a892c3 100644
--- a/Documentation/watchdog/src/Makefile
+++ b/Documentation/watchdog/src/Makefile
@@ -1,6 +1,3 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
# List of programs to build
hostprogs-y := watchdog-simple watchdog-test

--
1.9.2


2014-04-17 14:12:21

by Peter Foley

[permalink] [raw]
Subject: [PATCH 2/4] Documentation: add makefiles for more targets

Add a bunch of previously unbuilt source files to the Documentation build
machinery.

Signed-off-by: Peter Foley <[email protected]>
---
Documentation/Makefile | 7 +++---
Documentation/arm/Makefile | 1 +
Documentation/arm/SH-Mobile/Makefile | 11 ++++-----
Documentation/blackfin/Makefile | 7 ++----
Documentation/filesystems/Makefile | 2 ++
Documentation/laptops/Makefile | 2 +-
Documentation/mic/Makefile | 1 +
Documentation/mic/mpssd/Makefile | 22 ++++++++---------
Documentation/networking/timestamping/Makefile | 5 +---
Documentation/prctl/Makefile | 8 +++++++
Documentation/ptp/Makefile | 8 +++++++
Documentation/ptp/testptp.mk | 33 --------------------------
Documentation/vDSO/Makefile | 9 +++++++
Documentation/video4linux/Makefile | 1 +
14 files changed, 53 insertions(+), 64 deletions(-)
create mode 100644 Documentation/arm/Makefile
create mode 100644 Documentation/mic/Makefile
create mode 100644 Documentation/prctl/Makefile
create mode 100644 Documentation/ptp/Makefile
delete mode 100644 Documentation/ptp/testptp.mk
create mode 100644 Documentation/vDSO/Makefile
create mode 100644 Documentation/video4linux/Makefile

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 605f84f..6883a1b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,3 +1,4 @@
-subdir-y := DocBook accounting auxdisplay connector \
- filesystems filesystems ia64 laptops networking \
- pcmcia spi timers watchdog misc-devices
+subdir-y := accounting arm auxdisplay blackfin connector \
+ filesystems filesystems ia64 laptops mic misc-devices \
+ networking pcmcia prctl ptp spi timers vDSO video4linux \
+ watchdog
diff --git a/Documentation/arm/Makefile b/Documentation/arm/Makefile
new file mode 100644
index 0000000..732c770
--- /dev/null
+++ b/Documentation/arm/Makefile
@@ -0,0 +1 @@
+subdir-y := SH-Mobile
diff --git a/Documentation/arm/SH-Mobile/Makefile b/Documentation/arm/SH-Mobile/Makefile
index 8771d83..ac8075d 100644
--- a/Documentation/arm/SH-Mobile/Makefile
+++ b/Documentation/arm/SH-Mobile/Makefile
@@ -1,8 +1,7 @@
-BIN := vrl4
+# List of programs to build
+hostprogs-y := vrl4

-.PHONY: all
-all: $(BIN)
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)

-.PHONY: clean
-clean:
- rm -f *.o $(BIN)
+HOSTCFLAGS_vrl4.o += -I$(objtree)/usr/include
diff --git a/Documentation/blackfin/Makefile b/Documentation/blackfin/Makefile
index 773dbb1..c7e6c99 100644
--- a/Documentation/blackfin/Makefile
+++ b/Documentation/blackfin/Makefile
@@ -1,6 +1,3 @@
+ifneq ($(CONFIG_BLACKFIN),)
obj-m := gptimers-example.o
-
-all: modules
-
-modules clean:
- $(MAKE) -C ../.. SUBDIRS=$(PWD) $@
+endif
diff --git a/Documentation/filesystems/Makefile b/Documentation/filesystems/Makefile
index 883010c..13483d1 100644
--- a/Documentation/filesystems/Makefile
+++ b/Documentation/filesystems/Makefile
@@ -1,3 +1,5 @@
+subdir-y := configfs
+
# List of programs to build
hostprogs-y := dnotify_test

diff --git a/Documentation/laptops/Makefile b/Documentation/laptops/Makefile
index 0abe44f..9dcbc3f 100644
--- a/Documentation/laptops/Makefile
+++ b/Documentation/laptops/Makefile
@@ -1,5 +1,5 @@
# List of programs to build
-hostprogs-y := dslm
+hostprogs-y := dslm hpfall

# Tell kbuild to always build the programs
always := $(hostprogs-y)
diff --git a/Documentation/mic/Makefile b/Documentation/mic/Makefile
new file mode 100644
index 0000000..a191d45
--- /dev/null
+++ b/Documentation/mic/Makefile
@@ -0,0 +1 @@
+subdir-y := mpssd
diff --git a/Documentation/mic/mpssd/Makefile b/Documentation/mic/mpssd/Makefile
index eb860a7..44ec68b 100644
--- a/Documentation/mic/mpssd/Makefile
+++ b/Documentation/mic/mpssd/Makefile
@@ -1,19 +1,17 @@
-#
-# Makefile - Intel MIC User Space Tools.
-# Copyright(c) 2013, Intel Corporation.
-#
+# List of programs to build
+hostprogs-y := mpssd
+
+mpssd-objs := mpssd.o sysfs.o
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
+
ifdef DEBUG
-CFLAGS += $(USERWARNFLAGS) -I. -g -Wall -DDEBUG=$(DEBUG)
-else
-CFLAGS += $(USERWARNFLAGS) -I. -g -Wall
+HOSTCFLAGS += -DDEBUG=$(DEBUG)
endif

-mpssd: mpssd.o sysfs.o
- $(CC) $(CFLAGS) -o $@ $^ -lpthread
+HOSTLOADLIBES_mpssd := -lpthread

install:
install mpssd /usr/sbin/mpssd
install micctrl /usr/sbin/micctrl
-
-clean:
- rm -f mpssd *.o
diff --git a/Documentation/networking/timestamping/Makefile b/Documentation/networking/timestamping/Makefile
index bbe6f81..52ac67d 100644
--- a/Documentation/networking/timestamping/Makefile
+++ b/Documentation/networking/timestamping/Makefile
@@ -1,11 +1,8 @@
# List of programs to build
-hostprogs-y := timestamping hwtstamp_config
+hostprogs-y := hwtstamp_config timestamping

# Tell kbuild to always build the programs
always := $(hostprogs-y)

HOSTCFLAGS_timestamping.o += -I$(objtree)/usr/include
HOSTCFLAGS_hwtstamp_config.o += -I$(objtree)/usr/include
-
-clean:
- rm -f timestamping hwtstamp_config
diff --git a/Documentation/prctl/Makefile b/Documentation/prctl/Makefile
new file mode 100644
index 0000000..3e3232d
--- /dev/null
+++ b/Documentation/prctl/Makefile
@@ -0,0 +1,8 @@
+# List of programs to build
+hostprogs-y := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
+
+HOSTCFLAGS_disable-tsc-ctxt-sw-stress-test.o += -I$(objtree)/usr/include
+HOSTCFLAGS_disable-tsc-on-off-stress-test.o += -I$(objtree)/usr/include
+HOSTCFLAGS_disable-tsc-test.o += -I$(objtree)/usr/include
diff --git a/Documentation/ptp/Makefile b/Documentation/ptp/Makefile
new file mode 100644
index 0000000..293d6c0
--- /dev/null
+++ b/Documentation/ptp/Makefile
@@ -0,0 +1,8 @@
+# List of programs to build
+hostprogs-y := testptp
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
+
+HOSTCFLAGS_testptp.o += -I$(objtree)/usr/include
+HOSTLOADLIBES_testptp := -lrt
diff --git a/Documentation/ptp/testptp.mk b/Documentation/ptp/testptp.mk
deleted file mode 100644
index 4ef2d97..0000000
--- a/Documentation/ptp/testptp.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# PTP 1588 clock support - User space test program
-#
-# Copyright (C) 2010 OMICRON electronics GmbH
-#
-# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-CC = $(CROSS_COMPILE)gcc
-INC = -I$(KBUILD_OUTPUT)/usr/include
-CFLAGS = -Wall $(INC)
-LDLIBS = -lrt
-PROGS = testptp
-
-all: $(PROGS)
-
-testptp: testptp.o
-
-clean:
- rm -f testptp.o
-
-distclean: clean
- rm -f $(PROGS)
diff --git a/Documentation/vDSO/Makefile b/Documentation/vDSO/Makefile
new file mode 100644
index 0000000..2f22772
--- /dev/null
+++ b/Documentation/vDSO/Makefile
@@ -0,0 +1,9 @@
+# List of programs to build
+hostprogs-$(CONFIG_X86) := vdso_test
+vdso_test-objs := parse_vdso.o vdso_test.o
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
+
+HOSTCFLAGS := -I$(objtree)/usr/include -std=gnu99
+HOSTLDFLAGS = -nostdlib -fno-asynchronous-unwind-tables
diff --git a/Documentation/video4linux/Makefile b/Documentation/video4linux/Makefile
new file mode 100644
index 0000000..d58101e
--- /dev/null
+++ b/Documentation/video4linux/Makefile
@@ -0,0 +1 @@
+obj-m := v4l2-pci-skeleton.o
--
1.9.2

2014-04-17 14:12:49

by Peter Foley

[permalink] [raw]
Subject: [PATCH 4/4] Documentation: fix misc. warnings

Fix a few warnings that gcc emits during a default build.

Signed-off-by: Peter Foley <[email protected]>
---
Documentation/laptops/hpfall.c | 9 +++++++--
Documentation/mic/mpssd/mpssd.c | 4 ++--
Documentation/ptp/testptp.c | 6 +++---
3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Documentation/laptops/hpfall.c b/Documentation/laptops/hpfall.c
index d4e1380..3e04fc1 100644
--- a/Documentation/laptops/hpfall.c
+++ b/Documentation/laptops/hpfall.c
@@ -74,14 +74,16 @@ static void protect(int seconds)
static int on_ac(void)
{
// /sys/class/power_supply/AC0/online
+ return 0;
}

static int lid_open(void)
{
// /proc/acpi/button/lid/LID/state
+ return 0;
}

-static void ignore_me(void)
+static void ignore_me(int ignored)
{
protect(0);
set_led(0);
@@ -111,7 +113,10 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

- daemon(0, 0);
+ if (daemon(0, 0) < 0) {
+ perror("daemonization failed");
+ return EXIT_FAILURE;
+ }
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
sched_setscheduler(0, SCHED_FIFO, &param);
mlockall(MCL_CURRENT|MCL_FUTURE);
diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c
index 4d17487..24203dd 100644
--- a/Documentation/mic/mpssd/mpssd.c
+++ b/Documentation/mic/mpssd/mpssd.c
@@ -1476,9 +1476,9 @@ set_cmdline(struct mic_info *mic)

len = snprintf(buffer, PATH_MAX,
"clocksource=tsc highres=off nohz=off ");
- len += snprintf(buffer + len, PATH_MAX,
+ len += snprintf(buffer + len, PATH_MAX - len,
"cpufreq_on;corec6_off;pc3_off;pc6_off ");
- len += snprintf(buffer + len, PATH_MAX,
+ len += snprintf(buffer + len, PATH_MAX - len,
"ifcfg=static;address,172.31.%d.1;netmask,255.255.255.0",
mic->id);

diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c
index f1ac2da..913b7ba 100644
--- a/Documentation/ptp/testptp.c
+++ b/Documentation/ptp/testptp.c
@@ -497,11 +497,11 @@ int main(int argc, char *argv[])
interval = t2 - t1;
offset = (t2 + t1) / 2 - tp;

- printf("system time: %" PRId64 ".%u\n",
+ printf("system time: %lld.%u\n",
(pct+2*i)->sec, (pct+2*i)->nsec);
- printf("phc time: %" PRId64 ".%u\n",
+ printf("phc time: %lld.%u\n",
(pct+2*i+1)->sec, (pct+2*i+1)->nsec);
- printf("system time: %" PRId64 ".%u\n",
+ printf("system time: %lld.%u\n",
(pct+2*i+2)->sec, (pct+2*i+2)->nsec);
printf("system/phc clock time offset is %" PRId64 " ns\n"
"system clock time delay is %" PRId64 " ns\n",
--
1.9.2

2014-04-17 14:13:20

by Peter Foley

[permalink] [raw]
Subject: [PATCH 3/4] Documentation: make functions static to avoid prototype warnings

Signed-off-by: Peter Foley <[email protected]>
---
Documentation/arm/SH-Mobile/vrl4.c | 6 +++---
Documentation/laptops/hpfall.c | 16 ++++++++--------
Documentation/prctl/disable-tsc-ctxt-sw-stress-test.c | 11 ++++++-----
Documentation/prctl/disable-tsc-on-off-stress-test.c | 7 ++++---
Documentation/prctl/disable-tsc-test.c | 5 +++--
5 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/Documentation/arm/SH-Mobile/vrl4.c b/Documentation/arm/SH-Mobile/vrl4.c
index e8a1913..4cbbba5 100644
--- a/Documentation/arm/SH-Mobile/vrl4.c
+++ b/Documentation/arm/SH-Mobile/vrl4.c
@@ -77,7 +77,7 @@ struct hdr {

#define ROUND_UP(x) ((x + ALIGN - 1) & ~(ALIGN - 1))

-ssize_t do_read(int fd, void *buf, size_t count)
+static ssize_t do_read(int fd, void *buf, size_t count)
{
size_t offset = 0;
ssize_t l;
@@ -98,7 +98,7 @@ ssize_t do_read(int fd, void *buf, size_t count)
return offset;
}

-ssize_t do_write(int fd, const void *buf, size_t count)
+static ssize_t do_write(int fd, const void *buf, size_t count)
{
size_t offset = 0;
ssize_t l;
@@ -117,7 +117,7 @@ ssize_t do_write(int fd, const void *buf, size_t count)
return offset;
}

-ssize_t write_zero(int fd, size_t len)
+static ssize_t write_zero(int fd, size_t len)
{
size_t i = len;

diff --git a/Documentation/laptops/hpfall.c b/Documentation/laptops/hpfall.c
index b85dbba..d4e1380 100644
--- a/Documentation/laptops/hpfall.c
+++ b/Documentation/laptops/hpfall.c
@@ -21,7 +21,7 @@

char unload_heads_path[64];

-int set_unload_heads_path(char *device)
+static int set_unload_heads_path(char *device)
{
char devname[64];

@@ -33,7 +33,7 @@ int set_unload_heads_path(char *device)
"/sys/block/%s/device/unload_heads", devname);
return 0;
}
-int valid_disk(void)
+static int valid_disk(void)
{
int fd = open(unload_heads_path, O_RDONLY);
if (fd < 0) {
@@ -45,7 +45,7 @@ int valid_disk(void)
return 1;
}

-void write_int(char *path, int i)
+static void write_int(char *path, int i)
{
char buf[1024];
int fd = open(path, O_RDWR);
@@ -61,27 +61,27 @@ void write_int(char *path, int i)
close(fd);
}

-void set_led(int on)
+static void set_led(int on)
{
write_int("/sys/class/leds/hp::hddprotect/brightness", on);
}

-void protect(int seconds)
+static void protect(int seconds)
{
write_int(unload_heads_path, seconds*1000);
}

-int on_ac(void)
+static int on_ac(void)
{
// /sys/class/power_supply/AC0/online
}

-int lid_open(void)
+static int lid_open(void)
{
// /proc/acpi/button/lid/LID/state
}

-void ignore_me(void)
+static void ignore_me(void)
{
protect(0);
set_led(0);
diff --git a/Documentation/prctl/disable-tsc-ctxt-sw-stress-test.c b/Documentation/prctl/disable-tsc-ctxt-sw-stress-test.c
index f8e8e95..81fdd42 100644
--- a/Documentation/prctl/disable-tsc-ctxt-sw-stress-test.c
+++ b/Documentation/prctl/disable-tsc-ctxt-sw-stress-test.c
@@ -27,19 +27,20 @@
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
#endif

-uint64_t rdtsc() {
+static uint64_t rdtsc(void)
+{
uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo;
}

-void sigsegv_expect(int sig)
+static void sigsegv_expect(int sig)
{
/* */
}

-void segvtask(void)
+static void segvtask(void)
{
if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0)
{
@@ -54,13 +55,13 @@ void segvtask(void)
}


-void sigsegv_fail(int sig)
+static void sigsegv_fail(int sig)
{
fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n");
exit(0);
}

-void rdtsctask(void)
+static void rdtsctask(void)
{
if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0)
{
diff --git a/Documentation/prctl/disable-tsc-on-off-stress-test.c b/Documentation/prctl/disable-tsc-on-off-stress-test.c
index 1fcd9144..4d83a27 100644
--- a/Documentation/prctl/disable-tsc-on-off-stress-test.c
+++ b/Documentation/prctl/disable-tsc-on-off-stress-test.c
@@ -29,7 +29,8 @@

/* snippet from wikipedia :-) */

-uint64_t rdtsc() {
+static uint64_t rdtsc(void)
+{
uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
@@ -38,7 +39,7 @@ return (uint64_t)hi << 32 | lo;

int should_segv = 0;

-void sigsegv_cb(int sig)
+static void sigsegv_cb(int sig)
{
if (!should_segv)
{
@@ -55,7 +56,7 @@ void sigsegv_cb(int sig)
rdtsc();
}

-void task(void)
+static void task(void)
{
signal(SIGSEGV, sigsegv_cb);
alarm(10);
diff --git a/Documentation/prctl/disable-tsc-test.c b/Documentation/prctl/disable-tsc-test.c
index 843c81e..2541e65 100644
--- a/Documentation/prctl/disable-tsc-test.c
+++ b/Documentation/prctl/disable-tsc-test.c
@@ -29,14 +29,15 @@ const char *tsc_names[] =
[PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV",
};

-uint64_t rdtsc() {
+static uint64_t rdtsc(void)
+{
uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo;
}

-void sigsegv_cb(int sig)
+static void sigsegv_cb(int sig)
{
int tsc_val = 0;

--
1.9.2

2014-06-29 02:23:38

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 1/4] Documentation: use subdir-y to avoid unnecessary built-in.o files

On 04/17/14 07:11, Peter Foley wrote:
> Change the Documentation makefiles from obj-m to subdir-y
> to avoid generating unnecessary built-in.o files since nothing
> in Documentation/ is ever linked in to vmlinux.
>
> Signed-off-by: Peter Foley <[email protected]>

Hi Michal,

Does this look good to you?
I don't have enough makefile fu (or is it foo?) to judge this.

Thanks.

> ---
> Documentation/Makefile | 6 +++---
> Documentation/accounting/Makefile | 3 ---
> Documentation/auxdisplay/Makefile | 3 ---
> Documentation/filesystems/Makefile | 3 ---
> Documentation/ia64/Makefile | 3 ---
> Documentation/laptops/Makefile | 3 ---
> Documentation/misc-devices/Makefile | 1 +
> Documentation/misc-devices/mei/Makefile | 3 ---
> Documentation/networking/Makefile | 8 +-------
> Documentation/networking/timestamping/Makefile | 3 ---
> Documentation/pcmcia/Makefile | 3 ---
> Documentation/spi/Makefile | 3 ---
> Documentation/timers/Makefile | 3 ---
> Documentation/watchdog/Makefile | 1 +
> Documentation/watchdog/src/Makefile | 3 ---
> 15 files changed, 6 insertions(+), 43 deletions(-)
> create mode 100644 Documentation/misc-devices/Makefile
> create mode 100644 Documentation/watchdog/Makefile
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 31d302b..605f84f 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -1,3 +1,3 @@
> -obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
> - filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \
> - pcmcia/ spi/ timers/ watchdog/src/ misc-devices/mei/
> +subdir-y := DocBook accounting auxdisplay connector \
> + filesystems filesystems ia64 laptops networking \
> + pcmcia spi timers watchdog misc-devices
> diff --git a/Documentation/accounting/Makefile b/Documentation/accounting/Makefile
> index 31929eb..7e232cb 100644
> --- a/Documentation/accounting/Makefile
> +++ b/Documentation/accounting/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := getdelays
>
> diff --git a/Documentation/auxdisplay/Makefile b/Documentation/auxdisplay/Makefile
> index 51fe233..ada4dac 100644
> --- a/Documentation/auxdisplay/Makefile
> +++ b/Documentation/auxdisplay/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := cfag12864b-example
>
> diff --git a/Documentation/filesystems/Makefile b/Documentation/filesystems/Makefile
> index a5dd114..883010c 100644
> --- a/Documentation/filesystems/Makefile
> +++ b/Documentation/filesystems/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := dnotify_test
>
> diff --git a/Documentation/ia64/Makefile b/Documentation/ia64/Makefile
> index b75db69..d493163 100644
> --- a/Documentation/ia64/Makefile
> +++ b/Documentation/ia64/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := aliasing-test
>
> diff --git a/Documentation/laptops/Makefile b/Documentation/laptops/Makefile
> index 5cb144a..0abe44f 100644
> --- a/Documentation/laptops/Makefile
> +++ b/Documentation/laptops/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := dslm
>
> diff --git a/Documentation/misc-devices/Makefile b/Documentation/misc-devices/Makefile
> new file mode 100644
> index 0000000..e2b7aa4
> --- /dev/null
> +++ b/Documentation/misc-devices/Makefile
> @@ -0,0 +1 @@
> +subdir-y := mei
> diff --git a/Documentation/misc-devices/mei/Makefile b/Documentation/misc-devices/mei/Makefile
> index 00e8c3e..d758047 100644
> --- a/Documentation/misc-devices/mei/Makefile
> +++ b/Documentation/misc-devices/mei/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := mei-amt-version
> HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include
> diff --git a/Documentation/networking/Makefile b/Documentation/networking/Makefile
> index 0aa1ac9..4c5d7c4 100644
> --- a/Documentation/networking/Makefile
> +++ b/Documentation/networking/Makefile
> @@ -1,7 +1 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> -# Tell kbuild to always build the programs
> -always := $(hostprogs-y)
> -
> -obj-m := timestamping/
> +subdir-y := timestamping
> diff --git a/Documentation/networking/timestamping/Makefile b/Documentation/networking/timestamping/Makefile
> index d934afc..bbe6f81 100644
> --- a/Documentation/networking/timestamping/Makefile
> +++ b/Documentation/networking/timestamping/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := timestamping hwtstamp_config
>
> diff --git a/Documentation/pcmcia/Makefile b/Documentation/pcmcia/Makefile
> index accde87..47a8fa1 100644
> --- a/Documentation/pcmcia/Makefile
> +++ b/Documentation/pcmcia/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := crc32hash
>
> diff --git a/Documentation/spi/Makefile b/Documentation/spi/Makefile
> index a5b03c8..efa2558 100644
> --- a/Documentation/spi/Makefile
> +++ b/Documentation/spi/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := spidev_test spidev_fdx
>
> diff --git a/Documentation/timers/Makefile b/Documentation/timers/Makefile
> index 73f75f8..6c09ee6 100644
> --- a/Documentation/timers/Makefile
> +++ b/Documentation/timers/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-$(CONFIG_X86) := hpet_example
>
> diff --git a/Documentation/watchdog/Makefile b/Documentation/watchdog/Makefile
> new file mode 100644
> index 0000000..6018f45
> --- /dev/null
> +++ b/Documentation/watchdog/Makefile
> @@ -0,0 +1 @@
> +subdir-y := src
> diff --git a/Documentation/watchdog/src/Makefile b/Documentation/watchdog/src/Makefile
> index 40e5f46..4a892c3 100644
> --- a/Documentation/watchdog/src/Makefile
> +++ b/Documentation/watchdog/src/Makefile
> @@ -1,6 +1,3 @@
> -# kbuild trick to avoid linker error. Can be omitted if a module is built.
> -obj- := dummy.o
> -
> # List of programs to build
> hostprogs-y := watchdog-simple watchdog-test
>
>


--
~Randy

2014-07-09 20:52:26

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 1/4] Documentation: use subdir-y to avoid unnecessary built-in.o files

On Sat, Jun 28, 2014 at 07:23:35PM -0700, Randy Dunlap wrote:
> On 04/17/14 07:11, Peter Foley wrote:
> > Change the Documentation makefiles from obj-m to subdir-y
> > to avoid generating unnecessary built-in.o files since nothing
> > in Documentation/ is ever linked in to vmlinux.
> >
> > Signed-off-by: Peter Foley <[email protected]>
>
> Hi Michal,
>
> Does this look good to you?
> I don't have enough makefile fu (or is it foo?) to judge this.
Looks OK.
Please add my:
Acked-by: Sam Ravnborg <[email protected]>

Sam