From patchwork Tue Jul 19 15:56:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9237789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 14FA2607DA for ; Tue, 19 Jul 2016 15:58:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 078CF27BFF for ; Tue, 19 Jul 2016 15:58:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEEA2279E0; Tue, 19 Jul 2016 15:58:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C02627569 for ; Tue, 19 Jul 2016 15:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754139AbcGSP6S (ORCPT ); Tue, 19 Jul 2016 11:58:18 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43900 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753668AbcGSP5M (ORCPT ); Tue, 19 Jul 2016 11:57:12 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OAK01INSKB7RL30@mailout4.samsung.com>; Wed, 20 Jul 2016 00:57:07 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.112]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 2E.E7.05161.3DD4E875; Wed, 20 Jul 2016 00:57:07 +0900 (KST) X-AuditID: cbfee68f-f79476d000001429-d0-578e4dd3380d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 65.BA.02101.3DD4E875; Wed, 20 Jul 2016 00:57:07 +0900 (KST) Received: from samsunx.samsung ([10.113.63.54]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OAK006NUKB4PH70@mmp1.samsung.com>; Wed, 20 Jul 2016 00:57:07 +0900 (KST) From: Andi Shyti To: Mauro Carvalho Chehab , Sean Young Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [RFC 5/7] [media] ir-lirc-codec: do not handle any buffer for raw transmitters Date: Wed, 20 Jul 2016 00:56:56 +0900 Message-id: <1468943818-26025-6-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1468943818-26025-1-git-send-email-andi.shyti@samsung.com> References: <1468943818-26025-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRmVeSWpSXmKPExsWyRsSkQPeyb1+4wZdVhhbbjzxjtVj84zmT xeVdc9gsejZsZbVY/azCYuHT7ywObB7Xl3xi9ljyxtpjS/9ddo++LasYPT5vkgtgjeKySUnN ySxLLdK3S+DKePN/HUvBIt6KbwuWsjcwnuDqYuTkkBAwkTjZf5UVwhaTuHBvPVsXIxeHkMAK RolPz/cxwRS92tANlVjKKHHkWQ8ThPORUWLn0VNgVWwCmhJNt3+wgdgiAv4Sb3oWg41lFmhm lNh93QjEFhaIlJj3vpkdxGYRUJXY9mo1M4jNK+AmMW/xVXaIbXISl6c/AJrDwcEp4C5x5WYR SFgIqOTduocsIHslBCazS1z508AEMUdA4tvkQywg9RICshKbDjBDjJGUOLji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/6/0wMRo71PpF8VH6zZdajEp33FJbV/l5/vXSi6 /eYpe6GHzjuPCaY1srCGtFgKBntdVShukbm1Uvzt9Y/qOvMe27P0VPVM+7r896W1EkU6ju7r l/8/r5uvlHRw6lkh810RjNtiftVF/Xzc9KSPc5nIByWW4oxEQy3mouJEAHg0smO0AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Raw transmitters receive the data which need to be sent to receivers from userspace as stream of bits, they don't require any handling from the lirc framework. Signed-off-by: Andi Shyti --- drivers/media/rc/ir-lirc-codec.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 5effc65..80e94b6 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -121,17 +121,6 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, if (!lirc) return -EFAULT; - if (n < sizeof(unsigned) || n % sizeof(unsigned)) - return -EINVAL; - - count = n / sizeof(unsigned); - if (count > LIRCBUF_SIZE || count % 2 == 0) - return -EINVAL; - - txbuf = memdup_user(buf, n); - if (IS_ERR(txbuf)) - return PTR_ERR(txbuf); - dev = lirc->dev; if (!dev) { ret = -EFAULT; @@ -143,6 +132,25 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, goto out; } + if (dev->driver_type == RC_DRIVER_IR_RAW_TX) { + txbuf = memdup_user(buf, n); + if (IS_ERR(txbuf)) + return PTR_ERR(txbuf); + + return dev->tx_ir(dev, txbuf, n); + } + + if (n < sizeof(unsigned) || n % sizeof(unsigned)) + return -EINVAL; + + count = n / sizeof(unsigned); + if (count > LIRCBUF_SIZE || count % 2 == 0) + return -EINVAL; + + txbuf = memdup_user(buf, n); + if (IS_ERR(txbuf)) + return PTR_ERR(txbuf); + for (i = 0; i < count; i++) { if (txbuf[i] > IR_MAX_DURATION / 1000 - duration || !txbuf[i]) { ret = -EINVAL;