Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c5cb93b authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge branch 'topic/ctxfi' into for-linus

* topic/ctxfi:
  ALSA: ctxfi - Simple code clean up
  ALSA: ctxfi - Native timer support for emu20k2
parents f604529d 35ebf6e7
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -11,9 +11,12 @@




/* Timer Registers */
/* Timer Registers */
#define TIMER_TIMR          0x1B7004
#define WC		0x1b7000
#define INTERRUPT_GIP       0x1B7010
#define TIMR		0x1b7004
#define INTERRUPT_GIE       0x1B7014
# define	TIMR_IE		(1<<15)
# define	TIMR_IP		(1<<14)
#define GIP		0x1b7010
#define GIE		0x1b7014


/* I2C Registers */
/* I2C Registers */
#define I2C_IF_ADDRESS   0x1B9000
#define I2C_IF_ADDRESS   0x1B9000
+10 −10
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
	hw = amixer->rsc.hw;
	hw = amixer->rsc.hw;
	hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
	hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
	amixer->input = rsc;
	amixer->input = rsc;
	if (NULL == rsc)
	if (!rsc)
		hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT);
		hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT);
	else
	else
		hw->amixer_set_x(amixer->rsc.ctrl_blk,
		hw->amixer_set_x(amixer->rsc.ctrl_blk,
@@ -99,7 +99,7 @@ static int amixer_set_sum(struct amixer *amixer, struct sum *sum)


	hw = amixer->rsc.hw;
	hw = amixer->rsc.hw;
	amixer->sum = sum;
	amixer->sum = sum;
	if (NULL == sum) {
	if (!sum) {
		hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
		hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
	} else {
	} else {
		hw->amixer_set_se(amixer->rsc.ctrl_blk, 1);
		hw->amixer_set_se(amixer->rsc.ctrl_blk, 1);
@@ -124,20 +124,20 @@ static int amixer_commit_write(struct amixer *amixer)


	/* Program master and conjugate resources */
	/* Program master and conjugate resources */
	amixer->rsc.ops->master(&amixer->rsc);
	amixer->rsc.ops->master(&amixer->rsc);
	if (NULL != input)
	if (input)
		input->ops->master(input);
		input->ops->master(input);


	if (NULL != sum)
	if (sum)
		sum->rsc.ops->master(&sum->rsc);
		sum->rsc.ops->master(&sum->rsc);


	for (i = 0; i < amixer->rsc.msr; i++) {
	for (i = 0; i < amixer->rsc.msr; i++) {
		hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk);
		hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk);
		if (NULL != input) {
		if (input) {
			hw->amixer_set_x(amixer->rsc.ctrl_blk,
			hw->amixer_set_x(amixer->rsc.ctrl_blk,
						input->ops->output_slot(input));
						input->ops->output_slot(input));
			input->ops->next_conj(input);
			input->ops->next_conj(input);
		}
		}
		if (NULL != sum) {
		if (sum) {
			hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
			hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
						sum->rsc.ops->index(&sum->rsc));
						sum->rsc.ops->index(&sum->rsc));
			sum->rsc.ops->next_conj(&sum->rsc);
			sum->rsc.ops->next_conj(&sum->rsc);
@@ -147,10 +147,10 @@ static int amixer_commit_write(struct amixer *amixer)
		amixer->rsc.ops->next_conj(&amixer->rsc);
		amixer->rsc.ops->next_conj(&amixer->rsc);
	}
	}
	amixer->rsc.ops->master(&amixer->rsc);
	amixer->rsc.ops->master(&amixer->rsc);
	if (NULL != input)
	if (input)
		input->ops->master(input);
		input->ops->master(input);


	if (NULL != sum)
	if (sum)
		sum->rsc.ops->master(&sum->rsc);
		sum->rsc.ops->master(&sum->rsc);


	return 0;
	return 0;
@@ -303,7 +303,7 @@ int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr)


	*ramixer_mgr = NULL;
	*ramixer_mgr = NULL;
	amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL);
	amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL);
	if (NULL == amixer_mgr)
	if (!amixer_mgr)
		return -ENOMEM;
		return -ENOMEM;


	err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw);
	err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw);
@@ -456,7 +456,7 @@ int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr)


	*rsum_mgr = NULL;
	*rsum_mgr = NULL;
	sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL);
	sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL);
	if (NULL == sum_mgr)
	if (!sum_mgr)
		return -ENOMEM;
		return -ENOMEM;


	err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw);
	err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw);
+38 −39
Original line number Original line Diff line number Diff line
@@ -136,7 +136,7 @@ static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
	struct snd_pcm_runtime *runtime;
	struct snd_pcm_runtime *runtime;
	struct ct_vm *vm;
	struct ct_vm *vm;


	if (NULL == apcm->substream)
	if (!apcm->substream)
		return 0;
		return 0;


	runtime = apcm->substream->runtime;
	runtime = apcm->substream->runtime;
@@ -144,7 +144,7 @@ static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)


	apcm->vm_block = vm->map(vm, apcm->substream, runtime->dma_bytes);
	apcm->vm_block = vm->map(vm, apcm->substream, runtime->dma_bytes);


	if (NULL == apcm->vm_block)
	if (!apcm->vm_block)
		return -ENOENT;
		return -ENOENT;


	return 0;
	return 0;
@@ -154,7 +154,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
{
{
	struct ct_vm *vm;
	struct ct_vm *vm;


	if (NULL == apcm->vm_block)
	if (!apcm->vm_block)
		return;
		return;


	vm = atc->vm;
	vm = atc->vm;
@@ -231,16 +231,16 @@ atc_get_pitch(unsigned int input_rate, unsigned int output_rate)


static int select_rom(unsigned int pitch)
static int select_rom(unsigned int pitch)
{
{
	if ((pitch > 0x00428f5c) && (pitch < 0x01b851ec)) {
	if (pitch > 0x00428f5c && pitch < 0x01b851ec) {
		/* 0.26 <= pitch <= 1.72 */
		/* 0.26 <= pitch <= 1.72 */
		return 1;
		return 1;
	} else if ((0x01d66666 == pitch) || (0x01d66667 == pitch)) {
	} else if (pitch == 0x01d66666 || pitch == 0x01d66667) {
		/* pitch == 1.8375 */
		/* pitch == 1.8375 */
		return 2;
		return 2;
	} else if (0x02000000 == pitch) {
	} else if (pitch == 0x02000000) {
		/* pitch == 2 */
		/* pitch == 2 */
		return 3;
		return 3;
	} else if ((pitch >= 0x0) && (pitch <= 0x08000000)) {
	} else if (pitch >= 0x0 && pitch <= 0x08000000) {
		/* 0 <= pitch <= 8 */
		/* 0 <= pitch <= 8 */
		return 0;
		return 0;
	} else {
	} else {
@@ -283,7 +283,7 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
	/* Get AMIXER resource */
	/* Get AMIXER resource */
	n_amixer = (n_amixer < 2) ? 2 : n_amixer;
	n_amixer = (n_amixer < 2) ? 2 : n_amixer;
	apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
	apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
	if (NULL == apcm->amixers) {
	if (!apcm->amixers) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error1;
		goto error1;
	}
	}
@@ -311,7 +311,7 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
					INIT_VOL, atc->pcm[i+device*2]);
					INIT_VOL, atc->pcm[i+device*2]);
		mutex_unlock(&atc->atc_mutex);
		mutex_unlock(&atc->atc_mutex);
		src = src->ops->next_interleave(src);
		src = src->ops->next_interleave(src);
		if (NULL == src)
		if (!src)
			src = apcm->src;
			src = apcm->src;
	}
	}


@@ -334,7 +334,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
	struct srcimp *srcimp;
	struct srcimp *srcimp;
	int i;
	int i;


	if (NULL != apcm->srcimps) {
	if (apcm->srcimps) {
		for (i = 0; i < apcm->n_srcimp; i++) {
		for (i = 0; i < apcm->n_srcimp; i++) {
			srcimp = apcm->srcimps[i];
			srcimp = apcm->srcimps[i];
			srcimp->ops->unmap(srcimp);
			srcimp->ops->unmap(srcimp);
@@ -345,7 +345,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
		apcm->srcimps = NULL;
		apcm->srcimps = NULL;
	}
	}


	if (NULL != apcm->srccs) {
	if (apcm->srccs) {
		for (i = 0; i < apcm->n_srcc; i++) {
		for (i = 0; i < apcm->n_srcc; i++) {
			src_mgr->put_src(src_mgr, apcm->srccs[i]);
			src_mgr->put_src(src_mgr, apcm->srccs[i]);
			apcm->srccs[i] = NULL;
			apcm->srccs[i] = NULL;
@@ -354,7 +354,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
		apcm->srccs = NULL;
		apcm->srccs = NULL;
	}
	}


	if (NULL != apcm->amixers) {
	if (apcm->amixers) {
		for (i = 0; i < apcm->n_amixer; i++) {
		for (i = 0; i < apcm->n_amixer; i++) {
			amixer_mgr->put_amixer(amixer_mgr, apcm->amixers[i]);
			amixer_mgr->put_amixer(amixer_mgr, apcm->amixers[i]);
			apcm->amixers[i] = NULL;
			apcm->amixers[i] = NULL;
@@ -363,17 +363,17 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
		apcm->amixers = NULL;
		apcm->amixers = NULL;
	}
	}


	if (NULL != apcm->mono) {
	if (apcm->mono) {
		sum_mgr->put_sum(sum_mgr, apcm->mono);
		sum_mgr->put_sum(sum_mgr, apcm->mono);
		apcm->mono = NULL;
		apcm->mono = NULL;
	}
	}


	if (NULL != apcm->src) {
	if (apcm->src) {
		src_mgr->put_src(src_mgr, apcm->src);
		src_mgr->put_src(src_mgr, apcm->src);
		apcm->src = NULL;
		apcm->src = NULL;
	}
	}


	if (NULL != apcm->vm_block) {
	if (apcm->vm_block) {
		/* Undo device virtual mem map */
		/* Undo device virtual mem map */
		ct_unmap_audio_buffer(atc, apcm);
		ct_unmap_audio_buffer(atc, apcm);
		apcm->vm_block = NULL;
		apcm->vm_block = NULL;
@@ -419,7 +419,7 @@ static int atc_pcm_stop(struct ct_atc *atc, struct ct_atc_pcm *apcm)
	src->ops->set_state(src, SRC_STATE_OFF);
	src->ops->set_state(src, SRC_STATE_OFF);
	src->ops->commit_write(src);
	src->ops->commit_write(src);


	if (NULL != apcm->srccs) {
	if (apcm->srccs) {
		for (i = 0; i < apcm->n_srcc; i++) {
		for (i = 0; i < apcm->n_srcc; i++) {
			src = apcm->srccs[i];
			src = apcm->srccs[i];
			src->ops->set_bm(src, 0);
			src->ops->set_bm(src, 0);
@@ -544,18 +544,18 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)


	if (n_srcc) {
	if (n_srcc) {
		apcm->srccs = kzalloc(sizeof(void *)*n_srcc, GFP_KERNEL);
		apcm->srccs = kzalloc(sizeof(void *)*n_srcc, GFP_KERNEL);
		if (NULL == apcm->srccs)
		if (!apcm->srccs)
			return -ENOMEM;
			return -ENOMEM;
	}
	}
	if (n_amixer) {
	if (n_amixer) {
		apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
		apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
		if (NULL == apcm->amixers) {
		if (!apcm->amixers) {
			err = -ENOMEM;
			err = -ENOMEM;
			goto error1;
			goto error1;
		}
		}
	}
	}
	apcm->srcimps = kzalloc(sizeof(void *)*n_srcimp, GFP_KERNEL);
	apcm->srcimps = kzalloc(sizeof(void *)*n_srcimp, GFP_KERNEL);
	if (NULL == apcm->srcimps) {
	if (!apcm->srcimps) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error1;
		goto error1;
	}
	}
@@ -818,7 +818,7 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
	/* Get AMIXER resource */
	/* Get AMIXER resource */
	n_amixer = (n_amixer < 2) ? 2 : n_amixer;
	n_amixer = (n_amixer < 2) ? 2 : n_amixer;
	apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
	apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
	if (NULL == apcm->amixers) {
	if (!apcm->amixers) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error1;
		goto error1;
	}
	}
@@ -919,7 +919,7 @@ spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
		amixer = apcm->amixers[i];
		amixer = apcm->amixers[i];
		amixer->ops->setup(amixer, &src->rsc, INIT_VOL, NULL);
		amixer->ops->setup(amixer, &src->rsc, INIT_VOL, NULL);
		src = src->ops->next_interleave(src);
		src = src->ops->next_interleave(src);
		if (NULL == src)
		if (!src)
			src = apcm->src;
			src = apcm->src;
	}
	}
	/* Connect to SPDIFOO */
	/* Connect to SPDIFOO */
@@ -1121,7 +1121,7 @@ static int atc_release_resources(struct ct_atc *atc)
	struct ct_mixer *mixer = NULL;
	struct ct_mixer *mixer = NULL;


	/* disconnect internal mixer objects */
	/* disconnect internal mixer objects */
	if (NULL != atc->mixer) {
	if (atc->mixer) {
		mixer = atc->mixer;
		mixer = atc->mixer;
		mixer->set_input_left(mixer, MIX_LINE_IN, NULL);
		mixer->set_input_left(mixer, MIX_LINE_IN, NULL);
		mixer->set_input_right(mixer, MIX_LINE_IN, NULL);
		mixer->set_input_right(mixer, MIX_LINE_IN, NULL);
@@ -1131,7 +1131,7 @@ static int atc_release_resources(struct ct_atc *atc)
		mixer->set_input_right(mixer, MIX_SPDIF_IN, NULL);
		mixer->set_input_right(mixer, MIX_SPDIF_IN, NULL);
	}
	}


	if (NULL != atc->daios) {
	if (atc->daios) {
		daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
		daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
		for (i = 0; i < atc->n_daio; i++) {
		for (i = 0; i < atc->n_daio; i++) {
			daio = atc->daios[i];
			daio = atc->daios[i];
@@ -1149,7 +1149,7 @@ static int atc_release_resources(struct ct_atc *atc)
		atc->daios = NULL;
		atc->daios = NULL;
	}
	}


	if (NULL != atc->pcm) {
	if (atc->pcm) {
		sum_mgr = atc->rsc_mgrs[SUM];
		sum_mgr = atc->rsc_mgrs[SUM];
		for (i = 0; i < atc->n_pcm; i++)
		for (i = 0; i < atc->n_pcm; i++)
			sum_mgr->put_sum(sum_mgr, atc->pcm[i]);
			sum_mgr->put_sum(sum_mgr, atc->pcm[i]);
@@ -1158,7 +1158,7 @@ static int atc_release_resources(struct ct_atc *atc)
		atc->pcm = NULL;
		atc->pcm = NULL;
	}
	}


	if (NULL != atc->srcs) {
	if (atc->srcs) {
		src_mgr = atc->rsc_mgrs[SRC];
		src_mgr = atc->rsc_mgrs[SRC];
		for (i = 0; i < atc->n_src; i++)
		for (i = 0; i < atc->n_src; i++)
			src_mgr->put_src(src_mgr, atc->srcs[i]);
			src_mgr->put_src(src_mgr, atc->srcs[i]);
@@ -1167,7 +1167,7 @@ static int atc_release_resources(struct ct_atc *atc)
		atc->srcs = NULL;
		atc->srcs = NULL;
	}
	}


	if (NULL != atc->srcimps) {
	if (atc->srcimps) {
		srcimp_mgr = atc->rsc_mgrs[SRCIMP];
		srcimp_mgr = atc->rsc_mgrs[SRCIMP];
		for (i = 0; i < atc->n_srcimp; i++) {
		for (i = 0; i < atc->n_srcimp; i++) {
			srcimp = atc->srcimps[i];
			srcimp = atc->srcimps[i];
@@ -1185,7 +1185,7 @@ static int ct_atc_destroy(struct ct_atc *atc)
{
{
	int i = 0;
	int i = 0;


	if (NULL == atc)
	if (!atc)
		return 0;
		return 0;


	if (atc->timer) {
	if (atc->timer) {
@@ -1196,21 +1196,20 @@ static int ct_atc_destroy(struct ct_atc *atc)
	atc_release_resources(atc);
	atc_release_resources(atc);


	/* Destroy internal mixer objects */
	/* Destroy internal mixer objects */
	if (NULL != atc->mixer)
	if (atc->mixer)
		ct_mixer_destroy(atc->mixer);
		ct_mixer_destroy(atc->mixer);


	for (i = 0; i < NUM_RSCTYP; i++) {
	for (i = 0; i < NUM_RSCTYP; i++) {
		if ((NULL != rsc_mgr_funcs[i].destroy) &&
		if (rsc_mgr_funcs[i].destroy && atc->rsc_mgrs[i])
		    (NULL != atc->rsc_mgrs[i]))
			rsc_mgr_funcs[i].destroy(atc->rsc_mgrs[i]);
			rsc_mgr_funcs[i].destroy(atc->rsc_mgrs[i]);


	}
	}


	if (NULL != atc->hw)
	if (atc->hw)
		destroy_hw_obj((struct hw *)atc->hw);
		destroy_hw_obj((struct hw *)atc->hw);


	/* Destroy device virtual memory manager object */
	/* Destroy device virtual memory manager object */
	if (NULL != atc->vm) {
	if (atc->vm) {
		ct_vm_destroy(atc->vm);
		ct_vm_destroy(atc->vm);
		atc->vm = NULL;
		atc->vm = NULL;
	}
	}
@@ -1275,7 +1274,7 @@ int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc)
	alsa_dev_funcs[MIXER].public_name = atc->chip_name;
	alsa_dev_funcs[MIXER].public_name = atc->chip_name;


	for (i = 0; i < NUM_CTALSADEVS; i++) {
	for (i = 0; i < NUM_CTALSADEVS; i++) {
		if (NULL == alsa_dev_funcs[i].create)
		if (!alsa_dev_funcs[i].create)
			continue;
			continue;


		err = alsa_dev_funcs[i].create(atc, i,
		err = alsa_dev_funcs[i].create(atc, i,
@@ -1312,7 +1311,7 @@ static int __devinit atc_create_hw_devs(struct ct_atc *atc)
		return err;
		return err;


	for (i = 0; i < NUM_RSCTYP; i++) {
	for (i = 0; i < NUM_RSCTYP; i++) {
		if (NULL == rsc_mgr_funcs[i].create)
		if (!rsc_mgr_funcs[i].create)
			continue;
			continue;


		err = rsc_mgr_funcs[i].create(atc->hw, &atc->rsc_mgrs[i]);
		err = rsc_mgr_funcs[i].create(atc->hw, &atc->rsc_mgrs[i]);
@@ -1339,19 +1338,19 @@ static int atc_get_resources(struct ct_atc *atc)
	int err, i;
	int err, i;


	atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL);
	atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL);
	if (NULL == atc->daios)
	if (!atc->daios)
		return -ENOMEM;
		return -ENOMEM;


	atc->srcs = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL);
	atc->srcs = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL);
	if (NULL == atc->srcs)
	if (!atc->srcs)
		return -ENOMEM;
		return -ENOMEM;


	atc->srcimps = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL);
	atc->srcimps = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL);
	if (NULL == atc->srcimps)
	if (!atc->srcimps)
		return -ENOMEM;
		return -ENOMEM;


	atc->pcm = kzalloc(sizeof(void *)*(2*4), GFP_KERNEL);
	atc->pcm = kzalloc(sizeof(void *)*(2*4), GFP_KERNEL);
	if (NULL == atc->pcm)
	if (!atc->pcm)
		return -ENOMEM;
		return -ENOMEM;


	daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
	daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
@@ -1648,7 +1647,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
	*ratc = NULL;
	*ratc = NULL;


	atc = kzalloc(sizeof(*atc), GFP_KERNEL);
	atc = kzalloc(sizeof(*atc), GFP_KERNEL);
	if (NULL == atc)
	if (!atc)
		return -ENOMEM;
		return -ENOMEM;


	/* Set operations */
	/* Set operations */
+15 −15
Original line number Original line Diff line number Diff line
@@ -173,7 +173,7 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)
	int i;
	int i;


	entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL);
	entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL);
	if (NULL == entry)
	if (!entry)
		return -ENOMEM;
		return -ENOMEM;


	/* Program master and conjugate resources */
	/* Program master and conjugate resources */
@@ -201,7 +201,7 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)
	int i;
	int i;


	entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL);
	entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL);
	if (NULL == entry)
	if (!entry)
		return -ENOMEM;
		return -ENOMEM;


	/* Program master and conjugate resources */
	/* Program master and conjugate resources */
@@ -228,7 +228,7 @@ static int dao_clear_left_input(struct dao *dao)
	struct daio *daio = &dao->daio;
	struct daio *daio = &dao->daio;
	int i;
	int i;


	if (NULL == dao->imappers[0])
	if (!dao->imappers[0])
		return 0;
		return 0;


	entry = dao->imappers[0];
	entry = dao->imappers[0];
@@ -252,7 +252,7 @@ static int dao_clear_right_input(struct dao *dao)
	struct daio *daio = &dao->daio;
	struct daio *daio = &dao->daio;
	int i;
	int i;


	if (NULL == dao->imappers[daio->rscl.msr])
	if (!dao->imappers[daio->rscl.msr])
		return 0;
		return 0;


	entry = dao->imappers[daio->rscl.msr];
	entry = dao->imappers[daio->rscl.msr];
@@ -408,7 +408,7 @@ static int dao_rsc_init(struct dao *dao,
		return err;
		return err;


	dao->imappers = kzalloc(sizeof(void *)*desc->msr*2, GFP_KERNEL);
	dao->imappers = kzalloc(sizeof(void *)*desc->msr*2, GFP_KERNEL);
	if (NULL == dao->imappers) {
	if (!dao->imappers) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error1;
		goto error1;
	}
	}
@@ -442,11 +442,11 @@ error1:


static int dao_rsc_uninit(struct dao *dao)
static int dao_rsc_uninit(struct dao *dao)
{
{
	if (NULL != dao->imappers) {
	if (dao->imappers) {
		if (NULL != dao->imappers[0])
		if (dao->imappers[0])
			dao_clear_left_input(dao);
			dao_clear_left_input(dao);


		if (NULL != dao->imappers[dao->daio.rscl.msr])
		if (dao->imappers[dao->daio.rscl.msr])
			dao_clear_right_input(dao);
			dao_clear_right_input(dao);


		kfree(dao->imappers);
		kfree(dao->imappers);
@@ -555,7 +555,7 @@ static int get_daio_rsc(struct daio_mgr *mgr,
	/* Allocate mem for daio resource */
	/* Allocate mem for daio resource */
	if (desc->type <= DAIO_OUT_MAX) {
	if (desc->type <= DAIO_OUT_MAX) {
		dao = kzalloc(sizeof(*dao), GFP_KERNEL);
		dao = kzalloc(sizeof(*dao), GFP_KERNEL);
		if (NULL == dao) {
		if (!dao) {
			err = -ENOMEM;
			err = -ENOMEM;
			goto error;
			goto error;
		}
		}
@@ -566,7 +566,7 @@ static int get_daio_rsc(struct daio_mgr *mgr,
		*rdaio = &dao->daio;
		*rdaio = &dao->daio;
	} else {
	} else {
		dai = kzalloc(sizeof(*dai), GFP_KERNEL);
		dai = kzalloc(sizeof(*dai), GFP_KERNEL);
		if (NULL == dai) {
		if (!dai) {
			err = -ENOMEM;
			err = -ENOMEM;
			goto error;
			goto error;
		}
		}
@@ -583,9 +583,9 @@ static int get_daio_rsc(struct daio_mgr *mgr,
	return 0;
	return 0;


error:
error:
	if (NULL != dao)
	if (dao)
		kfree(dao);
		kfree(dao);
	else if (NULL != dai)
	else if (dai)
		kfree(dai);
		kfree(dai);


	spin_lock_irqsave(&mgr->mgr_lock, flags);
	spin_lock_irqsave(&mgr->mgr_lock, flags);
@@ -663,7 +663,7 @@ static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry)
	int err;
	int err;


	spin_lock_irqsave(&mgr->imap_lock, flags);
	spin_lock_irqsave(&mgr->imap_lock, flags);
	if ((0 == entry->addr) && (mgr->init_imap_added)) {
	if (!entry->addr && mgr->init_imap_added) {
		input_mapper_delete(&mgr->imappers, mgr->init_imap,
		input_mapper_delete(&mgr->imappers, mgr->init_imap,
							daio_map_op, mgr);
							daio_map_op, mgr);
		mgr->init_imap_added = 0;
		mgr->init_imap_added = 0;
@@ -707,7 +707,7 @@ int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr)


	*rdaio_mgr = NULL;
	*rdaio_mgr = NULL;
	daio_mgr = kzalloc(sizeof(*daio_mgr), GFP_KERNEL);
	daio_mgr = kzalloc(sizeof(*daio_mgr), GFP_KERNEL);
	if (NULL == daio_mgr)
	if (!daio_mgr)
		return -ENOMEM;
		return -ENOMEM;


	err = rsc_mgr_init(&daio_mgr->mgr, DAIO, DAIO_RESOURCE_NUM, hw);
	err = rsc_mgr_init(&daio_mgr->mgr, DAIO, DAIO_RESOURCE_NUM, hw);
@@ -718,7 +718,7 @@ int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr)
	spin_lock_init(&daio_mgr->imap_lock);
	spin_lock_init(&daio_mgr->imap_lock);
	INIT_LIST_HEAD(&daio_mgr->imappers);
	INIT_LIST_HEAD(&daio_mgr->imappers);
	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
	if (NULL == entry) {
	if (!entry) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error2;
		goto error2;
	}
	}
+11 −11
Original line number Original line Diff line number Diff line
@@ -168,7 +168,7 @@ static int src_get_rsc_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;
	*rblk = blk;
@@ -494,7 +494,7 @@ static int src_mgr_get_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;
	*rblk = blk;
@@ -515,7 +515,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;
	*rblk = blk;
@@ -702,7 +702,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;
	*rblk = blk;
@@ -723,7 +723,7 @@ static int amixer_mgr_get_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	/*blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	/*blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;*/
	*rblk = blk;*/
@@ -909,7 +909,7 @@ static int dai_get_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;
	*rblk = blk;
@@ -958,7 +958,7 @@ static int dao_get_ctrl_blk(void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	*rblk = blk;
	*rblk = blk;
@@ -1152,7 +1152,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)


	*rblk = NULL;
	*rblk = NULL;
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	blk = kzalloc(sizeof(*blk), GFP_KERNEL);
	if (NULL == blk)
	if (!blk)
		return -ENOMEM;
		return -ENOMEM;


	blk->i2sctl = hw_read_20kx(hw, I2SCTL);
	blk->i2sctl = hw_read_20kx(hw, I2SCTL);
@@ -1808,7 +1808,7 @@ static int uaa_to_xfi(struct pci_dev *pci)
	/* By default, Hendrix card UAA Bar0 should be using memory... */
	/* By default, Hendrix card UAA Bar0 should be using memory... */
	io_base = pci_resource_start(pci, 0);
	io_base = pci_resource_start(pci, 0);
	mem_base = ioremap(io_base, pci_resource_len(pci, 0));
	mem_base = ioremap(io_base, pci_resource_len(pci, 0));
	if (NULL == mem_base)
	if (!mem_base)
		return -ENOENT;
		return -ENOENT;


	/* Read current mode from Mode Change Register */
	/* Read current mode from Mode Change Register */
@@ -1977,7 +1977,7 @@ static int hw_card_shutdown(struct hw *hw)


	hw->irq	= -1;
	hw->irq	= -1;


	if (NULL != ((void *)hw->mem_base))
	if (hw->mem_base)
		iounmap((void *)hw->mem_base);
		iounmap((void *)hw->mem_base);


	hw->mem_base = (unsigned long)NULL;
	hw->mem_base = (unsigned long)NULL;
@@ -2274,7 +2274,7 @@ int __devinit create_20k1_hw_obj(struct hw **rhw)


	*rhw = NULL;
	*rhw = NULL;
	hw20k1 = kzalloc(sizeof(*hw20k1), GFP_KERNEL);
	hw20k1 = kzalloc(sizeof(*hw20k1), GFP_KERNEL);
	if (NULL == hw20k1)
	if (!hw20k1)
		return -ENOMEM;
		return -ENOMEM;


	spin_lock_init(&hw20k1->reg_20k1_lock);
	spin_lock_init(&hw20k1->reg_20k1_lock);
Loading