diff mbox series

[v2,06/13] wiphy: add two regulatory domain state events

Message ID 20220803213644.277534-6-prestwoj@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [v2,01/13] wiphy: fix runtime error from bit shift | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 3, 2022, 9:36 p.m. UTC
Events to indicate when a regulatory domain wiphy dump has
started and ended. This is important because certain actions
such as scanning need to be delayed until the dump has finished.
---
 src/device.c | 2 ++
 src/wiphy.h  | 2 ++
 2 files changed, 4 insertions(+)

Comments

Denis Kenzior Aug. 4, 2022, 3:31 p.m. UTC | #1
Hi James,

On 8/3/22 16:36, James Prestwood wrote:
> Events to indicate when a regulatory domain wiphy dump has
> started and ended. This is important because certain actions
> such as scanning need to be delayed until the dump has finished.
> ---
>   src/device.c | 2 ++
>   src/wiphy.h  | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/src/device.c b/src/device.c
> index 02da2cdc..d7eb6adb 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -282,6 +282,8 @@ static void device_wiphy_state_changed_event(struct wiphy *wiphy,
>   			netdev_set_powered(device->netdev, true,
>   							NULL, NULL, NULL);
>   		break;
> +	default:
> +		break;

nit: Prefer to not use default: when possible.  The reason is that if a new 
enumeration is added (like you do here), the compiler will warn when it isn't 
handled.  Prefer to be paranoid and explicitly add all the enumerations instead, 
so that any new enumerations are not left mistakenly unhandled.

>   	}
>   }
>   

I amended this patch to do the above and applied, thanks!

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 02da2cdc..d7eb6adb 100644
--- a/src/device.c
+++ b/src/device.c
@@ -282,6 +282,8 @@  static void device_wiphy_state_changed_event(struct wiphy *wiphy,
 			netdev_set_powered(device->netdev, true,
 							NULL, NULL, NULL);
 		break;
+	default:
+		break;
 	}
 }
 
diff --git a/src/wiphy.h b/src/wiphy.h
index 9a3b96f9..070c8aea 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -56,6 +56,8 @@  enum {
 enum wiphy_state_watch_event {
 	WIPHY_STATE_WATCH_EVENT_POWERED,
 	WIPHY_STATE_WATCH_EVENT_RFKILLED,
+	WIPHY_STATE_WATCH_EVENT_REGDOM_STARTED,
+	WIPHY_STATE_WATCH_EVENT_REGDOM_DONE,
 };
 
 typedef void (*wiphy_state_watch_func_t)(struct wiphy *wiphy,