linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>,
	Cristian Marussi <cristian.marussi@arm.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v2 2/2] firmware: arm_scmi: mailbox: support P2A channel completion
Date: Fri, 14 Jun 2024 11:31:43 +0100	[thread overview]
Message-ID: <ZmwcD-v6dCmObP_2@pluto> (raw)
In-Reply-To: <ZmwLLoh1dbykOZZq@bogus>

On Fri, Jun 14, 2024 at 10:19:42AM +0100, Sudeep Holla wrote:
> On Fri, May 10, 2024 at 11:19:48AM +0800, Peng Fan (OSS) wrote:
> 
> There was some coding style error reported(unbalanced {}) which made me
> look at the code again. I don't think we need to splat out error.
> 
> > @@ -300,8 +326,30 @@ static void mailbox_fetch_notification(struct scmi_chan_info *cinfo,
> >  static void mailbox_clear_channel(struct scmi_chan_info *cinfo)
> >  {
> >  	struct scmi_mailbox *smbox = cinfo->transport_info;
> > +	struct device *cdev = cinfo->dev;
> > +	struct mbox_chan *intr;
> > +	int ret;
> >  
> >  	shmem_clear_channel(smbox->shmem);
> > +
> > +	if (!shmem_channel_intr_enabled(smbox->shmem))
> > +		return;
> > +
> > +	if (smbox->chan_platform_receiver)
> > +		intr = smbox->chan_platform_receiver;
> > +	else if (smbox->chan)
> > +		intr = smbox->chan;
> > +	else {
> > +		dev_err(cdev, "Channel INTR wrongly set?\n");
> > +		return;
> > +	}
> > 
> 
> If it is OK I would like to fix it up with below change.
> 

Hi,

> Regards,
> Sudeep
> 
> -->8
> 
> diff --git i/drivers/firmware/arm_scmi/mailbox.c w/drivers/firmware/arm_scmi/mailbox.c
> index adb69a6a0223..3bb3fba8f478 100644
> --- i/drivers/firmware/arm_scmi/mailbox.c
> +++ w/drivers/firmware/arm_scmi/mailbox.c
> @@ -326,30 +326,25 @@ static void mailbox_fetch_notification(struct scmi_chan_info *cinfo,
>  static void mailbox_clear_channel(struct scmi_chan_info *cinfo)
>  {
>         struct scmi_mailbox *smbox = cinfo->transport_info;
> -       struct device *cdev = cinfo->dev;
> -       struct mbox_chan *intr;
> +       struct mbox_chan *intr_chan = NULL;
>         int ret;
> 
>         shmem_clear_channel(smbox->shmem);
> 
> -       if (!shmem_channel_intr_enabled(smbox->shmem))
> -               return;
> -
>         if (smbox->chan_platform_receiver)
> -               intr = smbox->chan_platform_receiver;
> +               intr_chan = smbox->chan_platform_receiver;
>         else if (smbox->chan)
> -               intr = smbox->chan;
> -       else {
> -               dev_err(cdev, "Channel INTR wrongly set?\n");
> +               intr_chan = smbox->chan;
> +
> +       if (!(intr_chan && shmem_channel_intr_enabled(smbox->shmem)))
>                 return;
> -       }

Fine with dropping the dev_err() but is not this cumulative negated-if a
bit cryptic...also you can bail out early straight away as before when
platform has not required any P2A completion irq...I mean something like

	
       struct mbox_chan *intr_chan = NULL;

       shmem_clear_channel(smbox->shmem);
       if (!shmem_channel_intr_enabled(smbox->shmem))
		return;

       if (smbox->chan_platform_receiver)
		intr_chan = smbox->chan_platform_receiver;
       else if (smbox->chan)
		intr_chan = smbox->chan;

       if (!intr_chan)
	       return;

(or just a dangling else return;)


.. no strongs opinion here really, though.

Thanks,
Cristian


  reply	other threads:[~2024-06-14 10:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  3:19 [PATCH v2 0/2] firmware: arm_scmi: add notification completion channel Peng Fan (OSS)
2024-05-10  3:19 ` [PATCH v2 1/2] dt-bindings: firmware: arm,scmi: Support " Peng Fan (OSS)
2024-05-20 14:51   ` Rob Herring (Arm)
2024-05-10  3:19 ` [PATCH v2 2/2] firmware: arm_scmi: mailbox: support P2A channel completion Peng Fan (OSS)
2024-06-03 16:11   ` Cristian Marussi
2024-06-04  1:06     ` Peng Fan
2024-06-04 11:21       ` Cristian Marussi
2024-06-14  9:19   ` Sudeep Holla
2024-06-14 10:31     ` Cristian Marussi [this message]
2024-06-14 11:19       ` Sudeep Holla
2024-06-17  9:54 ` [PATCH v2 0/2] firmware: arm_scmi: add notification completion channel Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZmwcD-v6dCmObP_2@pluto \
    --to=cristian.marussi@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).