wiiproto_req_status(wdata);
spin_unlock_irqrestore(&wdata->state.lock, flags);
- ret = wiimote_cmd_wait(wdata);
- state = wdata->state.cmd_battery;
+ wiimote_cmd_wait(wdata);
wiimote_cmd_release(wdata);
- if (ret)
- return ret;
+ spin_lock_irqsave(&wdata->state.lock, flags);
+ state = wdata->state.cmd_battery;
+ spin_unlock_irqrestore(&wdata->state.lock, flags);
switch (psp) {
case POWER_SUPPLY_PROP_CAPACITY:
wiiext_event(wdata, false);
}
- if (wiimote_cmd_pending(wdata, WIIPROTO_REQ_SREQ, 0)) {
- wdata->state.cmd_battery = payload[5];
+ wdata->state.cmd_battery = payload[5];
+ if (wiimote_cmd_pending(wdata, WIIPROTO_REQ_SREQ, 0))
wiimote_cmd_complete(wdata);
- }
}
/* reduced generic report with "BB BB" key data only */
init_completion(&wdata->state.ready);
mutex_init(&wdata->state.sync);
wdata->state.drm = WIIPROTO_REQ_DRM_K;
+ wdata->state.cmd_battery = 0xff;
INIT_WORK(&wdata->init_worker, wiimote_init_worker);