From 5679ed99065372bc62c57a895950914e1c0fb9e0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 10 Apr 2019 12:47:26 +0200 Subject: [PATCH] hwmon: (occ) Move common code to a separate module Instead of duplicating the common code into the 2 (binary) drivers, move the common code to a separate module. This is cleaner. Signed-off-by: Jean Delvare Cc: Eddie James Cc: Guenter Roeck Reviewed-by: Eddie James Tested-by: Eddie James Signed-off-by: Guenter Roeck --- drivers/hwmon/occ/Kconfig | 3 +-- drivers/hwmon/occ/Makefile | 6 ++++-- drivers/hwmon/occ/common.c | 7 +++++++ drivers/hwmon/occ/sysfs.c | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/occ/Kconfig b/drivers/hwmon/occ/Kconfig index 66686628fb53..9373945f6dc4 100644 --- a/drivers/hwmon/occ/Kconfig +++ b/drivers/hwmon/occ/Kconfig @@ -27,5 +27,4 @@ config SENSORS_OCC_P9_SBE called occ-p9-hwmon. config SENSORS_OCC - bool "POWER On-Chip Controller" - depends on SENSORS_OCC_P8_I2C || SENSORS_OCC_P9_SBE + tristate diff --git a/drivers/hwmon/occ/Makefile b/drivers/hwmon/occ/Makefile index 3fec12ddc7e7..493588d5a9d3 100644 --- a/drivers/hwmon/occ/Makefile +++ b/drivers/hwmon/occ/Makefile @@ -1,5 +1,7 @@ -occ-p8-hwmon-objs := common.o sysfs.o p8_i2c.o -occ-p9-hwmon-objs := common.o sysfs.o p9_sbe.o +occ-hwmon-common-objs := common.o sysfs.o +occ-p8-hwmon-objs := p8_i2c.o +occ-p9-hwmon-objs := p9_sbe.o +obj-$(CONFIG_SENSORS_OCC) += occ-hwmon-common.o obj-$(CONFIG_SENSORS_OCC_P8_I2C) += occ-p8-hwmon.o obj-$(CONFIG_SENSORS_OCC_P9_SBE) += occ-p9-hwmon.o diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index 4679acb4918e..9d197e9d47c0 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -2,11 +2,13 @@ // Copyright IBM Corp 2019 #include +#include #include #include #include #include #include +#include #include #include #include @@ -1099,3 +1101,8 @@ int occ_setup(struct occ *occ, const char *name) return rc; } +EXPORT_SYMBOL_GPL(occ_setup); + +MODULE_AUTHOR("Eddie James "); +MODULE_DESCRIPTION("Common OCC hwmon code"); +MODULE_LICENSE("GPL"); diff --git a/drivers/hwmon/occ/sysfs.c b/drivers/hwmon/occ/sysfs.c index a71ca94c789f..1cb1e65d086a 100644 --- a/drivers/hwmon/occ/sysfs.c +++ b/drivers/hwmon/occ/sysfs.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -177,3 +178,4 @@ void occ_shutdown(struct occ *occ) { sysfs_remove_group(&occ->bus_dev->kobj, &occ_sysfs); } +EXPORT_SYMBOL_GPL(occ_shutdown);