[PATCH] drivers: staging: speakup: serialio: delay initializing 'old_serial_port.baud_base'
Chen Gang
gang.chen at asianux.com
Sat Oct 26 13:18:11 UTC 2013
On 10/25/2013 01:29 PM, Greg KH wrote:
> On Wed, Oct 23, 2013 at 11:20:12AM +0800, Chen Gang wrote:
>> For some architectures (e.g. arc), BASE_BAUD cannot be constant number.
>> So have to delay initializing 'old_serial_port.baud_base', or can not
>> pass compiling.
>>
>> The related error (allmodconfig for arc with gcc-4.8.0):
>>
>> CC [M] drivers/staging/speakup/serialio.o
>> drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
>> SERIAL_PORT_DFNS
>> ^
>> drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[0].baud_base')
>> drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
>> drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[1].baud_base')
>> drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
>> drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[2].baud_base')
>> drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
>> drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[3].baud_base')
>>
>>
>> Signed-off-by: Chen Gang <gang.chen at asianux.com>
>> ---
>> drivers/staging/speakup/serialio.c | 7 +++++--
>> drivers/staging/speakup/serialio.h | 10 +++++-----
>> 2 files changed, 10 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
>> index 1354288..c337fea 100644
>> --- a/drivers/staging/speakup/serialio.c
>> +++ b/drivers/staging/speakup/serialio.c
>> @@ -8,7 +8,7 @@
>>
>> static void start_serial_interrupt(int irq);
>>
>> -static const struct old_serial_port rs_table[] = {
>> +static struct old_serial_port rs_table[] = {
>> SERIAL_PORT_DFNS
>> };
>> static const struct old_serial_port *serstate;
>> @@ -19,9 +19,12 @@ const struct old_serial_port *spk_serial_init(int index)
>> int baud = 9600, quot = 0;
>> unsigned int cval = 0;
>> int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
>> - const struct old_serial_port *ser = rs_table + index;
>> + struct old_serial_port *ser = rs_table + index;
>> int err;
>>
>> + /* Initialize baud_base firstly, BASE_BAUD may not be constant */
>> + ser->baud_base = BASE_BAUD;
>> +
>> /* Divisor, bytesize and parity */
>> quot = ser->baud_base / baud;
>> cval = cflag & (CSIZE | CSTOPB);
>> diff --git a/drivers/staging/speakup/serialio.h b/drivers/staging/speakup/serialio.h
>> index 55d68b5..e1e9152 100644
>> --- a/drivers/staging/speakup/serialio.h
>> +++ b/drivers/staging/speakup/serialio.h
>> @@ -52,11 +52,11 @@ struct old_serial_port {
>> #endif
>> #ifndef SERIAL_PORT_DFNS
>> #define SERIAL_PORT_DFNS \
>> - /* UART CLK PORT IRQ FLAGS */ \
>> - { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
>> - { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
>> - { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
>> - { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
>> + /* UART CLK PORT IRQ FLAGS */ \
>> + { 0, 0 /* delay init */, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
>> + { 0, 0 /* delay init */, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
>> + { 0, 0 /* delay init */, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
>> + { 0, 0 /* delay init */, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
>
> No, just use the platform-specific SERIAL_PORT_DNFS, instead of having a
> copy of it here in this driver, which is just wrong. So please remove
> this, and just rely on the system version of this, defining it to
> "nothing" if it isn't present, like the 8250 serial driver does it.
>
Hmm... excuse me, I am not quite familiar with it, I will consult
related member.
Hello Vineet, I have 2 questions to consult you, please help check:
- can arc support this driver? ("drivers/staging/speakup/serialio.c")
- if arc supports the driver, can arc let it be initialized statically?
(not dynamically, e.g. BASE_BAUD).
Thanks
--
Chen Gang
More information about the devel
mailing list