From f0a2d31ab1bbdefe9bbaeba22c6afd3680d28361 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sun, 25 Feb 2018 18:26:50 +0000 Subject: [PATCH] Instead of building ofw_iicbus as a separate module, just compile it in to the iicbus module for FDT-based systems. The primary motivation for this is that host controller drivers which declare DRIVER_MODULE(ofw_iicbus, thisdriver, etc, etc) now only need a single MODULE_DEPEND(thisdriver, ofw_iicbus) for runtime linking to resolve all the symbols. With ofw_iicbus and iicbus in separate modules, drivers would need to declare a MODULE_DEPEND() on both, because symbol lookup is non-recursive through the dependency chain. Requiring a driver to have MODULE_DEPENDS() on both amounts to requiring the drivers to understand the kobj inheritence details of how ofw_iicbus is implemented, which seems like something they shouldn't have to know (and could even change some day). Also, this is somewhat analogous to how the drivers get built when compiled into the kernel. You don't have to ask for ofw_iicbus separately, it just gets built in along with iicbus when option FDT is in effect. --- sys/modules/i2c/Makefile | 4 ---- sys/modules/i2c/iicbus/Makefile | 4 ++++ sys/modules/i2c/ofw_iicbus/Makefile | 15 --------------- 3 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 sys/modules/i2c/ofw_iicbus/Makefile diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index 69d2b51d0584..fa41c4ff6d47 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -21,8 +21,4 @@ SUBDIR = \ smb \ smbus \ -.if !empty(OPT_FDT) -SUBDIR += ofw_iicbus -.endif - .include diff --git a/sys/modules/i2c/iicbus/Makefile b/sys/modules/i2c/iicbus/Makefile index 796411eb2343..6f088e7ba538 100644 --- a/sys/modules/i2c/iicbus/Makefile +++ b/sys/modules/i2c/iicbus/Makefile @@ -14,4 +14,8 @@ SRCS= \ iiconf.c \ iiconf.h \ +.if !empty(OPT_FDT) +SRCS+= ofw_iicbus.c ofw_bus_if.h +.endif + .include diff --git a/sys/modules/i2c/ofw_iicbus/Makefile b/sys/modules/i2c/ofw_iicbus/Makefile deleted file mode 100644 index 7ada55247345..000000000000 --- a/sys/modules/i2c/ofw_iicbus/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/iicbus - -KMOD= ofw_iicbus -SRCS= ofw_iicbus.c - -SRCS+= \ - bus_if.h \ - device_if.h \ - iicbus_if.h \ - ofw_bus_if.h \ - opt_platform.h \ - -.include