Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1502898ybf; Thu, 27 Feb 2020 12:14:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzMYVtcmhOm+T1iO8QByYnoCP71rIHZrOUHLJ+ZXZ4TftqrybaB20eI3fee2rPdYVnXluaj X-Received: by 2002:a05:6830:1492:: with SMTP id s18mr539502otq.216.1582834469183; Thu, 27 Feb 2020 12:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582834469; cv=none; d=google.com; s=arc-20160816; b=sLMXpVrA6DlbgjwztOHHGjcuy4NGVCJc40zAhN9kv8NbimWFl5retLyT1Ep2AZ1b7H Vr0pCccBwQLWgV42fHfEYn+BAXL0Bh7H35tWheeRf5f/ldw7o1YFFukBb5i88EUfTlym yfHFcg9So9/ZpC7SzZ7T5nBJNf8t11nB3JHpnMjSaHCYXo79/eYe8ClmIApNw4hg0Ffa OyizhP2U2d+9aH4rCLTB3YK+crVoZn4KtrwItwtDx7ogVT90lLZJ07NUQb92H+WbrYQj YkXWtPltRP104mnmEH7UIwjTo2Ys5RkQNKkQ/ndB5p6i0LBUqv5eBALmMi7Jmmffvqk1 Q0iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HueSZx0ts8rrl9axXw3uhQrr5WR5FCAoM3cWMzSUgig=; b=o1gLtGhMDaHKZGZmv0bw7fkjo++e7iD44Nc0HougoUJxkmtGa/tsRR+dgk3IWtSkQ/ cAvpUO+gJ2wp/G6NE5Vvl6hqPn7IHr470uTE5SqJaoIHYtllkM+DQ7PRohrle9WHmGpy E92mUJ8bRoccxnB+V/kSH/BeJgfGiGFBtbid1y7ukp1OqfPASpjIpLEsbquPMrpWkxq+ IhRrViABVa402NT7pQjagXNIrgcEci564ELU6VHMwuYwrSxmFVwq2iXbRE1wpzeTzBlJ EPy9FtFQzutPhVXrFuexX0I/RWbpJvukRDAKLyz1/X1bUf6Fs5XltPLeDFjKS/m+Wy9W Jreg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hNTfbru9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q66si499508oig.65.2020.02.27.12.14.16; Thu, 27 Feb 2020 12:14:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hNTfbru9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729711AbgB0UOM (ORCPT + 99 others); Thu, 27 Feb 2020 15:14:12 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:51227 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbgB0UOM (ORCPT ); Thu, 27 Feb 2020 15:14:12 -0500 Received: by mail-pj1-f66.google.com with SMTP id fa20so263008pjb.1 for ; Thu, 27 Feb 2020 12:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HueSZx0ts8rrl9axXw3uhQrr5WR5FCAoM3cWMzSUgig=; b=hNTfbru9GbcIsnZTVTdW0TakeEdKmidNn9IGs9Q4vyQM5obrsrI6gbCWhrTP1ZjqiG fNOQO9OikDz6eyrMN7moq6+WGCOBwPrQXpa4mnSSzA1zjBxWb2RPE+/8/vLCTnCaBr6+ J/9PTCyTntgmKIZdiizaCQpVBAkIyzUGztMR71yEdQgpX3u3ovwgmtmnr04S4yvqhWy/ o/4yKE3uf+lGEqeLvsHPav3OumWq/dUSWNoOD1zYxCtB8GSe/M7PmgK0T9e4u3e1oT3M NI181DWGmEzEoSrD1WNQ30g8z0NTEHw6ZFeB9C8lZAlzm7nGhujoJQ+Am/nLoY1gT+Vo bjsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HueSZx0ts8rrl9axXw3uhQrr5WR5FCAoM3cWMzSUgig=; b=dzksoOj95T4Oawc6gFG4hjDeW8GtIO2M8DvzbT7Q0rJWUAuFlQt1LFQy3ujPV3Y/v5 +XW/Bdl0JnVidbqkr71XCx57jV7tsX1TgKo8ooqmeDHcBCVt86k/cIe+wxOB2vMzH7sa 71j6haPlhHjvAsaKNcKp1wWP9JIdYHSOdIk4Vo1ZeepqbErmy5cZhOPGikX1evbI96hI iZkk6TEioR1K9gS0HcFVbpqAskDIpYqx+kkiHTlnLVW9E3vy3LNZ4Swsm84kOm3MibN8 sq+/zjLRJ4BixQRlR8dMAUXGqMucado0EkwEv+Gc+ksr8RP2H88WYaOu26/8x3ijZtZv c9fw== X-Gm-Message-State: APjAAAWMsq3Uf97kfHe37RvVe8Gs1MpMP7O28nVFSCsVzZgmGtRGsekR yjIv2jwv2ckaxyEiepk+nZros2nyfHc= X-Received: by 2002:a17:90a:191a:: with SMTP id 26mr656861pjg.111.1582834450608; Thu, 27 Feb 2020 12:14:10 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v29sm7349350pgc.72.2020.02.27.12.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 12:14:10 -0800 (PST) Date: Thu, 27 Feb 2020 13:14:08 -0700 From: Mathieu Poirier To: Siddharth Gupta Cc: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com, Rishabh Bhatnagar , 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 Subject: Re: [PATCH 4/6] drivers: remoteproc: Add name field for every subdevice Message-ID: <20200227201408.GB20116@xps15> References: <1582167465-2549-1-git-send-email-sidgup@codeaurora.org> <1582167465-2549-5-git-send-email-sidgup@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1582167465-2549-5-git-send-email-sidgup@codeaurora.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 19, 2020 at 06:57:43PM -0800, Siddharth Gupta wrote: > From: Rishabh Bhatnagar > > When a client driver wishes to utilize functionality from a particular > subdevice of a remoteproc, it cannot differentiate between the subdevices > that have been added. This patch allows the client driver to distinguish > between subdevices and thus utilize their functionality. > > Signed-off-by: Rishabh Bhatnagar > Signed-off-by: Siddharth Gupta > --- > drivers/remoteproc/qcom_common.c | 6 ++++++ > include/linux/remoteproc.h | 2 ++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c > index 60650bc..5d59538 100644 > --- a/drivers/remoteproc/qcom_common.c > +++ b/drivers/remoteproc/qcom_common.c > @@ -58,6 +58,7 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) > glink->dev = dev; > glink->subdev.start = glink_subdev_start; > glink->subdev.stop = glink_subdev_stop; > + glink->subdev.name = kstrdup("glink", GFP_KERNEL); Because @subdev is a member of qcom_rproc_glink (rather than a pointer), it is possible to get to glink with container_of(). From there edge->name is available - would that work? > > rproc_add_subdev(rproc, &glink->subdev); > } > @@ -73,6 +74,7 @@ void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glin > if (!glink->node) > return; > > + kfree(glink->subdev.name); > rproc_remove_subdev(rproc, &glink->subdev); > of_node_put(glink->node); > } > @@ -154,6 +156,7 @@ void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) > smd->dev = dev; > smd->subdev.start = smd_subdev_start; > smd->subdev.stop = smd_subdev_stop; > + smd->subdev.name = kstrdup("smd", GFP_KERNEL); Same as above - qcom_smd_edge has a name. Worse case scenario, both qcom_rproc_glink and qcom_smd_edge have a device_node that can be used as well. > > rproc_add_subdev(rproc, &smd->subdev); > } > @@ -169,6 +172,7 @@ void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) > if (!smd->node) > return; > > + kfree(smd->subdev.name); > rproc_remove_subdev(rproc, &smd->subdev); > of_node_put(smd->node); > } > @@ -220,6 +224,7 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr, > const char *ssr_name) > { > ssr->name = ssr_name; > + ssr->subdev.name = kstrdup("ssr_notifs", GFP_KERNEL); > ssr->subdev.unprepare = ssr_notify_unprepare; > > rproc_add_subdev(rproc, &ssr->subdev); > @@ -233,6 +238,7 @@ EXPORT_SYMBOL_GPL(qcom_add_ssr_subdev); > */ > void qcom_remove_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr) > { > + kfree(ssr->subdev.name); > rproc_remove_subdev(rproc, &ssr->subdev); > } > EXPORT_SYMBOL_GPL(qcom_remove_ssr_subdev); > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index e2eaba9..e2f60cc 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -519,6 +519,7 @@ struct rproc { > /** > * struct rproc_subdev - subdevice tied to a remoteproc > * @node: list node related to the rproc subdevs list > + * @name: name of the subdevice > * @prepare: prepare function, called before the rproc is started > * @start: start function, called after the rproc has been started > * @stop: stop function, called before the rproc is stopped; the @crashed > @@ -527,6 +528,7 @@ struct rproc { > */ > struct rproc_subdev { > struct list_head node; > + char *name; > > int (*prepare)(struct rproc_subdev *subdev); > int (*start)(struct rproc_subdev *subdev); > -- > Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project