Re: [PATCH] drivers: staging: speakup: serialio: delay initializing 'old_serial_port.baud_base'

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

 



Excuse me, I have no related hardware to give a test, this patch passes
cross compiling. If test is necessary, welcome any members to help test it.

And also, if anyone finds another better fixing way, welcome to try, and
mark me as Reported-by is OK. :-)

Thanks.

On 10/23/2013 11:20 AM, 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@xxxxxxxxxxx>
> ---
>  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 */
>  #endif
>  #ifndef IRQF_SHARED
>  #define IRQF_SHARED SA_SHIRQ
> 


-- 
Chen Gang
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux