Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1157219pxf; Fri, 9 Apr 2021 01:10:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3lowebaiq7wgS5bmuXYbh8cdQSAltRP/6piR2rQ51k61sZLbUAhUg3BXIZ3+h8fSbKSMK X-Received: by 2002:a17:90a:644d:: with SMTP id y13mr12333548pjm.168.1617955847194; Fri, 09 Apr 2021 01:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617955847; cv=none; d=google.com; s=arc-20160816; b=a+Gy5zn/bMU6KgAx3IcC8w+MSm73t9pyVWOtBXjA9GGpC5ALviXQt5m39UgkS/eCcb a8m3E6Vj2h8MEuzuSg5vewOWrJv9SJluhDTRNIDJt8jhjM55mqASggD+RmHanLGmCekv MfDoI0SUEe1qTxP4e7odgGUUsngRPdeO/GjtElPmTm65XF7/iXniLv4aPQRlZtlmO/lI 8Yi7Tc4JYr2MYEi40j/oGDoXyxvqNb1rvl6nAEBh+rvvkIyKvsNQI2KEUF5VZSUG3CSl ZmXK5C1SLpq8njQSo2mD2Jiw51fpLLO7qOB4knohkkzBkdgI7ddzSnMVQpOXn//LdbCs O40A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=GZEKNpc5NkiGkvi6lIHFrkThqi2fqlKkWIV3fYKJyuA=; b=YC/X7RB8WVE8CiGQPLR/zo45NSuobf0izvP04eCCMm+R1zgT5EtEPc4niD6ZY0OCoI f69iEZAAK3wx/LW3k0/vb13E36Jd+nCshWYZXGMwfG55NrJt+qEtxI2EMCtl6ipsLiiF /CN5SYIDQgAmPYQJuM4wlQtk5qkvWX+GxSZFkTknoxA8nlPjapm+RESpRI0rcQwmQIoD q38OmBZA8coqypW9DFGhPlosrKFbpPTzFBTmrOXtfvyJKAoIwtmdY7ZoYdtoaNeGNotF KwXq4oIvhMN9J/8MJuytpmFwdb3u6BNkwb7mXfd51grsfQ8zsa1cGLfjQi2xlSOTMRy8 i1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gc4UhQTr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd12si2249946plb.198.2021.04.09.01.10.34; Fri, 09 Apr 2021 01:10:47 -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=@linaro.org header.s=google header.b=gc4UhQTr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230181AbhDIIKK (ORCPT + 99 others); Fri, 9 Apr 2021 04:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbhDIIKK (ORCPT ); Fri, 9 Apr 2021 04:10:10 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1112C061760 for ; Fri, 9 Apr 2021 01:09:57 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id s11so3745526pfm.1 for ; Fri, 09 Apr 2021 01:09:57 -0700 (PDT) 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=GZEKNpc5NkiGkvi6lIHFrkThqi2fqlKkWIV3fYKJyuA=; b=gc4UhQTrFpfRpAHfE+rHovxWUmxetzTRDbP0b3VohpspZz4bz9yJsZQ4pQyOHs3C2d a709dWDa92NaLpGrJ9DsSOV8nIKRLQ9jk7kLH4DCSaIHD5rmHjCOopn5hOV7kGXF32Cd GOebrQFDP9TOBqGJVBXWJ5kfJpI+FISCSP19cIZChRfEtU4fI/Gr0KwllL7dDwxRL/qj U/BTDwGc52Kf/fJuKtyxW0J6QyBBP6dUXJDd+F5CJgnx3tLX2OJ8sXFzlPkoMFk+sci0 j1QqfQAjJ1SweYZ+BuFGN96FLx9ZiDrgNJPyzLuYN4vOAiivnOItRPr064c5E92spjg/ 1VEg== 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=GZEKNpc5NkiGkvi6lIHFrkThqi2fqlKkWIV3fYKJyuA=; b=gZbXCxmmbC/WzUj9biKy5B6zHvhbKUlwcoEzbcMVsuJnGTYFNjsbO5gVAX3zuXIvRd oiMiwN/P/IMf7xAuQCSyOlRJJxMQJdu5rv0L/H/OJc51X4qEBsgcPO+pHk5PQ+Mq7MNC MBSKI6xJQ8AC57UKDas/nd8CFIsgL8PLeU5pzMWNtFnDv03RzFo0m92O55vFIi/m2zeU rbc/HjupSZGQt4at6KwhgL2o5sn7wg0FRDF/p6buqJPdq9vbFp/sxqyGn7VL6Uy4QrHq PbuyEINIiO+1mMPx3AqWWxvAhSiMPMC9Bfudo7Q+FnarT8Hlp0G1/eqQAx3oZ7yigy7e Zlww== X-Gm-Message-State: AOAM5303RXmdcUOQir/i6vcTjCJhMXVeR86cYFK7ey6BcFI1kKXz/ogm 3JQC+5KJ0Yf7PFRqI9cUJFYk X-Received: by 2002:a63:3e4b:: with SMTP id l72mr11801928pga.203.1617955797234; Fri, 09 Apr 2021 01:09:57 -0700 (PDT) Received: from work ([103.77.37.131]) by smtp.gmail.com with ESMTPSA id q9sm1805976pfn.19.2021.04.09.01.09.54 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Apr 2021 01:09:56 -0700 (PDT) Date: Fri, 9 Apr 2021 13:39:52 +0530 From: Manivannan Sadhasivam To: Deepak Kumar Singh Cc: bjorn.andersson@linaro.org, clew@codeaurora.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Deepak Kumar Singh , Andy Gross Subject: Re: [PATCH V2 2/2] soc: qcom: aoss: Add debugfs entry Message-ID: <20210409080952.GA17381@work> References: <1617943188-23278-1-git-send-email-deesin@qti.qualcomm.com> <1617943188-23278-3-git-send-email-deesin@qti.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1617943188-23278-3-git-send-email-deesin@qti.qualcomm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09, 2021 at 10:09:48AM +0530, Deepak Kumar Singh wrote: > It can be useful to control the different power states of various > parts of hardware for device testing. Add a debugfs node for qmp so > messages can be sent to aoss for debugging and testing purposes. > > Signed-off-by: Chris Lew > Signed-off-by: Deepak Kumar Singh > --- > drivers/soc/qcom/qcom_aoss.c | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c > index 0e397a7..6057bbe 100644 > --- a/drivers/soc/qcom/qcom_aoss.c > +++ b/drivers/soc/qcom/qcom_aoss.c > @@ -4,6 +4,7 @@ > */ > #include > #include > +#include > #include > #include > #include > @@ -88,6 +89,9 @@ struct qmp { > struct clk_hw qdss_clk; > struct genpd_onecell_data pd_data; > struct qmp_cooling_device *cooling_devs; > +#if IS_ENABLED(CONFIG_DEBUG_FS) > + struct dentry *debugfs_file; > +#endif /* CONFIG_DEBUG_FS */ > }; > > struct qmp_pd { > @@ -560,6 +564,34 @@ void qmp_put(struct platform_device *pdev) > } > EXPORT_SYMBOL(qmp_put); > > +#if IS_ENABLED(CONFIG_DEBUG_FS) > +static ssize_t aoss_dbg_write(struct file *file, const char __user *userstr, > + size_t len, loff_t *pos) > +{ > + struct qmp *qmp = file->private_data; > + char buf[QMP_MSG_LEN] = {}; > + int ret; > + > + if (!len || len >= QMP_MSG_LEN) > + return -EINVAL; > + > + ret = copy_from_user(buf, userstr, len); > + if (ret) { > + dev_err(qmp->dev, "copy from user failed, ret:%d\n", ret); Does the userspace need to know how many bytes were not copied? I don't think this is a useful information. So you could remove this err print. With that, Reviewed-by: Manivannan Sadhasivam Thanks, Mani > + return -EFAULT; > + } > + > + ret = qmp_send(qmp, buf, QMP_MSG_LEN); > + > + return ret ? ret : len; > +} > + > +static const struct file_operations aoss_dbg_fops = { > + .open = simple_open, > + .write = aoss_dbg_write, > +}; > +#endif /* CONFIG_DEBUG_FS */ > + > static int qmp_probe(struct platform_device *pdev) > { > struct resource *res; > @@ -616,6 +648,11 @@ static int qmp_probe(struct platform_device *pdev) > > atomic_set(&qmp->orphan, 0); > > +#if IS_ENABLED(CONFIG_DEBUG_FS) > + qmp->debugfs_file = debugfs_create_file("aoss_send_message", 0220, NULL, > + qmp, &aoss_dbg_fops); > +#endif /* CONFIG_DEBUG_FS */ > + > return 0; > > err_remove_qdss_clk: > @@ -632,6 +669,10 @@ static int qmp_remove(struct platform_device *pdev) > { > struct qmp *qmp = platform_get_drvdata(pdev); > > +#if IS_ENABLED(CONFIG_DEBUG_FS) > + debugfs_remove(qmp->debugfs_file); > +#endif /* CONFIG_DEBUG_FS */ > + > qmp_qdss_clk_remove(qmp); > qmp_pd_remove(qmp); > qmp_cooling_devices_remove(qmp); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >