| .. | .. |
|---|
| 166 | 166 | |
|---|
| 167 | 167 | static void ci_handle_id_switch(struct ci_hdrc *ci) |
|---|
| 168 | 168 | { |
|---|
| 169 | | - enum ci_role role = ci_otg_role(ci); |
|---|
| 169 | + enum ci_role role; |
|---|
| 170 | 170 | |
|---|
| 171 | + mutex_lock(&ci->mutex); |
|---|
| 172 | + role = ci_otg_role(ci); |
|---|
| 171 | 173 | if (role != ci->role) { |
|---|
| 172 | 174 | dev_dbg(ci->dev, "switching from %s to %s\n", |
|---|
| 173 | 175 | ci_role(ci)->name, ci->roles[role]->name); |
|---|
| .. | .. |
|---|
| 197 | 199 | if (role == CI_ROLE_GADGET) |
|---|
| 198 | 200 | ci_handle_vbus_change(ci); |
|---|
| 199 | 201 | } |
|---|
| 202 | + mutex_unlock(&ci->mutex); |
|---|
| 200 | 203 | } |
|---|
| 201 | 204 | /** |
|---|
| 202 | 205 | * ci_otg_work - perform otg (vbus/id) event handle |
|---|