x86: tangier: pinmux: Move is_protected assignment closer to its user
PATCH 2/2 x86: tangier: pinmux: Move error message to the caller
In reply to Andy ShevchenkoMove error message to the caller of mrfld_pinconfig*() in order to unify them in the future.
--- arch/x86/cpu/tangier/pinmux.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/cpu/tangier/pinmux.c +3 -7
@@ -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; }
Signature · 1 line
2.33.0
PATCH 1/2 x86: tangier: pinmux: Move is_protected assignment closer to its user
Move is_protected assignment closer to its user. This increases readability and makes maintenance easier.
--- arch/x86/cpu/tangier/pinmux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/cpu/tangier/pinmux.c +1 -2
@@ -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
Signature · 1 line
2.33.0
Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller
In reply to Andy ShevchenkoQuoted 8 lines · Andy Shevchenko
Move error message to the caller of mrfld_pinconfig*() in order to unify them in the future.
Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/pinmux.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Quoted 7 lines
arch/x86/cpu/tangier/pinmux.c +0
-0@@ -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",
arch/x86/cpu/tangier/pinmux.c static int mrfld_pinconfig_protected(unsigned int pin, u32 mask, u32 bits) · line 120
Quoted 10 lines
arch/x86/cpu/tangier/pinmux.c +1
-7v, (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;
Quoted 15 lines
arch/x86/cpu/tangier/pinmux.c +2
-1}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
Quoted 8 lines · Andy Shevchenko
Move
is_protectedassignment closer to its user. This increases readability and makes maintenance easier.Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/pinmux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
(with a note that normally we would read the devicetree in the of_to_plat() method)
Quoted 25 lines
arch/x86/cpu/tangier/pinmux.c +1
-3@@ -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
Quoted 9 lines · Andy Shevchenko
Move
is_protectedassignment closer to its user. This increases readability and makes maintenance easier.Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/pinmux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 7 lines · Bin Meng
Quoted 4 lines · Andy Shevchenko
Move
is_protectedassignment closer to its user. This increases readability and makes maintenance easier.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/pinmux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller
In reply to Andy ShevchenkoQuoted 9 lines · Andy Shevchenko
Move error message to the caller of mrfld_pinconfig*() in order to unify them in the future.
Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/pinmux.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Re: [PATCH v1 2/2] x86: tangier: pinmux: Move error message to the caller
Quoted 7 lines · Bin Meng
Quoted 4 lines · Andy Shevchenko
Move error message to the caller of mrfld_pinconfig*() in order to unify them in the future.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/pinmux.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!