Skip to content

Commit 5eb4f41

Browse files
sgruszkarafaeljw
authored andcommitted
thermal: netlink: Add enum for mutlicast groups indexes
Use enum instead of hard-coded numbers for indexing multicast groups. Signed-off-by: Stanislaw Gruszka <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5a5efda commit 5eb4f41

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/thermal/thermal_netlink.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@
1313

1414
#include "thermal_core.h"
1515

16+
enum thermal_genl_multicast_groups {
17+
THERMAL_GENL_SAMPLING_GROUP = 0,
18+
THERMAL_GENL_EVENT_GROUP = 1,
19+
};
20+
1621
static const struct genl_multicast_group thermal_genl_mcgrps[] = {
17-
{ .name = THERMAL_GENL_SAMPLING_GROUP_NAME, },
18-
{ .name = THERMAL_GENL_EVENT_GROUP_NAME, },
22+
[THERMAL_GENL_SAMPLING_GROUP] = { .name = THERMAL_GENL_SAMPLING_GROUP_NAME, },
23+
[THERMAL_GENL_EVENT_GROUP] = { .name = THERMAL_GENL_EVENT_GROUP_NAME, },
1924
};
2025

2126
static const struct nla_policy thermal_genl_policy[THERMAL_GENL_ATTR_MAX + 1] = {
@@ -95,7 +100,7 @@ int thermal_genl_sampling_temp(int id, int temp)
95100

96101
genlmsg_end(skb, hdr);
97102

98-
genlmsg_multicast(&thermal_gnl_family, skb, 0, 0, GFP_KERNEL);
103+
genlmsg_multicast(&thermal_gnl_family, skb, 0, THERMAL_GENL_SAMPLING_GROUP, GFP_KERNEL);
99104

100105
return 0;
101106
out_cancel:
@@ -290,7 +295,7 @@ static int thermal_genl_send_event(enum thermal_genl_event event,
290295

291296
genlmsg_end(msg, hdr);
292297

293-
genlmsg_multicast(&thermal_gnl_family, msg, 0, 1, GFP_KERNEL);
298+
genlmsg_multicast(&thermal_gnl_family, msg, 0, THERMAL_GENL_EVENT_GROUP, GFP_KERNEL);
294299

295300
return 0;
296301

0 commit comments

Comments
 (0)