[PATCH] mfd: cros_ec: move cros_ec_dev driver to MFD subdir.

From: Enric Balletbo i Serra
Date: Mon Sep 25 2017 - 16:05:05 EST


The cros_ec_dev serves multiple purposes, one is register dinamically the
MFD subdevices by checking the features available in a specific ChromeOS
Embedded Controller, hence there are different calls to mfd_add_devices.
The first time we upstreamed this driver was placed in
drivers/platform/chrome, but call mfd_add_devices outside MFD is wrong.
As cros_ec_dev driver is strongly related to the MFD cros-ec-core would
make sense move the driver to the mfd subdir.

This patch also fixes a small module loading issue, the name of the driver
in the C code was not matching their Makefile names, this prevented the
driver from loaded as module.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@xxxxxxxxxxxxx>
---
drivers/mfd/Kconfig | 9 +++++++++
drivers/mfd/Makefile | 4 ++++
drivers/{platform/chrome => mfd}/cros_ec_debugfs.c | 0
drivers/{platform/chrome => mfd}/cros_ec_debugfs.h | 0
drivers/{platform/chrome => mfd}/cros_ec_dev.c | 5 ++++-
drivers/{platform/chrome => mfd}/cros_ec_dev.h | 0
drivers/{platform/chrome => mfd}/cros_ec_lightbar.c | 0
drivers/{platform/chrome => mfd}/cros_ec_sysfs.c | 0
drivers/{platform/chrome => mfd}/cros_ec_vbc.c | 0
drivers/platform/chrome/Kconfig | 9 ---------
drivers/platform/chrome/Makefile | 4 ----
11 files changed, 17 insertions(+), 14 deletions(-)
rename drivers/{platform/chrome => mfd}/cros_ec_debugfs.c (100%)
rename drivers/{platform/chrome => mfd}/cros_ec_debugfs.h (100%)
rename drivers/{platform/chrome => mfd}/cros_ec_dev.c (99%)
rename drivers/{platform/chrome => mfd}/cros_ec_dev.h (100%)
rename drivers/{platform/chrome => mfd}/cros_ec_lightbar.c (100%)
rename drivers/{platform/chrome => mfd}/cros_ec_sysfs.c (100%)
rename drivers/{platform/chrome => mfd}/cros_ec_vbc.c (100%)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 94ad2c1..131e3b3 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -208,6 +208,15 @@ config MFD_CROS_EC_SPI
response time cannot be guaranteed, we support ignoring
'pre-amble' bytes before the response actually starts.

+config CROS_EC_CHARDEV
+ tristate "Chrome OS Embedded Controller userspace device interface"
+ depends on MFD_CROS_EC
+ ---help---
+ This driver adds support to talk with the ChromeOS EC from userspace.
+
+ If you have a supported Chromebook, choose Y or M here.
+ The module will be called cros_ec_dev.
+
config MFD_ASIC3
bool "Compaq ASIC3"
depends on GPIOLIB && ARM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 080793b..3973c11 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -15,6 +15,10 @@ cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
+cros_ec_ctl-objs := cros_ec_dev.o cros_ec_sysfs.o \
+ cros_ec_lightbar.o cros_ec_vbc.o \
+ cros_ec_debugfs.o
+obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_ctl.o
obj-$(CONFIG_MFD_EXYNOS_LPASS) += exynos-lpass.o

rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o
diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/mfd/cros_ec_debugfs.c
similarity index 100%
rename from drivers/platform/chrome/cros_ec_debugfs.c
rename to drivers/mfd/cros_ec_debugfs.c
diff --git a/drivers/platform/chrome/cros_ec_debugfs.h b/drivers/mfd/cros_ec_debugfs.h
similarity index 100%
rename from drivers/platform/chrome/cros_ec_debugfs.h
rename to drivers/mfd/cros_ec_debugfs.h
diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
similarity index 99%
rename from drivers/platform/chrome/cros_ec_dev.c
rename to drivers/mfd/cros_ec_dev.c
index cf6c4f0..370a716 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -28,6 +28,8 @@
#include "cros_ec_debugfs.h"
#include "cros_ec_dev.h"

+#define DRV_NAME "cros-ec-ctl"
+
/* Device variables */
#define CROS_MAX_DEV 128
static int ec_major;
@@ -493,7 +495,7 @@ static const struct dev_pm_ops cros_ec_dev_pm_ops = {

static struct platform_driver cros_ec_dev_driver = {
.driver = {
- .name = "cros-ec-ctl",
+ .name = DRV_NAME,
.pm = &cros_ec_dev_pm_ops,
},
.probe = ec_device_probe,
@@ -544,6 +546,7 @@ static void __exit cros_ec_dev_exit(void)
module_init(cros_ec_dev_init);
module_exit(cros_ec_dev_exit);

+MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Bill Richardson <wfrichar@xxxxxxxxxxxx>");
MODULE_DESCRIPTION("Userspace interface to the Chrome OS Embedded Controller");
MODULE_VERSION("1.0");
diff --git a/drivers/platform/chrome/cros_ec_dev.h b/drivers/mfd/cros_ec_dev.h
similarity index 100%
rename from drivers/platform/chrome/cros_ec_dev.h
rename to drivers/mfd/cros_ec_dev.h
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/mfd/cros_ec_lightbar.c
similarity index 100%
rename from drivers/platform/chrome/cros_ec_lightbar.c
rename to drivers/mfd/cros_ec_lightbar.c
diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/mfd/cros_ec_sysfs.c
similarity index 100%
rename from drivers/platform/chrome/cros_ec_sysfs.c
rename to drivers/mfd/cros_ec_sysfs.c
diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/mfd/cros_ec_vbc.c
similarity index 100%
rename from drivers/platform/chrome/cros_ec_vbc.c
rename to drivers/mfd/cros_ec_vbc.c
diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig
index 0ad6e29..8dc185e 100644
--- a/drivers/platform/chrome/Kconfig
+++ b/drivers/platform/chrome/Kconfig
@@ -38,15 +38,6 @@ config CHROMEOS_PSTORE
If you have a supported Chromebook, choose Y or M here.
The module will be called chromeos_pstore.

-config CROS_EC_CHARDEV
- tristate "Chrome OS Embedded Controller userspace device interface"
- depends on MFD_CROS_EC
- ---help---
- This driver adds support to talk with the ChromeOS EC from userspace.
-
- If you have a supported Chromebook, choose Y or M here.
- The module will be called cros_ec_dev.
-
config CROS_EC_LPC
tristate "ChromeOS Embedded Controller (LPC)"
depends on MFD_CROS_EC && ACPI && (X86 || COMPILE_TEST)
diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile
index 66c345c..f19ffc4 100644
--- a/drivers/platform/chrome/Makefile
+++ b/drivers/platform/chrome/Makefile
@@ -1,10 +1,6 @@

obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o
obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o
-cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \
- cros_ec_lightbar.o cros_ec_vbc.o \
- cros_ec_debugfs.o
-obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_devs.o
cros_ec_lpcs-objs := cros_ec_lpc.o cros_ec_lpc_reg.o
cros_ec_lpcs-$(CONFIG_CROS_EC_LPC_MEC) += cros_ec_lpc_mec.o
obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpcs.o
--
2.9.3