Re: [PATCH] Blackfin: sync termios header changes with x86

From: Mike Frysinger
Date: Fri Jun 12 2009 - 07:36:21 EST


On Fri, Jun 12, 2009 at 07:29, Arnd Bergmann wrote:
> On Friday 12 June 2009, Mike Frysinger wrote:
>> Â#define TIOCMIWAIT Â 0x545C Â/* wait for a change on serial input line(s) */
>> Â#define TIOCGICOUNT Â0x545D Â/* read serial port inline interrupt counts */
>> -
>> -#define FIOQSIZE Â Â 0x545E
>> +#define TIOCGHAYESESP Â 0x545E Â/* Get Hayes ESP configuration */
>> +#define TIOCSHAYESESP Â 0x545F Â/* Set Hayes ESP configuration */
>> +#define FIOQSIZE Â Â 0x5460
>
> This breaks existing applications using FIOQSIZE. You really shouldn't do that.

meh, no one uses that anyways ;)

>> diff --git a/arch/blackfin/include/asm/termbits.h b/arch/blackfin/include/asm/termbits.h
>> index f37feb7..faa569f 100644
>> --- a/arch/blackfin/include/asm/termbits.h
>> +++ b/arch/blackfin/include/asm/termbits.h
>
> This one only changes whitespace, what is the point?

makes diffing easier

>> --- a/arch/blackfin/include/asm/termios.h
>> +++ b/arch/blackfin/include/asm/termios.h
>
> This change fixes one bug but not another:

better than none at all !

>> @@ -58,37 +60,55 @@ struct termio {
>> Â Â Â *(unsigned short *) &(termios)->x = __tmp; \
>> Â}
>>
>> -#define user_termio_to_kernel_termios(termios, termio) \
>> -({ \
>> - Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
>> - Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
>> - Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
>> - Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
>> - Â Â copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
>> -})
>> +static inline int user_termio_to_kernel_termios(struct ktermios *termios,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct termio __user *termio)
>> +{
>> + Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_iflag);
>> + Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
>> + Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
>> + Â Â SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
>> + Â Â get_user(termios->c_line, &termio->c_line);
>> + Â Â return copy_from_user(termios->c_cc, termio->c_cc, NCC);
>> +}
>
> You correctly read termios->c_line now, which was missing previously,
> but you still don't check the return value of the get_user and
> copy_from_user functions. The code also has a very ugly property
> of working only on little-endian architectures (which includes
> blackfin AFAICT) but should not serve as an example.

Blackfin is LE which means the assumption is fine by me

> If you want a working version of this file, best copy it from avr32
> or frv. Or just wait for the asm-generic version.

is asm-generic going to be in 2.6.31 ? otherwise i'd prefer to have
Blackfin fixed now rather than 2.6.32+
-mike
--
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/