Commit 95cccf4d authored by Kalle Valo's avatar Kalle Valo

ath10k: make wmi_service_name() warn about missing service ids

When adding a new value to enum wmi_service it's very easy to miss that the new
value should be also added to wmi_service_name() mapping function. Modify the
function so that GCC can now warn about this:

drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 'WMI_SERVICE_FOO' not handled in switch [-Wswitch]

And also add a reminder to the enum.

Thanks to Jouni Malinen for the idea.
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 2321dd5d
...@@ -212,6 +212,8 @@ enum wmi_service { ...@@ -212,6 +212,8 @@ enum wmi_service {
WMI_SERVICE_PER_PACKET_SW_ENCRYPT, WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
WMI_SERVICE_REPORT_AIRTIME, WMI_SERVICE_REPORT_AIRTIME,
/* Remember to add the new value to wmi_service_name()! */
/* keep last */ /* keep last */
WMI_SERVICE_MAX, WMI_SERVICE_MAX,
}; };
...@@ -378,7 +380,7 @@ enum wmi_10_4_service { ...@@ -378,7 +380,7 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_REPORT_AIRTIME, WMI_10_4_SERVICE_REPORT_AIRTIME,
}; };
static inline char *wmi_service_name(int service_id) static inline char *wmi_service_name(enum wmi_service service_id)
{ {
#define SVCSTR(x) case x: return #x #define SVCSTR(x) case x: return #x
...@@ -501,11 +503,13 @@ static inline char *wmi_service_name(int service_id) ...@@ -501,11 +503,13 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT); SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT);
SVCSTR(WMI_SERVICE_REPORT_AIRTIME); SVCSTR(WMI_SERVICE_REPORT_AIRTIME);
default: case WMI_SERVICE_MAX:
return NULL; return NULL;
} }
#undef SVCSTR #undef SVCSTR
return NULL;
} }
#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \ #define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment