Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+41 -9
+3 -2
drivers/reset/Kconfig
··· 43 43 This enables the reset controller driver for BCM6345 SoCs. 44 44 45 45 config RESET_BERLIN 46 - bool "Berlin Reset Driver" if COMPILE_TEST 47 - default ARCH_BERLIN 46 + tristate "Berlin Reset Driver" 47 + depends on ARCH_BERLIN || COMPILE_TEST 48 + default m if ARCH_BERLIN 48 49 help 49 50 This enables the reset controller driver for Marvell Berlin SoCs. 50 51
+4 -1
drivers/reset/core.c
··· 774 774 if (!rstc) 775 775 return ERR_PTR(-ENOMEM); 776 776 777 - try_module_get(rcdev->owner); 777 + if (!try_module_get(rcdev->owner)) { 778 + kfree(rstc); 779 + return ERR_PTR(-ENODEV); 780 + } 778 781 779 782 rstc->rcdev = rcdev; 780 783 list_add(&rstc->list, &rcdev->reset_control_head);
+1 -1
drivers/reset/hisilicon/hi6220_reset.c
··· 3 3 * Hisilicon Hi6220 reset controller driver 4 4 * 5 5 * Copyright (c) 2016 Linaro Limited. 6 - * Copyright (c) 2015-2016 Hisilicon Limited. 6 + * Copyright (c) 2015-2016 HiSilicon Limited. 7 7 * 8 8 * Author: Feng Chen <puck.chen@hisilicon.com> 9 9 */
+8 -2
drivers/reset/reset-berlin.c
··· 14 14 #include <linux/delay.h> 15 15 #include <linux/io.h> 16 16 #include <linux/mfd/syscon.h> 17 - #include <linux/init.h> 17 + #include <linux/module.h> 18 18 #include <linux/of.h> 19 19 #include <linux/of_address.h> 20 20 #include <linux/platform_device.h> ··· 93 93 { .compatible = "marvell,berlin2-reset" }, 94 94 { }, 95 95 }; 96 + MODULE_DEVICE_TABLE(of, berlin_reset_dt_match); 96 97 97 98 static struct platform_driver berlin_reset_driver = { 98 99 .probe = berlin2_reset_probe, ··· 102 101 .of_match_table = berlin_reset_dt_match, 103 102 }, 104 103 }; 105 - builtin_platform_driver(berlin_reset_driver); 104 + module_platform_driver(berlin_reset_driver); 105 + 106 + MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>"); 107 + MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>"); 108 + MODULE_DESCRIPTION("Synaptics Berlin reset controller"); 109 + MODULE_LICENSE("GPL");
+1 -1
drivers/reset/reset-lantiq.c
··· 186 186 priv->rcdev.of_xlate = lantiq_rcu_reset_xlate; 187 187 priv->rcdev.of_reset_n_cells = 2; 188 188 189 - return reset_controller_register(&priv->rcdev); 189 + return devm_reset_controller_register(&pdev->dev, &priv->rcdev); 190 190 } 191 191 192 192 static const struct of_device_id lantiq_rcu_reset_dt_ids[] = {
+2 -2
drivers/reset/reset-microchip-sparx5.c
··· 82 82 void __iomem *mem; 83 83 84 84 mem = devm_platform_get_and_ioremap_resource(pdev, index, &res); 85 - if (!mem) { 85 + if (IS_ERR(mem)) { 86 86 dev_err(&pdev->dev, "Could not map resource %d\n", index); 87 - return -ENXIO; 87 + return PTR_ERR(mem); 88 88 } 89 89 sparx5_reset_regmap_config.name = res->name; 90 90 map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config);
+22
include/linux/reset-controller.h
··· 79 79 unsigned int nr_resets; 80 80 }; 81 81 82 + #if IS_ENABLED(CONFIG_RESET_CONTROLLER) 82 83 int reset_controller_register(struct reset_controller_dev *rcdev); 83 84 void reset_controller_unregister(struct reset_controller_dev *rcdev); 84 85 ··· 89 88 90 89 void reset_controller_add_lookup(struct reset_control_lookup *lookup, 91 90 unsigned int num_entries); 91 + #else 92 + static inline int reset_controller_register(struct reset_controller_dev *rcdev) 93 + { 94 + return 0; 95 + } 96 + 97 + static inline void reset_controller_unregister(struct reset_controller_dev *rcdev) 98 + { 99 + } 100 + 101 + static inline int devm_reset_controller_register(struct device *dev, 102 + struct reset_controller_dev *rcdev) 103 + { 104 + return 0; 105 + } 106 + 107 + static inline void reset_controller_add_lookup(struct reset_control_lookup *lookup, 108 + unsigned int num_entries) 109 + { 110 + } 111 + #endif 92 112 93 113 #endif