Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2345874pxb; Sat, 21 Nov 2020 19:31:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHgdX36nawmj7ZMugp0dj5VgSeI9XGStR2vgqV1FhpuO9RDQN3vm8EEI9Ae3FrNohYo8ja X-Received: by 2002:a17:906:8c7:: with SMTP id o7mr32954329eje.413.1606015869411; Sat, 21 Nov 2020 19:31:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606015869; cv=none; d=google.com; s=arc-20160816; b=0y4sZeQBiDHs4fnt4JcZ0Kk0S2NKRSP1pSy+zh3KGAhZw9GxCzp5HOKbT3p63wJVJL ANlwHlEAJvBeWEaQawaSPX9hXtgaex0+LhRzd4NY07TmSlvkia3rg6R9jogA0T4hAa4q bgx/Xp/geC9tFCq1nlDR2Uv9O1yDeuWCp0vViyNOD252OsCsaYEcDlr0nwYn7M8DsqGx S+4sa3xwvW45oQt4XaDMO0Ga61PEQiQzhda2u5VmKufcv7uFu94GVZa6N5u3lMmcdfCC DhiZug0Qn3kM6Fqk6EG+xh00UVgknlvcjcT+DTAojUAKlm2DI1dhczwDIHZpjzx1Q+ss pgEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WJX+iwCNrLY6xkeYMcGsZvSc2bHXcPa6YPJqPYja4x8=; b=QSJEDfXPPVkXM1+ItNFLAnUN3P8rKopCfib+qCx0ynaWgB7/sqW41QDw9/TsbeSzZq oVZSchQyGioAHG4XOpg/ghwAh7WEvlPfcwLfeCnXW5RU0pMv1ZknoT323H/iIiKiuPVd mrp870s5Mb+3iFLRsCEzLI4jNpxhffqgBFWzCgWFtAwdCKI/+8IAYXeg+7olhxtLC1ag 6VbqCzB1w7rrYRbQuiFzgguebn72Vi/fx16ClRb394TOKUho1GHK5xVQYkhJzrtjQjmh 3395DR7sLglLU0mMZJz3DZEOXyNG6p9jU02Gz1WAsaOIRyPDPhAocGHPj22R0Zi8QGer +8uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DN1PPyz9; 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 u9si4652422edb.338.2020.11.21.19.30.47; Sat, 21 Nov 2020 19:31:09 -0800 (PST) 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=DN1PPyz9; 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 S1727249AbgKVDZ0 (ORCPT + 99 others); Sat, 21 Nov 2020 22:25:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727237AbgKVDZZ (ORCPT ); Sat, 21 Nov 2020 22:25:25 -0500 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA1AC0613CF for ; Sat, 21 Nov 2020 19:25:25 -0800 (PST) Received: by mail-ot1-x341.google.com with SMTP id k3so12736913otp.12 for ; Sat, 21 Nov 2020 19:25:25 -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; bh=WJX+iwCNrLY6xkeYMcGsZvSc2bHXcPa6YPJqPYja4x8=; b=DN1PPyz9MoRKDfIWWWgkA09mEVlXnqYAWl8vTLJXTSRJkv2ClFu2i3aMYVbZdeoqX9 pKLKGJ2Oc8i/zsMrza+EdthuBFm5g8R6a5Shq7pMQWJJNbJOWr1CYkZTRlU0YDfiJkWs 6AWHQD7LST88nPRSwwXSmtm4Dka/f7i3srcDe3mBJNkjfNSI2Vpzt2Vy7zvfFA0w4urM UnNQeSy0B1tZwGBHPHDrEdxJRAJDDjtFrfLbyza30skD5tY6fjc2/ZOvryraDLB/8SzI CiLFAE6uqoaD8jf3JZ2LlvmnhOMyvKvU2Nsq+nw+0RR/xJ5xBkfAZXl1IQmz+jGcezpt og7g== 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; bh=WJX+iwCNrLY6xkeYMcGsZvSc2bHXcPa6YPJqPYja4x8=; b=st9D4X2qX+98E1tCHflAIkUMm6LQlIJwG9k4pVIvX7/axBw/Cz0nIsQt0u50Wbp9Yh kU6+go/UlZ5G6oZL0g694ioD5XjZGohzEESXS57I96GhLeDQrQHxuTLbWpenEGsoMnVS QGPYUCz30VtFDVxv2JpHPvotpZzkL7wdf8a7TouS4QlggEbEegTz8E1Uj8wdixWfKy4j QzN25e5A6XQoredAcRs9DC9EjKbFmIGh6CTW3faYYII+DlDVWnX/nzOonA+BMFEZfV0B UO0AsTr8N0jyOtrtB3o4qg/Sp7fvvBXkdkmUgX+H4OnHV1ACXT9KpQ+JF7X2NsSeHz/N 0jBw== X-Gm-Message-State: AOAM531VtXhqgxn+CvbH6S+HS2+N4QRryuzCUMW5OLWPaNHCMZtpTYM7 LjPMpXsSdy+KfBrCJn297ikO+M2k8uaWSg== X-Received: by 2002:a9d:62c9:: with SMTP id z9mr19325119otk.18.1606015525052; Sat, 21 Nov 2020 19:25:25 -0800 (PST) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id s28sm4190142otd.2.2020.11.21.19.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2020 19:25:24 -0800 (PST) Date: Sat, 21 Nov 2020 21:25:22 -0600 From: Bjorn Andersson To: Chris Lew Cc: agross@kernel.org, sibis@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] soc: qcom: aoss: Add debugfs send entry Message-ID: <20201122032522.GN8532@builder.lan> References: <1604373541-12641-1-git-send-email-clew@codeaurora.org> <1604373541-12641-2-git-send-email-clew@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1604373541-12641-2-git-send-email-clew@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 02 Nov 21:19 CST 2020, Chris Lew wrote: > It can be useful to control the different power states of various > parts of hardware for device testing. Add a debugfs node to send > messages through qmp to aoss for debugging and testing purposes. > > Signed-off-by: Chris Lew > --- > drivers/soc/qcom/qcom_aoss.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c > index 8f052db1880a..2fd755d2a92d 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 > @@ -85,6 +86,8 @@ struct qmp { > struct clk_hw qdss_clk; > struct genpd_onecell_data pd_data; > struct qmp_cooling_device *cooling_devs; > + > + struct dentry *debugfs_fp; > }; > > struct qmp_pd { > @@ -541,6 +544,34 @@ struct qmp_device *qmp_get(struct device_node *np) > } > EXPORT_SYMBOL_GPL(qmp_get); > > +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 len; > + > + ret = copy_from_user(buf, userstr, len); > + if (ret) { > + dev_err(qmp->dev, "copy from user failed, ret:%d\n", ret); > + return len; > + } > + > + ret = qmp_send(qmp, buf, QMP_MSG_LEN); > + if (ret) > + dev_err(qmp->dev, "debug send failed, ret:%d\n", ret); You should propagate this error to the caller, i.e. return ret ? ret : len; And with that the error print doesn't really add any value, so please drop it. > + > + return len; > +} > + This will result in a compile warning when compiled without CONFIG_DEBUG_FS, so either mark it __maybe_unused or wrap the whole hunk in a #if IS_ENABLED(CONFIG_DEBUG_FS). PS. Feel free to resubmit this change on its own, as it can be merged independently from patch 1. Regards, Bjorn > +static const struct file_operations aoss_dbg_fops = { > + .open = simple_open, > + .write = aoss_dbg_write, > +}; > + > static int qmp_probe(struct platform_device *pdev) > { > struct resource *res; > @@ -595,6 +626,9 @@ static int qmp_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, qmp); > > + qmp->debugfs_fp = debugfs_create_file("aoss_send_message", 0220, NULL, > + qmp, &aoss_dbg_fops); > + > return 0; > > err_remove_qdss_clk: > @@ -611,6 +645,8 @@ static int qmp_remove(struct platform_device *pdev) > { > struct qmp *qmp = platform_get_drvdata(pdev); > > + debugfs_remove(qmp->debugfs_fp); > + > 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 >