Re: [PATCH v2] USB: pl2303: Rewrite pl2303_encode_baud_rate_divisor

2015-07-23 Thread Johan Hovold
On Wed, Jul 15, 2015 at 01:35:58PM +0200, Michał Pecio wrote: This commit fixes the following issues: 1. The 9th bit of buf was believed to be the LSB of divisor's exponent, but the hardware interprets it as MSB (9th bit) of the mantissa. The exponent is actually one bit shorter and

Re: [PATCH v2] USB: pl2303: Rewrite pl2303_encode_baud_rate_divisor

2015-07-23 Thread Michał Pecio
+ u32 baseline, mantissa, exponent; Please keep these as unsigned int. What's the reason for that? u32 is the exact width needed to perform these computations, while unsigned int is something a bit unspecified. + /* Calculate and return the exact baud rate. */ + baud = (baseline

Re: [PATCH v2] USB: pl2303: Rewrite pl2303_encode_baud_rate_divisor

2015-07-23 Thread Johan Hovold
On Thu, Jul 23, 2015 at 04:21:36PM +0200, Michał Pecio wrote: + u32 baseline, mantissa, exponent; Please keep these as unsigned int. What's the reason for that? u32 is the exact width needed to perform these computations, while unsigned int is something a bit unspecified. Because you

Re: [PATCH v2] USB: pl2303: Rewrite pl2303_encode_baud_rate_divisor

2015-07-20 Thread Johan Hovold
On Wed, Jul 15, 2015 at 01:35:58PM +0200, Michał Pecio wrote: This commit fixes the following issues: 1. The 9th bit of buf was believed to be the LSB of divisor's exponent, but the hardware interprets it as MSB (9th bit) of the mantissa. The exponent is actually one bit shorter and

[PATCH v2] USB: pl2303: Rewrite pl2303_encode_baud_rate_divisor

2015-07-15 Thread Michał Pecio
This commit fixes the following issues: 1. The 9th bit of buf was believed to be the LSB of divisor's exponent, but the hardware interprets it as MSB (9th bit) of the mantissa. The exponent is actually one bit shorter and applies to base 4, not 2 as previously believed. 2. Loop iterations