Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1232551pxj; Wed, 19 May 2021 01:05:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0hAWiNNOCXeLzf2ZIABe4z4KKHcVruRkbleY1zlOQ+WWt2f3kAGOLZ7s/DaqDog/5MDUZ X-Received: by 2002:a05:6402:1489:: with SMTP id e9mr13091256edv.8.1621411525324; Wed, 19 May 2021 01:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621411525; cv=none; d=google.com; s=arc-20160816; b=AXsyOxYPNsxQahQOCdtmTqGira1EThMAgrd8jBegQhK9+1hNScUhnJ+sfQ7EDhXvZB tZanTa3HzEJpnU4WzZ0gEP54TjS8XPOoqm1hfflsNnM4aIk7JS/cNKdJT6N/MRA9YrWF lDUElDDc/pWyEFmzLYi060G7/FHGT4h5fO/zDwfnmtqX6gJwlrChZHaHbrLRKNNL4LXD Lq/cpKO8itDEDETitNXONGZxh9ovhkkeJ8yg7DFfH9dKUdPBG6ovH6CJXYaxwd2Q0Be4 BIRqpS5cbtEkz/KswS4PeCXM8pkHy1Ybcb9htw6bCFqctZweJ1nyr87U37CRruD9kjoZ 3cQw== 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=TocStTG0XB1qy9GrSaZ8rscY4lMKdHiICfCOtWRyqWU=; b=H+siICYhUDTo1OYRnBZhBbkK1wk6iZwU98EE4Q0/rqeAk4DiiSHr2Tg6TpxmLCIzs0 pZGkeW0h+BS2lCJcYXfyttd7h8nsfyqhMjEE9Iov3SE0WFgWvnTghUFFj1YlprYcqQ75 wd2l1Zq32EVMfmOkoz4Nu+7K3TGxJ8Iz4gKa4iQAmhVzUme4hxFEh8oDbWqc/FYp7EKR aWkU+TtsWNEtmd2Z8YyL+QGKcLee7NRP37BNQgUHfAxifkngAd3WfPVLP+KuUpAmrWyL Bg3ch/MLmROpO5EH4uXvUsvou+6nLopabU2DHeKCEgbmHgI5/nY+4LofK48hunD7gFDI FCdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=p0+PmnP3; 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 b10si23363292ejj.523.2021.05.19.01.04.49; Wed, 19 May 2021 01:05:25 -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=p0+PmnP3; 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 S244352AbhEQUrc (ORCPT + 99 others); Mon, 17 May 2021 16:47:32 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:34642 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244190AbhEQUra (ORCPT ); Mon, 17 May 2021 16:47:30 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1621284373; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=TocStTG0XB1qy9GrSaZ8rscY4lMKdHiICfCOtWRyqWU=; b=p0+PmnP3wlcnBAwzgh1wnuJ5W7WDLVN8XrCpotWaq/KjAU9B0RJVB6/LTCYhs1/1j848ymyy EBjrFUCH1kvsZY4OfhOxAFggffYfTLjv9L9imG1PGLCAnLjsKXTSd989nk+LdRS3jHMtGTYc 8FQcAE7+x7CcQy3dMNgJsDYLSXc= X-Mailgun-Sending-Ip: 198.61.254.9 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-n02.prod.us-east-1.postgun.com with SMTP id 60a2d6108dd30e785fa325a0 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 17 May 2021 20:46:08 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 92A78C4338A; Mon, 17 May 2021 20:46:07 +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 5D5B3C433D3; Mon, 17 May 2021 20:46:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5D5B3C433D3 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 1/3] remoteproc: core: Move cdev add before device add Date: Mon, 17 May 2021 13:45:47 -0700 Message-Id: <1621284349-22752-2-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621284349-22752-1-git-send-email-sidgup@codeaurora.org> References: <1621284349-22752-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 --- 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 626a6b90f..562355a 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2316,6 +2316,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; @@ -2329,11 +2334,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