diff options
| author | Will Deacon <willdeacon@google.com> | 2020-12-15 17:15:38 +0000 |
|---|---|---|
| committer | Giuliano Procida <gprocida@google.com> | 2021-01-05 15:58:52 +0000 |
| commit | fcd4fb6f4fa9b76a9ff8d4e923201311588f49f6 (patch) | |
| tree | 0c1dfb3be7b4aca256d3d1f8941cf81ef340a19f /drivers | |
| parent | 73251a2c8ca2bc680a69c0e50446d17b7e1ba416 (diff) | |
ANDROID: usb: f_accessory: Avoid bitfields for shared variables
Using bitfields for shared variables is a "bad idea", as they require
a non-atomic read-modify-write to be generated by the compiler, which can
cause updates to unrelated bits in the same word to disappear.
Ensure the 'online' and 'disconnected' members of 'struct acc_dev' are
placed in separate variables by declaring them each as 'int'.
Bug: 173789633
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ia6031d82a764e83b2cc3502fbe5fb273511da752
Signed-off-by: Giuliano Procida <gprocida@google.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/usb/gadget/function/f_accessory.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_accessory.c b/drivers/usb/gadget/function/f_accessory.c index eb544c26dbee..d43f8fb89701 100644 --- a/drivers/usb/gadget/function/f_accessory.c +++ b/drivers/usb/gadget/function/f_accessory.c @@ -82,13 +82,13 @@ struct acc_dev { /* online indicates state of function_set_alt & function_unbind * set to 1 when we connect */ - int online:1; + int online; /* disconnected indicates state of open & release * Set to 1 when we disconnect. * Not cleared until our file is closed. */ - int disconnected:1; + int disconnected; /* strings sent by the host */ char manufacturer[ACC_STRING_SIZE]; |
