amba/coresight: make non-modular code explicitly non-modular
Subsystems (4)
cover amba/coresight: make non-modular code explicitly non-modular
In a previous merge window, we made changes to allow better delineation between modular and non-modular code in commit 0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init from init.h to module.h"). This allows us to now ensure module code looks modular and non-modular code does not accidentally look modular just to avoid suffering build breakage.
Here we target code that is, by nature of their Makefile and/or Kconfig settings, only available to be built-in, but implicitly presenting itself as being possibly modular by way of using modular headers, macros, and functions.
The goal here is to remove that illusion of modularity from these files, but in a way that leaves the actual runtime unchanged. In doing so, we remove code that has never been tested and adds no value to the tree. And we continue the process of expecting a level of consistency between the Kconfig/Makefile of code and the code in use itself.
The coresight drivers make extensive use of module_amba_driver, hence why this is all grouped together. Build tested on the latest linux-next, for ARCH=arm.
Note that the coresight drivers could in theory be unbound prior to this commit, but there doesn't seem to be any case where that would make sense, so we explicitly disable that now that we have deleted the .remove functions that the unbind would have called.
Paul.
--
Paul Gortmaker (3):
amba: create builtin_amba_driver to avoid registration boilerplate drivers/hwtracing: make coresight-* explicitly non-modular drivers/amba: make tegra-ahb.c explicitly non-modular
drivers/amba/tegra-ahb.c | 9 ++----- drivers/hwtracing/coresight/coresight-etb10.c | 26 +++++-------------- drivers/hwtracing/coresight/coresight-etm3x.c | 29 ++++++--------------- drivers/hwtracing/coresight/coresight-etm4x.c | 19 +++----------- drivers/hwtracing/coresight/coresight-funnel.c | 25 +++++------------- .../coresight/coresight-replicator-qcom.c | 19 +++----------- drivers/hwtracing/coresight/coresight-replicator.c | 30 +++++----------------- drivers/hwtracing/coresight/coresight-tmc.c | 28 +++++--------------- drivers/hwtracing/coresight/coresight-tpiu.c | 25 +++++------------- drivers/hwtracing/coresight/coresight.c | 3 --- drivers/hwtracing/coresight/of_coresight.c | 1 - include/linux/amba/bus.h | 9 +++++++ 12 files changed, 60 insertions(+), 163 deletions(-)
Signature · 1 line
2.6.1
PATCH 1/3 amba: create builtin_amba_driver to avoid registration boilerplate
In commit f309d4443130bf814e991f836e919dca22df37ae ("platform_device:
better support builtin boilerplate avoidance") we introduced the builtin_driver macro.
Here we use that support and extend it to amba driver registration, so where a driver is clearly non-modular and builtin-only, we can register it in a similar fashion. And existing code that is clearly non-modular can be updated with the simple mapping of
module_amba_driver(...) ---> builtin_amba_driver(...)
We've essentially cloned the former to make the latter, and taken out the remove/module_exit parts since those never get used in a non-modular build of the code.
--- include/linux/amba/bus.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/amba/bus.h +9 -0
@@ -165,4 +165,13 @@ struct amba_device name##_device = { \#define module_amba_driver (__amba_drv) \ module_driver(__amba_drv, amba_driver_register, amba_driver_unregister) +/* +* builtin_amba_driver() - Helper macro for drivers that don't do anything +* special in driver initcall. This eliminates a lot of boilerplate. Each +* driver may only use this macro once, and calling it replaces the instance +* device_initcall(). +*/ +#define builtin_amba_driver (__amba_drv) \ + builtin_driver(__amba_drv, amba_driver_register) +#endif
Signature · 1 line
2.6.1
PATCH 2/3 drivers/hwtracing: make coresight-* explicitly non-modular
In reply to Paul GortmakerNone of the Kconfig currently controlling compilation of any of the files here are tristate, meaning that none of it currently is being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that when reading the drivers there is no doubt they are builtin-only. All drivers get mostly the same changes, so they are handled in batch.
The changes in this commit are as follows:
(1) convert from module_amba_driver to builtin_amba_driver
(2) delete module.h include where it is now unused
(3) relocate the description into the comments so we don't need MODULE_DESCRIPTION and associated tags
(4) delete any ".remove" related functions that were added under the presumption that module_exit would ever run here
(5) explicitly prevent anyone from mistakenly using the unbind interface to call the (now removed) ".remove" functions, as that never made sense for any of these drivers regardless.
The etm3x and etm4x use module_param_named, and have been adjusted to just include moduleparam.h for that purpose.
Since module_amba_driver() uses the same init level priority as builtin_amba_driver() the init ordering remains unchanged with this commit.
--- drivers/hwtracing/coresight/coresight-etb10.c | 26 +++++-------------- drivers/hwtracing/coresight/coresight-etm3x.c | 29 ++++++--------------- drivers/hwtracing/coresight/coresight-etm4x.c | 19 +++----------- drivers/hwtracing/coresight/coresight-funnel.c | 25 +++++------------- .../coresight/coresight-replicator-qcom.c | 19 +++----------- drivers/hwtracing/coresight/coresight-replicator.c | 30 +++++----------------- drivers/hwtracing/coresight/coresight-tmc.c | 28 +++++--------------- drivers/hwtracing/coresight/coresight-tpiu.c | 25 +++++------------- drivers/hwtracing/coresight/coresight.c | 3 --- drivers/hwtracing/coresight/of_coresight.c | 1 - 10 files changed, 49 insertions(+), 156 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +7 -19
@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Embedded Trace Buffer driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h>
@@ -489,15 +490,6 @@ err_misc_register:return ret; } -static int etb_remove (struct amba_device *adev) -{ -struct etb_drvdata *drvdata =amba_get_drvdata (adev); - -misc_deregister (&drvdata->miscdev); -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int etb_runtime_suspend (struct device *dev) {
@@ -534,17 +526,13 @@ static struct amba_id etb_ids[] = {static struct amba_driver etb_driver = { .drv = { - .name ="coresight-etb10" , - .owner =THIS_MODULE , - .pm = &etb_dev_pm_ops, + .name ="coresight-etb10" , + .owner =THIS_MODULE , + .pm = &etb_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = etb_probe, - .remove = etb_remove, .id_table = etb_ids, }; - -module_amba_driver (etb_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Embedded Trace Buffer driver" ); +builtin_amba_driver (etb_driver);
drivers/hwtracing/coresight/coresight-etm3x.c +8 -21
@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Program Flow Trace driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -11,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h>
@@ -1877,17 +1879,6 @@ err_arch_supported:return ret; } -static int etm_remove (struct amba_device *adev) -{ -struct etm_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -if (--etm_count ==0 ) -unregister_hotcpu_notifier (&etm_cpu_notifier); - -return 0 ; -} -#ifdef CONFIG_PM static int etm_runtime_suspend (struct device *dev) {
@@ -1945,16 +1936,12 @@ static struct amba_id etm_ids[] = {static struct amba_driver etm_driver = { .drv = { - .name ="coresight-etm3x" , - .owner =THIS_MODULE , - .pm = &etm_dev_pm_ops, + .name ="coresight-etm3x" , + .owner =THIS_MODULE , + .pm = &etm_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = etm_probe, - .remove = etm_remove, .id_table = etm_ids, }; - -module_amba_driver (etm_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Program Flow Trace driver" ); +builtin_amba_driver (etm_driver);
drivers/hwtracing/coresight/coresight-etm4x.c +3 -16
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/types.h> #include <linux/device.h> -#include <linux/module.h> #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h>
@@ -2684,17 +2683,6 @@ err_coresight_register:return ret; } -static int etm4_remove (struct amba_device *adev) -{ -struct etmv4_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -if (--etm4_count ==0 ) -unregister_hotcpu_notifier (&etm4_cpu_notifier); - -return 0 ; -} -static struct amba_id etm4_ids[] = { {/* ETM 4.0 - Qualcomm */ .id =0x0003b95d ,
@@ -2711,11 +2699,10 @@ static struct amba_id etm4_ids[] = {static struct amba_driver etm4x_driver = { .drv = { - .name ="coresight-etm4x" , + .name ="coresight-etm4x" , + .suppress_bind_attrs = true, }, .probe = etm4_probe, - .remove = etm4_remove, .id_table = etm4_ids, }; - -module_amba_driver (etm4x_driver); +builtin_amba_driver (etm4x_driver);
drivers/hwtracing/coresight/coresight-funnel.c +7 -18
@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Funnel driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h>
@@ -226,14 +227,6 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static int funnel_remove (struct amba_device *adev) -{ -struct funnel_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int funnel_runtime_suspend (struct device *dev) {
@@ -270,16 +263,12 @@ static struct amba_id funnel_ids[] = {static struct amba_driver funnel_driver = { .drv = { - .name ="coresight-funnel" , - .owner =THIS_MODULE , - .pm = &funnel_dev_pm_ops, + .name ="coresight-funnel" , + .owner =THIS_MODULE , + .pm = &funnel_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = funnel_probe, - .remove = funnel_remove, .id_table = funnel_ids, }; - -module_amba_driver (funnel_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Funnel driver" ); +builtin_amba_driver (funnel_driver);
drivers/hwtracing/coresight/coresight-replicator-qcom.c +4 -15
@@ -15,7 +15,6 @@#include <linux/clk.h> #include <linux/coresight.h> #include <linux/device.h> -#include <linux/module.h> #include <linux/err.h> #include <linux/init.h> #include <linux/io.h>
@@ -156,15 +155,6 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static int replicator_remove (struct amba_device *adev) -{ -struct replicator_state *drvdata =amba_get_drvdata (adev); - -pm_runtime_disable (&adev->dev); -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int replicator_runtime_suspend (struct device *dev) {
@@ -204,12 +194,11 @@ static struct amba_id replicator_ids[] = {static struct amba_driver replicator_driver = { .drv = { - .name ="coresight-replicator-qcom" , - .pm = &replicator_dev_pm_ops, + .name ="coresight-replicator-qcom" , + .pm = &replicator_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = replicator_probe, - .remove = replicator_remove, .id_table = replicator_ids, }; - -module_amba_driver (replicator_driver); +builtin_amba_driver (replicator_driver);
drivers/hwtracing/coresight/coresight-replicator.c +7 -23
@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Replicator driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -127,20 +128,6 @@ out_disable_pm:return ret; } -static int replicator_remove (struct platform_device *pdev) -{ -struct replicator_drvdata *drvdata =platform_get_drvdata (pdev); - -coresight_unregister (drvdata->csdev); -pm_runtime_get_sync (&pdev->dev); -if (!IS_ERR (drvdata->atclk)) -clk_disable_unprepare (drvdata->atclk); -pm_runtime_put_noidle (&pdev->dev); -pm_runtime_disable (&pdev->dev); - -return 0 ; -} -#ifdef CONFIG_PM static int replicator_runtime_suspend (struct device *dev) {
@@ -175,15 +162,12 @@ static const struct of_device_id replicator_match[] = {static struct platform_driver replicator_driver = { .probe = replicator_probe, - .remove = replicator_remove, .driver = { - .name ="coresight-replicator" , - .of_match_table = replicator_match, - .pm = &replicator_dev_pm_ops, + .name ="coresight-replicator" , + .of_match_table = replicator_match, + .pm = &replicator_dev_pm_ops, + .suppress_bind_attrs = true, + }, }; -builtin_platform_driver (replicator_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Replicator driver" );
drivers/hwtracing/coresight/coresight-tmc.c +6 -22
@@ -1,5 +1,7 @@/* Copyright (c) 2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Trace Memory Controller driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h>
@@ -770,19 +771,6 @@ err_devm_kzalloc:return ret; } -static int tmc_remove (struct amba_device *adev) -{ -struct tmc_drvdata *drvdata =amba_get_drvdata (adev); - -misc_deregister (&drvdata->miscdev); -coresight_unregister (drvdata->csdev); -if (drvdata->config_type ==TMC_CONFIG_TYPE_ETR ) -dma_free_coherent (drvdata->dev, drvdata->size, - &drvdata->paddr,GFP_KERNEL ); - -return 0 ; -} -static struct amba_id tmc_ids[] = { { .id =0x0003b961 ,
@@ -793,15 +781,11 @@ static struct amba_id tmc_ids[] = {static struct amba_driver tmc_driver = { .drv = { - .name ="coresight-tmc" , - .owner =THIS_MODULE , + .name ="coresight-tmc" , + .owner =THIS_MODULE , + .suppress_bind_attrs = true, }, .probe = tmc_probe, - .remove = tmc_remove, .id_table = tmc_ids, }; - -module_amba_driver (tmc_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Trace Memory Controller driver" ); +builtin_amba_driver (tmc_driver);
drivers/hwtracing/coresight/coresight-tpiu.c +7 -18
@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Trace Port Interface Unit driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/device.h> #include <linux/io.h>
@@ -172,14 +173,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static int tpiu_remove (struct amba_device *adev) -{ -struct tpiu_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int tpiu_runtime_suspend (struct device *dev) {
@@ -220,16 +213,12 @@ static struct amba_id tpiu_ids[] = {static struct amba_driver tpiu_driver = { .drv = { - .name ="coresight-tpiu" , - .owner =THIS_MODULE , - .pm = &tpiu_dev_pm_ops, + .name ="coresight-tpiu" , + .owner =THIS_MODULE , + .pm = &tpiu_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = tpiu_probe, - .remove = tpiu_remove, .id_table = tpiu_ids, }; - -module_amba_driver (tpiu_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Trace Port Interface Unit driver" ); +builtin_amba_driver (tpiu_driver);
drivers/hwtracing/coresight/coresight.c +0 -3
@@ -11,7 +11,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h>
@@ -721,5 +720,3 @@ void coresight_unregister(struct coresight_device *csdev)mutex_unlock (&coresight_mutex); }EXPORT_SYMBOL_GPL (coresight_unregister); - -MODULE_LICENSE ("GPL v2" );
drivers/hwtracing/coresight/of_coresight.c +0 -1
@@ -10,7 +10,6 @@* GNU General Public License for more details. */ -#include <linux/module.h> #include <linux/types.h> #include <linux/err.h> #include <linux/slab.h>
Signature · 1 line
2.6.1
Re: [PATCH 2/3] drivers/hwtracing: make coresight-* explicitly non-modular
Quoted 519 lines · Paul Gortmaker
None of the
Kconfigcurrently controlling compilation of any of the files here are tristate, meaning that none of it currently is being built as a module by anyone.Lets remove the modular code that is essentially orphaned, so that when reading the drivers there is no doubt they are builtin-only. All drivers get mostly the same changes, so they are handled in batch.
The changes in this commit are as follows:
(1) convert frommodule_amba_drivertobuiltin_amba_driver
(2) deletemodule.hinclude where it is now unused
(3) relocate the description into the comments so we don't needMODULE_DESCRIPTIONand associated tags
(4) delete any ".remove" related functions that were added under the presumption thatmodule_exitwould ever run here
(5) explicitly prevent anyone from mistakenly using the unbind interface to call the (now removed) ".remove" functions, as that never made sense for any of these drivers regardless.The etm3x and etm4x use
module_param_named, and have been adjusted to just includemoduleparam.hfor that purpose.Since
module_amba_driver()uses the same init level priority asbuiltin_amba_driver()the init ordering remains unchanged with this commit.Cc Mathieu Poirier <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Paul Gortmaker <[email protected]>--- drivers/hwtracing/coresight/coresight-etb10.c | 26 +++++-------------- drivers/hwtracing/coresight/coresight-etm3x.c | 29 ++++++--------------- drivers/hwtracing/coresight/coresight-etm4x.c | 19 +++----------- drivers/hwtracing/coresight/coresight-funnel.c | 25 +++++------------- .../coresight/coresight-replicator-qcom.c | 19 +++----------- drivers/hwtracing/coresight/coresight-replicator.c | 30 +++++----------------- drivers/hwtracing/coresight/coresight-tmc.c | 28 +++++--------------- drivers/hwtracing/coresight/coresight-tpiu.c | 25 +++++------------- drivers/hwtracing/coresight/coresight.c | 3 --- drivers/hwtracing/coresight/of_coresight.c | 1 - 10 files changed, 49 insertions(+), 156 deletions(-)drivers/hwtracing/coresight/coresight-etb10.c +7
-19@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Embedded Trace Buffer driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h> @@ -489,15 +490,6 @@ err_misc_register:return ret; } -static int etb_remove (struct amba_device *adev) -{ -struct etb_drvdata *drvdata =amba_get_drvdata (adev); - -misc_deregister (&drvdata->miscdev); -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int etb_runtime_suspend (struct device *dev) {@@ -534,17 +526,13 @@ static struct amba_id etb_ids[] = {static struct amba_driver etb_driver = { .drv = { - .name ="coresight-etb10" , - .owner =THIS_MODULE , - .pm = &etb_dev_pm_ops, + .name ="coresight-etb10" , + .owner =THIS_MODULE , + .pm = &etb_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = etb_probe, - .remove = etb_remove, .id_table = etb_ids, }; - -module_amba_driver (etb_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Embedded Trace Buffer driver" ); +builtin_amba_driver (etb_driver);drivers/hwtracing/coresight/coresight-etm3x.c +8
-21@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Program Flow Trace driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -11,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h> @@ -1877,17 +1879,6 @@ err_arch_supported:return ret; } -static int etm_remove (struct amba_device *adev) -{ -struct etm_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -if (--etm_count ==0 ) -unregister_hotcpu_notifier (&etm_cpu_notifier); - -return 0 ; -} -#ifdef CONFIG_PM static int etm_runtime_suspend (struct device *dev) {@@ -1945,16 +1936,12 @@ static struct amba_id etm_ids[] = {static struct amba_driver etm_driver = { .drv = { - .name ="coresight-etm3x" , - .owner =THIS_MODULE , - .pm = &etm_dev_pm_ops, + .name ="coresight-etm3x" , + .owner =THIS_MODULE , + .pm = &etm_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = etm_probe, - .remove = etm_remove, .id_table = etm_ids, }; - -module_amba_driver (etm_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Program Flow Trace driver" ); +builtin_amba_driver (etm_driver);drivers/hwtracing/coresight/coresight-etm4x.c +3
-16@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/types.h> #include <linux/device.h> -#include <linux/module.h> #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h> @@ -2684,17 +2683,6 @@ err_coresight_register:return ret; } -static int etm4_remove (struct amba_device *adev) -{ -struct etmv4_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -if (--etm4_count ==0 ) -unregister_hotcpu_notifier (&etm4_cpu_notifier); - -return 0 ; -} -static struct amba_id etm4_ids[] = { {/* ETM 4.0 - Qualcomm */ .id =0x0003b95d ,@@ -2711,11 +2699,10 @@ static struct amba_id etm4_ids[] = {static struct amba_driver etm4x_driver = { .drv = { - .name ="coresight-etm4x" , + .name ="coresight-etm4x" , + .suppress_bind_attrs = true, }, .probe = etm4_probe, - .remove = etm4_remove, .id_table = etm4_ids, }; - -module_amba_driver (etm4x_driver); +builtin_amba_driver (etm4x_driver);drivers/hwtracing/coresight/coresight-funnel.c +7
-18@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Funnel driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h> @@ -226,14 +227,6 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static int funnel_remove (struct amba_device *adev) -{ -struct funnel_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int funnel_runtime_suspend (struct device *dev) {@@ -270,16 +263,12 @@ static struct amba_id funnel_ids[] = {static struct amba_driver funnel_driver = { .drv = { - .name ="coresight-funnel" , - .owner =THIS_MODULE , - .pm = &funnel_dev_pm_ops, + .name ="coresight-funnel" , + .owner =THIS_MODULE , + .pm = &funnel_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = funnel_probe, - .remove = funnel_remove, .id_table = funnel_ids, }; - -module_amba_driver (funnel_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Funnel driver" ); +builtin_amba_driver (funnel_driver);drivers/hwtracing/coresight/coresight-replicator-qcom.c +4
-15@@ -15,7 +15,6 @@#include <linux/clk.h> #include <linux/coresight.h> #include <linux/device.h> -#include <linux/module.h> #include <linux/err.h> #include <linux/init.h> #include <linux/io.h> @@ -156,15 +155,6 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static int replicator_remove (struct amba_device *adev) -{ -struct replicator_state *drvdata =amba_get_drvdata (adev); - -pm_runtime_disable (&adev->dev); -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int replicator_runtime_suspend (struct device *dev) {@@ -204,12 +194,11 @@ static struct amba_id replicator_ids[] = {static struct amba_driver replicator_driver = { .drv = { - .name ="coresight-replicator-qcom" , - .pm = &replicator_dev_pm_ops, + .name ="coresight-replicator-qcom" , + .pm = &replicator_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = replicator_probe, - .remove = replicator_remove, .id_table = replicator_ids, }; - -module_amba_driver (replicator_driver); +builtin_amba_driver (replicator_driver);drivers/hwtracing/coresight/coresight-replicator.c +7
-23@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Replicator driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -127,20 +128,6 @@ out_disable_pm:return ret; } -static int replicator_remove (struct platform_device *pdev) -{ -struct replicator_drvdata *drvdata =platform_get_drvdata (pdev); - -coresight_unregister (drvdata->csdev); -pm_runtime_get_sync (&pdev->dev); -if (!IS_ERR (drvdata->atclk)) -clk_disable_unprepare (drvdata->atclk); -pm_runtime_put_noidle (&pdev->dev); -pm_runtime_disable (&pdev->dev); - -return 0 ; -} -#ifdef CONFIG_PM static int replicator_runtime_suspend (struct device *dev) {@@ -175,15 +162,12 @@ static const struct of_device_id replicator_match[] = {static struct platform_driver replicator_driver = { .probe = replicator_probe, - .remove = replicator_remove, .driver = { - .name ="coresight-replicator" , - .of_match_table = replicator_match, - .pm = &replicator_dev_pm_ops, + .name ="coresight-replicator" , + .of_match_table = replicator_match, + .pm = &replicator_dev_pm_ops, + .suppress_bind_attrs = true, + }, }; -builtin_platform_driver (replicator_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Replicator driver" );drivers/hwtracing/coresight/coresight-tmc.c +6
-22@@ -1,5 +1,7 @@/* Copyright (c) 2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Trace Memory Controller driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h> @@ -770,19 +771,6 @@ err_devm_kzalloc:return ret; } -static int tmc_remove (struct amba_device *adev) -{ -struct tmc_drvdata *drvdata =amba_get_drvdata (adev); - -misc_deregister (&drvdata->miscdev); -coresight_unregister (drvdata->csdev); -if (drvdata->config_type ==TMC_CONFIG_TYPE_ETR ) -dma_free_coherent (drvdata->dev, drvdata->size, - &drvdata->paddr,GFP_KERNEL ); - -return 0 ; -} -static struct amba_id tmc_ids[] = { { .id =0x0003b961 ,@@ -793,15 +781,11 @@ static struct amba_id tmc_ids[] = {static struct amba_driver tmc_driver = { .drv = { - .name ="coresight-tmc" , - .owner =THIS_MODULE , + .name ="coresight-tmc" , + .owner =THIS_MODULE , + .suppress_bind_attrs = true, }, .probe = tmc_probe, - .remove = tmc_remove, .id_table = tmc_ids, }; - -module_amba_driver (tmc_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Trace Memory Controller driver" ); +builtin_amba_driver (tmc_driver);drivers/hwtracing/coresight/coresight-tpiu.c +7
-18@@ -1,5 +1,7 @@/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * +* Description: CoreSight Trace Port Interface Unit driver +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -11,7 +13,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/device.h> #include <linux/io.h> @@ -172,14 +173,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static int tpiu_remove (struct amba_device *adev) -{ -struct tpiu_drvdata *drvdata =amba_get_drvdata (adev); - -coresight_unregister (drvdata->csdev); -return 0 ; -} -#ifdef CONFIG_PM static int tpiu_runtime_suspend (struct device *dev) {@@ -220,16 +213,12 @@ static struct amba_id tpiu_ids[] = {static struct amba_driver tpiu_driver = { .drv = { - .name ="coresight-tpiu" , - .owner =THIS_MODULE , - .pm = &tpiu_dev_pm_ops, + .name ="coresight-tpiu" , + .owner =THIS_MODULE , + .pm = &tpiu_dev_pm_ops, + .suppress_bind_attrs = true, }, .probe = tpiu_probe, - .remove = tpiu_remove, .id_table = tpiu_ids, }; - -module_amba_driver (tpiu_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("CoreSight Trace Port Interface Unit driver" ); +builtin_amba_driver (tpiu_driver);drivers/hwtracing/coresight/coresight.c +0
-3@@ -11,7 +11,6 @@*/ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/device.h> @@ -721,5 +720,3 @@ void coresight_unregister(struct coresight_device *csdev)mutex_unlock (&coresight_mutex); }EXPORT_SYMBOL_GPL (coresight_unregister); - -MODULE_LICENSE ("GPL v2" );drivers/hwtracing/coresight/of_coresight.c +0
-2@@ -10,7 +10,6 @@* GNU General Public License for more details. */ -#include <linux/module.h> #include <linux/types.h> #include <linux/err.h> #include <linux/slab.h> --
Quoted 2 lines
2.6.1
I've tested this on my side and everything is in order.
PATCH 3/3 drivers/amba: make tegra-ahb.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/amba/Kconfig:config TEGRA_AHBdrivers/amba/Kconfig: bool "Enable AHB driver for NVIDIA Tegra SoCs"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.
--- drivers/amba/tegra-ahb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/amba/tegra-ahb.c +2 -7
@@ -22,7 +22,7 @@#include <linux/err.h> #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/of.h>
@@ -301,9 +301,4 @@ static struct platform_driver tegra_ahb_driver = { .pm = &tegra_ahb_pm, }, }; -module_platform_driver (tegra_ahb_driver); - -MODULE_AUTHOR ("Hiroshi DOYU <[email protected]>" ); -MODULE_DESCRIPTION ("Tegra AHB driver" ); -MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("platform:" DRV_NAME ); +builtin_platform_driver (tegra_ahb_driver);
Signature · 1 line
2.6.1