[Prex-devel] [PATCH 22/22] convert driver selection to makefile based CONFIG variable. - removes de
Status: Beta
Brought to you by:
kohtani
convert driver selection to makefile based CONFIG variable. - removes dead code for disabled features. - allows drivers to be staticly compiled into the kernel or loaded as modules. --- dev/arch/arm/gba/Makefile | 4 +++- dev/arch/arm/gba/console.c | 2 -- dev/arch/i386/nommu/Makefile | 8 ++++++-- dev/arch/i386/pc/Makefile | 8 ++++++-- dev/arch/i386/pc/console.c | 2 -- dev/arch/i386/pc/fdd.c | 2 -- dev/arch/i386/pc/kbd.c | 2 -- dev/arch/i386/pc/mouse.c | 2 -- dev/arch/i386/pc/rtc.c | 2 -- dev/gen/Makefile | 3 ++- dev/gen/ramdisk.c | 2 -- dev/power/Makefile | 3 ++- dev/power/cpufreq.c | 4 ---- dev/power/dvs.c | 3 --- dev/power/pm.c | 4 ---- 15 files changed, 19 insertions(+), 32 deletions(-) diff --git a/dev/arch/arm/gba/Makefile b/dev/arch/arm/gba/Makefile index b0068b6..e0bfd7f 100755 --- a/dev/arch/arm/gba/Makefile +++ b/dev/arch/arm/gba/Makefile @@ -1,4 +1,6 @@ TARGET = dev.o TYPE = OBJECT -OBJS-m = platform.o keypad.o console.o swkbd.o +OBJS-m = platform.o keypad.o +OBJS-$(CONFIG_CONSOLE) += console.o +OBJS-$(CONFIG_KEYBOARD) += swkbd.o include $(PREX_SRC)/mk/dev.mk diff --git a/dev/arch/arm/gba/console.c b/dev/arch/arm/gba/console.c index 4239b91..83e013f 100755 --- a/dev/arch/arm/gba/console.c +++ b/dev/arch/arm/gba/console.c @@ -38,7 +38,6 @@ static int console_init(); static int console_write(); -#ifdef CONFIG_CONSOLE /* * Driver structure */ @@ -56,7 +55,6 @@ static struct devio console_io = { /* ioctl */ NULL, /* event */ NULL, }; -#endif static device_t console_dev; static uint16_t *vram = CONSOLE_MAP; diff --git a/dev/arch/i386/nommu/Makefile b/dev/arch/i386/nommu/Makefile index 387a20f..fbf4560 100755 --- a/dev/arch/i386/nommu/Makefile +++ b/dev/arch/i386/nommu/Makefile @@ -1,5 +1,9 @@ TARGET = dev.o TYPE = OBJECT -OBJS-m = ../pc/dma.o ../pc/rtc.o ../pc/kbd.o ../pc/console.o \ - ../pc/fdd.o ../pc/mouse.o ../i386/cpu.o ../pc/platform.o ../i386/delay.o +OBJS-m = ../pc/dma.o ../i386/cpu.o ../pc/platform.o ../i386/delay.o +OBJS-$(CONFIG_CONSOLE) += ../pc/console.o +OBJS-$(CONFIG_KEYBOARD) += ../pc/kbd.o +OBJS-$(CONFIG_FDD) += ../pc/fdd.o +OBJS-$(CONFIG_MOUSE) += ../pc/mouse.o +OBJS-$(CONFIG_RTC) += ../pc/rtc.o include $(PREX_SRC)/mk/dev.mk diff --git a/dev/arch/i386/pc/Makefile b/dev/arch/i386/pc/Makefile index 6fd4294..9041dbb 100755 --- a/dev/arch/i386/pc/Makefile +++ b/dev/arch/i386/pc/Makefile @@ -1,5 +1,9 @@ TARGET = dev.o TYPE = OBJECT -OBJS-m = dma.o rtc.o kbd.o console.o fdd.o mouse.o \ - ../i386/cpu.o platform.o ../i386/delay.o +OBJS-m = dma.o ../i386/cpu.o platform.o ../i386/delay.o +OBJS-$(CONFIG_CONSOLE) += console.o +OBJS-$(CONFIG_KEYBOARD) += kbd.o +OBJS-$(CONFIG_FDD) += fdd.o +OBJS-$(CONFIG_MOUSE) += mouse.o +OBJS-$(CONFIG_RTC) += rtc.o include $(PREX_SRC)/mk/dev.mk diff --git a/dev/arch/i386/pc/console.c b/dev/arch/i386/pc/console.c index 8c985bf..185b172 100755 --- a/dev/arch/i386/pc/console.c +++ b/dev/arch/i386/pc/console.c @@ -42,7 +42,6 @@ static int console_init(); static int console_write(); -#ifdef CONFIG_CONSOLE /* * Driver structure */ @@ -51,7 +50,6 @@ struct driver console_drv __driver_entry = { /* order */ 10, /* init */ console_init, }; -#endif static struct devio console_io = { /* open */ NULL, diff --git a/dev/arch/i386/pc/fdd.c b/dev/arch/i386/pc/fdd.c index 71ebc49..20a58bd 100755 --- a/dev/arch/i386/pc/fdd.c +++ b/dev/arch/i386/pc/fdd.c @@ -137,7 +137,6 @@ typedef struct io_req *ioreq_t; #define IO_FORMAT 3 /* not supported */ #define IO_CANCEL 4 -#ifdef CONFIG_FDD /* * Driver structure */ @@ -146,7 +145,6 @@ struct driver fdd_drv __driver_entry = { /* order */ 5, /* init */ fdd_init, }; -#endif static struct devio fdd_io = { /* open */ fdd_open, diff --git a/dev/arch/i386/pc/kbd.c b/dev/arch/i386/pc/kbd.c index 845d801..f5be35a 100755 --- a/dev/arch/i386/pc/kbd.c +++ b/dev/arch/i386/pc/kbd.c @@ -47,7 +47,6 @@ static int kbd_open(); static int kbd_close(); static int kbd_read(); -#ifdef CONFIG_KEYBOARD /* * Driver structure */ @@ -56,7 +55,6 @@ struct driver kbd_drv __driver_entry = { /* order */ 4, /* init */ kbd_init, }; -#endif static struct devio kbd_io = { /* open */ kbd_open, diff --git a/dev/arch/i386/pc/mouse.c b/dev/arch/i386/pc/mouse.c index 4361aff..d72ea05 100755 --- a/dev/arch/i386/pc/mouse.c +++ b/dev/arch/i386/pc/mouse.c @@ -62,7 +62,6 @@ static int mouse_open(); static int mouse_close(); static int mouse_read(); -#ifdef CONFIG_MOUSE /* * Driver structure */ @@ -71,7 +70,6 @@ struct driver mouse_drv __driver_entry = { /* order */ 6, /* init */ mouse_init, }; -#endif static struct devio mouse_io = { /* open */ mouse_open, diff --git a/dev/arch/i386/pc/rtc.c b/dev/arch/i386/pc/rtc.c index 3db5656..9b93b60 100755 --- a/dev/arch/i386/pc/rtc.c +++ b/dev/arch/i386/pc/rtc.c @@ -55,7 +55,6 @@ static int rtc_read(); static int rtc_init(); -#ifdef CONFIG_RTC /* * Driver structure */ @@ -64,7 +63,6 @@ struct driver rtc_drv __driver_entry = { /* order */ 4, /* init */ rtc_init, }; -#endif static struct devio rtc_io = { /* open */ NULL, diff --git a/dev/gen/Makefile b/dev/gen/Makefile index 2d8fd37..45a1212 100755 --- a/dev/gen/Makefile +++ b/dev/gen/Makefile @@ -1,5 +1,6 @@ TARGET = gen.o TYPE = OBJECT -OBJS-m = null.o zero.o ramdisk.o +OBJS-m = null.o zero.o +OBJS-$(CONFIG_RAMDISK) += ramdisk.o include $(PREX_SRC)/mk/dev.mk diff --git a/dev/gen/ramdisk.c b/dev/gen/ramdisk.c index 9d5bd20..05a73cd 100755 --- a/dev/gen/ramdisk.c +++ b/dev/gen/ramdisk.c @@ -49,7 +49,6 @@ static int ramdisk_read(device_t dev, char *buf, size_t *nbyte, int blkno); static int ramdisk_write(device_t dev, char *buf, size_t *nbyte, int blkno); static int ramdisk_init(void); -#ifdef CONFIG_RAMDISK /* * Driver structure */ @@ -58,7 +57,6 @@ struct driver ramdisk_drv __driver_entry = { /* order */ 6, /* init */ ramdisk_init, }; -#endif static struct devio ramdisk_io = { /* open */ NULL, diff --git a/dev/power/Makefile b/dev/power/Makefile index e60cc57..7e027e5 100755 --- a/dev/power/Makefile +++ b/dev/power/Makefile @@ -1,4 +1,5 @@ TARGET = power.o TYPE = OBJECT -OBJS-m = pm.o cpufreq.o dvs.o +OBJS-$(CONFIG_PM) += pm.o +OBJS-$(CONFIG_CPUFREQ) += cpufreq.o dvs.o include $(PREX_SRC)/mk/dev.mk diff --git a/dev/power/cpufreq.c b/dev/power/cpufreq.c index 8446113..e8a6502 100644 --- a/dev/power/cpufreq.c +++ b/dev/power/cpufreq.c @@ -36,8 +36,6 @@ #include <pm.h> #include "dvs.h" -#ifdef CONFIG_CPUFREQ - /* #define DEBUG_CPUFREQ 1 */ #ifdef DEBUG_CPUFREQ @@ -123,5 +121,3 @@ static int cpufreq_init(void) dvs_enable(); return 0; } - -#endif /* CONFIG_CPUFREQ */ diff --git a/dev/power/dvs.c b/dev/power/dvs.c index de006f0..5e63ada 100644 --- a/dev/power/dvs.c +++ b/dev/power/dvs.c @@ -44,8 +44,6 @@ #include <pm.h> #include "dvs.h" -#ifdef CONFIG_CPUFREQ - /* #define DEBUG_DVS 1 */ #ifdef DEBUG_DVS @@ -258,4 +256,3 @@ void dvs_init(void) dvs_capable = 1; } -#endif /* CONFIG_CPUFREQ */ diff --git a/dev/power/pm.c b/dev/power/pm.c index 9fae38a..fc084d7 100755 --- a/dev/power/pm.c +++ b/dev/power/pm.c @@ -36,8 +36,6 @@ #include <pm.h> #include "dvs.h" -#ifdef CONFIG_PM - /* #define DEBUG_PM 1 */ #ifdef DEBUG_PM @@ -300,5 +298,3 @@ static int pm_init(void) (power_policy == PM_POWERSAVE) ? "power save" : "performance"); return 0; } - -#endif /* CONFIG_PM */ -- 1.5.0.3.GIT |