Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3949482pxj; Tue, 15 Jun 2021 12:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOTMaxlRkQGDyh3T6YF+djTld5JqKAAjMRQe2OSeW0bcdJGqV4PrcAfXhTHaewtcZDYOfK X-Received: by 2002:a05:6602:3152:: with SMTP id m18mr643239ioy.30.1623783891536; Tue, 15 Jun 2021 12:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623783891; cv=none; d=google.com; s=arc-20160816; b=Qnhznw0m40vlv3A+2tVOGpqR/e9nVRBSbk/MQvV5BGfpHN7B9qL8q93psxnTmvVkYI QWCLDN930ylOrObV7OwAlkxQinfMjmhdAD5hBTebm4euwc8UxghMJX1QTCfUr0GuRWml mJnjLtWRo07m7N+cR+taPSjM6O6EyEvnmq7kMo/lC+ILWoHKoCgL9TXjWgTD0vaXtqko DwRGG8cja2hPttjsIv3K/ElWQu9qOGcVq5dj3gHs1tjbafY3Wp7DbxSGsTlcML5YDBGI cB2DW3KWHGfk0xL4oAF+bEC9J2aGQBOfngWc24ldwa67m/E6nNc8xCm7O4XHjnHbNS0c DGMQ== 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=XLDXlbBf1RkYvs69WN6jCHKwvNyh18c2GNsG4IDrBqs=; b=So2ASXPT3oQilHH9jSz0jzHKaVHCvjYNT1nohPKJet3HqxQYzwHQ8Ttia6/Ed7R9bC MVqI359O0B8WVP1MsRTUXhmxhSWaL8f4Tv1mP3Aaewfc3RbE+Vq/CbtlBq/b8G6wJ3yU NqqXnbrIUaDHmCzhjpOflrUtyR01ZzxgbY8SC1t8a2X9IVPRwkxQ+3PYu41v7VMLfYY3 C5pShvXI4InYe69uWKJcRs3TdmpvIezrzNZ+UW7VKMC5avN3HT+T3CJ9x2d9/k2MYdC+ CRwzQJUxT1DibmfSibScPF47uHHA++dCuSne+IsZ8gD8qbG4GgartiOha4ONXQRTnGyR ngCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=LDLhBlW1; 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 j12si8454633ils.44.2021.06.15.12.04.39; Tue, 15 Jun 2021 12:04:51 -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=LDLhBlW1; 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 S229749AbhFOTGF (ORCPT + 99 others); Tue, 15 Jun 2021 15:06:05 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:59815 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbhFOTGE (ORCPT ); Tue, 15 Jun 2021 15:06:04 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623783839; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=XLDXlbBf1RkYvs69WN6jCHKwvNyh18c2GNsG4IDrBqs=; b=LDLhBlW1k6DqTsSvTyoleiKmozVc0suAMTRXdAM31BIscmiIboEUODmiXMweQ1YwRvfccrk5 N8c3ZZtvxRTdOGikp3HLaYh/N+d4/FdYZUuwwrayPABrFCvwejpp7ugoX6fZZT1Es34HXlis W6E3S/EQj/9EyS77P4BK8NL5p0k= 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-n05.prod.us-west-2.postgun.com with SMTP id 60c8f99be570c05619ff2c5e (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Jun 2021 19:03:55 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8D110C433D3; Tue, 15 Jun 2021 19:03:55 +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 50AD1C433D3; Tue, 15 Jun 2021 19:03:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 50AD1C433D3 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 v4 1/4] remoteproc: core: Move cdev add before device add Date: Tue, 15 Jun 2021 12:03:41 -0700 Message-Id: <1623783824-13395-2-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623783824-13395-1-git-send-email-sidgup@codeaurora.org> References: <1623783824-13395-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 Cc: stable@vger.kernel.org --- 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