diff mbox series

bus: mhi: Move irq check in controller registration

Message ID 1600762066-25849-1-git-send-email-loic.poulain@linaro.org
State New
Headers show
Series bus: mhi: Move irq check in controller registration | expand

Commit Message

Loic Poulain Sept. 22, 2020, 8:07 a.m. UTC
Move irq number check early in mhi_register_controller along
with other mandatory parameters checking.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/bus/mhi/core/init.c | 2 +-
 drivers/bus/mhi/core/pm.c   | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Bhaumik Bhatt Sept. 22, 2020, 5 p.m. UTC | #1
On 2020-09-22 01:07, Loic Poulain wrote:
> Move irq number check early in mhi_register_controller along

> with other mandatory parameters checking.

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

> ---

>  drivers/bus/mhi/core/init.c | 2 +-

>  drivers/bus/mhi/core/pm.c   | 3 ---

>  2 files changed, 1 insertion(+), 4 deletions(-)

> 

> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c

> index ca08437..34f9ae3 100644

> --- a/drivers/bus/mhi/core/init.c

> +++ b/drivers/bus/mhi/core/init.c

> @@ -871,7 +871,7 @@ int mhi_register_controller(struct mhi_controller

> *mhi_cntrl,

> 

>  	if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||

>  	    !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||

> -	    !mhi_cntrl->write_reg)

> +	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)

>  		return -EINVAL;

> 

>  	ret = parse_config(mhi_cntrl, config);

> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c

> index 3de7b16..07efdbc 100644

> --- a/drivers/bus/mhi/core/pm.c

> +++ b/drivers/bus/mhi/core/pm.c

> @@ -918,9 +918,6 @@ int mhi_async_power_up(struct mhi_controller 

> *mhi_cntrl)

> 

>  	dev_info(dev, "Requested to power ON\n");

> 

> -	if (mhi_cntrl->nr_irqs < 1)

> -		return -EINVAL;

> -

>  	/* Supply default wake routines if not provided by controller driver 

> */

>  	if (!mhi_cntrl->wake_get || !mhi_cntrl->wake_put ||

>  	    !mhi_cntrl->wake_toggle) {

Hi Loic,

Can you please add a Suggested-by: Bhaumik Bhatt <bbhatt@codeaurora.org> 
tag with my name?

Also, I made this patch myself too but you can submit it. It'd be nice 
to add some more
details in the commit text.

Mine goes like this:

bus: mhi: core: Check for IRQ availability during registration

     Current design allows a controller to register with MHI successfully
     without the need to have any IRQs available for use. If no IRQs are
     available, power up requests to MHI can fail after a successful
     registration with MHI. Improve the design by checking for the number
     of IRQs available sooner within the mhi_regsiter_controller() API as
     it is required to be specified by the controller.

Thanks,
Bhaumik
Loic Poulain Sept. 22, 2020, 5:33 p.m. UTC | #2
Hi Bhaumik,

On Tue, 22 Sep 2020 at 19:00, <bbhatt@codeaurora.org> wrote:
>

> On 2020-09-22 01:07, Loic Poulain wrote:

> > Move irq number check early in mhi_register_controller along

> > with other mandatory parameters checking.

> >

> > Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

> > ---

> >  drivers/bus/mhi/core/init.c | 2 +-

> >  drivers/bus/mhi/core/pm.c   | 3 ---

> >  2 files changed, 1 insertion(+), 4 deletions(-)

> >

> > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c

> > index ca08437..34f9ae3 100644

> > --- a/drivers/bus/mhi/core/init.c

> > +++ b/drivers/bus/mhi/core/init.c

> > @@ -871,7 +871,7 @@ int mhi_register_controller(struct mhi_controller

> > *mhi_cntrl,

> >

> >       if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||

> >           !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||

> > -         !mhi_cntrl->write_reg)

> > +         !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)

> >               return -EINVAL;

> >

> >       ret = parse_config(mhi_cntrl, config);

> > diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c

> > index 3de7b16..07efdbc 100644

> > --- a/drivers/bus/mhi/core/pm.c

> > +++ b/drivers/bus/mhi/core/pm.c

> > @@ -918,9 +918,6 @@ int mhi_async_power_up(struct mhi_controller

> > *mhi_cntrl)

> >

> >       dev_info(dev, "Requested to power ON\n");

> >

> > -     if (mhi_cntrl->nr_irqs < 1)

> > -             return -EINVAL;

> > -

> >       /* Supply default wake routines if not provided by controller driver

> > */

> >       if (!mhi_cntrl->wake_get || !mhi_cntrl->wake_put ||

> >           !mhi_cntrl->wake_toggle) {

> Hi Loic,

>

> Can you please add a Suggested-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

> tag with my name?

>

> Also, I made this patch myself too but you can submit it. It'd be nice

> to add some more

> details in the commit text.

>

> Mine goes like this:

>

> bus: mhi: core: Check for IRQ availability during registration

>

>      Current design allows a controller to register with MHI successfully

>      without the need to have any IRQs available for use. If no IRQs are

>      available, power up requests to MHI can fail after a successful

>      registration with MHI. Improve the design by checking for the number

>      of IRQs available sooner within the mhi_regsiter_controller() API as

>      it is required to be specified by the controller.


Then I would prefer you to submit yours and we discard mine, don't
want to be authored for your work.

Thanks,
Loic
patchwork-bot+linux-arm-msm@kernel.org Dec. 29, 2020, 8:15 p.m. UTC | #3
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Tue, 22 Sep 2020 10:07:46 +0200 you wrote:
> Move irq number check early in mhi_register_controller along

> with other mandatory parameters checking.

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

> ---

>  drivers/bus/mhi/core/init.c | 2 +-

>  drivers/bus/mhi/core/pm.c   | 3 ---

>  2 files changed, 1 insertion(+), 4 deletions(-)


Here is the summary with links:
  - bus: mhi: Move irq check in controller registration
    https://git.kernel.org/qcom/c/40c3127187cb

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index ca08437..34f9ae3 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -871,7 +871,7 @@  int mhi_register_controller(struct mhi_controller *mhi_cntrl,
 
 	if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
 	    !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
-	    !mhi_cntrl->write_reg)
+	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)
 		return -EINVAL;
 
 	ret = parse_config(mhi_cntrl, config);
diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 3de7b16..07efdbc 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -918,9 +918,6 @@  int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
 
 	dev_info(dev, "Requested to power ON\n");
 
-	if (mhi_cntrl->nr_irqs < 1)
-		return -EINVAL;
-
 	/* Supply default wake routines if not provided by controller driver */
 	if (!mhi_cntrl->wake_get || !mhi_cntrl->wake_put ||
 	    !mhi_cntrl->wake_toggle) {