Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3268303pxj; Mon, 14 Jun 2021 19:27:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEOan3GnVSM334wByd6OGzJYgWKOTokhuqCii/HZbLRKsGHXg1zEo2BGVJficNcEUWTc70 X-Received: by 2002:a05:6402:cb5:: with SMTP id cn21mr20276401edb.164.1623724026877; Mon, 14 Jun 2021 19:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623724026; cv=none; d=google.com; s=arc-20160816; b=JnDg/GVqaqkWGJLRb2tQALTHBBVbueXQOLcoR1hU04q5Buflir/n83xLMEdGqwT4qy EoKn2DmBB0epmYhXsJY93cstdVfmfAttw1t6L/ukkJiTyPktbPz1rZAFBmVFCk32qFb7 wcqBIHNJux9gzH3gyv0KcrZ7iocDGGfnF2RKspHRkncFALw4o2+rL04zMj4t1MwSHnF8 2k2rDLcleObw+DxOasxxIA++LJUsXs1FhQC1tDmystDZalF9b/EHCDlStdoLW6ZLYJma NqbrRknpicCJXU01hjY40BK3lCNAlbSNa68v5CF1CCD179bpfTeCtSsyWcx6yh60dJkl PpZw== 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=NqhFTMXXwHAuproiy45YVkIrNJ+UAwV2CNiMlqxL/ok2xvs5C8C9TEF/TgNzFKrAoT ymjpd026cEv/33ES2ZH+VNw/H5y0DwHsLjDpKmQtaAsSLTjf3Pd2puTvxl2ILSVkKd72 4YiA7VMyBrc8ogGgAO2zDfGrxI+fbk7lMQLqr/tGNlnn3dxuIgw2ny9DKlx9lsxOoV9Y 7pCicttq89j7byMpHScrtjc/S4NEirt6Sa/hOys1s9JludmB3FcaRAghsPaQBCTaK+n1 b500J2kKkUl7mu4lpHqycvMntMVi7YtN0JaP9Ln8ZI0aNv+No76PFhp86KpEFd22Zm9e g6Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Hmj7pphL; 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 jz1si12756585ejb.461.2021.06.14.19.26.44; Mon, 14 Jun 2021 19:27:06 -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=Hmj7pphL; 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 S231868AbhFOC0M (ORCPT + 99 others); Mon, 14 Jun 2021 22:26:12 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:12620 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbhFOC0D (ORCPT ); Mon, 14 Jun 2021 22:26:03 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623723840; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Fh3LQYTuFAvNjhbMx7475BUc/YgZsqQM5Z8jXNUrVGQ=; b=Hmj7pphLOxvGpXmwhIO66lAuzV06nUh0rlaYa5eYef55xCzT87evZRi0IPWBtHuFSBuu5YP5 /PuhXq8EfbTpIA9LjO98YZUlQ7MmA0gcQdLvnUjQT1+SYrf+J9/AwaNvpdT6e24JdTriYAX6 wM3aTajJQSLdha1qGnBRAKbGVaM= 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-n01.prod.us-west-2.postgun.com with SMTP id 60c80ea08491191eb3f5d641 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Jun 2021 02:21:20 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A484AC43217; Tue, 15 Jun 2021 02:21:20 +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 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 AFC35C433D3; Tue, 15 Jun 2021 02:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AFC35C433D3 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 v3 1/4] remoteproc: core: Move cdev add before device add Date: Mon, 14 Jun 2021 19:21:08 -0700 Message-Id: <1623723671-5517-2-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623723671-5517-1-git-send-email-sidgup@codeaurora.org> References: <1623723671-5517-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