From bedbef8ad3e75a304af6361af235302bcc61d06b Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Tue, 14 May 2024 06:39:01 +0000 Subject: [PATCH] 修改内核路径 --- kernel/drivers/media/radio/wl128x/fmdrv_common.c | 45 ++++++++++++++++++++------------------------- 1 files changed, 20 insertions(+), 25 deletions(-) diff --git a/kernel/drivers/media/radio/wl128x/fmdrv_common.c b/kernel/drivers/media/radio/wl128x/fmdrv_common.c index cccf1a7..6142484 100644 --- a/kernel/drivers/media/radio/wl128x/fmdrv_common.c +++ b/kernel/drivers/media/radio/wl128x/fmdrv_common.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * FM Driver for Connectivity chip of Texas Instruments. * @@ -16,21 +17,13 @@ * Copyright (C) 2011 Texas Instruments * Author: Raja Mani <raja_mani@ti.com> * Author: Manjunatha Halli <manjunatha_halli@ti.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * 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. - * */ -#include <linux/module.h> -#include <linux/firmware.h> #include <linux/delay.h> +#include <linux/firmware.h> +#include <linux/module.h> +#include <linux/nospec.h> + #include "fmdrv.h" #include "fmdrv_v4l2.h" #include "fmdrv_common.h" @@ -253,7 +246,7 @@ * FM common sub-module will schedule this tasklet whenever it receives * FM packet from ST driver. */ -static void recv_tasklet(unsigned long arg) +static void recv_tasklet(struct tasklet_struct *t) { struct fmdev *fmdev; struct fm_irq *irq_info; @@ -262,7 +255,7 @@ u8 num_fm_hci_cmds; unsigned long flags; - fmdev = (struct fmdev *)arg; + fmdev = from_tasklet(fmdev, t, tx_task); irq_info = &fmdev->irq_info; /* Process all packets in the RX queue */ while ((skb = skb_dequeue(&fmdev->rx_q))) { @@ -337,13 +330,13 @@ } /* FM send tasklet: is scheduled when FM packet has to be sent to chip */ -static void send_tasklet(unsigned long arg) +static void send_tasklet(struct tasklet_struct *t) { struct fmdev *fmdev; struct sk_buff *skb; int len; - fmdev = (struct fmdev *)arg; + fmdev = from_tasklet(fmdev, t, tx_task); if (!atomic_read(&fmdev->tx_cnt)) return; @@ -709,7 +702,7 @@ struct fm_rds *rds = &fmdev->rx.rds; unsigned long group_idx, flags; u8 *rds_data, meta_data, tmpbuf[FM_RDS_BLK_SIZE]; - u8 type, blk_idx; + u8 type, blk_idx, idx; u16 cur_picode; u32 rds_len; @@ -742,9 +735,11 @@ } /* Skip checkword (control) byte and copy only data byte */ - memcpy(&rds_fmt.data.groupdatabuff. - buff[blk_idx * (FM_RDS_BLK_SIZE - 1)], - rds_data, (FM_RDS_BLK_SIZE - 1)); + idx = array_index_nospec(blk_idx * (FM_RDS_BLK_SIZE - 1), + FM_RX_RDS_INFO_FIELD_MAX - (FM_RDS_BLK_SIZE - 1)); + + memcpy(&rds_fmt.data.groupdatabuff.buff[idx], rds_data, + FM_RDS_BLK_SIZE - 1); rds->last_blk_idx = blk_idx; @@ -911,7 +906,7 @@ u16 frq_index; u16 payload; - fmdbg("Swtich to %d KHz\n", fmdev->rx.stat_info.af_cache[fmdev->rx.afjump_idx]); + fmdbg("Switch to %d KHz\n", fmdev->rx.stat_info.af_cache[fmdev->rx.afjump_idx]); frq_index = (fmdev->rx.stat_info.af_cache[fmdev->rx.afjump_idx] - fmdev->rx.region.bot_freq) / FM_FREQ_MUL; @@ -1050,7 +1045,7 @@ clear_bit(FM_INTTASK_RUNNING, &fmdev->flag); } -/* Returns availability of RDS data in internel buffer */ +/* Returns availability of RDS data in internal buffer */ int fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file, struct poll_table_struct *pts) { @@ -1524,7 +1519,7 @@ } ret = 0; - } else if (ret == -1) { + } else if (ret < 0) { fmerr("st_register failed %d\n", ret); return -EAGAIN; } @@ -1544,11 +1539,11 @@ /* Initialize TX queue and TX tasklet */ skb_queue_head_init(&fmdev->tx_q); - tasklet_init(&fmdev->tx_task, send_tasklet, (unsigned long)fmdev); + tasklet_setup(&fmdev->tx_task, send_tasklet); /* Initialize RX Queue and RX tasklet */ skb_queue_head_init(&fmdev->rx_q); - tasklet_init(&fmdev->rx_task, recv_tasklet, (unsigned long)fmdev); + tasklet_setup(&fmdev->rx_task, recv_tasklet); fmdev->irq_info.stage = 0; atomic_set(&fmdev->tx_cnt, 1); -- Gitblit v1.6.2