mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 11:30:53 +07:00
Replace module_platform_driver with builtin_platform driver in non modules.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVkO9lAAoJEOvOhAQsB9HWRV4P/jYrQm/S14ZfbwzqwV2w5xh+ E1SHk+kjcLyIvG6JXknp8mlNFGFhsIZNhTq8wvYBmFHlkop9jlMqT3IwaV7y9baV NmxltPHVIgFhnPMBF6+nvMJVFe0oBXh3adwc02h/LcXauEPK98Na/BtAfX5nxmoy DO/9R+R3SxqShSHvQqM6JNu3M/xAxU7RRSMsthF3nZJfZEm5i7Sl9w6Zcmu67gEn KbAPmthHSzDvJZGPt6xQiR2OPvhdA2Ddxjey0/cLyl/IVd2DdUTUUHDY0lUpPd3A Ba6C6OaWoHbCoAVzGvXEJLP1CfuF5upTmo53FZ2+1fERzX7Co4E2xInq6qkpWK5+ cLcqCZaxHXvmvmidrfTaJQ52dLseGAH5KsiDoR8m5RcsCMrK367V6ja5/A2UG+xW FVJzU7/1LRHzw17si/AcrD0Q3hFR0n6klEGS3E964fsyOuCYlSc77IspxZ7nF4QW cFKKweyAUdrmrlduS7rKxX4z/ne4ljbR1M82YxFVPWqg/n2cqQ4e9RQFeK8ogBe6 ASXu6pmz03X5xoD7xPQEsVzjDDGPzGFdD/601j9cRJ0+TR9udECP776gXt+5Ml0L jWlhVGbt7BN64UFZ/kInGo1h6cS+JjlrBfNq6eZVQP78bZ5UWdyiupGzcLcixefN bnkl2MHHY/d6yk2Rs7zh =WLBw -----END PGP SIGNATURE----- Merge tag 'module-builtin_driver-v4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux Pull module_platform_driver replacement from Paul Gortmaker: "Replace module_platform_driver with builtin_platform driver in non modules. We see an increasing number of non-modular drivers using modular_driver() type register functions. There are several downsides to letting this continue unchecked: - The code can appear modular to a reader of the code, and they won't know if the code really is modular without checking the Makefile and Kconfig to see if compilation is governed by a bool or tristate. - Coders of drivers may be tempted to code up an __exit function that is never used, just in order to satisfy the required three args of the modular registration function. - Non-modular code ends up including the <module.h> which increases CPP overhead that they don't need. - It hinders us from performing better separation of the module init code and the generic init code. So here we introduce similar macros for builtin drivers. Then we convert builtin drivers (controlled by a bool Kconfig) by making the following type of mapping: module_platform_driver() ---> builtin_platform_driver() module_platform_driver_probe() ---> builtin_platform_driver_probe(). The set of drivers that are converted here are just the ones that showed up as relying on an implicit include of <module.h> during a pending header cleanup. So we convert them here vs adding an include of <module.h> to non-modular code to avoid compile fails. Additonal conversions can be done asynchronously at any time. Once again, an unused module_exit function that is removed here appears in the diffstat as an outlier wrt all the other changes" * tag 'module-builtin_driver-v4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: drivers/clk: convert sunxi/clk-mod0.c to use builtin_platform_driver drivers/power: Convert non-modular syscon-reboot to use builtin_platform_driver drivers/soc: Convert non-modular soc-realview to use builtin_platform_driver drivers/soc: Convert non-modular tegra/pmc to use builtin_platform_driver drivers/cpufreq: Convert non-modular s5pv210-cpufreq.c to use builtin_platform_driver drivers/cpuidle: Convert non-modular drivers to use builtin_platform_driver drivers/platform: Convert non-modular pdev_bus to use builtin_platform_driver platform_device: better support builtin boilerplate avoidance
This commit is contained in:
commit
75462c8a87
@ -128,7 +128,7 @@ static struct platform_driver sun4i_a10_mod0_clk_driver = {
|
|||||||
},
|
},
|
||||||
.probe = sun4i_a10_mod0_clk_probe,
|
.probe = sun4i_a10_mod0_clk_probe,
|
||||||
};
|
};
|
||||||
module_platform_driver(sun4i_a10_mod0_clk_driver);
|
builtin_platform_driver(sun4i_a10_mod0_clk_driver);
|
||||||
|
|
||||||
static const struct factors_data sun9i_a80_mod0_data __initconst = {
|
static const struct factors_data sun9i_a80_mod0_data __initconst = {
|
||||||
.enable = 31,
|
.enable = 31,
|
||||||
|
@ -659,4 +659,4 @@ static struct platform_driver s5pv210_cpufreq_platdrv = {
|
|||||||
},
|
},
|
||||||
.probe = s5pv210_cpufreq_probe,
|
.probe = s5pv210_cpufreq_probe,
|
||||||
};
|
};
|
||||||
module_platform_driver(s5pv210_cpufreq_platdrv);
|
builtin_platform_driver(s5pv210_cpufreq_platdrv);
|
||||||
|
@ -62,5 +62,4 @@ static struct platform_driver at91_cpuidle_driver = {
|
|||||||
},
|
},
|
||||||
.probe = at91_cpuidle_probe,
|
.probe = at91_cpuidle_probe,
|
||||||
};
|
};
|
||||||
|
builtin_platform_driver(at91_cpuidle_driver);
|
||||||
module_platform_driver(at91_cpuidle_driver);
|
|
||||||
|
@ -75,5 +75,4 @@ static struct platform_driver calxeda_cpuidle_plat_driver = {
|
|||||||
},
|
},
|
||||||
.probe = calxeda_cpuidle_probe,
|
.probe = calxeda_cpuidle_probe,
|
||||||
};
|
};
|
||||||
|
builtin_platform_driver(calxeda_cpuidle_plat_driver);
|
||||||
module_platform_driver(calxeda_cpuidle_plat_driver);
|
|
||||||
|
@ -73,5 +73,4 @@ static struct platform_driver zynq_cpuidle_driver = {
|
|||||||
},
|
},
|
||||||
.probe = zynq_cpuidle_probe,
|
.probe = zynq_cpuidle_probe,
|
||||||
};
|
};
|
||||||
|
builtin_platform_driver(zynq_cpuidle_driver);
|
||||||
module_platform_driver(zynq_cpuidle_driver);
|
|
||||||
|
@ -220,20 +220,10 @@ static int goldfish_pdev_bus_probe(struct platform_device *pdev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int goldfish_pdev_bus_remove(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
iounmap(pdev_bus_base);
|
|
||||||
free_irq(pdev_bus_irq, pdev);
|
|
||||||
release_mem_region(pdev_bus_addr, pdev_bus_len);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct platform_driver goldfish_pdev_bus_driver = {
|
static struct platform_driver goldfish_pdev_bus_driver = {
|
||||||
.probe = goldfish_pdev_bus_probe,
|
.probe = goldfish_pdev_bus_probe,
|
||||||
.remove = goldfish_pdev_bus_remove,
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "goldfish_pdev_bus"
|
.name = "goldfish_pdev_bus"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
builtin_platform_driver(goldfish_pdev_bus_driver);
|
||||||
module_platform_driver(goldfish_pdev_bus_driver);
|
|
||||||
|
@ -88,4 +88,4 @@ static struct platform_driver syscon_reboot_driver = {
|
|||||||
.of_match_table = syscon_reboot_of_match,
|
.of_match_table = syscon_reboot_of_match,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
module_platform_driver(syscon_reboot_driver);
|
builtin_platform_driver(syscon_reboot_driver);
|
||||||
|
@ -1021,7 +1021,7 @@ static struct platform_driver tegra_pmc_driver = {
|
|||||||
},
|
},
|
||||||
.probe = tegra_pmc_probe,
|
.probe = tegra_pmc_probe,
|
||||||
};
|
};
|
||||||
module_platform_driver(tegra_pmc_driver);
|
builtin_platform_driver(tegra_pmc_driver);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Early initialization to allow access to registers in the very early boot
|
* Early initialization to allow access to registers in the very early boot
|
||||||
|
@ -142,4 +142,4 @@ static struct platform_driver realview_soc_driver = {
|
|||||||
.of_match_table = realview_soc_of_match,
|
.of_match_table = realview_soc_of_match,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
module_platform_driver(realview_soc_driver);
|
builtin_platform_driver(realview_soc_driver);
|
||||||
|
@ -1300,4 +1300,26 @@ static void __exit __driver##_exit(void) \
|
|||||||
} \
|
} \
|
||||||
module_exit(__driver##_exit);
|
module_exit(__driver##_exit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* builtin_driver() - Helper macro for drivers that don't do anything
|
||||||
|
* special in init and have no exit. This eliminates some boilerplate.
|
||||||
|
* Each driver may only use this macro once, and calling it replaces
|
||||||
|
* device_initcall (or in some cases, the legacy __initcall). This is
|
||||||
|
* meant to be a direct parallel of module_driver() above but without
|
||||||
|
* the __exit stuff that is not used for builtin cases.
|
||||||
|
*
|
||||||
|
* @__driver: driver name
|
||||||
|
* @__register: register function for this driver type
|
||||||
|
* @...: Additional arguments to be passed to __register
|
||||||
|
*
|
||||||
|
* Use this macro to construct bus specific macros for registering
|
||||||
|
* drivers, and do not use it on its own.
|
||||||
|
*/
|
||||||
|
#define builtin_driver(__driver, __register, ...) \
|
||||||
|
static int __init __driver##_init(void) \
|
||||||
|
{ \
|
||||||
|
return __register(&(__driver) , ##__VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
device_initcall(__driver##_init);
|
||||||
|
|
||||||
#endif /* _DEVICE_H_ */
|
#endif /* _DEVICE_H_ */
|
||||||
|
@ -222,6 +222,15 @@ static inline void platform_set_drvdata(struct platform_device *pdev,
|
|||||||
module_driver(__platform_driver, platform_driver_register, \
|
module_driver(__platform_driver, platform_driver_register, \
|
||||||
platform_driver_unregister)
|
platform_driver_unregister)
|
||||||
|
|
||||||
|
/* builtin_platform_driver() - Helper macro for builtin drivers that
|
||||||
|
* don't do anything special in driver init. This eliminates some
|
||||||
|
* boilerplate. Each driver may only use this macro once, and
|
||||||
|
* calling it replaces device_initcall(). Note this is meant to be
|
||||||
|
* a parallel of module_platform_driver() above, but w/o _exit stuff.
|
||||||
|
*/
|
||||||
|
#define builtin_platform_driver(__platform_driver) \
|
||||||
|
builtin_driver(__platform_driver, platform_driver_register)
|
||||||
|
|
||||||
/* module_platform_driver_probe() - Helper macro for drivers that don't do
|
/* module_platform_driver_probe() - Helper macro for drivers that don't do
|
||||||
* anything special in module init/exit. This eliminates a lot of
|
* anything special in module init/exit. This eliminates a lot of
|
||||||
* boilerplate. Each module may only use this macro once, and
|
* boilerplate. Each module may only use this macro once, and
|
||||||
@ -240,6 +249,20 @@ static void __exit __platform_driver##_exit(void) \
|
|||||||
} \
|
} \
|
||||||
module_exit(__platform_driver##_exit);
|
module_exit(__platform_driver##_exit);
|
||||||
|
|
||||||
|
/* builtin_platform_driver_probe() - Helper macro for drivers that don't do
|
||||||
|
* anything special in device init. This eliminates some boilerplate. Each
|
||||||
|
* driver may only use this macro once, and using it replaces device_initcall.
|
||||||
|
* This is meant to be a parallel of module_platform_driver_probe above, but
|
||||||
|
* without the __exit parts.
|
||||||
|
*/
|
||||||
|
#define builtin_platform_driver_probe(__platform_driver, __platform_probe) \
|
||||||
|
static int __init __platform_driver##_init(void) \
|
||||||
|
{ \
|
||||||
|
return platform_driver_probe(&(__platform_driver), \
|
||||||
|
__platform_probe); \
|
||||||
|
} \
|
||||||
|
device_initcall(__platform_driver##_init); \
|
||||||
|
|
||||||
#define platform_create_bundle(driver, probe, res, n_res, data, size) \
|
#define platform_create_bundle(driver, probe, res, n_res, data, size) \
|
||||||
__platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE)
|
__platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE)
|
||||||
extern struct platform_device *__platform_create_bundle(
|
extern struct platform_device *__platform_create_bundle(
|
||||||
|
Loading…
Reference in New Issue
Block a user