From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 A8A73C433E0 for ; Tue, 7 Jul 2020 19:08:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88CB2206F6 for ; Tue, 7 Jul 2020 19:08:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="gsejiEfK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728653AbgGGTI3 (ORCPT ); Tue, 7 Jul 2020 15:08:29 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:44714 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728709AbgGGTI2 (ORCPT ); Tue, 7 Jul 2020 15:08:28 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1594148907; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=VncLh8c1/5Bxa/RO8s4GPWFHixwOVBKMpVhCQLo0Vfw=; b=gsejiEfKp77vG/Jkc+GlxRCsxwJIs41Ek+asFYAN3sCZBYvw9kFpRtsj7hDl53wHL6A3I7uC eS80e8Y3jUNpJmEXuaeGvELeY8yA7gwBa/5cFHg4WyIuyxRECAKhpenFHWy+auLGoh0Wden3 Dwi30p/OA+G0xlJNOriPj1RNQc8= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI4ZWZiZiIsICJsaW51eC1yZW1vdGVwcm9jQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n19.prod.us-west-2.postgun.com with SMTP id 5f04c816d8ca07a57313be32 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 07 Jul 2020 19:08:06 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 97088C43395; Tue, 7 Jul 2020 19:08:06 +0000 (UTC) Received: from sidgup-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id 37CA2C433CA; Tue, 7 Jul 2020 19:08:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 37CA2C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com, corbet@lwn.net Cc: Siddharth Gupta , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, psodagud@codeaurora.org, rishabhb@codeaurora.org, linux-doc@vger.kernel.org Subject: [PATCH v4 2/2] remoteproc: core: Register the character device interface Date: Tue, 7 Jul 2020 12:07:50 -0700 Message-Id: <1594148870-27276-3-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594148870-27276-1-git-send-email-sidgup@codeaurora.org> References: <1594148870-27276-1-git-send-email-sidgup@codeaurora.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Add the character device during rproc_add. This would create a character device node at /dev/remoteproc. Userspace applications can interact with the remote processor using this interface. Signed-off-by: Rishabh Bhatnagar Signed-off-by: Siddharth Gupta --- drivers/remoteproc/remoteproc_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 0f95e02..ec7fb49 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1966,6 +1966,13 @@ int rproc_add(struct rproc *rproc) struct device *dev = &rproc->dev; int ret; + /* add char device for this remoteproc */ + ret = rproc_char_device_add(rproc); + if (ret) { + dev_err(dev, "Failed to add char dev for %s\n", rproc->name); + return ret; + } + ret = device_add(dev); if (ret < 0) return ret; @@ -2241,6 +2248,7 @@ int rproc_del(struct rproc *rproc) mutex_unlock(&rproc->lock); rproc_delete_debug_dir(rproc); + rproc_char_device_remove(rproc); /* the rproc is downref'ed as soon as it's removed from the klist */ mutex_lock(&rproc_list_mutex); @@ -2409,6 +2417,7 @@ static int __init remoteproc_init(void) { rproc_init_sysfs(); rproc_init_debugfs(); + rproc_init_cdev(); rproc_init_panic(); return 0; @@ -2420,6 +2429,7 @@ static void __exit remoteproc_exit(void) ida_destroy(&rproc_dev_index); rproc_exit_panic(); + rproc_exit_cdev(); rproc_exit_debugfs(); rproc_exit_sysfs(); } -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 8FC56C433DF for ; Tue, 7 Jul 2020 19:09:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 649F2206E9 for ; Tue, 7 Jul 2020 19:09:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="po4cxTEV"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="u0WUUV5d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 649F2206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FJxRKeNR1VZBYEBhE8uXHieCnA7i7JzNhyXexR3Mh0U=; b=po4cxTEVVetJzo9vT6a0ahGN71 AqMI0mpPc0V5ulSdc+UvBAGCYW0fqBdFEgv2h4FyfcxnTLFcAt/R/EmEnjqiCl2p59YNjnIdOeot4 Hsa4RFhhkLQ5sYe8WRVvm+Dr0tgahoYgXxomwyKDhQ7/zhY9eyFCYg9vK8bIshyWMfTZrJPK5DHrX Ikq1GGKf9MVafrhYWEL/JgZhKtdxCMawBq0+2diaBZDmeoMb8BkdVaDgGBq6B0w1GkBQMDL0W6SOL 7qQb/iMi8AerWjlgHmnJXCHkqSWZc3Q1o+KrTFtyHpc0LCm+qMHAtiGDrnuzhbvFbS3RMZoLHEHwo aAHE7p8Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jssx3-0001OA-0d; Tue, 07 Jul 2020 19:08:21 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsswu-0001J8-NU for linux-arm-kernel@lists.infradead.org; Tue, 07 Jul 2020 19:08:17 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1594148896; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=VncLh8c1/5Bxa/RO8s4GPWFHixwOVBKMpVhCQLo0Vfw=; b=u0WUUV5d8C83+JO8sOTMnoIq0ybNy2DSlrYALCd4jCxsugudxPDU37QxQNlR2XXuz4k59wK2 qHfX2fdRmSEBq5flYpHI1EAbCsDTCDA4VNFNFHgIDhCI6S9+XGOxZqHvMSdPe3nfmYqQtZ+l BaIiAe+nAcJwIWGuusBHNu0+ZFI= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-west-2.postgun.com with SMTP id 5f04c816c9789fa90663fafb (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 07 Jul 2020 19:08:06 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8FFADC43391; Tue, 7 Jul 2020 19:08:06 +0000 (UTC) Received: from sidgup-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id 37CA2C433CA; Tue, 7 Jul 2020 19:08:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 37CA2C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com, corbet@lwn.net Subject: [PATCH v4 2/2] remoteproc: core: Register the character device interface Date: Tue, 7 Jul 2020 12:07:50 -0700 Message-Id: <1594148870-27276-3-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594148870-27276-1-git-send-email-sidgup@codeaurora.org> References: <1594148870-27276-1-git-send-email-sidgup@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200707_150816_810873_DCC66E0A X-CRM114-Status: GOOD ( 14.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tsoni@codeaurora.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, rishabhb@codeaurora.org, Siddharth Gupta , psodagud@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the character device during rproc_add. This would create a character device node at /dev/remoteproc. Userspace applications can interact with the remote processor using this interface. Signed-off-by: Rishabh Bhatnagar Signed-off-by: Siddharth Gupta --- drivers/remoteproc/remoteproc_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 0f95e02..ec7fb49 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1966,6 +1966,13 @@ int rproc_add(struct rproc *rproc) struct device *dev = &rproc->dev; int ret; + /* add char device for this remoteproc */ + ret = rproc_char_device_add(rproc); + if (ret) { + dev_err(dev, "Failed to add char dev for %s\n", rproc->name); + return ret; + } + ret = device_add(dev); if (ret < 0) return ret; @@ -2241,6 +2248,7 @@ int rproc_del(struct rproc *rproc) mutex_unlock(&rproc->lock); rproc_delete_debug_dir(rproc); + rproc_char_device_remove(rproc); /* the rproc is downref'ed as soon as it's removed from the klist */ mutex_lock(&rproc_list_mutex); @@ -2409,6 +2417,7 @@ static int __init remoteproc_init(void) { rproc_init_sysfs(); rproc_init_debugfs(); + rproc_init_cdev(); rproc_init_panic(); return 0; @@ -2420,6 +2429,7 @@ static void __exit remoteproc_exit(void) ida_destroy(&rproc_dev_index); rproc_exit_panic(); + rproc_exit_cdev(); rproc_exit_debugfs(); rproc_exit_sysfs(); } -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel