[PATCH] serial: sc16is7xx: remove I2C/SPI separate kernel configs

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

 



The change removes SERIAL_SC16IS7XX_CORE, SERIAL_SC16IS7XX_I2C and
SERIAL_SC16IS7XX_SPI kernel configuration options by merging code protected
by SERIAL_SC16IS7XX_I2C and SERIAL_SC16IS7XX_SPI, also it noticeably
simplifies driver code.

Statistics for armv5 compilation, stripped and unstripped module sizes:

|                     | unstripped | stripped | diff, bytes | diff, % |
| only SPI enabled    |     166496 |    16204 |        1724 |  +10.6% |
| only I2C enabled    |     164832 |    16020 |        1908 |  +11.9% |
| SPI and I2C enabled |     172684 |    17928 |           0 |       0 |

Hopefully partially the increased module size is compensated by
reduced size of config.gz, which at the moment may contain something like

    CONFIG_SERIAL_SC16IS7XX_CORE=m
    CONFIG_SERIAL_SC16IS7XX=m
    CONFIG_SERIAL_SC16IS7XX_I2C=y
    CONFIG_SERIAL_SC16IS7XX_SPI=y

There are other device drivers, which describe devices with both
I2C and SPI interfaces, all of them do not provide separate compilation
options for I2C and/or SPI cases, the drivers are:

    iio/dac/ad5446.c
    iio/dac/ad5064.c
    iio/dac/ad5380.c
    gpio/gpio-mcp23s08.c

Signed-off-by: Vladimir Zapolskiy <vz@xxxxxxxxx>
---
 drivers/tty/serial/Kconfig     | 44 +++++++++---------------------------------
 drivers/tty/serial/Makefile    |  2 +-
 drivers/tty/serial/sc16is7xx.c | 15 ++------------
 3 files changed, 12 insertions(+), 49 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 687b1ea..b224df5 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1180,42 +1180,16 @@ config SERIAL_SCCNXP_CONSOLE
 	help
 	  Support for console on SCCNXP serial ports.
 
-config SERIAL_SC16IS7XX_CORE
-        tristate
-
 config SERIAL_SC16IS7XX
-        tristate "SC16IS7xx serial support"
-        select SERIAL_CORE
-        depends on (SPI_MASTER && !I2C) || I2C
-        help
-          This selects support for SC16IS7xx serial ports.
-          Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752,
-          SC16IS760 and SC16IS762. Select supported buses using options below.
-
-config SERIAL_SC16IS7XX_I2C
-        bool "SC16IS7xx for I2C interface"
-        depends on SERIAL_SC16IS7XX
-        depends on I2C
-        select SERIAL_SC16IS7XX_CORE if SERIAL_SC16IS7XX
-        select REGMAP_I2C if I2C
-        default y
-        help
-          Enable SC16IS7xx driver on I2C bus,
-          If required say y, and say n to i2c if not required,
-          Enabled by default to support oldconfig.
-          You must select at least one bus for the driver to be built.
-
-config SERIAL_SC16IS7XX_SPI
-        bool "SC16IS7xx for spi interface"
-        depends on SERIAL_SC16IS7XX
-        depends on SPI_MASTER
-        select SERIAL_SC16IS7XX_CORE if SERIAL_SC16IS7XX
-        select REGMAP_SPI if SPI_MASTER
-        help
-          Enable SC16IS7xx driver on SPI bus,
-          If required say y, and say n to spi if not required,
-          This is additional support to exsisting driver.
-          You must select at least one bus for the driver to be built.
+	tristate "SC16IS7xx serial support"
+	select SERIAL_CORE
+	select REGMAP_SPI if SPI_MASTER
+	select REGMAP_I2C if I2C
+	depends on (SPI_MASTER && !I2C) || I2C
+	help
+	  This selects support for SC16IS7xx serial ports on I2C or SPI bus.
+	  Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752,
+	  SC16IS760 and SC16IS762. Select supported buses using options below.
 
 config SERIAL_BFIN_SPORT
 	tristate "Blackfin SPORT emulate UART"
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 5ab4111..6381805 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -53,7 +53,7 @@ obj-$(CONFIG_SERIAL_SB1250_DUART) += sb1250-duart.o
 obj-$(CONFIG_ETRAX_SERIAL) += crisv10.o
 obj-$(CONFIG_SERIAL_ETRAXFS) += etraxfs-uart.o
 obj-$(CONFIG_SERIAL_SCCNXP) += sccnxp.o
-obj-$(CONFIG_SERIAL_SC16IS7XX_CORE) += sc16is7xx.o
+obj-$(CONFIG_SERIAL_SC16IS7XX) += sc16is7xx.o
 obj-$(CONFIG_SERIAL_JSM) += jsm/
 obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o
 obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 72ffd0d..a329088 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1300,7 +1300,6 @@ static struct regmap_config regcfg = {
 	.precious_reg = sc16is7xx_regmap_precious,
 };
 
-#ifdef CONFIG_SERIAL_SC16IS7XX_SPI
 static int sc16is7xx_spi_probe(struct spi_device *spi)
 {
 	const struct sc16is7xx_devtype *devtype;
@@ -1366,9 +1365,7 @@ static struct spi_driver sc16is7xx_spi_uart_driver = {
 };
 
 MODULE_ALIAS("spi:sc16is7xx");
-#endif
 
-#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
 static int sc16is7xx_i2c_probe(struct i2c_client *i2c,
 			       const struct i2c_device_id *id)
 {
@@ -1421,7 +1418,6 @@ static struct i2c_driver sc16is7xx_i2c_uart_driver = {
 };
 
 MODULE_ALIAS("i2c:sc16is7xx");
-#endif
 
 static int __init sc16is7xx_init(void)
 {
@@ -1433,34 +1429,27 @@ static int __init sc16is7xx_init(void)
 		return ret;
 	}
 
-#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
 	ret = i2c_add_driver(&sc16is7xx_i2c_uart_driver);
 	if (ret < 0) {
 		pr_err("failed to init sc16is7xx i2c --> %d\n", ret);
 		return ret;
 	}
-#endif
 
-#ifdef CONFIG_SERIAL_SC16IS7XX_SPI
 	ret = spi_register_driver(&sc16is7xx_spi_uart_driver);
 	if (ret < 0) {
 		pr_err("failed to init sc16is7xx spi --> %d\n", ret);
 		return ret;
 	}
-#endif
+
 	return ret;
 }
 module_init(sc16is7xx_init);
 
 static void __exit sc16is7xx_exit(void)
 {
-#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
 	i2c_del_driver(&sc16is7xx_i2c_uart_driver);
-#endif
-
-#ifdef CONFIG_SERIAL_SC16IS7XX_SPI
 	spi_unregister_driver(&sc16is7xx_spi_uart_driver);
-#endif
+
 	uart_unregister_driver(&sc16is7xx_uart);
 }
 module_exit(sc16is7xx_exit);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux