Merge "usb: pd: Further differentiate errors from select_pdo_store"

tirimbino
qctecmdr Service 6 years ago committed by Gerrit - the friendly Code Review server
commit c1b1f71ede
  1. 18
      drivers/usb/pd/policy_engine.c

@ -3668,12 +3668,6 @@ static int usbpd_dr_set_property(struct dual_role_phy_instance *dual_role,
return -EAGAIN;
}
if (pd->current_state == PE_SNK_READY &&
!is_sink_tx_ok(pd)) {
usbpd_err(&pd->dev, "Rp indicates SinkTxNG\n");
return -EAGAIN;
}
mutex_lock(&pd->swap_lock);
reinit_completion(&pd->is_ready);
pd->send_dr_swap = true;
@ -3728,12 +3722,6 @@ static int usbpd_dr_set_property(struct dual_role_phy_instance *dual_role,
return -EAGAIN;
}
if (pd->current_state == PE_SNK_READY &&
!is_sink_tx_ok(pd)) {
usbpd_err(&pd->dev, "Rp indicates SinkTxNG\n");
return -EAGAIN;
}
mutex_lock(&pd->swap_lock);
reinit_completion(&pd->is_ready);
pd->send_pr_swap = true;
@ -4029,7 +4017,7 @@ static ssize_t select_pdo_store(struct device *dev,
mutex_lock(&pd->swap_lock);
/* Only allowed if we are already in explicit sink contract */
if (pd->current_state != PE_SNK_READY || !is_sink_tx_ok(pd)) {
if (pd->current_state != PE_SNK_READY) {
usbpd_err(&pd->dev, "select_pdo: Cannot select new PDO yet\n");
ret = -EBUSY;
goto out;
@ -4075,7 +4063,7 @@ static ssize_t select_pdo_store(struct device *dev,
if (pd->selected_pdo != pd->requested_pdo ||
pd->current_voltage != pd->requested_voltage) {
usbpd_err(&pd->dev, "select_pdo: request rejected\n");
ret = -EINVAL;
ret = -ECONNREFUSED;
}
out:
@ -4181,7 +4169,7 @@ static int trigger_tx_msg(struct usbpd *pd, bool *msg_tx_flag)
int ret = 0;
/* Only allowed if we are already in explicit sink contract */
if (pd->current_state != PE_SNK_READY || !is_sink_tx_ok(pd)) {
if (pd->current_state != PE_SNK_READY) {
usbpd_err(&pd->dev, "%s: Cannot send msg\n", __func__);
ret = -EBUSY;
goto out;

Loading…
Cancel
Save