Re: [PATCH 1/2] media: rkvdec: reduce excessive stack usage in assemble_hw_pps()
From: David Laight <hidden>
Date: 2026-02-02 22:45:40
Also in:
linux-media, linux-rockchip, lkml, llvm
From: David Laight <hidden>
Date: 2026-02-02 22:45:40
Also in:
linux-media, linux-rockchip, lkml, llvm
On Mon, 02 Feb 2026 16:59:05 +0100 "Arnd Bergmann" [off-list ref] wrote: ...
- Since most of the fields are exactly 6 bits offset from a word boundary, you can try assembling all the *_field_order_cnt* fields in an array first that has all the bits in the correct order, but then shift the entire array six bits.
How are they being written to the hardware? It would be very unusual for hardware not to have things 'reasonably aligned'. This makes me think that the data buffer is actually being 'bit-bashed' down some serial data interface. In which case the simple solution is to give the function that writes the data a 'bit offset' for the first word. And to re-iterate C bit-fields are completely non portable and entirely inappropriate for mapping onto device registers. You can use C structures (arranged with everything on its natural boundary so there are no holes) with members declared with the correct endianness. Indeed that is actually preferable to using numeric constants as the offsets are tied to the correct structure. David
Arnd