Use device life-cycle managed register function to simplify probe.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/firmware/ti_sci.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 8b9a2556de16d..16501aa0b84cf 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -103,7 +103,6 @@ struct ti_sci_desc {
*/
struct ti_sci_info {
struct device *dev;
- struct notifier_block nb;
const struct ti_sci_desc *desc;
struct dentry *d;
void __iomem *debug_region;
@@ -122,7 +121,6 @@ struct ti_sci_info {
#define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
#define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
-#define reboot_to_ti_sci_info(n) container_of(n, struct ti_sci_info, nb)
#ifdef CONFIG_DEBUG_FS
@@ -3254,10 +3252,9 @@ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
}
EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
-static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
- void *cmd)
+static int tisci_reboot_handler(struct sys_off_data *data)
{
- struct ti_sci_info *info = reboot_to_ti_sci_info(nb);
+ struct ti_sci_info *info = data->cb_data;
const struct ti_sci_handle *handle = &info->handle;
ti_sci_cmd_core_reboot(handle);
@@ -3400,10 +3397,9 @@ static int ti_sci_probe(struct platform_device *pdev)
ti_sci_setup_ops(info);
if (reboot) {
- info->nb.notifier_call = tisci_reboot_handler;
- info->nb.priority = 128;
-
- ret = register_restart_handler(&info->nb);
+ ret = devm_register_restart_handler(dev,
+ tisci_reboot_handler,
+ info);
if (ret) {
dev_err(dev, "reboot registration fail(%d)\n", ret);
goto out;
--
2.39.2
Hi Andrew,
kernel test robot noticed the following build warnings:
[auto build test WARNING on lee-leds/for-leds-next]
[also build test WARNING on linus/master v6.8-rc1 next-20240125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andrew-Davis/kernel-reboot-Deprecate-register_restart_handler/20240124-005424
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
patch link: https://lore.kernel.org/r/20240123164443.394642-5-afd%40ti.com
patch subject: [PATCH 4/4] firmware: ti_sci: Use devm_register_restart_handler()
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240129/202401291053.Bc9G6QTc-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240129/202401291053.Bc9G6QTc-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401291053.Bc9G6QTc-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/firmware/ti_sci.c:120: warning: Excess struct member 'nb' description in 'ti_sci_info'
vim +120 drivers/firmware/ti_sci.c
aa276781a64a5f Nishanth Menon 2016-10-18 85
aa276781a64a5f Nishanth Menon 2016-10-18 86 /**
aa276781a64a5f Nishanth Menon 2016-10-18 87 * struct ti_sci_info - Structure representing a TI SCI instance
aa276781a64a5f Nishanth Menon 2016-10-18 88 * @dev: Device pointer
aa276781a64a5f Nishanth Menon 2016-10-18 89 * @desc: SoC description for this instance
912cffb4ed8612 Nishanth Menon 2016-10-18 90 * @nb: Reboot Notifier block
aa276781a64a5f Nishanth Menon 2016-10-18 91 * @d: Debugfs file entry
aa276781a64a5f Nishanth Menon 2016-10-18 92 * @debug_region: Memory region where the debug message are available
aa276781a64a5f Nishanth Menon 2016-10-18 93 * @debug_region_size: Debug region size
aa276781a64a5f Nishanth Menon 2016-10-18 94 * @debug_buffer: Buffer allocated to copy debug messages.
aa276781a64a5f Nishanth Menon 2016-10-18 95 * @handle: Instance of TI SCI handle to send to clients.
aa276781a64a5f Nishanth Menon 2016-10-18 96 * @cl: Mailbox Client
aa276781a64a5f Nishanth Menon 2016-10-18 97 * @chan_tx: Transmit mailbox channel
aa276781a64a5f Nishanth Menon 2016-10-18 98 * @chan_rx: Receive mailbox channel
aa276781a64a5f Nishanth Menon 2016-10-18 99 * @minfo: Message info
aa276781a64a5f Nishanth Menon 2016-10-18 100 * @node: list head
e69a35531589a2 Nishanth Menon 2018-08-28 101 * @host_id: Host ID
aa276781a64a5f Nishanth Menon 2016-10-18 102 * @users: Number of users of this instance
aa276781a64a5f Nishanth Menon 2016-10-18 103 */
aa276781a64a5f Nishanth Menon 2016-10-18 104 struct ti_sci_info {
aa276781a64a5f Nishanth Menon 2016-10-18 105 struct device *dev;
aa276781a64a5f Nishanth Menon 2016-10-18 106 const struct ti_sci_desc *desc;
aa276781a64a5f Nishanth Menon 2016-10-18 107 struct dentry *d;
aa276781a64a5f Nishanth Menon 2016-10-18 108 void __iomem *debug_region;
aa276781a64a5f Nishanth Menon 2016-10-18 109 char *debug_buffer;
aa276781a64a5f Nishanth Menon 2016-10-18 110 size_t debug_region_size;
aa276781a64a5f Nishanth Menon 2016-10-18 111 struct ti_sci_handle handle;
aa276781a64a5f Nishanth Menon 2016-10-18 112 struct mbox_client cl;
aa276781a64a5f Nishanth Menon 2016-10-18 113 struct mbox_chan *chan_tx;
aa276781a64a5f Nishanth Menon 2016-10-18 114 struct mbox_chan *chan_rx;
aa276781a64a5f Nishanth Menon 2016-10-18 115 struct ti_sci_xfers_info minfo;
aa276781a64a5f Nishanth Menon 2016-10-18 116 struct list_head node;
e69a35531589a2 Nishanth Menon 2018-08-28 117 u8 host_id;
aa276781a64a5f Nishanth Menon 2016-10-18 118 /* protected by ti_sci_list_mutex */
aa276781a64a5f Nishanth Menon 2016-10-18 119 int users;
aa276781a64a5f Nishanth Menon 2016-10-18 @120 };
aa276781a64a5f Nishanth Menon 2016-10-18 121
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Tue, Jan 23, 2024 at 10:44:43AM -0600, Andrew Davis wrote:
> Use device life-cycle managed register function to simplify probe.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Gabriel Somlo <gsomlo@gmail.com>
> ---
> drivers/firmware/ti_sci.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 8b9a2556de16d..16501aa0b84cf 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -103,7 +103,6 @@ struct ti_sci_desc {
> */
> struct ti_sci_info {
> struct device *dev;
> - struct notifier_block nb;
> const struct ti_sci_desc *desc;
> struct dentry *d;
> void __iomem *debug_region;
> @@ -122,7 +121,6 @@ struct ti_sci_info {
>
> #define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
> #define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
> -#define reboot_to_ti_sci_info(n) container_of(n, struct ti_sci_info, nb)
>
> #ifdef CONFIG_DEBUG_FS
>
> @@ -3254,10 +3252,9 @@ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
> }
> EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
>
> -static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
> - void *cmd)
> +static int tisci_reboot_handler(struct sys_off_data *data)
> {
> - struct ti_sci_info *info = reboot_to_ti_sci_info(nb);
> + struct ti_sci_info *info = data->cb_data;
> const struct ti_sci_handle *handle = &info->handle;
>
> ti_sci_cmd_core_reboot(handle);
> @@ -3400,10 +3397,9 @@ static int ti_sci_probe(struct platform_device *pdev)
> ti_sci_setup_ops(info);
>
> if (reboot) {
> - info->nb.notifier_call = tisci_reboot_handler;
> - info->nb.priority = 128;
> -
> - ret = register_restart_handler(&info->nb);
> + ret = devm_register_restart_handler(dev,
> + tisci_reboot_handler,
> + info);
> if (ret) {
> dev_err(dev, "reboot registration fail(%d)\n", ret);
> goto out;
> --
> 2.39.2
>
© 2016 - 2025 Red Hat, Inc.