From 23fa18eaa71266feff7ba8d83022d9e1cc83c65a Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Fri, 10 May 2024 07:42:03 +0000 Subject: [PATCH] disable pwm7 --- kernel/drivers/media/rc/iguanair.c | 59 +++++++++-------------------------------------------------- 1 files changed, 9 insertions(+), 50 deletions(-) diff --git a/kernel/drivers/media/rc/iguanair.c b/kernel/drivers/media/rc/iguanair.c index 1df9522..84949ba 100644 --- a/kernel/drivers/media/rc/iguanair.c +++ b/kernel/drivers/media/rc/iguanair.c @@ -1,17 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * IguanaWorks USB IR Transceiver support * * Copyright (C) 2012 Sean Young <sean@mess.org> - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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/device.h> @@ -23,7 +14,6 @@ #include <linux/completion.h> #include <media/rc-core.h> -#define DRIVER_NAME "iguanair" #define BUF_SIZE 152 struct iguanair { @@ -35,8 +25,6 @@ uint16_t version; uint8_t bufsize; uint8_t cycle_overhead; - - struct mutex lock; /* receiver support */ bool receiver_on; @@ -71,7 +59,7 @@ #define MAX_IN_PACKET 8u #define MAX_OUT_PACKET (sizeof(struct send_packet) + BUF_SIZE) #define TIMEOUT 1000 -#define RX_RESOLUTION 21333 +#define RX_RESOLUTION 21 struct packet { uint16_t start; @@ -85,7 +73,7 @@ uint8_t channels; uint8_t busy7; uint8_t busy4; - uint8_t payload[0]; + uint8_t payload[]; }; static void process_ir_data(struct iguanair *ir, unsigned len) @@ -113,7 +101,7 @@ break; case CMD_TX_OVERFLOW: ir->tx_overflow = true; - /* fall through */ + fallthrough; case CMD_RECEIVER_OFF: case CMD_RECEIVER_ON: case CMD_SEND: @@ -129,16 +117,14 @@ break; } } else if (len >= 7) { - DEFINE_IR_RAW_EVENT(rawir); + struct ir_raw_event rawir = {}; unsigned i; bool event = false; - - init_ir_raw_event(&rawir); for (i = 0; i < 7; i++) { if (ir->buf_in[i] == 0x80) { rawir.pulse = false; - rawir.duration = US_TO_NS(21845); + rawir.duration = 21845; } else { rawir.pulse = (ir->buf_in[i] & 0x80) == 0; rawir.duration = ((ir->buf_in[i] & 0x7f) + 1) * @@ -295,8 +281,6 @@ if (carrier < 25000 || carrier > 150000) return -EINVAL; - mutex_lock(&ir->lock); - if (carrier != ir->carrier) { uint32_t cycles, fours, sevens; @@ -325,8 +309,6 @@ ir->packet->busy4 = 110 - fours; } - mutex_unlock(&ir->lock); - return 0; } @@ -337,9 +319,7 @@ if (mask > 15) return 4; - mutex_lock(&ir->lock); ir->packet->channels = mask << 4; - mutex_unlock(&ir->lock); return 0; } @@ -349,8 +329,6 @@ struct iguanair *ir = dev->priv; unsigned int i, size, p, periods; int rc; - - mutex_lock(&ir->lock); /* convert from us to carrier periods */ for (i = size = 0; i < count; i++) { @@ -379,8 +357,6 @@ rc = -EOVERFLOW; out: - mutex_unlock(&ir->lock); - return rc ? rc : count; } @@ -389,13 +365,9 @@ struct iguanair *ir = rdev->priv; int rc; - mutex_lock(&ir->lock); - rc = iguanair_receiver(ir, true); if (rc == 0) ir->receiver_on = true; - - mutex_unlock(&ir->lock); return rc; } @@ -405,14 +377,10 @@ struct iguanair *ir = rdev->priv; int rc; - mutex_lock(&ir->lock); - rc = iguanair_receiver(ir, false); ir->receiver_on = false; if (rc && rc != -ENODEV) dev_warn(ir->dev, "failed to disable receiver: %d\n", rc); - - mutex_unlock(&ir->lock); } static int iguanair_probe(struct usb_interface *intf, @@ -452,7 +420,6 @@ ir->rc = rc; ir->dev = &intf->dev; ir->udev = udev; - mutex_init(&ir->lock); init_completion(&ir->completion); pipeout = usb_sndintpipe(udev, @@ -494,7 +461,7 @@ rc->s_tx_mask = iguanair_set_tx_mask; rc->s_tx_carrier = iguanair_set_tx_carrier; rc->tx_ir = iguanair_tx; - rc->driver_name = DRIVER_NAME; + rc->driver_name = KBUILD_MODNAME; rc->map_name = RC_MAP_RC6_MCE; rc->min_timeout = 1; rc->timeout = IR_DEFAULT_TIMEOUT; @@ -549,8 +516,6 @@ struct iguanair *ir = usb_get_intfdata(intf); int rc = 0; - mutex_lock(&ir->lock); - if (ir->receiver_on) { rc = iguanair_receiver(ir, false); if (rc) @@ -560,17 +525,13 @@ usb_kill_urb(ir->urb_in); usb_kill_urb(ir->urb_out); - mutex_unlock(&ir->lock); - return rc; } static int iguanair_resume(struct usb_interface *intf) { struct iguanair *ir = usb_get_intfdata(intf); - int rc = 0; - - mutex_lock(&ir->lock); + int rc; rc = usb_submit_urb(ir->urb_in, GFP_KERNEL); if (rc) @@ -582,8 +543,6 @@ dev_warn(ir->dev, "failed to enable receiver after resume\n"); } - mutex_unlock(&ir->lock); - return rc; } @@ -593,7 +552,7 @@ }; static struct usb_driver iguanair_driver = { - .name = DRIVER_NAME, + .name = KBUILD_MODNAME, .probe = iguanair_probe, .disconnect = iguanair_disconnect, .suspend = iguanair_suspend, -- Gitblit v1.6.2