diff mbox

[1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts

Message ID 20160907161324.27774-1-richard.genoud@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Genoud Sept. 7, 2016, 4:13 p.m. UTC
This function returns true if CTS and RTS are used as GPIOs.
Some drivers (like atmel_serial) needs to know if the flow control is
handled by the controller or by GPIOs.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/tty/serial/serial_mctrl_gpio.c | 8 ++++++++
 drivers/tty/serial/serial_mctrl_gpio.h | 9 +++++++++
 2 files changed, 17 insertions(+)

Comments

kernel test robot Sept. 7, 2016, 6:37 p.m. UTC | #1
Hi Richard,

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v4.8-rc5 next-20160907]
[cannot apply to tty/tty-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Richard-Genoud/serial-mctrl_gpio-implement-mctrl_gpio_use_rtscts/20160908-002703
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: sh-titan_defconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All warnings (new ones prefixed by >>):

   In file included from drivers/tty/serial/sh-sci.c:60:0:
   drivers/tty/serial/serial_mctrl_gpio.h: In function 'mctrl_gpio_use_rtscts':
>> drivers/tty/serial/serial_mctrl_gpio.h:162:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^

vim +162 drivers/tty/serial/serial_mctrl_gpio.h

   146	
   147	static inline
   148	void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
   149	{
   150	}
   151	
   152	static inline void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios)
   153	{
   154	}
   155	
   156	static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
   157	{
   158	}
   159	
   160	static inline bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios)
   161	{
 > 162	}
   163	
   164	#endif /* GPIOLIB */
   165	
   166	#endif

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index d2da6aa7f27d..93bed8c99796 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -17,6 +17,7 @@ 
 #include <linux/err.h>
 #include <linux/device.h>
 #include <linux/irq.h>
+#include <linux/err.h>
 #include <linux/gpio/consumer.h>
 #include <linux/termios.h>
 #include <linux/serial_core.h>
@@ -72,6 +73,13 @@  struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
 }
 EXPORT_SYMBOL_GPL(mctrl_gpio_to_gpiod);
 
+bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios)
+{
+	return !IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS)) &&
+		!IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_RTS));
+}
+EXPORT_SYMBOL_GPL(mctrl_gpio_use_rtscts);
+
 unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
 {
 	enum mctrl_gpio_idx i;
diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h
index fa000bcff217..5d423b7f1e1c 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.h
+++ b/drivers/tty/serial/serial_mctrl_gpio.h
@@ -101,6 +101,11 @@  void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios);
  */
 void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios);
 
+/*
+ * Return true if both CTS and RTS are used with GPIOs
+ */
+bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios);
+
 #else /* GPIOLIB */
 
 static inline
@@ -152,6 +157,10 @@  static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
 {
 }
 
+static inline bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios)
+{
+}
+
 #endif /* GPIOLIB */
 
 #endif