Useless TIOCSERGSTRUCT logic in most serial drivers is not compiled unless CONFIG_DEBUG and CONFIG_SERIAL_TIOCSERGSTRUCT are defined

This commit is contained in:
Gregory Nutt 2013-04-25 15:52:48 -06:00
parent f9b9875952
commit b630e6a153
19 changed files with 64 additions and 18 deletions

View File

@ -4628,3 +4628,7 @@
could be a good feature, the codes have not be well utilized nor could be a good feature, the codes have not be well utilized nor
documented. Give that situation it is better to remove the API documented. Give that situation it is better to remove the API
and reduce the footprint a little (2014-4-25). and reduce the footprint a little (2014-4-25).
* drivers/serial/Kconfig and arch/*/src/*/*_serial.c: Add
compilation so that the useless TIOCSERGSTRUCT ioctl logic
is not build unless CONFIG_DEBUG and CONFIG_SERIAL_TIOCSERGSTRUCT
are defined.

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* c5471/c5471_serial.c * c5471/c5471_serial.c
* *
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -620,6 +620,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -633,6 +634,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {

View File

@ -5,7 +5,7 @@
* Author: Stefan Richter <ichgeh@l--putt.de> * Author: Stefan Richter <ichgeh@l--putt.de>
* *
* based on c5471/c5471_serial.c * based on c5471/c5471_serial.c
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -707,6 +707,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -720,6 +721,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {

View File

@ -2,7 +2,7 @@
* arch/arm/src/dm320/dm320_serial.c * arch/arm/src/dm320/dm320_serial.c
* arch/arm/src/chip/dm320_serial.c * arch/arm/src/chip/dm320_serial.c
* *
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -546,6 +546,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -559,6 +560,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {

View File

@ -2,7 +2,7 @@
* arch/arm/src/imx/imx_serial.c * arch/arm/src/imx/imx_serial.c
* arch/arm/src/chip/imx_serial.c * arch/arm/src/chip/imx_serial.c
* *
* Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -885,6 +885,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -898,6 +899,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */ case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */

View File

@ -395,14 +395,14 @@ config ENET_NRXBUFFERS
default 6 default 6
---help--- ---help---
Number of Ethernet Rx buffers to use. The size of one buffer is Number of Ethernet Rx buffers to use. The size of one buffer is
determined by CONFIG_NET_BUFSIZE determined by NET_BUFSIZE
config ENET_NTXBUFFERS config ENET_NTXBUFFERS
int "Number of Ethernet Tx buffers" int "Number of Ethernet Tx buffers"
default 2 default 2
---help--- ---help---
Number of Ethernet Tx buffers to use. The size of one buffer is Number of Ethernet Tx buffers to use. The size of one buffer is
determined by CONFIG_NET_BUFSIZE determined by NET_BUFSIZE
config ENET_PHYADDR config ENET_PHYADDR
int "PHY address" int "PHY address"
@ -451,14 +451,14 @@ config KINETIS_MMCXFR_FREQ
config KINETIS_SD1BIT_FREQ config KINETIS_SD1BIT_FREQ
int "SD 1-bit transfer frequency" int "SD 1-bit transfer frequency"
default 20000000 default 20000000
depends on CONFIG_SDIO_WIDTH_D1_ONLY depends on SDIO_WIDTH_D1_ONLY
---help--- ---help---
Frequency to use for transferring data to/from an SD card using on a single data liune. Frequency to use for transferring data to/from an SD card using on a single data liune.
config KINETIS_SD4BIT_FREQ config KINETIS_SD4BIT_FREQ
int "SD 4-bit transfer frequency" int "SD 4-bit transfer frequency"
default 20000000 default 20000000
depends on !CONFIG_SDIO_WIDTH_D1_ONLY depends on !SDIO_WIDTH_D1_ONLY
---help--- ---help---
Frequency to use for transferring data to/from an SD card using all four data lines. Frequency to use for transferring data to/from an SD card using all four data lines.

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/lm/lm_serial.c * arch/arm/src/lm/lm_serial.c
* *
* Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -1019,6 +1019,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -1032,6 +1033,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
default: default:
ret = -ENOTTY; ret = -ENOTTY;

View File

@ -1169,6 +1169,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -1182,6 +1183,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {

View File

@ -117,7 +117,7 @@ config LPC214X_USBDEV_DMA
bool "USB Device DMA Support" bool "USB Device DMA Support"
default n default n
config CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS config LPC214X_USBDEV_NDMADESCRIPTORS
int "Number of USB DMA Descriptors" int "Number of USB DMA Descriptors"
default 8 default 8
depends on LPC214X_USBDEV_DMA depends on LPC214X_USBDEV_DMA

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/lpc214x/lpc214x_serial.c * arch/arm/src/lpc214x/lpc214x_serial.c
* *
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -569,6 +569,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -582,6 +583,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {

View File

@ -7,7 +7,7 @@
* *
* This file is part of the NuttX RTOS and based on the lpc2148 port: * This file is part of the NuttX RTOS and based on the lpc2148 port:
* *
* Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -692,6 +692,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s *)arg; struct up_dev_s *user = (struct up_dev_s *)arg;
@ -705,6 +706,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, case TIOCSBRK: /* BSD compatibility: Turn break on,
* unconditionally */ * unconditionally */

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/lpc31xx/lpc31_serial.c * arch/arm/src/lpc31xx/lpc31_serial.c
* *
* Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -582,6 +582,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -595,6 +596,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/lpc43xx/lpc43_serial.c * arch/arm/src/lpc43xx/lpc43_serial.c
* *
* Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -1080,6 +1080,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -1093,6 +1094,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
#ifdef CONFIG_SERIAL_TERMIOS #ifdef CONFIG_SERIAL_TERMIOS
case TCGETS: case TCGETS:

View File

@ -760,6 +760,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct nuc_dev_s *user = (struct nuc_dev_s*)arg; struct nuc_dev_s *user = (struct nuc_dev_s*)arg;
@ -773,6 +774,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */ case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/sam3u/sam3u_serial.c * arch/arm/src/sam3u/sam3u_serial.c
* *
* Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -1138,6 +1138,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -1151,6 +1152,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
default: default:
ret = -ENOTTY; ret = -ENOTTY;

View File

@ -1621,6 +1621,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -1634,6 +1635,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
#ifdef CONFIG_STM32_USART_SINGLEWIRE #ifdef CONFIG_STM32_USART_SINGLEWIRE
case TIOCSSINGLEWIRE: case TIOCSSINGLEWIRE:

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/str71x/str71x_serial.c * arch/arm/src/str71x/str71x_serial.c
* *
* Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -759,6 +759,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct up_dev_s *user = (struct up_dev_s*)arg; struct up_dev_s *user = (struct up_dev_s*)arg;
@ -772,6 +773,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
default: default:
ret = -ENOTTY; ret = -ENOTTY;

View File

@ -336,7 +336,7 @@ config STANDARD_SERIAL
---help--- ---help---
Enable the standard, upper-half serial driver used by most MCU serial peripherals. Enable the standard, upper-half serial driver used by most MCU serial peripherals.
config CONFIG_SERIAL_NPOLLWAITERS config SERIAL_NPOLLWAITERS
int "Number of poll threads" int "Number of poll threads"
default 2 default 2
depends on !DISABLE_POLL && STANDARD_SERIAL depends on !DISABLE_POLL && STANDARD_SERIAL
@ -344,6 +344,18 @@ config CONFIG_SERIAL_NPOLLWAITERS
Maximum number of threads than can be waiting for POLL events. Maximum number of threads than can be waiting for POLL events.
Default: 2 Default: 2
config SERIAL_TIOCSERGSTRUCT
bool "Support TIOCSERGSTRUCT"
default n
depends on DEBUG && (MCU_SERIAL || 16550_UART)
---help---
As a debug option, many serial bottom half drivers support the TIOCSERGSTRUCT
that allows you to get the internal drvier data structure. By default, this
IOCTL is not supported in order to reduce footprint. But if (1) the driver
supports the TIOCSERGSTRUCT ioctl, and (2) this option is selected, then
support for the TIOCSERGSTRUCT will be enabled.
# #
# U[S]ARTn_XYZ settings for MCU serial drivers # U[S]ARTn_XYZ settings for MCU serial drivers
# #

View File

@ -2,7 +2,7 @@
* drivers/serial/uart_16550.c * drivers/serial/uart_16550.c
* Serial driver for 16550 UART * Serial driver for 16550 UART
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -865,6 +865,7 @@ static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg)
switch (cmd) switch (cmd)
{ {
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
{ {
struct u16550_s *user = (struct u16550_s*)arg; struct u16550_s *user = (struct u16550_s*)arg;
@ -879,6 +880,7 @@ static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
} }
break; break;
#endif
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{ {