From patchwork Tue Jul 19 15:56:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9237787 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 EB82F600CB for ; Tue, 19 Jul 2016 15:58:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4CB127B13 for ; Tue, 19 Jul 2016 15:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7B1F279E0; 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 5A2A827BE5 for ; Tue, 19 Jul 2016 15:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753827AbcGSP5M (ORCPT ); Tue, 19 Jul 2016 11:57:12 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:34235 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753197AbcGSP5J (ORCPT ); Tue, 19 Jul 2016 11:57:09 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OAK02TQJKB7FX80@mailout2.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 6C.E7.05161.3DD4E875; Wed, 20 Jul 2016 00:57:07 +0900 (KST) X-AuditID: cbfee68f-f79476d000001429-cb-578e4dd3d8a0 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id A3.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 1/7] [media] rc-main: assign driver type during allocation Date: Wed, 20 Jul 2016 00:56:52 +0900 Message-id: <1468943818-26025-2-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+NgFrrILMWRmVeSWpSXmKPExsWyRsSkQPeyb1+4QetMEYvtR56xWiz+8ZzJ 4vKuOWwWPRu2slqsflZhsfDpdxYHNo/rSz4xeyx5Y+2xpf8uu0ffllWMHp83yQWwRnHZpKTm ZJalFunbJXBlrP6ygr3gLU/FtWuCDYwPuLoYOTkkBEwk2pefZoKwxSQu3FvP1sXIxSEksIJR 4v2U+UAJDrCiRzPzIeJLGSX6Dl+FKvrIKLHz6CmwbjYBTYmm2z/YQGwRAX+JNz2LWUFsZoFm Rond141ABgkLeEgsniIOEmYRUJXY9OkbM4jNK+AmsfP0GjaII+QkLk9/wAZSzingLnHlZhFI WAio5N26hywgayUEJrNLzL7+khlijoDEt8mHWCDulJXYdIAZYoykxMEVN1gmMAov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wrZCr7VWLKdzYNuVZ0UrFGq8Hizi9 rQ3fhVeeUtsSNp/95xTTE4e5W9+/q04Q3jRpynZh2Q181etfafQbzFzik1gpouy0haH28WHR o4cOpv896pi+6PQ5nb6fRseez4pleNubWu24fplpsxJLcUaioRZzUXEiAE0gJ9uxAgAA 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 The driver type can be assigned immediately when an RC device requests to the framework to allocate the device. This is an 'enum rc_driver_type' data type and specifies whether the device is a raw receiver or scancode receiver. The type will be given as parameter to the rc_allocate_device device. Suggested-by: Sean Young Signed-off-by: Andi Shyti --- drivers/media/rc/rc-main.c | 4 +++- include/media/rc-core.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 7dfc7c2..6403674 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1346,7 +1346,7 @@ static struct device_type rc_dev_type = { .uevent = rc_dev_uevent, }; -struct rc_dev *rc_allocate_device(void) +struct rc_dev *rc_allocate_device(enum rc_driver_type type) { struct rc_dev *dev; @@ -1373,6 +1373,8 @@ struct rc_dev *rc_allocate_device(void) dev->dev.class = &rc_class; device_initialize(&dev->dev); + dev->driver_type = type; + __module_get(THIS_MODULE); return dev; } diff --git a/include/media/rc-core.h b/include/media/rc-core.h index b6586a9..c6bf1ef 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -185,7 +185,7 @@ struct rc_dev { * Remote Controller, at sys/class/rc. */ -struct rc_dev *rc_allocate_device(void); +struct rc_dev *rc_allocate_device(enum rc_driver_type); void rc_free_device(struct rc_dev *dev); int rc_register_device(struct rc_dev *dev); void rc_unregister_device(struct rc_dev *dev);