Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mailbox: sun6i: modernize probe and convert to fully managed
@ 2026-07-27 19:42 Rosen Penev
  2026-07-28 15:56 ` Chen-Yu Tsai
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rosen Penev @ 2026-07-27 19:42 UTC (permalink / raw)
  To: linux-sunxi
  Cc: Jassi Brar, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	open list:MAILBOX API,
	moderated list:ARM/Allwinner sunXi SoC support

Replace irq_of_parse_and_map() with platform_get_irq() and move both
IRQ and MMIO resource acquisition to the top of probe, before any
allocations, for early error exit.

Switch from devm_clk_get() + clk_prepare_enable() to
devm_clk_get_enabled(), which combines both operations and registers
devres callbacks for automatic disable/unprepare on unbind. This
eliminates the manual err_disable_unprepare error path and the
remove callback entirely.

Use devm_mbox_controller_register() for devres-managed controller
registration, and drop the remove callback and platform_set_drvdata()
which are no longer needed.

Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/mailbox/sun6i-msgbox.c | 62 ++++++++++------------------------
 1 file changed, 18 insertions(+), 44 deletions(-)

diff --git a/drivers/mailbox/sun6i-msgbox.c b/drivers/mailbox/sun6i-msgbox.c
index 6ba6920f4645..28d8636afad2 100644
--- a/drivers/mailbox/sun6i-msgbox.c
+++ b/drivers/mailbox/sun6i-msgbox.c
@@ -198,7 +198,17 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
 	struct mbox_chan *chans;
 	struct reset_control *reset;
 	struct sun6i_msgbox *mbox;
+	void __iomem *regs;
 	int i, ret;
+	int irq;
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
+	regs = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
 	mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL);
 	if (!mbox)
@@ -211,24 +221,18 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
 	for (i = 0; i < NUM_CHANS; ++i)
 		chans[i].con_priv = mbox;
 
-	mbox->clk = devm_clk_get(dev, NULL);
+	mbox->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(mbox->clk)) {
 		ret = PTR_ERR(mbox->clk);
 		dev_err(dev, "Failed to get clock: %d\n", ret);
 		return ret;
 	}
 
-	ret = clk_prepare_enable(mbox->clk);
-	if (ret) {
-		dev_err(dev, "Failed to enable clock: %d\n", ret);
-		return ret;
-	}
-
 	reset = devm_reset_control_get_exclusive(dev, NULL);
 	if (IS_ERR(reset)) {
 		ret = PTR_ERR(reset);
 		dev_err(dev, "Failed to get reset control: %d\n", ret);
-		goto err_disable_unprepare;
+		return ret;
 	}
 
 	/*
@@ -242,25 +246,17 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
 	ret = reset_control_deassert(reset);
 	if (ret) {
 		dev_err(dev, "Failed to deassert reset: %d\n", ret);
-		goto err_disable_unprepare;
+		return ret;
 	}
 
-	mbox->regs = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(mbox->regs)) {
-		ret = PTR_ERR(mbox->regs);
-		dev_err(dev, "Failed to map MMIO resource: %d\n", ret);
-		goto err_disable_unprepare;
-	}
+	mbox->regs = regs;
 
 	/* Disable all IRQs for this end of the msgbox. */
 	writel(0, mbox->regs + LOCAL_IRQ_EN_REG);
 
-	ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
-			       sun6i_msgbox_irq, 0, dev_name(dev), mbox);
-	if (ret) {
-		dev_err(dev, "Failed to register IRQ handler: %d\n", ret);
-		goto err_disable_unprepare;
-	}
+	ret = devm_request_irq(dev, irq, sun6i_msgbox_irq, 0, dev_name(dev), mbox);
+	if (ret)
+		return ret;
 
 	mbox->controller.dev           = dev;
 	mbox->controller.ops           = &sun6i_msgbox_chan_ops;
@@ -271,29 +267,8 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
 	mbox->controller.txpoll_period = 5;
 
 	spin_lock_init(&mbox->lock);
-	platform_set_drvdata(pdev, mbox);
-
-	ret = mbox_controller_register(&mbox->controller);
-	if (ret) {
-		dev_err(dev, "Failed to register controller: %d\n", ret);
-		goto err_disable_unprepare;
-	}
-
-	return 0;
-
-err_disable_unprepare:
-	clk_disable_unprepare(mbox->clk);
-
-	return ret;
-}
-
-static void sun6i_msgbox_remove(struct platform_device *pdev)
-{
-	struct sun6i_msgbox *mbox = platform_get_drvdata(pdev);
 
-	mbox_controller_unregister(&mbox->controller);
-	/* See the comment in sun6i_msgbox_probe about the reset line. */
-	clk_disable_unprepare(mbox->clk);
+	return devm_mbox_controller_register(&mbox->controller);
 }
 
 static const struct of_device_id sun6i_msgbox_of_match[] = {
@@ -308,7 +283,6 @@ static struct platform_driver sun6i_msgbox_driver = {
 		.of_match_table = sun6i_msgbox_of_match,
 	},
 	.probe = sun6i_msgbox_probe,
-	.remove = sun6i_msgbox_remove,
 };
 module_platform_driver(sun6i_msgbox_driver);
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed
  2026-07-27 19:42 [PATCH] mailbox: sun6i: modernize probe and convert to fully managed Rosen Penev
@ 2026-07-28 15:56 ` Chen-Yu Tsai
  2026-08-07  4:41 ` kernel test robot
  2026-08-07 19:44 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: Chen-Yu Tsai @ 2026-07-28 15:56 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-sunxi, Jassi Brar, Jernej Skrabec, Samuel Holland,
	open list:MAILBOX API,
	moderated list:ARM/Allwinner sunXi SoC support

On Tue, Jul 28, 2026 at 3:42 AM Rosen Penev <rosenp@gmail.com> wrote:
>
> Replace irq_of_parse_and_map() with platform_get_irq() and move both
> IRQ and MMIO resource acquisition to the top of probe, before any
> allocations, for early error exit.

There's no real reason for the code movement. It's going to fail once
or maybe twice at the most. And the ones you moved are the least likely
to fail.

Now I could see replacing irq_of_parse_and_map() with the more standard
platform_get_irq(), but you haven't given a reasonable reason. And it
should be a separate patch since it has nothing to do with streamlining
the error handling and dropping the remove function.

> Switch from devm_clk_get() + clk_prepare_enable() to
> devm_clk_get_enabled(), which combines both operations and registers
> devres callbacks for automatic disable/unprepare on unbind. This
> eliminates the manual err_disable_unprepare error path and the
> remove callback entirely.
>
> Use devm_mbox_controller_register() for devres-managed controller
> registration, and drop the remove callback and platform_set_drvdata()
> which are no longer needed.

These two are what are important.

> Assisted-by: Opencode:Big-Pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/mailbox/sun6i-msgbox.c | 62 ++++++++++------------------------
>  1 file changed, 18 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/mailbox/sun6i-msgbox.c b/drivers/mailbox/sun6i-msgbox.c
> index 6ba6920f4645..28d8636afad2 100644
> --- a/drivers/mailbox/sun6i-msgbox.c
> +++ b/drivers/mailbox/sun6i-msgbox.c
> @@ -198,7 +198,17 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
>         struct mbox_chan *chans;
>         struct reset_control *reset;
>         struct sun6i_msgbox *mbox;
> +       void __iomem *regs;
>         int i, ret;
> +       int irq;
> +
> +       irq = platform_get_irq(pdev, 0);
> +       if (irq < 0)
> +               return irq;
> +
> +       regs = devm_platform_ioremap_resource(pdev, 0);
> +       if (IS_ERR(regs))
> +               return PTR_ERR(regs);
>
>         mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL);
>         if (!mbox)
> @@ -211,24 +221,18 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
>         for (i = 0; i < NUM_CHANS; ++i)
>                 chans[i].con_priv = mbox;
>
> -       mbox->clk = devm_clk_get(dev, NULL);
> +       mbox->clk = devm_clk_get_enabled(dev, NULL);
>         if (IS_ERR(mbox->clk)) {
>                 ret = PTR_ERR(mbox->clk);
>                 dev_err(dev, "Failed to get clock: %d\n", ret);
>                 return ret;
>         }
>
> -       ret = clk_prepare_enable(mbox->clk);
> -       if (ret) {
> -               dev_err(dev, "Failed to enable clock: %d\n", ret);
> -               return ret;
> -       }
> -
>         reset = devm_reset_control_get_exclusive(dev, NULL);
>         if (IS_ERR(reset)) {
>                 ret = PTR_ERR(reset);
>                 dev_err(dev, "Failed to get reset control: %d\n", ret);
> -               goto err_disable_unprepare;
> +               return ret;
>         }
>
>         /*
> @@ -242,25 +246,17 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
>         ret = reset_control_deassert(reset);
>         if (ret) {
>                 dev_err(dev, "Failed to deassert reset: %d\n", ret);
> -               goto err_disable_unprepare;
> +               return ret;
>         }
>
> -       mbox->regs = devm_platform_ioremap_resource(pdev, 0);
> -       if (IS_ERR(mbox->regs)) {
> -               ret = PTR_ERR(mbox->regs);
> -               dev_err(dev, "Failed to map MMIO resource: %d\n", ret);
> -               goto err_disable_unprepare;
> -       }
> +       mbox->regs = regs;
>
>         /* Disable all IRQs for this end of the msgbox. */
>         writel(0, mbox->regs + LOCAL_IRQ_EN_REG);
>
> -       ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
> -                              sun6i_msgbox_irq, 0, dev_name(dev), mbox);
> -       if (ret) {
> -               dev_err(dev, "Failed to register IRQ handler: %d\n", ret);
> -               goto err_disable_unprepare;
> -       }
> +       ret = devm_request_irq(dev, irq, sun6i_msgbox_irq, 0, dev_name(dev), mbox);
> +       if (ret)
> +               return ret;
>
>         mbox->controller.dev           = dev;
>         mbox->controller.ops           = &sun6i_msgbox_chan_ops;
> @@ -271,29 +267,8 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
>         mbox->controller.txpoll_period = 5;
>
>         spin_lock_init(&mbox->lock);
> -       platform_set_drvdata(pdev, mbox);
> -
> -       ret = mbox_controller_register(&mbox->controller);
> -       if (ret) {
> -               dev_err(dev, "Failed to register controller: %d\n", ret);
> -               goto err_disable_unprepare;
> -       }
> -
> -       return 0;
> -
> -err_disable_unprepare:
> -       clk_disable_unprepare(mbox->clk);
> -
> -       return ret;
> -}
> -
> -static void sun6i_msgbox_remove(struct platform_device *pdev)
> -{
> -       struct sun6i_msgbox *mbox = platform_get_drvdata(pdev);
>
> -       mbox_controller_unregister(&mbox->controller);
> -       /* See the comment in sun6i_msgbox_probe about the reset line. */
> -       clk_disable_unprepare(mbox->clk);
> +       return devm_mbox_controller_register(&mbox->controller);

Like Sashiko said, this doesn't compile. All devm_*() functions require
a |struct device *| parameter.


Build testing your patch before sending it is a must.


ChenYu

>  }
>
>  static const struct of_device_id sun6i_msgbox_of_match[] = {
> @@ -308,7 +283,6 @@ static struct platform_driver sun6i_msgbox_driver = {
>                 .of_match_table = sun6i_msgbox_of_match,
>         },
>         .probe = sun6i_msgbox_probe,
> -       .remove = sun6i_msgbox_remove,
>  };
>  module_platform_driver(sun6i_msgbox_driver);
>
> --
> 2.55.0
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed
  2026-07-27 19:42 [PATCH] mailbox: sun6i: modernize probe and convert to fully managed Rosen Penev
  2026-07-28 15:56 ` Chen-Yu Tsai
@ 2026-08-07  4:41 ` kernel test robot
  2026-08-07 19:44 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-08-07  4:41 UTC (permalink / raw)
  To: Rosen Penev, linux-sunxi
  Cc: oe-kbuild-all, Jassi Brar, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, linux-kernel, linux-arm-kernel

Hi Rosen,

kernel test robot noticed the following build errors:

[auto build test ERROR on sunxi/sunxi/for-next]
[also build test ERROR on linus/master v7.2-rc6 next-20260806]
[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/Rosen-Penev/mailbox-sun6i-modernize-probe-and-convert-to-fully-managed/20260807-054041
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git sunxi/for-next
patch link:    https://lore.kernel.org/r/20260727194208.10082-1-rosenp%40gmail.com
patch subject: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20260807/202608071227.vRfy33Rr-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608071227.vRfy33Rr-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/202608071227.vRfy33Rr-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/mailbox/sun6i-msgbox.c: In function 'sun6i_msgbox_probe':
>> drivers/mailbox/sun6i-msgbox.c:271:46: error: passing argument 1 of 'devm_mbox_controller_register' from incompatible pointer type [-Wincompatible-pointer-types]
     271 |         return devm_mbox_controller_register(&mbox->controller);
         |                                              ^~~~~~~~~~~~~~~~~
         |                                              |
         |                                              struct mbox_controller *
   In file included from drivers/mailbox/sun6i-msgbox.c:12:
   include/linux/mailbox_controller.h:149:50: note: expected 'struct device *' but argument is of type 'struct mbox_controller *'
     149 | int devm_mbox_controller_register(struct device *dev,
         |                                   ~~~~~~~~~~~~~~~^~~
>> drivers/mailbox/sun6i-msgbox.c:271:16: error: too few arguments to function 'devm_mbox_controller_register'; expected 2, have 1
     271 |         return devm_mbox_controller_register(&mbox->controller);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mailbox_controller.h:149:5: note: declared here
     149 | int devm_mbox_controller_register(struct device *dev,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/devm_mbox_controller_register +271 drivers/mailbox/sun6i-msgbox.c

   194	
   195	static int sun6i_msgbox_probe(struct platform_device *pdev)
   196	{
   197		struct device *dev = &pdev->dev;
   198		struct mbox_chan *chans;
   199		struct reset_control *reset;
   200		struct sun6i_msgbox *mbox;
   201		void __iomem *regs;
   202		int i, ret;
   203		int irq;
   204	
   205		irq = platform_get_irq(pdev, 0);
   206		if (irq < 0)
   207			return irq;
   208	
   209		regs = devm_platform_ioremap_resource(pdev, 0);
   210		if (IS_ERR(regs))
   211			return PTR_ERR(regs);
   212	
   213		mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL);
   214		if (!mbox)
   215			return -ENOMEM;
   216	
   217		chans = devm_kcalloc(dev, NUM_CHANS, sizeof(*chans), GFP_KERNEL);
   218		if (!chans)
   219			return -ENOMEM;
   220	
   221		for (i = 0; i < NUM_CHANS; ++i)
   222			chans[i].con_priv = mbox;
   223	
   224		mbox->clk = devm_clk_get_enabled(dev, NULL);
   225		if (IS_ERR(mbox->clk)) {
   226			ret = PTR_ERR(mbox->clk);
   227			dev_err(dev, "Failed to get clock: %d\n", ret);
   228			return ret;
   229		}
   230	
   231		reset = devm_reset_control_get_exclusive(dev, NULL);
   232		if (IS_ERR(reset)) {
   233			ret = PTR_ERR(reset);
   234			dev_err(dev, "Failed to get reset control: %d\n", ret);
   235			return ret;
   236		}
   237	
   238		/*
   239		 * NOTE: We rely on platform firmware to preconfigure the channel
   240		 * directions, and we share this hardware block with other firmware
   241		 * that runs concurrently with Linux (e.g. a trusted monitor).
   242		 *
   243		 * Therefore, we do *not* assert the reset line if probing fails or
   244		 * when removing the device.
   245		 */
   246		ret = reset_control_deassert(reset);
   247		if (ret) {
   248			dev_err(dev, "Failed to deassert reset: %d\n", ret);
   249			return ret;
   250		}
   251	
   252		mbox->regs = regs;
   253	
   254		/* Disable all IRQs for this end of the msgbox. */
   255		writel(0, mbox->regs + LOCAL_IRQ_EN_REG);
   256	
   257		ret = devm_request_irq(dev, irq, sun6i_msgbox_irq, 0, dev_name(dev), mbox);
   258		if (ret)
   259			return ret;
   260	
   261		mbox->controller.dev           = dev;
   262		mbox->controller.ops           = &sun6i_msgbox_chan_ops;
   263		mbox->controller.chans         = chans;
   264		mbox->controller.num_chans     = NUM_CHANS;
   265		mbox->controller.txdone_irq    = false;
   266		mbox->controller.txdone_poll   = true;
   267		mbox->controller.txpoll_period = 5;
   268	
   269		spin_lock_init(&mbox->lock);
   270	
 > 271		return devm_mbox_controller_register(&mbox->controller);
   272	}
   273	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed
  2026-07-27 19:42 [PATCH] mailbox: sun6i: modernize probe and convert to fully managed Rosen Penev
  2026-07-28 15:56 ` Chen-Yu Tsai
  2026-08-07  4:41 ` kernel test robot
@ 2026-08-07 19:44 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-08-07 19:44 UTC (permalink / raw)
  To: Rosen Penev, linux-sunxi
  Cc: llvm, oe-kbuild-all, Jassi Brar, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, linux-kernel, linux-arm-kernel

Hi Rosen,

kernel test robot noticed the following build errors:

[auto build test ERROR on sunxi/sunxi/for-next]
[also build test ERROR on linus/master v7.2-rc6 next-20260806]
[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/Rosen-Penev/mailbox-sun6i-modernize-probe-and-convert-to-fully-managed/20260807-054041
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git sunxi/for-next
patch link:    https://lore.kernel.org/r/20260727194208.10082-1-rosenp%40gmail.com
patch subject: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed
config: arm64-randconfig-001-20260807 (https://download.01.org/0day-ci/archive/20260808/202608080303.ryiYJhRA-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 12df34b8469b8095359de8c249cb1b2753fadeea)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260808/202608080303.ryiYJhRA-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/202608080303.ryiYJhRA-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/mailbox/sun6i-msgbox.c:271:56: error: too few arguments to function call, expected 2, have 1
     271 |         return devm_mbox_controller_register(&mbox->controller);
         |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                  ^
   include/linux/mailbox_controller.h:149:5: note: 'devm_mbox_controller_register' declared here
     149 | int devm_mbox_controller_register(struct device *dev,
         |     ^                             ~~~~~~~~~~~~~~~~~~~
     150 |                                   struct mbox_controller *mbox);
         |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 error generated.


vim +271 drivers/mailbox/sun6i-msgbox.c

   194	
   195	static int sun6i_msgbox_probe(struct platform_device *pdev)
   196	{
   197		struct device *dev = &pdev->dev;
   198		struct mbox_chan *chans;
   199		struct reset_control *reset;
   200		struct sun6i_msgbox *mbox;
   201		void __iomem *regs;
   202		int i, ret;
   203		int irq;
   204	
   205		irq = platform_get_irq(pdev, 0);
   206		if (irq < 0)
   207			return irq;
   208	
   209		regs = devm_platform_ioremap_resource(pdev, 0);
   210		if (IS_ERR(regs))
   211			return PTR_ERR(regs);
   212	
   213		mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL);
   214		if (!mbox)
   215			return -ENOMEM;
   216	
   217		chans = devm_kcalloc(dev, NUM_CHANS, sizeof(*chans), GFP_KERNEL);
   218		if (!chans)
   219			return -ENOMEM;
   220	
   221		for (i = 0; i < NUM_CHANS; ++i)
   222			chans[i].con_priv = mbox;
   223	
   224		mbox->clk = devm_clk_get_enabled(dev, NULL);
   225		if (IS_ERR(mbox->clk)) {
   226			ret = PTR_ERR(mbox->clk);
   227			dev_err(dev, "Failed to get clock: %d\n", ret);
   228			return ret;
   229		}
   230	
   231		reset = devm_reset_control_get_exclusive(dev, NULL);
   232		if (IS_ERR(reset)) {
   233			ret = PTR_ERR(reset);
   234			dev_err(dev, "Failed to get reset control: %d\n", ret);
   235			return ret;
   236		}
   237	
   238		/*
   239		 * NOTE: We rely on platform firmware to preconfigure the channel
   240		 * directions, and we share this hardware block with other firmware
   241		 * that runs concurrently with Linux (e.g. a trusted monitor).
   242		 *
   243		 * Therefore, we do *not* assert the reset line if probing fails or
   244		 * when removing the device.
   245		 */
   246		ret = reset_control_deassert(reset);
   247		if (ret) {
   248			dev_err(dev, "Failed to deassert reset: %d\n", ret);
   249			return ret;
   250		}
   251	
   252		mbox->regs = regs;
   253	
   254		/* Disable all IRQs for this end of the msgbox. */
   255		writel(0, mbox->regs + LOCAL_IRQ_EN_REG);
   256	
   257		ret = devm_request_irq(dev, irq, sun6i_msgbox_irq, 0, dev_name(dev), mbox);
   258		if (ret)
   259			return ret;
   260	
   261		mbox->controller.dev           = dev;
   262		mbox->controller.ops           = &sun6i_msgbox_chan_ops;
   263		mbox->controller.chans         = chans;
   264		mbox->controller.num_chans     = NUM_CHANS;
   265		mbox->controller.txdone_irq    = false;
   266		mbox->controller.txdone_poll   = true;
   267		mbox->controller.txpoll_period = 5;
   268	
   269		spin_lock_init(&mbox->lock);
   270	
 > 271		return devm_mbox_controller_register(&mbox->controller);
   272	}
   273	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-07 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 19:42 [PATCH] mailbox: sun6i: modernize probe and convert to fully managed Rosen Penev
2026-07-28 15:56 ` Chen-Yu Tsai
2026-08-07  4:41 ` kernel test robot
2026-08-07 19:44 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox