static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
amixer->input = rsc;
- if (NULL == rsc)
+ if (!rsc)
hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT);
else
hw->amixer_set_x(amixer->rsc.ctrl_blk,
/* y is a 14-bit immediate constant */
static int amixer_set_y(struct amixer *amixer, unsigned int y)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
hw->amixer_set_y(amixer->rsc.ctrl_blk, y);
return 0;
static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv);
return 0;
static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
amixer->sum = sum;
- if (NULL == sum) {
+ if (!sum) {
hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
} else {
hw->amixer_set_se(amixer->rsc.ctrl_blk, 1);
static int amixer_commit_write(struct amixer *amixer)
{
- struct hw *hw = NULL;
- unsigned int index = 0;
- int i = 0;
- struct rsc *input = NULL;
- struct sum *sum = NULL;
+ struct hw *hw;
+ unsigned int index;
+ int i;
+ struct rsc *input;
+ struct sum *sum;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
input = amixer->input;
sum = amixer->sum;
/* Program master and conjugate resources */
amixer->rsc.ops->master(&amixer->rsc);
- if (NULL != input)
+ if (input)
input->ops->master(input);
- if (NULL != sum)
+ if (sum)
sum->rsc.ops->master(&sum->rsc);
for (i = 0; i < amixer->rsc.msr; i++) {
hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk);
- if (NULL != input) {
+ if (input) {
hw->amixer_set_x(amixer->rsc.ctrl_blk,
input->ops->output_slot(input));
input->ops->next_conj(input);
}
- if (NULL != sum) {
+ if (sum) {
hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
sum->rsc.ops->index(&sum->rsc));
sum->rsc.ops->next_conj(&sum->rsc);
amixer->rsc.ops->next_conj(&amixer->rsc);
}
amixer->rsc.ops->master(&amixer->rsc);
- if (NULL != input)
+ if (input)
input->ops->master(input);
- if (NULL != sum)
+ if (sum)
sum->rsc.ops->master(&sum->rsc);
return 0;
static int amixer_commit_raw_write(struct amixer *amixer)
{
- struct hw *hw = NULL;
- unsigned int index = 0;
+ struct hw *hw;
+ unsigned int index;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
index = amixer->rsc.ops->output_slot(&amixer->rsc);
hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
static int amixer_get_y(struct amixer *amixer)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)amixer->rsc.hw;
+ hw = amixer->rsc.hw;
return hw->amixer_get_y(amixer->rsc.ctrl_blk);
}
const struct amixer_desc *desc,
struct amixer_mgr *mgr)
{
- int err = 0;
+ int err;
err = rsc_init(&amixer->rsc, amixer->idx[0],
AMIXER, desc->msr, mgr->mgr.hw);
const struct amixer_desc *desc,
struct amixer **ramixer)
{
- int err = 0, i = 0;
- unsigned int idx = 0;
- struct amixer *amixer = NULL;
+ int err, i;
+ unsigned int idx;
+ struct amixer *amixer;
unsigned long flags;
*ramixer = NULL;
/* Allocate mem for amixer resource */
amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
- if (NULL == amixer) {
- err = -ENOMEM;
- return err;
- }
+ if (!amixer)
+ return -ENOMEM;
/* Check whether there are sufficient
* amixer resources to meet request. */
+ err = 0;
spin_lock_irqsave(&mgr->mgr_lock, flags);
for (i = 0; i < desc->msr; i++) {
err = mgr_get_resource(&mgr->mgr, 1, &idx);
static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
{
unsigned long flags;
- int i = 0;
+ int i;
spin_lock_irqsave(&mgr->mgr_lock, flags);
for (i = 0; i < amixer->rsc.msr; i++)
int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr)
{
- int err = 0;
+ int err;
struct amixer_mgr *amixer_mgr;
*ramixer_mgr = NULL;
amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL);
- if (NULL == amixer_mgr)
+ if (!amixer_mgr)
return -ENOMEM;
err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw);
const struct sum_desc *desc,
struct sum_mgr *mgr)
{
- int err = 0;
+ int err;
err = rsc_init(&sum->rsc, sum->idx[0], SUM, desc->msr, mgr->mgr.hw);
if (err)
const struct sum_desc *desc,
struct sum **rsum)
{
- int err = 0, i = 0;
- unsigned int idx = 0;
- struct sum *sum = NULL;
+ int err, i;
+ unsigned int idx;
+ struct sum *sum;
unsigned long flags;
*rsum = NULL;
/* Allocate mem for sum resource */
sum = kzalloc(sizeof(*sum), GFP_KERNEL);
- if (NULL == sum) {
- err = -ENOMEM;
- return err;
- }
+ if (!sum)
+ return -ENOMEM;
/* Check whether there are sufficient sum resources to meet request. */
+ err = 0;
spin_lock_irqsave(&mgr->mgr_lock, flags);
for (i = 0; i < desc->msr; i++) {
err = mgr_get_resource(&mgr->mgr, 1, &idx);
static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum)
{
unsigned long flags;
- int i = 0;
+ int i;
spin_lock_irqsave(&mgr->mgr_lock, flags);
for (i = 0; i < sum->rsc.msr; i++)
int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr)
{
- int err = 0;
+ int err;
struct sum_mgr *sum_mgr;
*rsum_mgr = NULL;
sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL);
- if (NULL == sum_mgr)
+ if (!sum_mgr)
return -ENOMEM;
err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw);