Re: [PATCH RFC v5 6/6] iio: osf: register IIO devices from capabilities
From: Andy Shevchenko
Date: Tue Jun 16 2026 - 07:32:37 EST
On Tue, Jun 16, 2026 at 04:22:42PM +0900, Jinseob Kim wrote:
> Register IIO devices for supported Open Sensor Fusion capability entries
> and push received samples into IIO buffers when enabled.
...
> help
> - Build the Open Sensor Fusion UART receive path.
> + Build the Open Sensor Fusion UART IIO driver.
>
> - The driver receives OSF protocol frames over a serdev UART.
> - Frames are decoded and validated before being passed to the
> - driver core.
> - This patch only adds the transport path.
> - IIO device registration is added separately.
> + The driver receives OSF protocol frames over a serdev UART and
> + registers IIO devices for supported capability entries.
Can't you fix this in the initial patch?
...
> obj-$(CONFIG_OPEN_SENSOR_FUSION) += open-sensor-fusion.o
>
> -open-sensor-fusion-y := osf_core.o osf_protocol.o osf_serdev.o osf_stream.o
> +open-sensor-fusion-y := osf_core.o osf_iio.o osf_protocol.o osf_serdev.o \
> + osf_stream.o
Modify the original code the way that this will only have a + line.
...
> void osf_core_unregister_iio(struct osf_device *osf)
> {
> + unsigned int i;
> +
> + for (i = 0; i < osf->iio_dev_count; i++)
For all for-loops where it's not going outside it
for (unsigned int i = 0; i < osf->iio_dev_count; i++)
> + osf_iio_unregister_sensor(osf->iio_devs[i].indio_dev);
> +
> + osf->iio_dev_count = 0;
> +}
...
> - ret = osf_core_validate_sensor_sample(&frame);
> - break;
> + return osf_core_handle_sensor_sample(osf, &frame);
> case OSF_MSG_DEVICE_STATUS:
> - ret = osf_core_validate_device_status(&frame);
> - break;
> + return osf_core_handle_device_status(osf, &frame);
> case OSF_MSG_CAPABILITY_REPORT:
> - ret = osf_core_validate_capability_report(&frame);
> - break;
> + return osf_core_handle_capability_report(osf, &frame);
> default:
> if (frame.message_type >= OSF_RESERVED_MSG_FIRST &&
> frame.message_type <= OSF_RESERVED_MSG_LAST)
> - ret = 0;
> - else if (frame.message_type >= OSF_VENDOR_PRIVATE_FIRST)
> - ret = 0;
> - else
> - ret = -EOPNOTSUPP;
> - break;
> + return 0;
> + if (frame.message_type >= OSF_VENDOR_PRIVATE_FIRST)
> + return 0;
> + return -EOPNOTSUPP;
With my suggestion this can be done in the initial patch.
So, this indeed needs a lot of work as for RFC :-)
I stop here.
--
With Best Regards,
Andy Shevchenko