On 11/14/19 4:32 PM, Takashi Iwai wrote:
On Thu, 14 Nov 2019 04:37:04 +0100, Nikhil Mahale wrote:
@@ -3494,11 +3500,86 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { .master_unbind = generic_acomp_master_unbind, };
+static int nvhdmi_find_pcm_slot(struct hdmi_spec *spec,
struct hdmi_spec_per_pin *per_pin)
+{
- int i;
- /*
* generic_hdmi_build_pcms() allocates (num_nids + dev_num - 1)
* number of pcms.
*
* The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n if m==0.
* This guarantees that dynamic pcm assignments are compatible with the
* legacy static per_pin-pmc assignment that existed in the days before
* DP-MST.
*
* per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)).
*/
- if (per_pin->dev_id == 0 &&
!test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap))
return per_pin->pin_nid_idx;
- if (per_pin->dev_id != 0 &&
!(test_bit(spec->num_nids + (per_pin->dev_id - 1),
&spec->pcm_bitmap))) {
return spec->num_nids + (per_pin->dev_id - 1);
- }
- /* have a second try; check the area over num_nids */
- for (i = spec->num_nids; i < spec->pcm_used; i++) {
if (!test_bit(i, &spec->pcm_bitmap))
return i;
- }
- /* the last try; check the empty slots in pins */
- for (i = 0; i < spec->num_nids; i++) {
if (!test_bit(i, &spec->pcm_bitmap))
return i;
- }
- return -EBUSY;
+}
I think this can be applied for Intel case, too. No need for creating yet another indirect branch.
Do you mean I should replace existing logic in hdmi_find_pcm_slot() by this new logic?
Thanks, Nikhil Mahale
thanks,
Takashi
----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -----------------------------------------------------------------------------------