diff mbox series

[v2,4/4] iio: adc: qcom-vadc: Move symbol exports to IIO_QCOM_VADC namespace

Message ID 20220604155306.422937-5-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series 3rd set of IIO export namespaces. | expand

Commit Message

Jonathan Cameron June 4, 2022, 3:53 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Avoid unnecessary pollution of the global symbol namespace by
moving library functions in to a specific namespace and import
that into the drivers that make use of the functions.

For more info: https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Siddartha Mohanadoss <smohanad@codeaurora.org>
Link: https://lore.kernel.org/r/20220220173701.502331-6-jic23@kernel.org
---
 drivers/iio/adc/qcom-pm8xxx-xoadc.c |  1 +
 drivers/iio/adc/qcom-spmi-adc5.c    |  1 +
 drivers/iio/adc/qcom-spmi-vadc.c    |  1 +
 drivers/iio/adc/qcom-vadc-common.c  | 16 ++++++++--------
 4 files changed, 11 insertions(+), 8 deletions(-)

Comments

Jonathan Cameron July 1, 2022, 10:15 a.m. UTC | #1
On Sat,  4 Jun 2022 16:53:06 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Avoid unnecessary pollution of the global symbol namespace by
> moving library functions in to a specific namespace and import
> that into the drivers that make use of the functions.
> 
> For more info: https://lwn.net/Articles/760045/
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Siddartha Mohanadoss <smohanad@codeaurora.org>
> Link: https://lore.kernel.org/r/20220220173701.502331-6-jic23@kernel.org

Dropped for now after a build issue found in linux next as
there are a few calls into this made from a thermal driver.

I'll send out a new version at somepoint.

Thanks,

Jonathan


> ---
>  drivers/iio/adc/qcom-pm8xxx-xoadc.c |  1 +
>  drivers/iio/adc/qcom-spmi-adc5.c    |  1 +
>  drivers/iio/adc/qcom-spmi-vadc.c    |  1 +
>  drivers/iio/adc/qcom-vadc-common.c  | 16 ++++++++--------
>  4 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> index 5e9e56821075..e2ef89dcaa5e 100644
> --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> @@ -1028,3 +1028,4 @@ module_platform_driver(pm8xxx_xoadc_driver);
>  MODULE_DESCRIPTION("PM8xxx XOADC driver");
>  MODULE_LICENSE("GPL v2");
>  MODULE_ALIAS("platform:pm8xxx-xoadc");
> +MODULE_IMPORT_NS(IIO_QCOM_VADC);
> diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
> index 87438d1e5c0b..10bb51b648c1 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5.c
> @@ -925,3 +925,4 @@ module_platform_driver(adc5_driver);
>  MODULE_ALIAS("platform:qcom-spmi-adc5");
>  MODULE_DESCRIPTION("Qualcomm Technologies Inc. PMIC5 ADC driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(IIO_QCOM_VADC);
> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> index 34202ba52469..cb0c6af091ac 100644
> --- a/drivers/iio/adc/qcom-spmi-vadc.c
> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> @@ -935,3 +935,4 @@ MODULE_DESCRIPTION("Qualcomm SPMI PMIC voltage ADC driver");
>  MODULE_LICENSE("GPL v2");
>  MODULE_AUTHOR("Stanimir Varbanov <svarbanov@mm-sol.com>");
>  MODULE_AUTHOR("Ivan T. Ivanov <iivanov@mm-sol.com>");
> +MODULE_IMPORT_NS(IIO_QCOM_VADC);
> diff --git a/drivers/iio/adc/qcom-vadc-common.c b/drivers/iio/adc/qcom-vadc-common.c
> index d5209f32adb3..7ca191ea1a65 100644
> --- a/drivers/iio/adc/qcom-vadc-common.c
> +++ b/drivers/iio/adc/qcom-vadc-common.c
> @@ -662,7 +662,7 @@ int qcom_vadc_scale(enum vadc_scale_fn_type scaletype,
>  		return -EINVAL;
>  	}
>  }
> -EXPORT_SYMBOL(qcom_vadc_scale);
> +EXPORT_SYMBOL_NS(qcom_vadc_scale, IIO_QCOM_VADC);
>  
>  u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
>  				 u32 full_scale_code_volt, int temp)
> @@ -675,7 +675,7 @@ u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
>  					     temp);
>  	return qcom_vadc_scale_voltage_code(voltage, prescale, full_scale_code_volt, 1000);
>  }
> -EXPORT_SYMBOL(qcom_adc_tm5_temp_volt_scale);
> +EXPORT_SYMBOL_NS(qcom_adc_tm5_temp_volt_scale, IIO_QCOM_VADC);
>  
>  u16 qcom_adc_tm5_gen2_temp_res_scale(int temp)
>  {
> @@ -704,7 +704,7 @@ int qcom_adc5_hw_scale(enum vadc_scale_fn_type scaletype,
>  	return scale_adc5_fn[scaletype].scale_fn(prescale, data,
>  					adc_code, result);
>  }
> -EXPORT_SYMBOL(qcom_adc5_hw_scale);
> +EXPORT_SYMBOL_NS(qcom_adc5_hw_scale, IIO_QCOM_VADC);
>  
>  int qcom_adc5_prescaling_from_dt(u32 numerator, u32 denominator)
>  {
> @@ -720,7 +720,7 @@ int qcom_adc5_prescaling_from_dt(u32 numerator, u32 denominator)
>  
>  	return pre;
>  }
> -EXPORT_SYMBOL(qcom_adc5_prescaling_from_dt);
> +EXPORT_SYMBOL_NS(qcom_adc5_prescaling_from_dt, IIO_QCOM_VADC);
>  
>  int qcom_adc5_hw_settle_time_from_dt(u32 value,
>  				     const unsigned int *hw_settle)
> @@ -734,7 +734,7 @@ int qcom_adc5_hw_settle_time_from_dt(u32 value,
>  
>  	return -EINVAL;
>  }
> -EXPORT_SYMBOL(qcom_adc5_hw_settle_time_from_dt);
> +EXPORT_SYMBOL_NS(qcom_adc5_hw_settle_time_from_dt, IIO_QCOM_VADC);
>  
>  int qcom_adc5_avg_samples_from_dt(u32 value)
>  {
> @@ -743,7 +743,7 @@ int qcom_adc5_avg_samples_from_dt(u32 value)
>  
>  	return __ffs(value);
>  }
> -EXPORT_SYMBOL(qcom_adc5_avg_samples_from_dt);
> +EXPORT_SYMBOL_NS(qcom_adc5_avg_samples_from_dt, IIO_QCOM_VADC);
>  
>  int qcom_adc5_decimation_from_dt(u32 value, const unsigned int *decimation)
>  {
> @@ -756,7 +756,7 @@ int qcom_adc5_decimation_from_dt(u32 value, const unsigned int *decimation)
>  
>  	return -EINVAL;
>  }
> -EXPORT_SYMBOL(qcom_adc5_decimation_from_dt);
> +EXPORT_SYMBOL_NS(qcom_adc5_decimation_from_dt, IIO_QCOM_VADC);
>  
>  int qcom_vadc_decimation_from_dt(u32 value)
>  {
> @@ -766,7 +766,7 @@ int qcom_vadc_decimation_from_dt(u32 value)
>  
>  	return __ffs64(value / VADC_DECIMATION_MIN);
>  }
> -EXPORT_SYMBOL(qcom_vadc_decimation_from_dt);
> +EXPORT_SYMBOL_NS(qcom_vadc_decimation_from_dt, IIO_QCOM_VADC);
>  
>  MODULE_LICENSE("GPL v2");
>  MODULE_DESCRIPTION("Qualcomm ADC common functionality");
diff mbox series

Patch

diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 5e9e56821075..e2ef89dcaa5e 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -1028,3 +1028,4 @@  module_platform_driver(pm8xxx_xoadc_driver);
 MODULE_DESCRIPTION("PM8xxx XOADC driver");
 MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:pm8xxx-xoadc");
+MODULE_IMPORT_NS(IIO_QCOM_VADC);
diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
index 87438d1e5c0b..10bb51b648c1 100644
--- a/drivers/iio/adc/qcom-spmi-adc5.c
+++ b/drivers/iio/adc/qcom-spmi-adc5.c
@@ -925,3 +925,4 @@  module_platform_driver(adc5_driver);
 MODULE_ALIAS("platform:qcom-spmi-adc5");
 MODULE_DESCRIPTION("Qualcomm Technologies Inc. PMIC5 ADC driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_QCOM_VADC);
diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index 34202ba52469..cb0c6af091ac 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -935,3 +935,4 @@  MODULE_DESCRIPTION("Qualcomm SPMI PMIC voltage ADC driver");
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Stanimir Varbanov <svarbanov@mm-sol.com>");
 MODULE_AUTHOR("Ivan T. Ivanov <iivanov@mm-sol.com>");
+MODULE_IMPORT_NS(IIO_QCOM_VADC);
diff --git a/drivers/iio/adc/qcom-vadc-common.c b/drivers/iio/adc/qcom-vadc-common.c
index d5209f32adb3..7ca191ea1a65 100644
--- a/drivers/iio/adc/qcom-vadc-common.c
+++ b/drivers/iio/adc/qcom-vadc-common.c
@@ -662,7 +662,7 @@  int qcom_vadc_scale(enum vadc_scale_fn_type scaletype,
 		return -EINVAL;
 	}
 }
-EXPORT_SYMBOL(qcom_vadc_scale);
+EXPORT_SYMBOL_NS(qcom_vadc_scale, IIO_QCOM_VADC);
 
 u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
 				 u32 full_scale_code_volt, int temp)
@@ -675,7 +675,7 @@  u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
 					     temp);
 	return qcom_vadc_scale_voltage_code(voltage, prescale, full_scale_code_volt, 1000);
 }
-EXPORT_SYMBOL(qcom_adc_tm5_temp_volt_scale);
+EXPORT_SYMBOL_NS(qcom_adc_tm5_temp_volt_scale, IIO_QCOM_VADC);
 
 u16 qcom_adc_tm5_gen2_temp_res_scale(int temp)
 {
@@ -704,7 +704,7 @@  int qcom_adc5_hw_scale(enum vadc_scale_fn_type scaletype,
 	return scale_adc5_fn[scaletype].scale_fn(prescale, data,
 					adc_code, result);
 }
-EXPORT_SYMBOL(qcom_adc5_hw_scale);
+EXPORT_SYMBOL_NS(qcom_adc5_hw_scale, IIO_QCOM_VADC);
 
 int qcom_adc5_prescaling_from_dt(u32 numerator, u32 denominator)
 {
@@ -720,7 +720,7 @@  int qcom_adc5_prescaling_from_dt(u32 numerator, u32 denominator)
 
 	return pre;
 }
-EXPORT_SYMBOL(qcom_adc5_prescaling_from_dt);
+EXPORT_SYMBOL_NS(qcom_adc5_prescaling_from_dt, IIO_QCOM_VADC);
 
 int qcom_adc5_hw_settle_time_from_dt(u32 value,
 				     const unsigned int *hw_settle)
@@ -734,7 +734,7 @@  int qcom_adc5_hw_settle_time_from_dt(u32 value,
 
 	return -EINVAL;
 }
-EXPORT_SYMBOL(qcom_adc5_hw_settle_time_from_dt);
+EXPORT_SYMBOL_NS(qcom_adc5_hw_settle_time_from_dt, IIO_QCOM_VADC);
 
 int qcom_adc5_avg_samples_from_dt(u32 value)
 {
@@ -743,7 +743,7 @@  int qcom_adc5_avg_samples_from_dt(u32 value)
 
 	return __ffs(value);
 }
-EXPORT_SYMBOL(qcom_adc5_avg_samples_from_dt);
+EXPORT_SYMBOL_NS(qcom_adc5_avg_samples_from_dt, IIO_QCOM_VADC);
 
 int qcom_adc5_decimation_from_dt(u32 value, const unsigned int *decimation)
 {
@@ -756,7 +756,7 @@  int qcom_adc5_decimation_from_dt(u32 value, const unsigned int *decimation)
 
 	return -EINVAL;
 }
-EXPORT_SYMBOL(qcom_adc5_decimation_from_dt);
+EXPORT_SYMBOL_NS(qcom_adc5_decimation_from_dt, IIO_QCOM_VADC);
 
 int qcom_vadc_decimation_from_dt(u32 value)
 {
@@ -766,7 +766,7 @@  int qcom_vadc_decimation_from_dt(u32 value)
 
 	return __ffs64(value / VADC_DECIMATION_MIN);
 }
-EXPORT_SYMBOL(qcom_vadc_decimation_from_dt);
+EXPORT_SYMBOL_NS(qcom_vadc_decimation_from_dt, IIO_QCOM_VADC);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Qualcomm ADC common functionality");