Re: [PATCH] soundwire: stream: validate slave port against DisCo port bitmap

From: chang wu

Date: Tue Jul 14 2026 - 04:45:32 EST


> Smart, good idea. I would recommend adding the first sentence as code comments, I had to look up the code to figure out what it did.

I'll add a short comment explaining that the generic range check does
not verify whether the Slave exposes the port for the requested
direction.

> That's a problem in general, maybe push this patch first through the Intel/SOF CI to check that some SoundWire platforms are tested?

I'll run the updated patch through the Intel/SOF CI before posting v2.

> That comment is a tad misleading.
>
> In the real world, all drivers ignore DisCo properties provided by platform firmware, and hard-code the values, e.g.
>
> prop->source_ports = 0x14; /* BITMAP: 00010100 */
> prop->sink_ports = 0x8; /* BITMAP: 00001000 */
>
> Those properties are really not optional at all, what's optional is that they are blindly read from firmware.

Agreed. Describing source_ports and sink_ports as optional is
inaccurate.So I'll rework the comment.


> This test is a bit odd, there could be cases where only source_ports are defined so you would try to check for a sink_port in sdw_get_slave_dpn_prop()
> It probably works in the end but maybe you could check s_rt->direction with source/sink port first?

I'll select the relevant bitmap based on the stream direction first and
reject a zero bitmap for that direction.