aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/asihpi/hpicmn.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/asihpi/hpicmn.c')
-rw-r--r--sound/pci/asihpi/hpicmn.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index bd47521b24e..7ed5c26c373 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -68,7 +68,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr)
68u16 hpi_add_adapter(struct hpi_adapter_obj *pao) 68u16 hpi_add_adapter(struct hpi_adapter_obj *pao)
69{ 69{
70 u16 retval = 0; 70 u16 retval = 0;
71 /*HPI_ASSERT(pao->wAdapterType); */ 71 /*HPI_ASSERT(pao->type); */
72 72
73 hpios_alistlock_lock(&adapters); 73 hpios_alistlock_lock(&adapters);
74 74
@@ -77,13 +77,13 @@ u16 hpi_add_adapter(struct hpi_adapter_obj *pao)
77 goto unlock; 77 goto unlock;
78 } 78 }
79 79
80 if (adapters.adapter[pao->index].adapter_type) { 80 if (adapters.adapter[pao->index].type) {
81 int a; 81 int a;
82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { 82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) {
83 if (!adapters.adapter[a].adapter_type) { 83 if (!adapters.adapter[a].type) {
84 HPI_DEBUG_LOG(WARNING, 84 HPI_DEBUG_LOG(WARNING,
85 "ASI%X duplicate index %d moved to %d\n", 85 "ASI%X duplicate index %d moved to %d\n",
86 pao->adapter_type, pao->index, a); 86 pao->type, pao->index, a);
87 pao->index = a; 87 pao->index = a;
88 break; 88 break;
89 } 89 }
@@ -104,13 +104,13 @@ unlock:
104 104
105void hpi_delete_adapter(struct hpi_adapter_obj *pao) 105void hpi_delete_adapter(struct hpi_adapter_obj *pao)
106{ 106{
107 if (!pao->adapter_type) { 107 if (!pao->type) {
108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n"); 108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n");
109 return; 109 return;
110 } 110 }
111 111
112 hpios_alistlock_lock(&adapters); 112 hpios_alistlock_lock(&adapters);
113 if (adapters.adapter[pao->index].adapter_type) 113 if (adapters.adapter[pao->index].type)
114 adapters.gw_num_adapters--; 114 adapters.gw_num_adapters--;
115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0])); 115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0]));
116 hpios_alistlock_unlock(&adapters); 116 hpios_alistlock_unlock(&adapters);
@@ -132,7 +132,7 @@ struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index)
132 } 132 }
133 133
134 pao = &adapters.adapter[adapter_index]; 134 pao = &adapters.adapter[adapter_index];
135 if (pao->adapter_type != 0) { 135 if (pao->type != 0) {
136 /* 136 /*
137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n", 137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n",
138 wAdapterIndex); 138 wAdapterIndex);
@@ -165,7 +165,7 @@ static void subsys_get_adapter(struct hpi_message *phm,
165 165
166 /* find the nCount'th nonzero adapter in array */ 166 /* find the nCount'th nonzero adapter in array */
167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) { 167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) {
168 if (adapters.adapter[index].adapter_type) { 168 if (adapters.adapter[index].type) {
169 if (!count) 169 if (!count)
170 break; 170 break;
171 count--; 171 count--;
@@ -174,11 +174,11 @@ static void subsys_get_adapter(struct hpi_message *phm,
174 174
175 if (index < HPI_MAX_ADAPTERS) { 175 if (index < HPI_MAX_ADAPTERS) {
176 phr->u.s.adapter_index = adapters.adapter[index].index; 176 phr->u.s.adapter_index = adapters.adapter[index].index;
177 phr->u.s.adapter_type = adapters.adapter[index].adapter_type; 177 phr->u.s.adapter_type = adapters.adapter[index].type;
178 } else { 178 } else {
179 phr->u.s.adapter_index = 0; 179 phr->u.s.adapter_index = 0;
180 phr->u.s.adapter_type = 0; 180 phr->u.s.adapter_type = 0;
181 phr->error = HPI_ERROR_BAD_ADAPTER_NUMBER; 181 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
182 } 182 }
183} 183}
184 184
@@ -324,6 +324,8 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
324 } 324 }
325 325
326 phr->error = 0; 326 phr->error = 0;
327 phr->specific_error = 0;
328 phr->version = 0;
327 329
328 /* set the default response size */ 330 /* set the default response size */
329 response_size = 331 response_size =
@@ -531,8 +533,12 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
531 found ? "Cached" : "Uncached", phm->adapter_index, 533 found ? "Cached" : "Uncached", phm->adapter_index,
532 pI->control_index, pI->control_type, phm->u.c.attribute); 534 pI->control_index, pI->control_type, phm->u.c.attribute);
533 535
534 if (found) 536 if (found) {
535 phr->size = (u16)response_size; 537 phr->size = (u16)response_size;
538 phr->type = HPI_TYPE_RESPONSE;
539 phr->object = phm->object;
540 phr->function = phm->function;
541 }
536 542
537 return found; 543 return found;
538} 544}
@@ -631,7 +637,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count,
631 if (!p_cache) 637 if (!p_cache)
632 return NULL; 638 return NULL;
633 639
634 p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count, 640 p_cache->p_info = kcalloc(control_count, sizeof(*p_cache->p_info),
635 GFP_KERNEL); 641 GFP_KERNEL);
636 if (!p_cache->p_info) { 642 if (!p_cache->p_info) {
637 kfree(p_cache); 643 kfree(p_cache);