From d6f1c1c3646276c0784398d4ab31a9c307a6e15f Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 10 Feb 2011 17:26:12 +1300 Subject: [PATCH] ALSA: asihpi - Allow adapters with duplicate index jumpers to be discovered. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpicmn.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index 4b3f4761cba5..3e9c5c289764 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c @@ -78,8 +78,18 @@ u16 hpi_add_adapter(struct hpi_adapter_obj *pao) } if (adapters.adapter[pao->index].adapter_type) { - { - retval = HPI_DUPLICATE_ADAPTER_NUMBER; + int a; + for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { + if (!adapters.adapter[a].adapter_type) { + HPI_DEBUG_LOG(WARNING, + "ASI%X duplicate index %d moved to %d\n", + pao->adapter_type, pao->index, a); + pao->index = a; + break; + } + } + if (a < 0) { + retval = HPI_ERROR_DUPLICATE_ADAPTER_NUMBER; goto unlock; } } -- 2.30.2