Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3071009pxj; Mon, 14 Jun 2021 13:44:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPfV3Ero94bL8U4MDFltFbNYqzPZ0qXCupddEOJtv5Xqh7c3Hpwyyw+HDKNqtIl2PEorlF X-Received: by 2002:a17:906:ae91:: with SMTP id md17mr17837392ejb.433.1623703494577; Mon, 14 Jun 2021 13:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623703494; cv=none; d=google.com; s=arc-20160816; b=XihF/BE/HHD7rpT3PKoXzcoLIvmYveuN6BsO+6T/5hBLKTqGU6pcPGmOUxVQKDTVic f2f4AqoJSQcHtRKrVGpHXjloF4YvZhL8e3xzFMSm+i2j285cgL2AunRvGGhjY7wfwRTv I0qwHqHdkkpiFh+vx3vdSMXObeO2kM+JukL0rqiWrPcxtdtV8eap7Ct1Y22ntXs6djY1 GRcTZh/2AP4dlt5WQo3v4uja6AmUT+OV8hbj2AqNGFbFTvAhdPF7eaR1+jX/G77IC+Iw UbvLoP73LdvmXSpZTKmKHJrAWwvH3cYX+bzxNg4SshV5PwjCvQNFHc8GXQioIahLpltA R1Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=Fh3LQYTuFAvNjhbMx7475BUc/YgZsqQM5Z8jXNUrVGQ=; b=U3drjAFnXKtqQqhr8HGWX4+j0uhVCpLym5+0Py7t69DO96uChrOJK/z26JTxfzghgX 3c0Y0glkimWGSqJt6kwoTBhs/NhCfdYPiova9wrsaynaTMHBFbxs25J/9h4M0GX+ShBf l3nild15/gOfhcP3lSeP5azkXwQ5zhFKYO5FzCaH7HOzaygrzBAuoW+bgs+OCmHNySxu xMXIcs4kr+tY5L9zWBun8iFAFTd5qeAf/efnD6WwHyRxi5AIuiPUZvq1XdXvX7FcXh2u tDkxpfujym/3BuXZw1vy0FWvfwrPJxQJh0Kaal764ig6xG+sfEb6wZiTWiTSYBgnE4i2 Xc3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=aXRXp5DN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt21si11936022ejb.198.2021.06.14.13.44.31; Mon, 14 Jun 2021 13:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=aXRXp5DN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235674AbhFNUnS (ORCPT + 99 others); Mon, 14 Jun 2021 16:43:18 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:52095 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235586AbhFNUnR (ORCPT ); Mon, 14 Jun 2021 16:43:17 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623703274; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Fh3LQYTuFAvNjhbMx7475BUc/YgZsqQM5Z8jXNUrVGQ=; b=aXRXp5DN6cL6B9w+E0lvCr93buA3zkJj63CEN7I82ZHYwHI3dDcoKesPYr+aIPSAIOpiwyQb hSpsMqf9VgKRda0YNQ0j6OYRnJ/tSqropQ1CohT2WHoaADOqYq+oSuypKsfirLMom1g+/eYf djy3qumtj9Sc11nQw1LkltIN/s0= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 60c7bed9abfd22a3dc97c3dc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 14 Jun 2021 20:40:57 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 44C32C43460; Mon, 14 Jun 2021 20:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 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 0C0E7C4338A; Mon, 14 Jun 2021 20:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0C0E7C4338A 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=fail smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: bjorn.andersson@linaro.org, ohad@wizery.com, linux-remoteproc@vger.kernel.org Cc: Siddharth Gupta , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, psodagud@codeaurora.org, stable@vger.kernel.org Subject: [PATCH v2 1/4] remoteproc: core: Move cdev add before device add Date: Mon, 14 Jun 2021 13:40:41 -0700 Message-Id: <1623703244-26814-2-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623703244-26814-1-git-send-email-sidgup@codeaurora.org> References: <1623703244-26814-1-git-send-email-sidgup@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When cdev_add is called after device_add has been called there is no way for the userspace to know about the addition of a cdev as cdev_add itself doesn't trigger a uevent notification, or for the kernel to know about the change to devt. This results in two problems: - mknod is never called for the cdev and hence no cdev appears on devtmpfs. - sysfs links to the new cdev are not established. The cdev needs to be added and devt assigned before device_add() is called in order for the relevant sysfs and devtmpfs entries to be created and the uevent to be properly populated. Signed-off-by: Siddharth Gupta Reviewed-by: Bjorn Andersson --- drivers/remoteproc/remoteproc_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 6348aaa..9ad8c5f 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2333,6 +2333,11 @@ 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 < 0) + return ret; + ret = device_add(dev); if (ret < 0) return ret; @@ -2346,11 +2351,6 @@ int rproc_add(struct rproc *rproc) /* create debugfs entries */ rproc_create_debug_dir(rproc); - /* add char device for this remoteproc */ - ret = rproc_char_device_add(rproc); - if (ret < 0) - return ret; - /* if rproc is marked always-on, request it to boot */ if (rproc->auto_boot) { ret = rproc_trigger_auto_boot(rproc); -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project