device: change device_usb logic

Allow PPPS function even if there is no device->usb callback. PPPS is
useable even with no control interface.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
Dmitry Baryshkov
2023-10-02 17:32:13 +03:00
parent f09b3e1b2b
commit fb23cabbc4

View File

@@ -254,12 +254,10 @@ void device_print_status(struct device *device)
void device_usb(struct device *device, bool on)
{
if (device->usb) {
if (device->ppps_path)
ppps_power(device, on);
else
device->usb(device, on);
}
if (device->ppps_path)
ppps_power(device, on);
else if (device->usb)
device->usb(device, on);
}
int device_write(struct device *device, const void *buf, size_t len)