>> +    if (val > 0 && val != AQ_HW_MEDIA_DETECT_CNT) {
>> +            netdev_err(self->ndev, "EDPD on this device could have
> only fixed value of %d\n",
>> +                       AQ_HW_MEDIA_DETECT_CNT);
>> +            return -EINVAL;
>> +    }
>> +
>> +    /* msecs plays no role - configuration is always fixed in PHY */
>> +    cfg->is_media_detect = val ? 1 : 0;
>> +
>> +    mutex_lock(&self->fwreq_mutex);
>> +    err = self->aq_fw_ops->set_media_detect(self->aq_hw,
> cfg->is_media_detect);
>> +    mutex_unlock(&self->fwreq_mutex);
>> +
>> +    return err;
>> +}
> 
>> +static int aq_fw2x_set_media_detect(struct aq_hw_s *self, bool on)
>> +{
>> +    u32 enable;
>> +    u32 offset;
>> +
>> +    if (self->fw_ver_actual < HW_ATL_FW_VER_MEDIA_CONTROL)
>> +            return -EOPNOTSUPP;
> 
> So if the firmware is tool old, you return -EOPNOTSUPP. But it appears
> cfg->is_media_detect has already been changed?

Hmm, right. The problem here will be that next --get edpd will return "enabled".

This'll also happen if by some reason FW command will fail to enable EDPD.

Think I have to save 'is_media_detect' only after successful FW operation.

Will send v3, thanks, good catch.

Regards,
  Igor

Reply via email to