From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Sat, 09 Dec 2023 07:24:11 +0000 Subject: [PATCH] add stmac read mac form eeprom --- kernel/drivers/media/pci/cx25821/cx25821-alsa.c | 37 ++++++++++++++----------------------- 1 files changed, 14 insertions(+), 23 deletions(-) diff --git a/kernel/drivers/media/pci/cx25821/cx25821-alsa.c b/kernel/drivers/media/pci/cx25821/cx25821-alsa.c index ef63806..608fbaf 100644 --- a/kernel/drivers/media/pci/cx25821/cx25821-alsa.c +++ b/kernel/drivers/media/pci/cx25821/cx25821-alsa.c @@ -1,19 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Driver for the Conexant CX25821 PCIe bridge * * Copyright (C) 2009 Conexant Systems Inc. * Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com> * Based on SAA713x ALSA driver and CX88 driver - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -62,8 +53,8 @@ struct cx25821_riscmem risc; void *vaddr; struct scatterlist *sglist; - int sglen; - int nr_pages; + int sglen; + unsigned long nr_pages; }; struct cx25821_audio_dev { @@ -120,7 +111,7 @@ MODULE_PARM_DESC(debug, "enable debug messages"); /**************************************************************************** - Module specific funtions + Module specific functions ****************************************************************************/ /* Constants taken from cx88-reg.h */ #define AUD_INT_DN_RISCI1 (1 << 0) @@ -140,7 +131,8 @@ #define PCI_MSK_AUD_EXT (1 << 4) #define PCI_MSK_AUD_INT (1 << 3) -static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, int nr_pages) +static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, + unsigned long nr_pages) { struct cx25821_audio_buffer *buf = chip->buf; struct page *pg; @@ -148,11 +140,11 @@ buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); if (NULL == buf->vaddr) { - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); return -ENOMEM; } - dprintk(1, "vmalloc is at addr 0x%p, size=%d\n", + dprintk(1, "vmalloc is at addr 0x%p, size=%lu\n", buf->vaddr, nr_pages << PAGE_SHIFT); @@ -186,7 +178,7 @@ struct cx25821_audio_buffer *buf = dev->buf; buf->sglen = dma_map_sg(&dev->pci->dev, buf->sglist, - buf->nr_pages, PCI_DMA_FROMDEVICE); + buf->nr_pages, DMA_FROM_DEVICE); if (0 == buf->sglen) { pr_warn("%s: cx25821_alsa_map_sg failed\n", __func__); @@ -202,7 +194,7 @@ if (!buf->sglen) return 0; - dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->sglen, PCI_DMA_FROMDEVICE); + dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->nr_pages, DMA_FROM_DEVICE); buf->sglen = 0; return 0; } @@ -648,7 +640,6 @@ static const struct snd_pcm_ops snd_cx25821_pcm_ops = { .open = snd_cx25821_pcm_open, .close = snd_cx25821_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_cx25821_hw_params, .hw_free = snd_cx25821_hw_free, .prepare = snd_cx25821_prepare, @@ -674,7 +665,7 @@ } pcm->private_data = chip; pcm->info_flags = 0; - strcpy(pcm->name, name); + strscpy(pcm->name, name, sizeof(pcm->name)); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx25821_pcm_ops); return 0; @@ -725,7 +716,7 @@ return err; } - strcpy(card->driver, "cx25821"); + strscpy(card->driver, "cx25821", sizeof(card->driver)); /* Card "creation" */ chip = card->private_data; @@ -754,10 +745,10 @@ goto error; } - strcpy(card->shortname, "cx25821"); + strscpy(card->shortname, "cx25821", sizeof(card->shortname)); sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name, chip->iobase, chip->irq); - strcpy(card->mixername, "CX25821"); + strscpy(card->mixername, "CX25821", sizeof(card->mixername)); pr_info("%s/%i: ALSA support for cx25821 boards\n", card->driver, devno); -- Gitblit v1.6.2