From patchwork Mon Jul 5 18:31:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 12359499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96A64C07E9B for ; Mon, 5 Jul 2021 18:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 723866197E for ; Mon, 5 Jul 2021 18:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbhGESeM (ORCPT ); Mon, 5 Jul 2021 14:34:12 -0400 Received: from gofer.mess.org ([88.97.38.141]:43111 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbhGESeM (ORCPT ); Mon, 5 Jul 2021 14:34:12 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 33A5EC6321; Mon, 5 Jul 2021 19:31:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1625509893; bh=C97Jf0IqMGc/9Ae4C0upgpgnrECJPBkfBahrQt6SAok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/eewfO6zf4agoMwKBmFtNv+Yr3+DlmXur1NZ/vGOGrBQzLObaVwyG9ibsnnWsLps jwXywGW9+nlNh/5B5KFX3fFVFS03OPTPtwzGfXsZo5K5UHmRqicskKywGJXQjWprTV GQtFbJEp7l3q1C/6cGxfAq0FOOp5Jb6EUAppRh3ROFbzFeFVJrX3oTYYCWYP0GiHSQ cGiakbWfGuWfzs3CeG7/dB55bsFBEr6GWoMf2gtGZu60jLEw2An73VZnBw/OUaWNma UUmcgJ/HFRP8J0kiR6gHPn8NYfxiR/QAySnv9MXqVimjiHXYwL7Eqocsu/r5ntkxh3 Ri6EL+RgEWJdw== From: Sean Young To: linux-media@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH v2 1/5] media: rc-loopback: return number of emitters rather than error Date: Mon, 5 Jul 2021 19:31:28 +0100 Message-Id: <1c0df5716e9aa335d6d47558b3a1c7fbd7477bc7.1625509803.git.sean@mess.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The LIRC_SET_TRANSMITTER_MASK ioctl should return the number of emitters if an invalid list was set. Cc: stable@vger.kernel.org Signed-off-by: Sean Young --- drivers/media/rc/rc-loopback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 1ba3f96ffa7d..40ab66c850f2 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -42,7 +42,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask) if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) { dprintk("invalid tx mask: %u\n", mask); - return -EINVAL; + return 2; } dprintk("setting tx mask: %u\n", mask); From patchwork Mon Jul 5 18:31:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 12359495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16614C07E99 for ; Mon, 5 Jul 2021 18:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6B4261979 for ; Mon, 5 Jul 2021 18:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbhGESeM (ORCPT ); Mon, 5 Jul 2021 14:34:12 -0400 Received: from gofer.mess.org ([88.97.38.141]:38517 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbhGESeM (ORCPT ); Mon, 5 Jul 2021 14:34:12 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 5CD5FC6463; Mon, 5 Jul 2021 19:31:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1625509893; bh=3CQhAHBSbs+Le8jsuowOR2MPNUM9ASGmL3ITMqEh9jk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SUisFQJ2EE7WRTWXbo3kkc0kDb7nvGmMyNrWs0SZGK+VLNSP4Xg2gjGxvFNMuiVXU CkfVjAJvHJflLHNEXj+MlYHkZ/vOmrOSR5gF0aONoifb/xlfdnRHgwGzFJfnSNO1xC 6ycMwKbVoByBRQzUzcSV5BeioT/uz0FilxDorRuTs3OtoPIHQG8Ak3NSett9l+X2Ni bln76PMvk5ANTjOVVjAyOONfl9Q6sx1maDbb00VuwLObMRpcZj0W2A1LeTZveOZksq G5sk1z4ReJoe3IVNmkSL8vJcP291nUHsMwExrUgRiR9vQsySy4Ppk5Z61Bv2EDQKjx 5ivAXeD0gVBSQ== From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH v2 2/5] media: rc-loopback: use dev_dbg() rather than handrolled debug Date: Mon, 5 Jul 2021 19:31:29 +0100 Message-Id: <6543a93009d82ef136d942d5c87e626e22829cda.1625509803.git.sean@mess.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Sean Young --- drivers/media/rc/rc-loopback.c | 36 +++++++++++++--------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 40ab66c850f2..5adfbb6989ee 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -16,12 +16,9 @@ #include #define DRIVER_NAME "rc-loopback" -#define dprintk(x...) if (debug) printk(KERN_INFO DRIVER_NAME ": " x) #define RXMASK_REGULAR 0x1 #define RXMASK_LEARNING 0x2 -static bool debug; - struct loopback_dev { struct rc_dev *dev; u32 txmask; @@ -41,11 +38,11 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask) struct loopback_dev *lodev = dev->priv; if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) { - dprintk("invalid tx mask: %u\n", mask); + dev_dbg(&dev->dev, "invalid tx mask: %u\n", mask); return 2; } - dprintk("setting tx mask: %u\n", mask); + dev_dbg(&dev->dev, "setting tx mask: %u\n", mask); lodev->txmask = mask; return 0; } @@ -54,7 +51,7 @@ static int loop_set_tx_carrier(struct rc_dev *dev, u32 carrier) { struct loopback_dev *lodev = dev->priv; - dprintk("setting tx carrier: %u\n", carrier); + dev_dbg(&dev->dev, "setting tx carrier: %u\n", carrier); lodev->txcarrier = carrier; return 0; } @@ -64,11 +61,11 @@ static int loop_set_tx_duty_cycle(struct rc_dev *dev, u32 duty_cycle) struct loopback_dev *lodev = dev->priv; if (duty_cycle < 1 || duty_cycle > 99) { - dprintk("invalid duty cycle: %u\n", duty_cycle); + dev_dbg(&dev->dev, "invalid duty cycle: %u\n", duty_cycle); return -EINVAL; } - dprintk("setting duty cycle: %u\n", duty_cycle); + dev_dbg(&dev->dev, "setting duty cycle: %u\n", duty_cycle); lodev->txduty = duty_cycle; return 0; } @@ -78,11 +75,11 @@ static int loop_set_rx_carrier_range(struct rc_dev *dev, u32 min, u32 max) struct loopback_dev *lodev = dev->priv; if (min < 1 || min > max) { - dprintk("invalid rx carrier range %u to %u\n", min, max); + dev_dbg(&dev->dev, "invalid rx carrier range %u to %u\n", min, max); return -EINVAL; } - dprintk("setting rx carrier range %u to %u\n", min, max); + dev_dbg(&dev->dev, "setting rx carrier range %u to %u\n", min, max); lodev->rxcarriermin = min; lodev->rxcarriermax = max; return 0; @@ -97,7 +94,7 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) if (lodev->txcarrier < lodev->rxcarriermin || lodev->txcarrier > lodev->rxcarriermax) { - dprintk("ignoring tx, carrier out of range\n"); + dev_dbg(&dev->dev, "ignoring tx, carrier out of range\n"); goto out; } @@ -107,7 +104,7 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) rxmask = RXMASK_REGULAR; if (!(rxmask & lodev->txmask)) { - dprintk("ignoring tx, rx mask mismatch\n"); + dev_dbg(&dev->dev, "ignoring tx, rx mask mismatch\n"); goto out; } @@ -134,7 +131,7 @@ static void loop_set_idle(struct rc_dev *dev, bool enable) struct loopback_dev *lodev = dev->priv; if (lodev->idle != enable) { - dprintk("%sing idle mode\n", enable ? "enter" : "exit"); + dev_dbg(&dev->dev, "%sing idle mode\n", enable ? "enter" : "exit"); lodev->idle = enable; } } @@ -144,7 +141,7 @@ static int loop_set_learning_mode(struct rc_dev *dev, int enable) struct loopback_dev *lodev = dev->priv; if (lodev->learning != enable) { - dprintk("%sing learning mode\n", enable ? "enter" : "exit"); + dev_dbg(&dev->dev, "%sing learning mode\n", enable ? "enter" : "exit"); lodev->learning = !!enable; } @@ -156,7 +153,7 @@ static int loop_set_carrier_report(struct rc_dev *dev, int enable) struct loopback_dev *lodev = dev->priv; if (lodev->carrierreport != enable) { - dprintk("%sabling carrier reports\n", enable ? "en" : "dis"); + dev_dbg(&dev->dev, "%sabling carrier reports\n", enable ? "en" : "dis"); lodev->carrierreport = !!enable; } @@ -204,10 +201,8 @@ static int __init loop_init(void) int ret; rc = rc_allocate_device(RC_DRIVER_IR_RAW); - if (!rc) { - printk(KERN_ERR DRIVER_NAME ": rc_dev allocation failed\n"); + if (!rc) return -ENOMEM; - } rc->device_name = "rc-core loopback device"; rc->input_phys = "rc-core/virtual"; @@ -245,7 +240,7 @@ static int __init loop_init(void) ret = rc_register_device(rc); if (ret < 0) { - printk(KERN_ERR DRIVER_NAME ": rc_dev registration failed\n"); + dev_err(&rc->dev, "rc_dev registration failed\n"); rc_free_device(rc); return ret; } @@ -262,9 +257,6 @@ static void __exit loop_exit(void) module_init(loop_init); module_exit(loop_exit); -module_param(debug, bool, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Enable debug messages"); - MODULE_DESCRIPTION("Loopback device for rc-core debugging"); MODULE_AUTHOR("David Härdeman "); MODULE_LICENSE("GPL"); From patchwork Mon Jul 5 18:31:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 12359501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4440BC11F67 for ; Mon, 5 Jul 2021 18:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28F486197F for ; Mon, 5 Jul 2021 18:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbhGESeN (ORCPT ); Mon, 5 Jul 2021 14:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbhGESeM (ORCPT ); Mon, 5 Jul 2021 14:34:12 -0400 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67663C06175F for ; Mon, 5 Jul 2021 11:31:35 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id 8E87CC646F; Mon, 5 Jul 2021 19:31:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1625509893; bh=UcGZek/WfFgoCf8+Aa7RAKh0mW6E5iFPgKBa/FK+I6k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=staYy7KJM/whFvu6jVrYLwnoloRVZ5v8rgeG9xp1n5Pu23Qp2Xoi4FdHRaBDVOFFb ocXAHeO3A8On2pbOeVBkOb9F4+u8zt+uKx1lSgncSOV19rz4VPr0ryOPTvJfrzZYh6 zzcfBIOyC2AU4va+O3tyRU8yAO70dS1wYpt2j0RRqc2nlZEwMo6udsc1U1/4SWx7fR XuzbuZLefWvKrn07FjLiwYPOPtHq0zAy9mTS77TOJJSC1TrRzoxRRoVu3nnSZxZ6tS YjXhO8XvIrSGhZ0x1xckT9H8GCt11IjVXf+RWvN+t1Ugg3jhKYCasGgplLTDF1N02H V/s+9JTegg42Q== From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH v2 3/5] media: rc-loopback: send carrier reports Date: Mon, 5 Jul 2021 19:31:30 +0100 Message-Id: <1ba0550091184d566d9a4539377a637bf5a06f78.1625509803.git.sean@mess.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org When carrier reports are enabled, send them over loopback. Signed-off-by: Sean Young --- drivers/media/rc/rc-loopback.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 5adfbb6989ee..67782dd7ee4d 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -111,8 +111,16 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) for (i = 0; i < count; i++) { rawir.pulse = i % 2 ? false : true; rawir.duration = txbuf[i]; - if (rawir.duration) - ir_raw_event_store_with_filter(dev, &rawir); + + ir_raw_event_store_with_filter(dev, &rawir); + } + + if (lodev->carrierreport) { + rawir.pulse = false; + rawir.carrier_report = true; + rawir.carrier = lodev->txcarrier; + + ir_raw_event_store(dev, &rawir); } /* Fake a silence long enough to cause us to go idle */ From patchwork Mon Jul 5 18:31:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 12359503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB770C07E9E for ; Mon, 5 Jul 2021 18:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD1E86197B for ; Mon, 5 Jul 2021 18:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbhGESeN (ORCPT ); Mon, 5 Jul 2021 14:34:13 -0400 Received: from gofer.mess.org ([88.97.38.141]:40529 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbhGESeM (ORCPT ); Mon, 5 Jul 2021 14:34:12 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id AF7BCC64A8; Mon, 5 Jul 2021 19:31:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1625509893; bh=B0Vwzu3OBCSHvYIhvOuQSZWXyZ01Ql5G0JEOj4NNMzQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NP4Nj2PtGaMGoPZuiRYAg8AxdJx58+hZCYzXTh2VwuPmkMQt80rIqNCg9ATfiLWXc MsjaM5pNptKMdvGXJXrcBYKxs06WVF6epKnKqfEKlK3apXu05iBjxbgu/oGVk9OccG uyqlFIgJooLR35fsYsXRdsWBx3yoG+q49CZvPkV6p4vxBmVjsbelrprXPE6gGA6ITF XzEyHgRFjFxdWYVFor7JJVp5AzGqdIq6PSm4fIqXHreZQwGHeHsQCp9ZIW066zNwNv m0D5FBeONr0F2x7veRxudzHy0zalFFeQoat/CI9JPrG/I0EQpVik0QtA9Zf3iW0YV+ XRh6+fBtfBbqg== From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH v2 4/5] media: rc-loopback: max_timeout of UINT_MAX does not work Date: Mon, 5 Jul 2021 19:31:31 +0100 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Any timeout larger than LIRC_VALUE_MASK cannot work for the lirc uapi. LIRC_VALUE_MASK is about 16 seconds which is more than enough. Signed-off-by: Sean Young --- drivers/media/rc/rc-loopback.c | 4 ++-- include/media/rc-core.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 67782dd7ee4d..40fca1226b09 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -222,9 +222,9 @@ static int __init loop_init(void) rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; rc->allowed_wakeup_protocols = RC_PROTO_BIT_ALL_IR_ENCODER; rc->encode_wakeup = true; - rc->timeout = MS_TO_US(100); /* 100 ms */ + rc->timeout = IR_DEFAULT_TIMEOUT; rc->min_timeout = 1; - rc->max_timeout = UINT_MAX; + rc->max_timeout = IR_MAX_TIMEOUT; rc->rx_resolution = 1; rc->tx_resolution = 1; rc->s_tx_mask = loop_set_tx_mask; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index a1019c4ab5e8..64b43d76f7f0 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -313,6 +313,7 @@ struct ir_raw_event { #define MS_TO_US(msec) ((msec) * 1000) #define IR_MAX_DURATION MS_TO_US(500) #define IR_DEFAULT_TIMEOUT MS_TO_US(125) +#define IR_MAX_TIMEOUT LIRC_VALUE_MASK void ir_raw_event_handle(struct rc_dev *dev); int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); From patchwork Mon Jul 5 18:31:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 12359505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7E90C11F68 for ; Mon, 5 Jul 2021 18:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9AEFD6197B for ; Mon, 5 Jul 2021 18:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbhGESeO (ORCPT ); Mon, 5 Jul 2021 14:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbhGESeO (ORCPT ); Mon, 5 Jul 2021 14:34:14 -0400 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB07C061574 for ; Mon, 5 Jul 2021 11:31:36 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id CDAEBC64B1; Mon, 5 Jul 2021 19:31:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1625509893; bh=WIkgReCHRgyh4aZeAjbDjoglXJnwphLIi5c0ma86+9k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GoDPAEqGwHHx5Z11hYqfe5zzkl5Prkf4rcXyEBP3r9LThhyi2FGS2UsI26ms7077e v/KmCvSrbkDnm4sSSJ0z/UiP7GyawvqxAfIxppyAM77D3e55mBKCU/BQvePWGX5F+D wlfmYLBNKPmhxVMxSF3bKm0BiE7KDoaF5XqEuEESQw6quk1QqkOsWCZJZADlBusAAX ML1A1bmmGyNg6QqjLNWvFljYvsKFgX2Gkk2hgWIsHjlR/1U5JWzWGMWFjw+SqEc318 4EQED4TkaQM6kYOTi82fZ6es7BLVagI8uCPEsi4OBJzUkoAfGJVVZg4QLXt3aOllsn QpG+2p5zNKHZw== From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH v2 5/5] media: rc: rename s_learning_mode() to s_wideband_receiver() Date: Mon, 5 Jul 2021 19:31:32 +0100 Message-Id: <40cb0597123ec81e77c74492b006ad8d9c388dd2.1625509803.git.sean@mess.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The s_learning_mode() function is called in response to the ioctl LIRC_SET_WIDEBAND_RECEIVER, so rename it to s_wideband_receiver(). Learning mode is when both the wideband receiver is turned on and carrier reports are enabled. Signed-off-by: Sean Young --- drivers/media/rc/ene_ir.c | 2 +- drivers/media/rc/lirc_dev.c | 6 +++--- drivers/media/rc/mceusb.c | 2 +- drivers/media/rc/rc-loopback.c | 30 +++++++++++++++--------------- include/media/rc-core.h | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index 6049e5c95394..e09270916fbc 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -1052,7 +1052,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) rdev->device_name = "ENE eHome Infrared Remote Receiver"; if (dev->hw_learning_and_tx_capable) { - rdev->s_learning_mode = ene_set_learning_mode; + rdev->s_wideband_receiver = ene_set_learning_mode; init_completion(&dev->tx_complete); rdev->tx_ir = ene_transmit; rdev->s_tx_mask = ene_set_tx_mask; diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 116daf90c858..7f591ff5269d 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -412,7 +412,7 @@ static long lirc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) val |= LIRC_CAN_SET_REC_CARRIER | LIRC_CAN_SET_REC_CARRIER_RANGE; - if (dev->s_learning_mode) + if (dev->s_wideband_receiver) val |= LIRC_CAN_USE_WIDEBAND_RECEIVER; if (dev->s_carrier_report) @@ -519,10 +519,10 @@ static long lirc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; case LIRC_SET_WIDEBAND_RECEIVER: - if (!dev->s_learning_mode) + if (!dev->s_wideband_receiver) ret = -ENOTTY; else - ret = dev->s_learning_mode(dev, !!val); + ret = dev->s_wideband_receiver(dev, !!val); break; case LIRC_SET_MEASURE_CARRIER_MODE: diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 5642595a057e..e03dd1f0144f 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1630,7 +1630,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) rc->tx_ir = mceusb_tx_ir; } if (ir->flags.rx2 > 0) { - rc->s_learning_mode = mceusb_set_rx_wideband; + rc->s_wideband_receiver = mceusb_set_rx_wideband; rc->s_carrier_report = mceusb_set_rx_carrier_report; } rc->driver_name = DRIVER_NAME; diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 40fca1226b09..6441879fcba1 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -15,9 +15,9 @@ #include #include -#define DRIVER_NAME "rc-loopback" -#define RXMASK_REGULAR 0x1 -#define RXMASK_LEARNING 0x2 +#define DRIVER_NAME "rc-loopback" +#define RXMASK_NARROWBAND 0x1 +#define RXMASK_WIDEBAND 0x2 struct loopback_dev { struct rc_dev *dev; @@ -25,7 +25,7 @@ struct loopback_dev { u32 txcarrier; u32 txduty; bool idle; - bool learning; + bool wideband; bool carrierreport; u32 rxcarriermin; u32 rxcarriermax; @@ -37,7 +37,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask) { struct loopback_dev *lodev = dev->priv; - if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) { + if ((mask & (RXMASK_NARROWBAND | RXMASK_WIDEBAND)) != mask) { dev_dbg(&dev->dev, "invalid tx mask: %u\n", mask); return 2; } @@ -98,10 +98,10 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) goto out; } - if (lodev->learning) - rxmask = RXMASK_LEARNING; + if (lodev->wideband) + rxmask = RXMASK_WIDEBAND; else - rxmask = RXMASK_REGULAR; + rxmask = RXMASK_NARROWBAND; if (!(rxmask & lodev->txmask)) { dev_dbg(&dev->dev, "ignoring tx, rx mask mismatch\n"); @@ -144,13 +144,13 @@ static void loop_set_idle(struct rc_dev *dev, bool enable) } } -static int loop_set_learning_mode(struct rc_dev *dev, int enable) +static int loop_set_wideband_receiver(struct rc_dev *dev, int enable) { struct loopback_dev *lodev = dev->priv; - if (lodev->learning != enable) { - dev_dbg(&dev->dev, "%sing learning mode\n", enable ? "enter" : "exit"); - lodev->learning = !!enable; + if (lodev->wideband != enable) { + dev_dbg(&dev->dev, "using %sband receiver\n", enable ? "wide" : "narrow"); + lodev->wideband = !!enable; } return 0; @@ -233,17 +233,17 @@ static int __init loop_init(void) rc->s_rx_carrier_range = loop_set_rx_carrier_range; rc->tx_ir = loop_tx_ir; rc->s_idle = loop_set_idle; - rc->s_learning_mode = loop_set_learning_mode; + rc->s_wideband_receiver = loop_set_wideband_receiver; rc->s_carrier_report = loop_set_carrier_report; rc->s_wakeup_filter = loop_set_wakeup_filter; - loopdev.txmask = RXMASK_REGULAR; + loopdev.txmask = RXMASK_NARROWBAND; loopdev.txcarrier = 36000; loopdev.txduty = 50; loopdev.rxcarriermin = 1; loopdev.rxcarriermax = ~0; loopdev.idle = true; - loopdev.learning = false; + loopdev.wideband = false; loopdev.carrierreport = false; ret = rc_register_device(rc); diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 64b43d76f7f0..8c5b7978e1d9 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -151,7 +151,7 @@ struct lirc_fh { * @tx_ir: transmit IR * @s_idle: enable/disable hardware idle mode, upon which, * device doesn't interrupt host until it sees IR pulses - * @s_learning_mode: enable wide band receiver used for learning + * @s_wideband_receiver: enable wide band receiver used for learning * @s_carrier_report: enable carrier reports * @s_filter: set the scancode filter * @s_wakeup_filter: set the wakeup scancode filter. If the mask is zero @@ -218,7 +218,7 @@ struct rc_dev { int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); int (*tx_ir)(struct rc_dev *dev, unsigned *txbuf, unsigned n); void (*s_idle)(struct rc_dev *dev, bool enable); - int (*s_learning_mode)(struct rc_dev *dev, int enable); + int (*s_wideband_receiver)(struct rc_dev *dev, int enable); int (*s_carrier_report) (struct rc_dev *dev, int enable); int (*s_filter)(struct rc_dev *dev, struct rc_scancode_filter *filter);