Re: [PATCHv2 03/16] staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters

From: RaphaÃl Beamonte
Date: Thu Sep 17 2015 - 14:27:12 EST


2015-09-17 1:18 GMT-04:00 Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>:
> On Thu, Sep 17, 2015 at 01:06:33AM -0400, RaphaÃl Beamonte wrote:
>> 2015-09-17 0:57 GMT-04:00 Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>:
>> <SNIP>
>> >> @@ -1748,8 +1755,9 @@ static short rtl8192_usb_initendpoints(struct net_device *dev)
>> >> oldaddr = priv->oldaddr;
>> >> align = ((long)oldaddr) & 3;
>> >> if (align) {
>> >> - newaddr = oldaddr + 4 - align;
>> >> - priv->rx_urb[16]->transfer_buffer_length = 16 - 4 + align;
>> >> + align = 4 - align;
>> >> + newaddr = oldaddr + align;
>> >> + priv->rx_urb[16]->transfer_buffer_length = 16 - align;
>> >
<SNIP>
>
> But step back please, what exactly is this trying to do? I think it's a
> round_up type function, perhaps that should be what we do instead (the
> kernel has such functions already.)

I think it's trying to get a 4-alignment for the transfer_buffer
stored in priv->rx_urb[16].
If our alignment is not correct, and there is for instance X needed to
align (X < 4), we move the address of X, and reduce the buffer size of
X.
I looked at the code of round_up (also round_down and __round_mask) in
the kernel, but I'm not totally sure how we would use it here?

> It might be the same "idea", but it's not what you did, so don't try to
> sneak it in.

That wasn't my intention. Sorry for that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/