#!/bin/sh -e # alsa-negative-index.dpatch by Thomas Hood # # DP: Negative indices are bitmasks . $(dirname $0)/DPATCH @DPATCH@ diff -urNad a/sound/core/init.c b/sound/core/init.c --- a/sound/core/init.c 2005-01-16 15:11:05.000000000 +0100 +++ b/sound/core/init.c 2005-01-16 15:12:00.000000000 +0100 @@ -84,16 +84,13 @@ write_lock(&snd_card_rwlock); if (idx < 0) { int idx2; - for (idx2 = 0; idx2 < snd_ecards_limit; idx2++) - if (!(snd_cards_lock & (1 << idx2))) { + for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) + if (~snd_cards_lock & idx & 1<= snd_ecards_limit) + snd_ecards_limit = idx + 1; break; } - if (idx < 0 && snd_ecards_limit < SNDRV_CARDS) - /* for dynamically additional devices like hotplug: - * increment the limit if still free slot exists. - */ - idx = snd_ecards_limit++; } else if (idx < snd_ecards_limit) { if (snd_cards_lock & (1 << idx)) err = -ENODEV; /* invalid */