All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Bin Meng <bmeng.cn@gmail.com>
Subject: Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller
Date: Wed, 27 Oct 2021 12:34:46 -0600	[thread overview]
Message-ID: <CAPnjgZ3w_PBNQwT0DAtXQ6D_9TLHFK_CCE-c72Osg=ccoWHs6w@mail.gmail.com> (raw)
In-Reply-To: <20211027142338.77161-2-andriy.shevchenko@linux.intel.com>

On Wed, 27 Oct 2021 at 08:23, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Move error message to the caller of mrfld_pinconfig*() in order
> to unify them in the future.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/x86/cpu/tangier/pinmux.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

>
> diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c
> index 883860f75e28..7b2c35fbf794 100644
> --- a/arch/x86/cpu/tangier/pinmux.c
> +++ b/arch/x86/cpu/tangier/pinmux.c
> @@ -117,13 +117,7 @@ static int mrfld_pinconfig_protected(unsigned int pin, u32 mask, u32 bits)
>         debug("scu: v: 0x%x p: 0x%x bits: %d, mask: %d bufcfg: 0x%p\n",
>               v, (u32)bufcfg, bits, mask, bufcfg);
>
> -       ret = scu_ipc_raw_command(IPCMSG_INDIRECT_WRITE, 0, &v, 4,
> -                                 NULL, 0, (u32)bufcfg, 0);
> -       if (ret)
> -               pr_err("Failed to set mode via SCU for pin %u (%d)\n",
> -                      pin, ret);
> -
> -       return ret;
> +       return scu_ipc_raw_command(IPCMSG_INDIRECT_WRITE, 0, &v, 4, NULL, 0, (u32)bufcfg, 0);

In general I like to separate out the error return so we can use something like:

ret = scu_...
if (ret)
   return log_msg_ret("scu", ret);

return 0;


>  }
>
>  static int mrfld_pinconfig(unsigned int pin, u32 mask, u32 bits)
> @@ -181,6 +175,8 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node)
>                 ret = mrfld_pinconfig_protected(pad_offset, mask, mode);
>         else
>                 ret = mrfld_pinconfig(pad_offset, mask, mode);
> +       if (ret)
> +               pr_err("Failed to set mode for pin %u (%d)\n", pad_offset, ret);
>
>         return ret;
>  }
> --
> 2.33.0
>

  reply	other threads:[~2021-10-27 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 14:23 [PATCH v1 1/2] x86: tangier: pinmux: Move is_protected assignment closer to its user Andy Shevchenko
2021-10-27 14:23 ` [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller Andy Shevchenko
2021-10-27 18:34   ` Simon Glass [this message]
2021-11-01  2:18   ` Bin Meng
2021-11-01  2:18     ` Bin Meng
2021-10-27 18:34 ` [PATCH v1 1/2] x86: tangier: pinmux: Move is_protected assignment closer to its user Simon Glass
2021-11-01  2:05 ` Bin Meng
2021-11-01  2:10   ` Bin Meng

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='CAPnjgZ3w_PBNQwT0DAtXQ6D_9TLHFK_CCE-c72Osg=ccoWHs6w@mail.gmail.com' \
    --to=sjg@chromium.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.