History

mfd: cros_ec: Remove zero-size structs

Empty structure size is different between C and C++. To prevent clang warning when compiling this include file in C++ programs, remove empty structures.

Gwendal Grignou committed 7 years ago

Commit fd3bbf41 parent e849b871 file · +18 −15Browse files

Unified · Split

include/linux/mfd/cros_ec_commands.h+18−15
@@ -1540,10 +1540,14 @@ struct lightbar_program { · 1539 unmodified lines
15401540 struct ec_params_lightbar {
15411541 uint8_t cmd; /* Command (see enum lightbar_command) */
15421542 union {
1543− struct {
1544− /* no args */
1545− } dump, off, on, init, get_seq, get_params_v0, get_params_v1,
1546− version, get_brightness, get_demo, suspend, resume;
1543+ /*
1544+ * The following commands have no args:
1545+ *
1546+ * dump, off, on, init, get_seq, get_params_v0, get_params_v1,
1547+ * version, get_brightness, get_demo, suspend, resume
1548+ *
1549+ * Don't use an empty struct, because C++ hates that.
1550+ */
15471551
15481552 struct __ec_todo_unpacked {
15491553 uint8_t num;
@@ -1597,11 +1601,13 @@ struct ec_response_lightbar { · 47 unmodified lines
15971601 uint8_t red, green, blue;
15981602 } get_rgb;
15991603
1600− struct {
1601− /* no return params */
1602− } off, on, init, set_brightness, seq, reg, set_rgb,
1603− demo, set_params_v0, set_params_v1,
1604− set_program, manual_suspend_ctrl, suspend, resume;
1604+ /*
1605+ * The following commands have no response:
1606+ *
1607+ * off, on, init, set_brightness, seq, reg, set_rgb,
1608+ * set_params_v0, set_params_v1, set_program,
1609+ * manual_suspend_ctrl, suspend, resume
1610+ */
16051611 };
16061612 } __ec_todo_packed;
16071613
@@ -3021,9 +3027,7 @@ enum charge_state_params { · 1413 unmodified lines
30213027 struct ec_params_charge_state {
30223028 uint8_t cmd; /* enum charge_state_command */
30233029 union {
3024− struct {
3025− /* no args */
3026− } get_state;
3030+ /* get_state has no args */
30273031
30283032 struct __ec_todo_unpacked {
30293033 uint32_t param; /* enum charge_state_param */
@@ -3049,9 +3053,8 @@ struct ec_response_charge_state { · 19 unmodified lines
30493053 struct __ec_align4 {
30503054 uint32_t value;
30513055 } get_param;
3052− struct {
3053− /* no return values */
3054− } set_param;
3056+
3057+ /* set_param returns no args */
30553058 };
30563059 } __ec_align4;
30573060

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t