diff options
Diffstat (limited to 'sound/pci/ctxfi/ctamixer.c')
-rw-r--r-- | sound/pci/ctxfi/ctamixer.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c index a1db51b3ead8..fee35cfc0c7f 100644 --- a/sound/pci/ctxfi/ctamixer.c +++ b/sound/pci/ctxfi/ctamixer.c | |||
@@ -63,7 +63,7 @@ static int amixer_set_input(struct amixer *amixer, struct rsc *rsc) | |||
63 | hw = amixer->rsc.hw; | 63 | hw = amixer->rsc.hw; |
64 | hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE); | 64 | hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE); |
65 | amixer->input = rsc; | 65 | amixer->input = rsc; |
66 | if (NULL == rsc) | 66 | if (!rsc) |
67 | hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT); | 67 | hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT); |
68 | else | 68 | else |
69 | hw->amixer_set_x(amixer->rsc.ctrl_blk, | 69 | hw->amixer_set_x(amixer->rsc.ctrl_blk, |
@@ -99,7 +99,7 @@ static int amixer_set_sum(struct amixer *amixer, struct sum *sum) | |||
99 | 99 | ||
100 | hw = amixer->rsc.hw; | 100 | hw = amixer->rsc.hw; |
101 | amixer->sum = sum; | 101 | amixer->sum = sum; |
102 | if (NULL == sum) { | 102 | if (!sum) { |
103 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 0); | 103 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 0); |
104 | } else { | 104 | } else { |
105 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 1); | 105 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 1); |
@@ -124,20 +124,20 @@ static int amixer_commit_write(struct amixer *amixer) | |||
124 | 124 | ||
125 | /* Program master and conjugate resources */ | 125 | /* Program master and conjugate resources */ |
126 | amixer->rsc.ops->master(&amixer->rsc); | 126 | amixer->rsc.ops->master(&amixer->rsc); |
127 | if (NULL != input) | 127 | if (input) |
128 | input->ops->master(input); | 128 | input->ops->master(input); |
129 | 129 | ||
130 | if (NULL != sum) | 130 | if (sum) |
131 | sum->rsc.ops->master(&sum->rsc); | 131 | sum->rsc.ops->master(&sum->rsc); |
132 | 132 | ||
133 | for (i = 0; i < amixer->rsc.msr; i++) { | 133 | for (i = 0; i < amixer->rsc.msr; i++) { |
134 | hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk); | 134 | hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk); |
135 | if (NULL != input) { | 135 | if (input) { |
136 | hw->amixer_set_x(amixer->rsc.ctrl_blk, | 136 | hw->amixer_set_x(amixer->rsc.ctrl_blk, |
137 | input->ops->output_slot(input)); | 137 | input->ops->output_slot(input)); |
138 | input->ops->next_conj(input); | 138 | input->ops->next_conj(input); |
139 | } | 139 | } |
140 | if (NULL != sum) { | 140 | if (sum) { |
141 | hw->amixer_set_sadr(amixer->rsc.ctrl_blk, | 141 | hw->amixer_set_sadr(amixer->rsc.ctrl_blk, |
142 | sum->rsc.ops->index(&sum->rsc)); | 142 | sum->rsc.ops->index(&sum->rsc)); |
143 | sum->rsc.ops->next_conj(&sum->rsc); | 143 | sum->rsc.ops->next_conj(&sum->rsc); |
@@ -147,10 +147,10 @@ static int amixer_commit_write(struct amixer *amixer) | |||
147 | amixer->rsc.ops->next_conj(&amixer->rsc); | 147 | amixer->rsc.ops->next_conj(&amixer->rsc); |
148 | } | 148 | } |
149 | amixer->rsc.ops->master(&amixer->rsc); | 149 | amixer->rsc.ops->master(&amixer->rsc); |
150 | if (NULL != input) | 150 | if (input) |
151 | input->ops->master(input); | 151 | input->ops->master(input); |
152 | 152 | ||
153 | if (NULL != sum) | 153 | if (sum) |
154 | sum->rsc.ops->master(&sum->rsc); | 154 | sum->rsc.ops->master(&sum->rsc); |
155 | 155 | ||
156 | return 0; | 156 | return 0; |
@@ -242,13 +242,12 @@ static int get_amixer_rsc(struct amixer_mgr *mgr, | |||
242 | 242 | ||
243 | /* Allocate mem for amixer resource */ | 243 | /* Allocate mem for amixer resource */ |
244 | amixer = kzalloc(sizeof(*amixer), GFP_KERNEL); | 244 | amixer = kzalloc(sizeof(*amixer), GFP_KERNEL); |
245 | if (NULL == amixer) { | 245 | if (!amixer) |
246 | err = -ENOMEM; | 246 | return -ENOMEM; |
247 | return err; | ||
248 | } | ||
249 | 247 | ||
250 | /* Check whether there are sufficient | 248 | /* Check whether there are sufficient |
251 | * amixer resources to meet request. */ | 249 | * amixer resources to meet request. */ |
250 | err = 0; | ||
252 | spin_lock_irqsave(&mgr->mgr_lock, flags); | 251 | spin_lock_irqsave(&mgr->mgr_lock, flags); |
253 | for (i = 0; i < desc->msr; i++) { | 252 | for (i = 0; i < desc->msr; i++) { |
254 | err = mgr_get_resource(&mgr->mgr, 1, &idx); | 253 | err = mgr_get_resource(&mgr->mgr, 1, &idx); |
@@ -304,7 +303,7 @@ int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr) | |||
304 | 303 | ||
305 | *ramixer_mgr = NULL; | 304 | *ramixer_mgr = NULL; |
306 | amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL); | 305 | amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL); |
307 | if (NULL == amixer_mgr) | 306 | if (!amixer_mgr) |
308 | return -ENOMEM; | 307 | return -ENOMEM; |
309 | 308 | ||
310 | err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw); | 309 | err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw); |
@@ -397,12 +396,11 @@ static int get_sum_rsc(struct sum_mgr *mgr, | |||
397 | 396 | ||
398 | /* Allocate mem for sum resource */ | 397 | /* Allocate mem for sum resource */ |
399 | sum = kzalloc(sizeof(*sum), GFP_KERNEL); | 398 | sum = kzalloc(sizeof(*sum), GFP_KERNEL); |
400 | if (NULL == sum) { | 399 | if (!sum) |
401 | err = -ENOMEM; | 400 | return -ENOMEM; |
402 | return err; | ||
403 | } | ||
404 | 401 | ||
405 | /* Check whether there are sufficient sum resources to meet request. */ | 402 | /* Check whether there are sufficient sum resources to meet request. */ |
403 | err = 0; | ||
406 | spin_lock_irqsave(&mgr->mgr_lock, flags); | 404 | spin_lock_irqsave(&mgr->mgr_lock, flags); |
407 | for (i = 0; i < desc->msr; i++) { | 405 | for (i = 0; i < desc->msr; i++) { |
408 | err = mgr_get_resource(&mgr->mgr, 1, &idx); | 406 | err = mgr_get_resource(&mgr->mgr, 1, &idx); |
@@ -458,7 +456,7 @@ int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr) | |||
458 | 456 | ||
459 | *rsum_mgr = NULL; | 457 | *rsum_mgr = NULL; |
460 | sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL); | 458 | sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL); |
461 | if (NULL == sum_mgr) | 459 | if (!sum_mgr) |
462 | return -ENOMEM; | 460 | return -ENOMEM; |
463 | 461 | ||
464 | err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw); | 462 | err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw); |