sensor/av100: use <linux/ioctl.h> for _IOC_SIZEBITS in hi_spi.h#90
Merged
Conversation
Take 2 of the musl fix from #83. The previous attempt added <sys/ioctl.h>, which works under glibc (transitively pulls in <asm-generic/ioctl.h> with _IOC_SIZEBITS) but not under musl on arm — musl's <sys/ioctl.h> -> <bits/ioctl.h> chain doesn't re-export the kernel UAPI _IOC_SIZEBITS macro. Match the pattern that hi3516cv200/hi_spi.h and hi3516cv300/hi_spi.h already use: #include <linux/ioctl.h> This is the kernel UAPI header that defines _IOC_SIZEBITS directly (both libcs forward to it). No-op under glibc, fixes the musl build of imx117, imx123, imx185 (every av100 sensor whose *_sensor_ctl.c issues SPI_IOC_MESSAGE). Surfaced when OpenIPC/firmware#2056 wired the av100 source-built sensors via HISILICON_OPENSDK_SENSORS_hi3516av100 — the install foreach failed with "cannot stat libsns_imx117.so" / imx123 / imx185 because the libraries Makefile's "|| true" hid the per-sensor build failures, so #83 looked green but the install step couldn't find the missing .so files.
This was referenced May 8, 2026
widgetii
added a commit
that referenced
this pull request
May 9, 2026
Both libraries/Makefile and libraries/sensor/hi3516cv500/Makefile iterated subdirs with `make ... || true`, which silently swallowed per-sensor compile failures. Three musl-only header bugs surfaced this way during the per-platform sensor source migration: cv300/imx323 missing <linux/ioctl.h> -> _IOC_SIZEBITS fixed in #84 av100/imx117 missing -I kernel/pwm/hi3516av100 fixed in #83 av100/imx123/imx185 av100 hi_spi.h <sys/ioctl.h> vs musl fixed in #90 In each case the `Build SDK (chiparch)` CI job stayed green because the libraries Makefile reported success even when individual sensors didn't link. The breakage was only caught when the firmware-side INSTALL_TARGET_CMDS step couldn't stat the missing .so. For cv300 that even slipped past CI entirely (the install foreach uses `;` so its exit code is the LAST install's exit code) — only sysupgrading a real camera surfaced the missing libsns_imx323.so. Replace `|| true` with a fail-late accumulator: keep iterating so all errors surface in one CI run, then exit 1 with a summary list of failing dirs at the end. Verified locally: - all 7 platforms still build clean under arm-openipc-linux-gnueabi-gcc - injecting `#error` into one sensor source causes: * the surrounding sensors continue to build * the loop reports "Build failed for: ./sensor/.../" * make exits 1 (CI red) The libraries/Makefile and libraries/sensor/hi3516cv500/Makefile are independent invocation paths (the latter is reached when CHIPARCH=hi3516cv500 since the outer SUBDIRS filter pulls in ./sensor/hi3516cv500/ alongside its subsensors), so both need the same fix. Co-authored-by: Vasiliy Yakovlev <vixand@openipc.org> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Take 2 of the musl fix from #83. The previous attempt added `<sys/ioctl.h>`, which works under glibc (transitively pulls in `<asm-generic/ioctl.h>` with `_IOC_SIZEBITS`) but not under musl on arm — musl's `<sys/ioctl.h>` -> `<bits/ioctl.h>` chain doesn't re-export the kernel UAPI `_IOC_SIZEBITS` macro.
Match the pattern that `hi3516cv200/hi_spi.h` and `hi3516cv300/hi_spi.h` already use:
```diff
-#include <sys/ioctl.h>
+#include <linux/ioctl.h>
```
`<linux/ioctl.h>` is the kernel UAPI header that defines `_IOC_SIZEBITS` directly (both libcs forward to it). No-op under glibc, fixes the musl build of `imx117`, `imx123`, `imx185` — every av100 sensor whose `*_sensor_ctl.c` issues `SPI_IOC_MESSAGE`.
How surfaced
OpenIPC/firmware#2056's CI install step:
```
hi_spi.h:92:60: error: '_IOC_SIZEBITS' undeclared (first use in this function)
…
/usr/bin/install: cannot stat '.../sony_imx117/libsns_imx117.so': No such file or directory
/usr/bin/install: cannot stat '.../sony_imx123/libsns_imx123.so': No such file or directory
/usr/bin/install: cannot stat '.../sony_imx185/libsns_imx185.so': No such file or directory
```
The previous `<sys/ioctl.h>` change landed CI-green on #83 because the libraries Makefile's `|| true` hides per-sensor build failures — only the firmware-side install foreach surfaces them.
Test plan
🤖 Generated with Claude Code