Skip to content

fmcomms5_phase_sync: ambiguous code in quad_tracking() #75

Open
@julienmalik

Description

@julienmalik

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions