diff mbox series

[BlueZ,1/2] mesh: Always set net modes based on node feature settings

Message ID 20200818222208.50938-1-inga.stotland@intel.com (mailing list archive)
State Accepted
Headers show
Series [BlueZ,1/2] mesh: Always set net modes based on node feature settings | expand

Commit Message

Stotland, Inga Aug. 18, 2020, 10:22 p.m. UTC
The network settings such as relay, beacon, proxy and friend are
always set based on local node feature settings. This change makes
the net modes intialization unconditional, to include the "No Support"
setting on node level which should result in the disabled mode in net.c
---
 mesh/node.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 18, 2020, 10:50 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.

Test Result:
checkpatch Failed

Outputs:
WARNING:TYPO_SPELLING: 'intialization' may be misspelled - perhaps 'initialization'?
#8: 
the net modes intialization unconditional, to include the "No Support"

- total: 0 errors, 1 warnings, 29 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.



---
Regards,
Linux Bluetooth
Brian Gix Aug. 20, 2020, 2:27 p.m. UTC | #2
Applied patchset with spelling correction

On Tue, 2020-08-18 at 15:22 -0700, Inga Stotland wrote:
> The network settings such as relay, beacon, proxy and friend are
> always set based on local node feature settings. This change makes
> the net modes intialization unconditional, to include the "No Support"
> setting on node level which should result in the disabled mode in net.c
> ---
>  mesh/node.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index 1eeffeb8b..ebc111a62 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -399,24 +399,16 @@ static bool init_storage_dir(struct mesh_node *node)
>  
>  static void update_net_settings(struct mesh_node *node)
>  {
> -	uint8_t mode;
> +	struct mesh_net *net = node->net;
>  
> -	mode = node->proxy;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_proxy_mode(node->net, mode == MESH_MODE_ENABLED);
> +	mesh_net_set_proxy_mode(net, node->proxy == MESH_MODE_ENABLED);
>  
> -	mode = node->friend;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_friend_mode(node->net, mode == MESH_MODE_ENABLED);
> +	mesh_net_set_friend_mode(net, node->friend == MESH_MODE_ENABLED);
>  
> -	mode = node->relay.mode;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_relay_mode(node->net, mode == MESH_MODE_ENABLED,
> +	mesh_net_set_relay_mode(net, node->relay.mode == MESH_MODE_ENABLED,
>  					node->relay.cnt, node->relay.interval);
>  
> -	mode = node->beacon;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_beacon_mode(node->net, mode == MESH_MODE_ENABLED);
> +	mesh_net_set_beacon_mode(net, node->beacon == MESH_MODE_ENABLED);
>  }
>  
>  static bool init_from_storage(struct mesh_config_node *db_node,
diff mbox series

Patch

diff --git a/mesh/node.c b/mesh/node.c
index 1eeffeb8b..ebc111a62 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -399,24 +399,16 @@  static bool init_storage_dir(struct mesh_node *node)
 
 static void update_net_settings(struct mesh_node *node)
 {
-	uint8_t mode;
+	struct mesh_net *net = node->net;
 
-	mode = node->proxy;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_proxy_mode(node->net, mode == MESH_MODE_ENABLED);
+	mesh_net_set_proxy_mode(net, node->proxy == MESH_MODE_ENABLED);
 
-	mode = node->friend;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_friend_mode(node->net, mode == MESH_MODE_ENABLED);
+	mesh_net_set_friend_mode(net, node->friend == MESH_MODE_ENABLED);
 
-	mode = node->relay.mode;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_relay_mode(node->net, mode == MESH_MODE_ENABLED,
+	mesh_net_set_relay_mode(net, node->relay.mode == MESH_MODE_ENABLED,
 					node->relay.cnt, node->relay.interval);
 
-	mode = node->beacon;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_beacon_mode(node->net, mode == MESH_MODE_ENABLED);
+	mesh_net_set_beacon_mode(net, node->beacon == MESH_MODE_ENABLED);
 }
 
 static bool init_from_storage(struct mesh_config_node *db_node,