Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmcomms5_phase_sync: ambiguous code in quad_tracking() #75

Open
julienmalik opened this issue Oct 20, 2021 · 1 comment
Open

fmcomms5_phase_sync: ambiguous code in quad_tracking() #75

julienmalik opened this issue Oct 20, 2021 · 1 comment

Comments

@julienmalik
Copy link
Contributor

The code inside quad_tracking function is ambiguous to me. It reads in current master :

int quad_tracking(bool enable)
{
    struct iio_channel *chn =
        iio_device_find_channel(dev_phy, "voltage0", enable);
    if (chn == NULL)
        return -ENODEV;
    iio_channel_attr_write(chn, "quadrature_tracking_en", "0");
    chn = iio_device_find_channel(dev_phy_slave, "voltage0", enable);
    if (chn == NULL)
        return -ENODEV;
    iio_channel_attr_write(chn, "quadrature_tracking_en", "0");
    return 0;
}

So the enable parameter is used for selecting the channel direction (tx or rx) when calling iio_device_find_channel, while I guess the meaning was to use it to configure the value to send in iio_channel_attr_write. All the more since quadrature_tracking_en is only a RX channel attr.

Since it is only called later with 0 for the enable parameter, it does not manifest as a bug.

Do you confirm ?

@tfcollins
Copy link
Contributor

Yes the naming of the function is wrong but the logic/behavior is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants