media: iguanair: rc drivers no longer need to do locking

Since commit 4957133fe3 ("media: lirc: improve locking"), drivers
do not need to do any of their own locking.

During suspend and resume, no processes are running so no locking is
needed.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Sean Young 2020-04-15 13:47:38 +02:00 committed by Mauro Carvalho Chehab
parent 038fd41410
commit fdb9e30e91

View File

@ -14,7 +14,6 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <media/rc-core.h> #include <media/rc-core.h>
#define DRIVER_NAME "iguanair"
#define BUF_SIZE 152 #define BUF_SIZE 152
struct iguanair { struct iguanair {
@ -27,8 +26,6 @@ struct iguanair {
uint8_t bufsize; uint8_t bufsize;
uint8_t cycle_overhead; uint8_t cycle_overhead;
struct mutex lock;
/* receiver support */ /* receiver support */
bool receiver_on; bool receiver_on;
dma_addr_t dma_in, dma_out; dma_addr_t dma_in, dma_out;
@ -284,8 +281,6 @@ static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier)
if (carrier < 25000 || carrier > 150000) if (carrier < 25000 || carrier > 150000)
return -EINVAL; return -EINVAL;
mutex_lock(&ir->lock);
if (carrier != ir->carrier) { if (carrier != ir->carrier) {
uint32_t cycles, fours, sevens; uint32_t cycles, fours, sevens;
@ -314,8 +309,6 @@ static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier)
ir->packet->busy4 = 110 - fours; ir->packet->busy4 = 110 - fours;
} }
mutex_unlock(&ir->lock);
return 0; return 0;
} }
@ -326,9 +319,7 @@ static int iguanair_set_tx_mask(struct rc_dev *dev, uint32_t mask)
if (mask > 15) if (mask > 15)
return 4; return 4;
mutex_lock(&ir->lock);
ir->packet->channels = mask << 4; ir->packet->channels = mask << 4;
mutex_unlock(&ir->lock);
return 0; return 0;
} }
@ -339,8 +330,6 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
unsigned int i, size, p, periods; unsigned int i, size, p, periods;
int rc; int rc;
mutex_lock(&ir->lock);
/* convert from us to carrier periods */ /* convert from us to carrier periods */
for (i = size = 0; i < count; i++) { for (i = size = 0; i < count; i++) {
periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000); periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000);
@ -368,8 +357,6 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
rc = -EOVERFLOW; rc = -EOVERFLOW;
out: out:
mutex_unlock(&ir->lock);
return rc ? rc : count; return rc ? rc : count;
} }
@ -378,14 +365,10 @@ static int iguanair_open(struct rc_dev *rdev)
struct iguanair *ir = rdev->priv; struct iguanair *ir = rdev->priv;
int rc; int rc;
mutex_lock(&ir->lock);
rc = iguanair_receiver(ir, true); rc = iguanair_receiver(ir, true);
if (rc == 0) if (rc == 0)
ir->receiver_on = true; ir->receiver_on = true;
mutex_unlock(&ir->lock);
return rc; return rc;
} }
@ -394,14 +377,10 @@ static void iguanair_close(struct rc_dev *rdev)
struct iguanair *ir = rdev->priv; struct iguanair *ir = rdev->priv;
int rc; int rc;
mutex_lock(&ir->lock);
rc = iguanair_receiver(ir, false); rc = iguanair_receiver(ir, false);
ir->receiver_on = false; ir->receiver_on = false;
if (rc && rc != -ENODEV) if (rc && rc != -ENODEV)
dev_warn(ir->dev, "failed to disable receiver: %d\n", rc); dev_warn(ir->dev, "failed to disable receiver: %d\n", rc);
mutex_unlock(&ir->lock);
} }
static int iguanair_probe(struct usb_interface *intf, static int iguanair_probe(struct usb_interface *intf,
@ -441,7 +420,6 @@ static int iguanair_probe(struct usb_interface *intf,
ir->rc = rc; ir->rc = rc;
ir->dev = &intf->dev; ir->dev = &intf->dev;
ir->udev = udev; ir->udev = udev;
mutex_init(&ir->lock);
init_completion(&ir->completion); init_completion(&ir->completion);
pipeout = usb_sndintpipe(udev, pipeout = usb_sndintpipe(udev,
@ -483,7 +461,7 @@ static int iguanair_probe(struct usb_interface *intf,
rc->s_tx_mask = iguanair_set_tx_mask; rc->s_tx_mask = iguanair_set_tx_mask;
rc->s_tx_carrier = iguanair_set_tx_carrier; rc->s_tx_carrier = iguanair_set_tx_carrier;
rc->tx_ir = iguanair_tx; rc->tx_ir = iguanair_tx;
rc->driver_name = DRIVER_NAME; rc->driver_name = KBUILD_MODNAME;
rc->map_name = RC_MAP_RC6_MCE; rc->map_name = RC_MAP_RC6_MCE;
rc->min_timeout = 1; rc->min_timeout = 1;
rc->timeout = IR_DEFAULT_TIMEOUT; rc->timeout = IR_DEFAULT_TIMEOUT;
@ -538,8 +516,6 @@ static int iguanair_suspend(struct usb_interface *intf, pm_message_t message)
struct iguanair *ir = usb_get_intfdata(intf); struct iguanair *ir = usb_get_intfdata(intf);
int rc = 0; int rc = 0;
mutex_lock(&ir->lock);
if (ir->receiver_on) { if (ir->receiver_on) {
rc = iguanair_receiver(ir, false); rc = iguanair_receiver(ir, false);
if (rc) if (rc)
@ -549,17 +525,13 @@ static int iguanair_suspend(struct usb_interface *intf, pm_message_t message)
usb_kill_urb(ir->urb_in); usb_kill_urb(ir->urb_in);
usb_kill_urb(ir->urb_out); usb_kill_urb(ir->urb_out);
mutex_unlock(&ir->lock);
return rc; return rc;
} }
static int iguanair_resume(struct usb_interface *intf) static int iguanair_resume(struct usb_interface *intf)
{ {
struct iguanair *ir = usb_get_intfdata(intf); struct iguanair *ir = usb_get_intfdata(intf);
int rc = 0; int rc;
mutex_lock(&ir->lock);
rc = usb_submit_urb(ir->urb_in, GFP_KERNEL); rc = usb_submit_urb(ir->urb_in, GFP_KERNEL);
if (rc) if (rc)
@ -571,8 +543,6 @@ static int iguanair_resume(struct usb_interface *intf)
dev_warn(ir->dev, "failed to enable receiver after resume\n"); dev_warn(ir->dev, "failed to enable receiver after resume\n");
} }
mutex_unlock(&ir->lock);
return rc; return rc;
} }
@ -582,7 +552,7 @@ static const struct usb_device_id iguanair_table[] = {
}; };
static struct usb_driver iguanair_driver = { static struct usb_driver iguanair_driver = {
.name = DRIVER_NAME, .name = KBUILD_MODNAME,
.probe = iguanair_probe, .probe = iguanair_probe,
.disconnect = iguanair_disconnect, .disconnect = iguanair_disconnect,
.suspend = iguanair_suspend, .suspend = iguanair_suspend,