Reset controller updates for v5.14, part2

This tag contains a few small fixes, allows to build the Berlin reset
 driver as a module, and adds stubs to the reset controller API to allow
 compile-testing drivers outside of drivers/reset without enabling the
 reset framework.
 -----BEGIN PGP SIGNATURE-----
 
 iI0EABYIADUWIQRRO6F6WdpH1R0vGibVhaclGDdiwAUCYMtFIxcccC56YWJlbEBw
 ZW5ndXRyb25peC5kZQAKCRDVhaclGDdiwEIsAP4m0pQOBknwAy8IpNXhXzqcXd3d
 fcFn36QGzMxA3CEI7QD+IQMxfKvCOZNUVKaDQa3azX6gvbooqsr8xl+5MYsHSQU=
 =/q1G
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJDBAABCgAtFiEElf+HevZ4QCAJmMQ+jBrnPN6EHHcFAmDLqRoPHG9sb2ZAbGl4
 b20ubmV0AAoJEIwa5zzehBx3xZcP/33VY9ORMKiiNIwKGz3DKHZY8M3139xyYA/e
 QXazt/Uo1OahmGpGqM8hnoIciP7CbasY8HyED4mhdIoulRAmZ9i7wILl2punXLP+
 PxlTHnYNStPDO36mt9GleNu7/HpOjJNvoEklpeslNMrDOImQ4mbyrSmrY4Yp6gop
 dSDMwXPtSTkFfxnNYUPYpf+TYXv1II9SaDYhR8rixhC6LXGv5Xa5QMNxRUwds1id
 xXgNBLb06lPvgYQVu7cyrroa5BbAyeVBehJaWXbymvY7gETXrOy6mH3Koo3enHA2
 XyWsWo/AsY1ZkzT3zldS6YGGPW6v2Rp8+XpQ/qFD9bYf6rFzMHuebF63RHgD/ljM
 HiVRsIEnAJO1Agq/0aMgcPv5TT4ehIblU1NZFUZ/5aeo7mGrHArNjm6nFRh0ztpI
 f5LbavbfDAzSF/1q4sDvpauD4y9K/WgTXGx99QRRQN6oayUsY5BbsIIQ9K0VDPKq
 8a+SnZuxPWwleZ959OQDsaBM8mNEK/2aLjXI63YJyH8HB8Xs8Orx5iYRcYDz5qlb
 oH6FfwpckLusrvFdp/sU1KMmtPtKxmUFPXZcrE3OCeoL3UpgxlSgGFUHBQHqZppm
 rKtpJZbxp81MEls9U5yP1PhNtvt8xl0BuecTMWVCf6ccIYH/O67+q45usM6A8hAc
 BEzPhhZ9
 =AwL+
 -----END PGP SIGNATURE-----

Merge tag 'reset-for-v5.14-2' of git://git.pengutronix.de/pza/linux into arm/drivers

Reset controller updates for v5.14, part2

This tag contains a few small fixes, allows to build the Berlin reset
driver as a module, and adds stubs to the reset controller API to allow
compile-testing drivers outside of drivers/reset without enabling the
reset framework.

* tag 'reset-for-v5.14-2' of git://git.pengutronix.de/pza/linux:
  reset: Add compile-test stubs
  reset: berlin: support module build
  reset: bail if try_module_get() fails
  reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io()
  reset: lantiq: use devm_reset_controller_register()
  reset: hi6220: Use the correct HiSilicon copyright

Link: https://lore.kernel.org/r/14d33ac19b2a107e97ce1ab264987b707baa9ba7.camel@pengutronix.de
Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
Olof Johansson 2021-06-17 12:54:28 -07:00
commit 25da503ecc
7 changed files with 41 additions and 9 deletions

View File

@ -43,8 +43,9 @@ config RESET_BCM6345
This enables the reset controller driver for BCM6345 SoCs.
config RESET_BERLIN
bool "Berlin Reset Driver" if COMPILE_TEST
default ARCH_BERLIN
tristate "Berlin Reset Driver"
depends on ARCH_BERLIN || COMPILE_TEST
default m if ARCH_BERLIN
help
This enables the reset controller driver for Marvell Berlin SoCs.

View File

@ -774,7 +774,10 @@ __reset_control_get_internal(struct reset_controller_dev *rcdev,
if (!rstc)
return ERR_PTR(-ENOMEM);
try_module_get(rcdev->owner);
if (!try_module_get(rcdev->owner)) {
kfree(rstc);
return ERR_PTR(-ENODEV);
}
rstc->rcdev = rcdev;
list_add(&rstc->list, &rcdev->reset_control_head);

View File

@ -3,7 +3,7 @@
* Hisilicon Hi6220 reset controller driver
*
* Copyright (c) 2016 Linaro Limited.
* Copyright (c) 2015-2016 Hisilicon Limited.
* Copyright (c) 2015-2016 HiSilicon Limited.
*
* Author: Feng Chen <puck.chen@hisilicon.com>
*/

View File

@ -14,7 +14,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
@ -93,6 +93,7 @@ static const struct of_device_id berlin_reset_dt_match[] = {
{ .compatible = "marvell,berlin2-reset" },
{ },
};
MODULE_DEVICE_TABLE(of, berlin_reset_dt_match);
static struct platform_driver berlin_reset_driver = {
.probe = berlin2_reset_probe,
@ -101,4 +102,9 @@ static struct platform_driver berlin_reset_driver = {
.of_match_table = berlin_reset_dt_match,
},
};
builtin_platform_driver(berlin_reset_driver);
module_platform_driver(berlin_reset_driver);
MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>");
MODULE_DESCRIPTION("Synaptics Berlin reset controller");
MODULE_LICENSE("GPL");

View File

@ -186,7 +186,7 @@ static int lantiq_rcu_reset_probe(struct platform_device *pdev)
priv->rcdev.of_xlate = lantiq_rcu_reset_xlate;
priv->rcdev.of_reset_n_cells = 2;
return reset_controller_register(&priv->rcdev);
return devm_reset_controller_register(&pdev->dev, &priv->rcdev);
}
static const struct of_device_id lantiq_rcu_reset_dt_ids[] = {

View File

@ -82,9 +82,9 @@ static int mchp_sparx5_map_io(struct platform_device *pdev, int index,
void __iomem *mem;
mem = devm_platform_get_and_ioremap_resource(pdev, index, &res);
if (!mem) {
if (IS_ERR(mem)) {
dev_err(&pdev->dev, "Could not map resource %d\n", index);
return -ENXIO;
return PTR_ERR(mem);
}
sparx5_reset_regmap_config.name = res->name;
map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config);

View File

@ -79,6 +79,7 @@ struct reset_controller_dev {
unsigned int nr_resets;
};
#if IS_ENABLED(CONFIG_RESET_CONTROLLER)
int reset_controller_register(struct reset_controller_dev *rcdev);
void reset_controller_unregister(struct reset_controller_dev *rcdev);
@ -88,5 +89,26 @@ int devm_reset_controller_register(struct device *dev,
void reset_controller_add_lookup(struct reset_control_lookup *lookup,
unsigned int num_entries);
#else
static inline int reset_controller_register(struct reset_controller_dev *rcdev)
{
return 0;
}
static inline void reset_controller_unregister(struct reset_controller_dev *rcdev)
{
}
static inline int devm_reset_controller_register(struct device *dev,
struct reset_controller_dev *rcdev)
{
return 0;
}
static inline void reset_controller_add_lookup(struct reset_control_lookup *lookup,
unsigned int num_entries)
{
}
#endif
#endif