Re: u_serial ring buffer bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> This makes more than one patch.  I count:
>
> - using buf size as a compile time constant
>
> - changing the index scheme
>
> - a few gratuitous changes like
>	unsigned len;
>	...
>	len = ...;
>
>   becoming
>	unsigned len = ...;

Really, I was just doing #2.  #1 I did because it was less work
than any alternative scheme for guaranteeing that that buf_size
was always a power of two.

I suppose I could split it up, but doing that will reduce the
patch by 2 deleted lines and 4 changed ones, a total of 10
lines of delta.

I'll happily do it if you like, but I plead honest belief that
it was too small a difference to be worth dividing.

It would have been extra effort to create an intermediate version
and I was trying to create a simple patch, not a patch series.


As for #3, if you look, I added a line of the form
+	unsigned put_pos = gb->buf_put % WRITE_BUF_SIZE;

And I adpated the "len =" assignment to match.  It wasn't
entirely gratuitous.

My personal habit is to use initializers for short simple expressions.
I wrote my additions that way, then noticed the inconsistency was
awkward, so one or the other had to change.  I thought making them both
initializers was cleanest.

Is there a style preference against initializers in the USB code?

> - maybe more

I also added a clarifying comment to gs_buf_free.  Again, it is my
habit to add a comment when I spend more than a few seconds wondering
"why did they do that?", and in that case, the reason for setting
gb->buf_buf to NULL was not completely obvious.


Anyway, the following series of 6 patches is the smallest units
I can break it down to.  Number 3 is the big one, but number 2
is a prerequisite.  Number 6 is particularly unimportant.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux