Re: [PATCH 5/6 v6] sound: Add n64 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 13, 2021 at 05:13:22PM +0200, Lauri Kasanen wrote:
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	len = res->end - res->start + 1;
> +	priv->mi_reg_base = ioremap(res->start, len);

now with resources in place, you can use devm_platform_ioremap_resource,
which will make handling error cases simpler.

> +	if (!priv->mi_reg_base) {
> +		err = -EINVAL;
> +		goto fail_dma_alloc;
> +	}
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	len = res->end - res->start + 1;
> +	priv->ai_reg_base = ioremap(res->start, len);
> +	if (!priv->ai_reg_base) {
> +		err = -EINVAL;
> +		goto fail_mi_ioremap;
> +	}
> +
> +	err = snd_pcm_new(card, "N64 Audio", 0, 1, 0, &pcm);
> +	if (err < 0)
> +		goto fail_ioremaps;
> +
> +	pcm->private_data = priv;
> +	strcpy(pcm->name, "N64 Audio");
> +
> +	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &n64audio_pcm_ops);
> +	snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, card->dev, 0, 0);
> +
> +	strcpy(card->driver, "N64 Audio");
> +	strcpy(card->shortname, "N64 Audio");
> +	strcpy(card->longname, "N64 Audio");
> +
> +	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +	if (request_irq(res->start, n64audio_isr,

and here you can use devm_request_irq .

> +				IRQF_SHARED, "N64 Audio", priv)) {

is it really shared ? Looking at n64/init.c there is no other device
using this interrupt.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux