All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: cros_ec: move cros_ec_dev driver to MFD subdir.
@ 2017-09-25 20:04 Enric Balletbo i Serra
  2017-09-28 19:22 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Enric Balletbo i Serra @ 2017-09-25 20:04 UTC (permalink / raw)
  To: Lee Jones, Benson Leung; +Cc: gwendal, groeck, linux-kernel, thierry.escande

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@collabora.com>
---
 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@chromium.org>");
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: cros_ec: move cros_ec_dev driver to MFD subdir.
  2017-09-25 20:04 [PATCH] mfd: cros_ec: move cros_ec_dev driver to MFD subdir Enric Balletbo i Serra
@ 2017-09-28 19:22 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2017-09-28 19:22 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: Benson Leung, gwendal, groeck, linux-kernel, thierry.escande

On Mon, 25 Sep 2017, Enric Balletbo i Serra wrote:

> 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@collabora.com>
> ---
>  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%)

This is not what I had in mind.

Only the MFD portion (the part which registers other devices) should
live in drivers/mfd.  Everything else should either live in their
respective subsystem(s) or in drivers/platform.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-28 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-25 20:04 [PATCH] mfd: cros_ec: move cros_ec_dev driver to MFD subdir Enric Balletbo i Serra
2017-09-28 19:22 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.