* [PATCH] Add early return to Method because the else can be ignored.
@ 2021-03-24 12:20 Swen Kalski
2021-03-24 12:32 ` Greg KH
2021-03-26 11:31 ` Jonathan Cameron
0 siblings, 2 replies; 3+ messages in thread
From: Swen Kalski @ 2021-03-24 12:20 UTC (permalink / raw)
To: linux-iio; +Cc: gregkh
---
drivers/staging/comedi/comedi_buf.c | 56 ++++++++++++++---------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
index 3ef3ddabf139..05927fb321ba 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -366,42 +366,42 @@ static unsigned int comedi_buf_munge(struct comedi_subdevice *s,
unsigned int num_bytes)
{
struct comedi_async *async = s->async;
- unsigned int count = 0;
const unsigned int num_sample_bytes = comedi_bytes_per_sample(s);
+ unsigned int count = 0;
if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) {
async->munge_count += num_bytes;
- count = num_bytes;
- } else {
- /* don't munge partial samples */
- num_bytes -= num_bytes % num_sample_bytes;
- while (count < num_bytes) {
- int block_size = num_bytes - count;
- unsigned int buf_end;
+ return num_bytes;
+ }
- buf_end = async->prealloc_bufsz - async->munge_ptr;
- if (block_size > buf_end)
- block_size = buf_end;
+ /* don't munge partial samples */
+ num_bytes -= num_bytes % num_sample_bytes;
+ while (count < num_bytes) {
+ int block_size = num_bytes - count;
+ unsigned int buf_end;
- s->munge(s->device, s,
- async->prealloc_buf + async->munge_ptr,
- block_size, async->munge_chan);
+ buf_end = async->prealloc_bufsz - async->munge_ptr;
+ if (block_size > buf_end)
+ block_size = buf_end;
- /*
- * ensure data is munged in buffer before the
- * async buffer munge_count is incremented
- */
- smp_wmb();
-
- async->munge_chan += block_size / num_sample_bytes;
- async->munge_chan %= async->cmd.chanlist_len;
- async->munge_count += block_size;
- async->munge_ptr += block_size;
- async->munge_ptr %= async->prealloc_bufsz;
- count += block_size;
- }
- }
+ s->munge(s->device, s,
+ async->prealloc_buf + async->munge_ptr,
+ block_size, async->munge_chan);
+ /*
+ * ensure data is munged in buffer before the
+ * async buffer munge_count is incremented
+ */
+ smp_wmb();
+
+ async->munge_chan += block_size / num_sample_bytes;
+ async->munge_chan %= async->cmd.chanlist_len;
+ async->munge_count += block_size;
+ async->munge_ptr += block_size;
+ async->munge_ptr %= async->prealloc_bufsz;
+ count += block_size;
+ }
+
return count;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Add early return to Method because the else can be ignored.
2021-03-24 12:20 [PATCH] Add early return to Method because the else can be ignored Swen Kalski
@ 2021-03-24 12:32 ` Greg KH
2021-03-26 11:31 ` Jonathan Cameron
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-03-24 12:32 UTC (permalink / raw)
To: Swen Kalski; +Cc: linux-iio
On Wed, Mar 24, 2021 at 01:20:50PM +0100, Swen Kalski wrote:
> ---
> drivers/staging/comedi/comedi_buf.c | 56 ++++++++++++++---------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch does not have a Signed-off-by: line. Please read the
kernel file, Documentation/SubmittingPatches and resend it after
adding that line. Note, the line needs to be in the body of the
email, before the patch, not at the bottom of the patch or in the
email signature.
- You did not specify a description of why the patch is needed, or
possibly, any description at all, in the email body. Please read the
section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatches for what is needed in order to
properly describe the change.
- You did not write a descriptive Subject: for the patch, allowing Greg,
and everyone else, to know what this patch is all about. Please read
the section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatches for what a proper Subject: line should
look like.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add early return to Method because the else can be ignored.
2021-03-24 12:20 [PATCH] Add early return to Method because the else can be ignored Swen Kalski
2021-03-24 12:32 ` Greg KH
@ 2021-03-26 11:31 ` Jonathan Cameron
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2021-03-26 11:31 UTC (permalink / raw)
To: Swen Kalski; +Cc: linux-iio, gregkh
On Wed, 24 Mar 2021 13:20:50 +0100
Swen Kalski <kalski.swen@gmail.com> wrote:
IIO isn't the right list for comedi related patches.
Take a look at MAINTAINERS
However it is marked odd fixes only so I'm not sure on how receptive
they will be to tidying up like this.
+ all the stuff in Greg's 'bot' response :)
Jonathan
> ---
> drivers/staging/comedi/comedi_buf.c | 56 ++++++++++++++---------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
> index 3ef3ddabf139..05927fb321ba 100644
> --- a/drivers/staging/comedi/comedi_buf.c
> +++ b/drivers/staging/comedi/comedi_buf.c
> @@ -366,42 +366,42 @@ static unsigned int comedi_buf_munge(struct comedi_subdevice *s,
> unsigned int num_bytes)
> {
> struct comedi_async *async = s->async;
> - unsigned int count = 0;
> const unsigned int num_sample_bytes = comedi_bytes_per_sample(s);
> + unsigned int count = 0;
>
> if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) {
> async->munge_count += num_bytes;
> - count = num_bytes;
> - } else {
> - /* don't munge partial samples */
> - num_bytes -= num_bytes % num_sample_bytes;
> - while (count < num_bytes) {
> - int block_size = num_bytes - count;
> - unsigned int buf_end;
> + return num_bytes;
> + }
>
> - buf_end = async->prealloc_bufsz - async->munge_ptr;
> - if (block_size > buf_end)
> - block_size = buf_end;
> + /* don't munge partial samples */
> + num_bytes -= num_bytes % num_sample_bytes;
> + while (count < num_bytes) {
> + int block_size = num_bytes - count;
> + unsigned int buf_end;
>
> - s->munge(s->device, s,
> - async->prealloc_buf + async->munge_ptr,
> - block_size, async->munge_chan);
> + buf_end = async->prealloc_bufsz - async->munge_ptr;
> + if (block_size > buf_end)
> + block_size = buf_end;
>
> - /*
> - * ensure data is munged in buffer before the
> - * async buffer munge_count is incremented
> - */
> - smp_wmb();
> -
> - async->munge_chan += block_size / num_sample_bytes;
> - async->munge_chan %= async->cmd.chanlist_len;
> - async->munge_count += block_size;
> - async->munge_ptr += block_size;
> - async->munge_ptr %= async->prealloc_bufsz;
> - count += block_size;
> - }
> - }
> + s->munge(s->device, s,
> + async->prealloc_buf + async->munge_ptr,
> + block_size, async->munge_chan);
>
> + /*
> + * ensure data is munged in buffer before the
> + * async buffer munge_count is incremented
> + */
> + smp_wmb();
> +
> + async->munge_chan += block_size / num_sample_bytes;
> + async->munge_chan %= async->cmd.chanlist_len;
> + async->munge_count += block_size;
> + async->munge_ptr += block_size;
> + async->munge_ptr %= async->prealloc_bufsz;
> + count += block_size;
> + }
> +
> return count;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-26 11:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-24 12:20 [PATCH] Add early return to Method because the else can be ignored Swen Kalski
2021-03-24 12:32 ` Greg KH
2021-03-26 11:31 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox