From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org,
pierre-louis.bossart@linux.intel.com,
kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com
Subject: [PATCH] ASoC: SOF: trace: Simplify count adjustment in trace_read
Date: Fri, 28 Jan 2022 14:06:27 +0200 [thread overview]
Message-ID: <20220128120627.18443-1-peter.ujfalusi@linux.intel.com> (raw)
The first count check and fixup against "buffer - lpos" can be removed as
we will do the adjustment later against the "avail" in
sof_dfsentry_trace_read()
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
sound/soc/sof/trace.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c
index f13024c8ebf2..9b505c4fe794 100644
--- a/sound/soc/sof/trace.c
+++ b/sound/soc/sof/trace.c
@@ -308,9 +308,6 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
lpos_64 = lpos;
lpos = do_div(lpos_64, buffer_size);
- if (count > buffer_size - lpos) /* min() not used to avoid sparse warnings */
- count = buffer_size - lpos;
-
/* get available count based on current host offset */
avail = sof_wait_trace_avail(sdev, lpos, buffer_size);
if (sdev->dtrace_error) {
@@ -319,7 +316,8 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
}
/* make sure count is <= avail */
- count = avail > count ? count : avail;
+ if (count > avail)
+ count = avail;
/* copy available trace data to debugfs */
rem = copy_to_user(buffer, ((u8 *)(dfse->buf) + lpos), count);
--
2.35.0
next reply other threads:[~2022-01-28 12:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 12:06 Peter Ujfalusi [this message]
2022-01-28 15:58 ` [PATCH] ASoC: SOF: trace: Simplify count adjustment in trace_read Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220128120627.18443-1-peter.ujfalusi@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.