Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/modules/iic Split i2c_subr.c into a separate module rath...



details:   https://anonhg.NetBSD.org/src/rev/7cb14c1aba72
branches:  trunk
changeset: 364627:7cb14c1aba72
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Apr 01 15:49:11 2022 +0000

description:
Split i2c_subr.c into a separate module rather than including it in
the iic module.  There are valid configurations where i2c_subr code
can be both built-in and part of a loaded module (eg, piixpm is in
the kernel, but the iic module is loaded later).  This causes the
in-kernel linker to detect a duplicate symbol.

diffstat:

 distrib/sets/lists/debug/module.mi |   4 +++-
 distrib/sets/lists/modules/mi      |   4 +++-
 sys/dev/i2c/i2c.c                  |   6 +++---
 sys/dev/i2c/i2c_subr.c             |  20 ++++++++++++++++++--
 sys/modules/Makefile               |   3 ++-
 sys/modules/i2c_subr/Makefile      |  10 ++++++++++
 sys/modules/iic/Makefile           |   4 ++--
 7 files changed, 41 insertions(+), 10 deletions(-)

diffs (152 lines):

diff -r c49076eca357 -r 7cb14c1aba72 distrib/sets/lists/debug/module.mi
--- a/distrib/sets/lists/debug/module.mi        Fri Apr 01 15:34:34 2022 +0000
+++ b/distrib/sets/lists/debug/module.mi        Fri Apr 01 15:49:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: module.mi,v 1.16 2021/12/07 17:39:53 brad Exp $
+# $NetBSD: module.mi,v 1.17 2022/04/01 15:49:11 pgoyette Exp $
 ./usr/libdata/debug/@MODULEDIR@                                        modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/accf_dataready                 modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/accf_dataready/accf_dataready.kmod.debug       modules-base-kernel     kmod,debug
@@ -166,6 +166,8 @@
 ./usr/libdata/debug/@MODULEDIR@/i2c_bitbang/i2c_bitbang.kmod.debug     modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/i2cexec                                modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/i2cexec/i2cexec.kmod.debug             modules-base-kernel     kmod,debug
+./usr/libdata/debug/@MODULEDIR@/i2c_subr                               modules-base-kernel     kmod,debug
+./usr/libdata/debug/@MODULEDIR@/i2c_subr/i2c_subr.kmod.debug           modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/if_agr                         modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/if_agr/if_agr.kmod.debug               modules-base-kernel     kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/if_aue                         modules-base-kernel     kmod,debug
diff -r c49076eca357 -r 7cb14c1aba72 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Fri Apr 01 15:34:34 2022 +0000
+++ b/distrib/sets/lists/modules/mi     Fri Apr 01 15:49:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.150 2021/12/07 17:39:53 brad Exp $
+# $NetBSD: mi,v 1.151 2022/04/01 15:49:11 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -189,6 +189,8 @@
 ./@MODULEDIR@/i2c_bitbang/i2c_bitbang.kmod     modules-base-kernel     kmod
 ./@MODULEDIR@/i2cexec                          modules-base-kernel     kmod
 ./@MODULEDIR@/i2cexec/i2cexec.kmod             modules-base-kernel     kmod
+./@MODULEDIR@/i2c_subr                         modules-base-kernel     kmod
+./@MODULEDIR@/i2c_subr/i2c_subr.kmod           modules-base-kernel     kmod
 ./@MODULEDIR@/if_agr                           modules-base-kernel     kmod
 ./@MODULEDIR@/if_agr/if_agr.kmod               modules-base-kernel     kmod
 ./@MODULEDIR@/if_aue                           modules-base-kernel     kmod
diff -r c49076eca357 -r 7cb14c1aba72 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Fri Apr 01 15:34:34 2022 +0000
+++ b/sys/dev/i2c/i2c.c Fri Apr 01 15:49:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.85 2022/03/28 12:33:21 riastradh Exp $       */
+/*     $NetBSD: i2c.c,v 1.86 2022/04/01 15:49:12 pgoyette Exp $        */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -53,7 +53,7 @@
 #endif /* _KERNEL_OPT */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.85 2022/03/28 12:33:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.86 2022/04/01 15:49:12 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -900,7 +900,7 @@
     iic_match, iic_attach, iic_detach, NULL, iic_rescan, iic_child_detach,
     DVF_DETACH_SHUTDOWN);
 
-MODULE(MODULE_CLASS_DRIVER, iic, "i2cexec,i2c_bitbang");
+MODULE(MODULE_CLASS_DRIVER, iic, "i2cexec,i2c_bitbang,i2c_subr");
 
 #ifdef _MODULE
 #include "ioconf.c"
diff -r c49076eca357 -r 7cb14c1aba72 sys/dev/i2c/i2c_subr.c
--- a/sys/dev/i2c/i2c_subr.c    Fri Apr 01 15:34:34 2022 +0000
+++ b/sys/dev/i2c/i2c_subr.c    Fri Apr 01 15:49:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c_subr.c,v 1.1 2011/10/03 22:27:23 jmcneill Exp $    */
+/*     $NetBSD: i2c_subr.c,v 1.2 2022/04/01 15:49:12 pgoyette Exp $    */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,13 +36,29 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c_subr.c,v 1.1 2011/10/03 22:27:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c_subr.c,v 1.2 2022/04/01 15:49:12 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/module.h>
 
 #include <dev/i2c/i2cvar.h>
 
+MODULE(MODULE_CLASS_EXEC, i2c_subr, NULL);
+
+static int
+i2c_subr_modcmd(modcmd_t cmd, void *opaque)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+       case MODULE_CMD_FINI:
+               return 0;
+       default:
+               return ENOTTY;
+       }
+}
+
 int
 iicbus_print(void *aux, const char *pnp)
 {
diff -r c49076eca357 -r 7cb14c1aba72 sys/modules/Makefile
--- a/sys/modules/Makefile      Fri Apr 01 15:34:34 2022 +0000
+++ b/sys/modules/Makefile      Fri Apr 01 15:49:11 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.262 2021/12/07 17:39:54 brad Exp $
+#      $NetBSD: Makefile,v 1.263 2022/04/01 15:49:11 pgoyette Exp $
 
 .include <bsd.own.mk>
 
@@ -70,6 +70,7 @@
 SUBDIR+=       am2315temp
 SUBDIR+=       i2cexec
 SUBDIR+=       i2c_bitbang
+SUBDIR+=       i2c_subr
 SUBDIR+=       if_agr
 SUBDIR+=       if_aue
 SUBDIR+=       if_axe
diff -r c49076eca357 -r 7cb14c1aba72 sys/modules/i2c_subr/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/i2c_subr/Makefile     Fri Apr 01 15:49:11 2022 +0000
@@ -0,0 +1,10 @@
+#      $NetBSD: Makefile,v 1.1 2022/04/01 15:49:11 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/dev/i2c
+
+KMOD=  i2c_subr
+SRCS=  i2c_subr.c
+
+.include <bsd.kmodule.mk>
diff -r c49076eca357 -r 7cb14c1aba72 sys/modules/iic/Makefile
--- a/sys/modules/iic/Makefile  Fri Apr 01 15:34:34 2022 +0000
+++ b/sys/modules/iic/Makefile  Fri Apr 01 15:49:11 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.6 2019/02/17 04:05:53 rin Exp $
+#      $NetBSD: Makefile,v 1.7 2022/04/01 15:49:11 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -6,7 +6,7 @@
 
 KMOD=          iic
 IOCONF=                iic.ioconf
-SRCS=          i2c.c i2c_subr.c
+SRCS=          i2c.c
 
 WARNS=         3
 



Home | Main Index | Thread Index | Old Index