* [PATCH v1 1/2] x86: tangier: pinmux: Move is_protected assignment closer to its user @ 2021-10-27 14:23 Andy Shevchenko 2021-10-27 14:23 ` [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller Andy Shevchenko ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Andy Shevchenko @ 2021-10-27 14:23 UTC (permalink / raw) To: Andy Shevchenko, u-boot; +Cc: Simon Glass, Bin Meng Move is_protected assignment closer to its user. This increases readability and makes maintenance easier. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- arch/x86/cpu/tangier/pinmux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c index 8385167b2b6b..883860f75e28 100644 --- a/arch/x86/cpu/tangier/pinmux.c +++ b/arch/x86/cpu/tangier/pinmux.c @@ -162,8 +162,6 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) u32 mask; int ret; - is_protected = ofnode_read_bool(pin_node, "protected"); - pad_offset = ofnode_read_s32_default(pin_node, "pad-offset", -1); if (pad_offset == -1) return -EINVAL; @@ -178,6 +176,7 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) if (mode & ~mask) return -ENOTSUPP; + is_protected = ofnode_read_bool(pin_node, "protected"); if (is_protected) ret = mrfld_pinconfig_protected(pad_offset, mask, mode); else -- 2.33.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller 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 ` Andy Shevchenko 2021-10-27 18:34 ` Simon Glass 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 2 siblings, 2 replies; 8+ messages in thread From: Andy Shevchenko @ 2021-10-27 14:23 UTC (permalink / raw) To: Andy Shevchenko, u-boot; +Cc: Simon Glass, Bin Meng 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(-) 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); } 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller 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 2021-11-01 2:18 ` Bin Meng 1 sibling, 0 replies; 8+ messages in thread From: Simon Glass @ 2021-10-27 18:34 UTC (permalink / raw) To: Andy Shevchenko; +Cc: U-Boot Mailing List, Bin Meng 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 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller 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 @ 2021-11-01 2:18 ` Bin Meng 2021-11-01 2:18 ` Bin Meng 1 sibling, 1 reply; 8+ messages in thread From: Bin Meng @ 2021-11-01 2:18 UTC (permalink / raw) To: Andy Shevchenko; +Cc: U-Boot Mailing List, Simon Glass On Wed, Oct 27, 2021 at 10:23 PM 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: Bin Meng <bmeng.cn@gmail.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller 2021-11-01 2:18 ` Bin Meng @ 2021-11-01 2:18 ` Bin Meng 0 siblings, 0 replies; 8+ messages in thread From: Bin Meng @ 2021-11-01 2:18 UTC (permalink / raw) To: Andy Shevchenko; +Cc: U-Boot Mailing List, Simon Glass On Mon, Nov 1, 2021 at 10:18 AM Bin Meng <bmeng.cn@gmail.com> wrote: > > On Wed, Oct 27, 2021 at 10:23 PM 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: Bin Meng <bmeng.cn@gmail.com> applied to u-boot-x86, thanks! ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/2] x86: tangier: pinmux: Move is_protected assignment closer to its user 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 2021-11-01 2:05 ` Bin Meng 2 siblings, 0 replies; 8+ messages in thread From: Simon Glass @ 2021-10-27 18:34 UTC (permalink / raw) To: Andy Shevchenko; +Cc: U-Boot Mailing List, Bin Meng On Wed, 27 Oct 2021 at 08:23, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > Move is_protected assignment closer to its user. > This increases readability and makes maintenance easier. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > arch/x86/cpu/tangier/pinmux.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> (with a note that normally we would read the devicetree in the of_to_plat() method) > > diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c > index 8385167b2b6b..883860f75e28 100644 > --- a/arch/x86/cpu/tangier/pinmux.c > +++ b/arch/x86/cpu/tangier/pinmux.c > @@ -162,8 +162,6 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) > u32 mask; > int ret; > > - is_protected = ofnode_read_bool(pin_node, "protected"); > - > pad_offset = ofnode_read_s32_default(pin_node, "pad-offset", -1); > if (pad_offset == -1) > return -EINVAL; > @@ -178,6 +176,7 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) > if (mode & ~mask) > return -ENOTSUPP; > > + is_protected = ofnode_read_bool(pin_node, "protected"); > if (is_protected) > ret = mrfld_pinconfig_protected(pad_offset, mask, mode); > else > -- > 2.33.0 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/2] x86: tangier: pinmux: Move is_protected assignment closer to its user 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 ` [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 2 siblings, 1 reply; 8+ messages in thread From: Bin Meng @ 2021-11-01 2:05 UTC (permalink / raw) To: Andy Shevchenko; +Cc: U-Boot Mailing List, Simon Glass On Wed, Oct 27, 2021 at 10:23 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > Move is_protected assignment closer to its user. > This increases readability and makes maintenance easier. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > arch/x86/cpu/tangier/pinmux.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/2] x86: tangier: pinmux: Move is_protected assignment closer to its user 2021-11-01 2:05 ` Bin Meng @ 2021-11-01 2:10 ` Bin Meng 0 siblings, 0 replies; 8+ messages in thread From: Bin Meng @ 2021-11-01 2:10 UTC (permalink / raw) To: Andy Shevchenko; +Cc: U-Boot Mailing List, Simon Glass On Mon, Nov 1, 2021 at 10:05 AM Bin Meng <bmeng.cn@gmail.com> wrote: > > On Wed, Oct 27, 2021 at 10:23 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > > > Move is_protected assignment closer to its user. > > This increases readability and makes maintenance easier. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > arch/x86/cpu/tangier/pinmux.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> applied to u-boot-x86, thanks! ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-01 2:18 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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
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.