Re: [PATCH v2 2/3] media: qcom: camss: csid: Stop using csid->id as both index and identifier
From: Nihal Kumar Gupta
Date: Fri Nov 27 2026 - 06:17:34 EST
On 27-11-2026 09:45, bryan.odonoghue@xxxxxxxxxx wrote:
> From: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
>
> We have thus far used csid->id as both a hardware identifier and as an
> index to the array of CSI devices.
>
> This is obviously not correct, but has thus far not been obviously
> damaging. Removing a piece of dark silicon CSID2 on x1e80100 we see that
> the reliance of csid->id as both hardware id and index is a brittle
> happenstance.
>
> A previous patch enumerated a .id field in the CSID resources structure.
> The purpose of the id field is to denote hardware identifier.
>
> Instead of maintaining both an hw_id and index field in the CSI
> data-structure pass the struct resource field to csid->id.
>
> Use helper functions from a previous commit to differentiate between CSID
> hardware-id and CSID index where appropriate.
>
> A level of granularity doing csid_index() and csid_hwid() in separate
> patches wouldn't work as we need to change the subdev_init() index and the
> meaning of that index atomically.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
Reviewed-by: Nihal Kumar Gupta <nihal.gupta@xxxxxxxxxxxxxxxx>
Tested-by: Nihal Kumar Gupta <nihal.gupta@xxxxxxxxxxxxxxxx> # Monaco EVK
> ---
> .../media/platform/qcom/camss/camss-csid-1080.c | 2 +-
> drivers/media/platform/qcom/camss/camss-csid-340.c | 6 ++--
> drivers/media/platform/qcom/camss/camss-csid-680.c | 4 +--
> .../media/platform/qcom/camss/camss-csid-gen3.c | 4 +--
> drivers/media/platform/qcom/camss/camss-csid.c | 34 +++++++++++++++-------
> drivers/media/platform/qcom/camss/camss-csid.h | 17 +++++++++++
> drivers/media/platform/qcom/camss/camss-csiphy.c | 2 +-
> drivers/media/platform/qcom/camss/camss.c | 3 +-
> 8 files changed, 51 insertions(+), 21 deletions(-)
>
...
--
Regards,
Nihal Kumar Gupta