diff mbox series

counter: Move symbols into COUNTER namespace

Message ID 20220815220321.74161-1-william.gray@linaro.org (mailing list archive)
State New, archived
Headers show
Series counter: Move symbols into COUNTER namespace | expand

Commit Message

William Breathitt Gray Aug. 15, 2022, 10:03 p.m. UTC
Counter subsystem symbols are only relevant to counter drivers. A
COUNTER namespace is created to control the availability of these
symbols to modules that import this namespace explicitly.

Cc: Patrick Havelange <patrick.havelange@essensium.com>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Oleksij Rempel <linux@rempel-privat.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
 drivers/counter/104-quad-8.c            |  1 +
 drivers/counter/counter-chrdev.c        |  2 +-
 drivers/counter/counter-core.c          | 14 +++++++-------
 drivers/counter/ftm-quaddec.c           |  1 +
 drivers/counter/intel-qep.c             |  1 +
 drivers/counter/interrupt-cnt.c         |  1 +
 drivers/counter/microchip-tcb-capture.c |  1 +
 drivers/counter/stm32-lptimer-cnt.c     |  1 +
 drivers/counter/stm32-timer-cnt.c       |  1 +
 drivers/counter/ti-eqep.c               |  1 +
 10 files changed, 16 insertions(+), 8 deletions(-)


base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868

Comments

David Lechner Aug. 16, 2022, 1:37 p.m. UTC | #1
On 8/15/22 5:03 PM, William Breathitt Gray wrote:
> Counter subsystem symbols are only relevant to counter drivers. A
> COUNTER namespace is created to control the availability of these
> symbols to modules that import this namespace explicitly.
> ---


Acked-by: David Lechner <david@lechnology.com>
Jonathan Cameron Aug. 20, 2022, 12:08 p.m. UTC | #2
On Mon, 15 Aug 2022 18:03:21 -0400
William Breathitt Gray <william.gray@linaro.org> wrote:

> Counter subsystem symbols are only relevant to counter drivers. A
> COUNTER namespace is created to control the availability of these
> symbols to modules that import this namespace explicitly.
> 
> Cc: Patrick Havelange <patrick.havelange@essensium.com>
> Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Cc: Oleksij Rempel <linux@rempel-privat.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
> Cc: David Lechner <david@lechnology.com>
> Signed-off-by: William Breathitt Gray <william.gray@linaro.org>

I'm kind of amazed the interface is this small :)

Definitely a good thing to do.  Sometime soon I'll finish
doing equivalent for IIO.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/counter/104-quad-8.c            |  1 +
>  drivers/counter/counter-chrdev.c        |  2 +-
>  drivers/counter/counter-core.c          | 14 +++++++-------
>  drivers/counter/ftm-quaddec.c           |  1 +
>  drivers/counter/intel-qep.c             |  1 +
>  drivers/counter/interrupt-cnt.c         |  1 +
>  drivers/counter/microchip-tcb-capture.c |  1 +
>  drivers/counter/stm32-lptimer-cnt.c     |  1 +
>  drivers/counter/stm32-timer-cnt.c       |  1 +
>  drivers/counter/ti-eqep.c               |  1 +
>  10 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
> index 62c2b7ac4339..1323edfbe40c 100644
> --- a/drivers/counter/104-quad-8.c
> +++ b/drivers/counter/104-quad-8.c
> @@ -1241,3 +1241,4 @@ module_isa_driver(quad8_driver, num_quad8);
>  MODULE_AUTHOR("William Breathitt Gray <vilhelm.gray@gmail.com>");
>  MODULE_DESCRIPTION("ACCES 104-QUAD-8 driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/counter-chrdev.c b/drivers/counter/counter-chrdev.c
> index 69d340be9c93..4e71a19d7e6a 100644
> --- a/drivers/counter/counter-chrdev.c
> +++ b/drivers/counter/counter-chrdev.c
> @@ -574,4 +574,4 @@ void counter_push_event(struct counter_device *const counter, const u8 event,
>  	if (copied)
>  		wake_up_poll(&counter->events_wait, EPOLLIN);
>  }
> -EXPORT_SYMBOL_GPL(counter_push_event);
> +EXPORT_SYMBOL_NS_GPL(counter_push_event, COUNTER);
> diff --git a/drivers/counter/counter-core.c b/drivers/counter/counter-core.c
> index 938651f9e9e0..09c77afb33ca 100644
> --- a/drivers/counter/counter-core.c
> +++ b/drivers/counter/counter-core.c
> @@ -73,7 +73,7 @@ void *counter_priv(const struct counter_device *const counter)
>  
>  	return &ch->privdata;
>  }
> -EXPORT_SYMBOL_GPL(counter_priv);
> +EXPORT_SYMBOL_NS_GPL(counter_priv, COUNTER);
>  
>  /**
>   * counter_alloc - allocate a counter_device
> @@ -133,13 +133,13 @@ struct counter_device *counter_alloc(size_t sizeof_priv)
>  
>  	return NULL;
>  }
> -EXPORT_SYMBOL_GPL(counter_alloc);
> +EXPORT_SYMBOL_NS_GPL(counter_alloc, COUNTER);
>  
>  void counter_put(struct counter_device *counter)
>  {
>  	put_device(&counter->dev);
>  }
> -EXPORT_SYMBOL_GPL(counter_put);
> +EXPORT_SYMBOL_NS_GPL(counter_put, COUNTER);
>  
>  /**
>   * counter_add - complete registration of a counter
> @@ -166,7 +166,7 @@ int counter_add(struct counter_device *counter)
>  	/* implies device_add(dev) */
>  	return cdev_device_add(&counter->chrdev, dev);
>  }
> -EXPORT_SYMBOL_GPL(counter_add);
> +EXPORT_SYMBOL_NS_GPL(counter_add, COUNTER);
>  
>  /**
>   * counter_unregister - unregister Counter from the system
> @@ -188,7 +188,7 @@ void counter_unregister(struct counter_device *const counter)
>  
>  	mutex_unlock(&counter->ops_exist_lock);
>  }
> -EXPORT_SYMBOL_GPL(counter_unregister);
> +EXPORT_SYMBOL_NS_GPL(counter_unregister, COUNTER);
>  
>  static void devm_counter_release(void *counter)
>  {
> @@ -223,7 +223,7 @@ struct counter_device *devm_counter_alloc(struct device *dev, size_t sizeof_priv
>  
>  	return counter;
>  }
> -EXPORT_SYMBOL_GPL(devm_counter_alloc);
> +EXPORT_SYMBOL_NS_GPL(devm_counter_alloc, COUNTER);
>  
>  /**
>   * devm_counter_add - complete registration of a counter
> @@ -244,7 +244,7 @@ int devm_counter_add(struct device *dev,
>  
>  	return devm_add_action_or_reset(dev, devm_counter_release, counter);
>  }
> -EXPORT_SYMBOL_GPL(devm_counter_add);
> +EXPORT_SYMBOL_NS_GPL(devm_counter_add, COUNTER);
>  
>  #define COUNTER_DEV_MAX 256
>  
> diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c
> index 2a58582a9df4..aea6622a9b13 100644
> --- a/drivers/counter/ftm-quaddec.c
> +++ b/drivers/counter/ftm-quaddec.c
> @@ -325,3 +325,4 @@ module_platform_driver(ftm_quaddec_driver);
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Kjeld Flarup <kfa@deif.com>");
>  MODULE_AUTHOR("Patrick Havelange <patrick.havelange@essensium.com>");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/intel-qep.c b/drivers/counter/intel-qep.c
> index 47a6a9dfc9e8..af5942e66f7d 100644
> --- a/drivers/counter/intel-qep.c
> +++ b/drivers/counter/intel-qep.c
> @@ -523,3 +523,4 @@ MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@linux.intel.com>");
>  MODULE_AUTHOR("Raymond Tan <raymond.tan@intel.com>");
>  MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION("Intel Quadrature Encoder Peripheral driver");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
> index 3b13f56bbb11..5a11b65fc0e5 100644
> --- a/drivers/counter/interrupt-cnt.c
> +++ b/drivers/counter/interrupt-cnt.c
> @@ -242,3 +242,4 @@ MODULE_ALIAS("platform:interrupt-counter");
>  MODULE_AUTHOR("Oleksij Rempel <o.rempel@pengutronix.de>");
>  MODULE_DESCRIPTION("Interrupt counter driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
> index 00844445143b..f9dee15d9777 100644
> --- a/drivers/counter/microchip-tcb-capture.c
> +++ b/drivers/counter/microchip-tcb-capture.c
> @@ -394,3 +394,4 @@ module_platform_driver(mchp_tc_driver);
>  MODULE_AUTHOR("Kamel Bouhara <kamel.bouhara@bootlin.com>");
>  MODULE_DESCRIPTION("Microchip TCB Capture driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
> index 68031d93ce89..d6b80b6dfc28 100644
> --- a/drivers/counter/stm32-lptimer-cnt.c
> +++ b/drivers/counter/stm32-lptimer-cnt.c
> @@ -520,3 +520,4 @@ MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
>  MODULE_ALIAS("platform:stm32-lptimer-counter");
>  MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM counter driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 5779ae7c73cf..9bf20a5d6bda 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -417,3 +417,4 @@ MODULE_AUTHOR("Benjamin Gaignard <benjamin.gaignard@st.com>");
>  MODULE_ALIAS("platform:stm32-timer-counter");
>  MODULE_DESCRIPTION("STMicroelectronics STM32 TIMER counter driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(COUNTER);
> diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c
> index 0489d26eb47c..b0f24cf3e891 100644
> --- a/drivers/counter/ti-eqep.c
> +++ b/drivers/counter/ti-eqep.c
> @@ -456,3 +456,4 @@ module_platform_driver(ti_eqep_driver);
>  MODULE_AUTHOR("David Lechner <david@lechnology.com>");
>  MODULE_DESCRIPTION("TI eQEP counter driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(COUNTER);
> 
> base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
William Breathitt Gray Aug. 25, 2022, 2:03 p.m. UTC | #3
On Mon, Aug 15, 2022 at 06:03:21PM -0400, William Breathitt Gray wrote:
> Counter subsystem symbols are only relevant to counter drivers. A
> COUNTER namespace is created to control the availability of these
> symbols to modules that import this namespace explicitly.
> 
> Cc: Patrick Havelange <patrick.havelange@essensium.com>
> Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Cc: Oleksij Rempel <linux@rempel-privat.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
> Cc: David Lechner <david@lechnology.com>
> Signed-off-by: William Breathitt Gray <william.gray@linaro.org>

Applied to counter-next branch.

William Breathitt Gray
diff mbox series

Patch

diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
index 62c2b7ac4339..1323edfbe40c 100644
--- a/drivers/counter/104-quad-8.c
+++ b/drivers/counter/104-quad-8.c
@@ -1241,3 +1241,4 @@  module_isa_driver(quad8_driver, num_quad8);
 MODULE_AUTHOR("William Breathitt Gray <vilhelm.gray@gmail.com>");
 MODULE_DESCRIPTION("ACCES 104-QUAD-8 driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/counter-chrdev.c b/drivers/counter/counter-chrdev.c
index 69d340be9c93..4e71a19d7e6a 100644
--- a/drivers/counter/counter-chrdev.c
+++ b/drivers/counter/counter-chrdev.c
@@ -574,4 +574,4 @@  void counter_push_event(struct counter_device *const counter, const u8 event,
 	if (copied)
 		wake_up_poll(&counter->events_wait, EPOLLIN);
 }
-EXPORT_SYMBOL_GPL(counter_push_event);
+EXPORT_SYMBOL_NS_GPL(counter_push_event, COUNTER);
diff --git a/drivers/counter/counter-core.c b/drivers/counter/counter-core.c
index 938651f9e9e0..09c77afb33ca 100644
--- a/drivers/counter/counter-core.c
+++ b/drivers/counter/counter-core.c
@@ -73,7 +73,7 @@  void *counter_priv(const struct counter_device *const counter)
 
 	return &ch->privdata;
 }
-EXPORT_SYMBOL_GPL(counter_priv);
+EXPORT_SYMBOL_NS_GPL(counter_priv, COUNTER);
 
 /**
  * counter_alloc - allocate a counter_device
@@ -133,13 +133,13 @@  struct counter_device *counter_alloc(size_t sizeof_priv)
 
 	return NULL;
 }
-EXPORT_SYMBOL_GPL(counter_alloc);
+EXPORT_SYMBOL_NS_GPL(counter_alloc, COUNTER);
 
 void counter_put(struct counter_device *counter)
 {
 	put_device(&counter->dev);
 }
-EXPORT_SYMBOL_GPL(counter_put);
+EXPORT_SYMBOL_NS_GPL(counter_put, COUNTER);
 
 /**
  * counter_add - complete registration of a counter
@@ -166,7 +166,7 @@  int counter_add(struct counter_device *counter)
 	/* implies device_add(dev) */
 	return cdev_device_add(&counter->chrdev, dev);
 }
-EXPORT_SYMBOL_GPL(counter_add);
+EXPORT_SYMBOL_NS_GPL(counter_add, COUNTER);
 
 /**
  * counter_unregister - unregister Counter from the system
@@ -188,7 +188,7 @@  void counter_unregister(struct counter_device *const counter)
 
 	mutex_unlock(&counter->ops_exist_lock);
 }
-EXPORT_SYMBOL_GPL(counter_unregister);
+EXPORT_SYMBOL_NS_GPL(counter_unregister, COUNTER);
 
 static void devm_counter_release(void *counter)
 {
@@ -223,7 +223,7 @@  struct counter_device *devm_counter_alloc(struct device *dev, size_t sizeof_priv
 
 	return counter;
 }
-EXPORT_SYMBOL_GPL(devm_counter_alloc);
+EXPORT_SYMBOL_NS_GPL(devm_counter_alloc, COUNTER);
 
 /**
  * devm_counter_add - complete registration of a counter
@@ -244,7 +244,7 @@  int devm_counter_add(struct device *dev,
 
 	return devm_add_action_or_reset(dev, devm_counter_release, counter);
 }
-EXPORT_SYMBOL_GPL(devm_counter_add);
+EXPORT_SYMBOL_NS_GPL(devm_counter_add, COUNTER);
 
 #define COUNTER_DEV_MAX 256
 
diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c
index 2a58582a9df4..aea6622a9b13 100644
--- a/drivers/counter/ftm-quaddec.c
+++ b/drivers/counter/ftm-quaddec.c
@@ -325,3 +325,4 @@  module_platform_driver(ftm_quaddec_driver);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kjeld Flarup <kfa@deif.com>");
 MODULE_AUTHOR("Patrick Havelange <patrick.havelange@essensium.com>");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/intel-qep.c b/drivers/counter/intel-qep.c
index 47a6a9dfc9e8..af5942e66f7d 100644
--- a/drivers/counter/intel-qep.c
+++ b/drivers/counter/intel-qep.c
@@ -523,3 +523,4 @@  MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@linux.intel.com>");
 MODULE_AUTHOR("Raymond Tan <raymond.tan@intel.com>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Intel Quadrature Encoder Peripheral driver");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
index 3b13f56bbb11..5a11b65fc0e5 100644
--- a/drivers/counter/interrupt-cnt.c
+++ b/drivers/counter/interrupt-cnt.c
@@ -242,3 +242,4 @@  MODULE_ALIAS("platform:interrupt-counter");
 MODULE_AUTHOR("Oleksij Rempel <o.rempel@pengutronix.de>");
 MODULE_DESCRIPTION("Interrupt counter driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
index 00844445143b..f9dee15d9777 100644
--- a/drivers/counter/microchip-tcb-capture.c
+++ b/drivers/counter/microchip-tcb-capture.c
@@ -394,3 +394,4 @@  module_platform_driver(mchp_tc_driver);
 MODULE_AUTHOR("Kamel Bouhara <kamel.bouhara@bootlin.com>");
 MODULE_DESCRIPTION("Microchip TCB Capture driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
index 68031d93ce89..d6b80b6dfc28 100644
--- a/drivers/counter/stm32-lptimer-cnt.c
+++ b/drivers/counter/stm32-lptimer-cnt.c
@@ -520,3 +520,4 @@  MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
 MODULE_ALIAS("platform:stm32-lptimer-counter");
 MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM counter driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 5779ae7c73cf..9bf20a5d6bda 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -417,3 +417,4 @@  MODULE_AUTHOR("Benjamin Gaignard <benjamin.gaignard@st.com>");
 MODULE_ALIAS("platform:stm32-timer-counter");
 MODULE_DESCRIPTION("STMicroelectronics STM32 TIMER counter driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(COUNTER);
diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c
index 0489d26eb47c..b0f24cf3e891 100644
--- a/drivers/counter/ti-eqep.c
+++ b/drivers/counter/ti-eqep.c
@@ -456,3 +456,4 @@  module_platform_driver(ti_eqep_driver);
 MODULE_AUTHOR("David Lechner <david@lechnology.com>");
 MODULE_DESCRIPTION("TI eQEP counter driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(COUNTER);