Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get()
@ 2020-01-03  1:20 Dmitry Torokhov
  2020-01-03 18:23 ` Dmitry Torokhov
  2020-01-04  4:52 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-01-03  1:20 UTC (permalink / raw)
  To: Patrice Chotard, Greg Kroah-Hartman
  Cc: Jiri Slaby, linux-arm-kernel, linux-serial, linux-kernel

devm_fwnode_get_gpiod_from_child() is going away as the name is too
unwieldy, let's switch to using the new devm_fwnode_gpiod_get().

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/tty/serial/st-asc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index fb6bbb5e22344..3a533a0f172bd 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -566,11 +566,11 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
 			pinctrl_select_state(ascport->pinctrl,
 					     ascport->states[NO_HW_FLOWCTRL]);
 
-			gpiod = devm_fwnode_get_gpiod_from_child(port->dev,
-								 "rts",
-								 &np->fwnode,
-								 GPIOD_OUT_LOW,
-								 np->name);
+			gpiod = devm_fwnode_gpiod_get(port->dev,
+						      of_fwhandle_node(np),
+						      "rts",
+						      GPIOD_OUT_LOW,
+						      np->name);
 			if (!IS_ERR(gpiod))
 				ascport->rts = gpiod;
 		}
-- 
2.24.1.735.g03f4e72817-goog


-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get()
  2020-01-03  1:20 [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get() Dmitry Torokhov
@ 2020-01-03 18:23 ` Dmitry Torokhov
  2020-01-04  4:52 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-01-03 18:23 UTC (permalink / raw)
  To: Patrice Chotard, Greg Kroah-Hartman
  Cc: Jiri Slaby, linux-arm-kernel, linux-serial, linux-kernel

On Thu, Jan 02, 2020 at 05:20:53PM -0800, Dmitry Torokhov wrote:
> devm_fwnode_get_gpiod_from_child() is going away as the name is too
> unwieldy, let's switch to using the new devm_fwnode_gpiod_get().

Ugh, please ignore this, apparently I haven't compiled this branch...
Additionally, I think we can use standard devm_gpiod_get() here as node
is the same as the device in question.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get()
  2020-01-03  1:20 [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get() Dmitry Torokhov
  2020-01-03 18:23 ` Dmitry Torokhov
@ 2020-01-04  4:52 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-01-04  4:52 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: kbuild-all, Patrice Chotard, Greg Kroah-Hartman, Jiri Slaby,
	linux-arm-kernel, linux-serial, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 6589 bytes --]

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.5-rc4 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/tty-st-asc-switch-to-using-devm_fwnode_gpiod_get/20200104-090945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: x86_64-randconfig-a002-20200102 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/tty/serial/st-asc.c: In function 'asc_set_termios':
>> drivers/tty/serial/st-asc.c:570:13: error: implicit declaration of function 'of_fwhandle_node'; did you mean 'of_match_node'? [-Werror=implicit-function-declaration]
                of_fwhandle_node(np),
                ^~~~~~~~~~~~~~~~
                of_match_node
   drivers/tty/serial/st-asc.c:570:13: warning: passing argument 2 of 'devm_fwnode_gpiod_get' makes pointer from integer without a cast [-Wint-conversion]
   In file included from drivers/tty/serial/st-asc.c:25:0:
   include/linux/gpio/consumer.h:560:19: note: expected 'struct fwnode_handle *' but argument is of type 'int'
    struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
                      ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +570 drivers/tty/serial/st-asc.c

   502	
   503	static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
   504				    struct ktermios *old)
   505	{
   506		struct asc_port *ascport = to_asc_port(port);
   507		struct device_node *np = port->dev->of_node;
   508		struct gpio_desc *gpiod;
   509		unsigned int baud;
   510		u32 ctrl_val;
   511		tcflag_t cflag;
   512		unsigned long flags;
   513	
   514		/* Update termios to reflect hardware capabilities */
   515		termios->c_cflag &= ~(CMSPAR |
   516				 (ascport->hw_flow_control ? 0 : CRTSCTS));
   517	
   518		port->uartclk = clk_get_rate(ascport->clk);
   519	
   520		baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
   521		cflag = termios->c_cflag;
   522	
   523		spin_lock_irqsave(&port->lock, flags);
   524	
   525		/* read control register */
   526		ctrl_val = asc_in(port, ASC_CTL);
   527	
   528		/* stop serial port and reset value */
   529		asc_out(port, ASC_CTL, (ctrl_val & ~ASC_CTL_RUN));
   530		ctrl_val = ASC_CTL_RXENABLE | ASC_CTL_FIFOENABLE;
   531	
   532		/* reset fifo rx & tx */
   533		asc_out(port, ASC_TXRESET, 1);
   534		asc_out(port, ASC_RXRESET, 1);
   535	
   536		/* set character length */
   537		if ((cflag & CSIZE) == CS7) {
   538			ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
   539		} else {
   540			ctrl_val |= (cflag & PARENB) ?  ASC_CTL_MODE_8BIT_PAR :
   541							ASC_CTL_MODE_8BIT;
   542		}
   543	
   544		/* set stop bit */
   545		ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
   546	
   547		/* odd parity */
   548		if (cflag & PARODD)
   549			ctrl_val |= ASC_CTL_PARITYODD;
   550	
   551		/* hardware flow control */
   552		if ((cflag & CRTSCTS)) {
   553			ctrl_val |= ASC_CTL_CTSENABLE;
   554	
   555			/* If flow-control selected, stop handling RTS manually */
   556			if (ascport->rts) {
   557				devm_gpiod_put(port->dev, ascport->rts);
   558				ascport->rts = NULL;
   559	
   560				pinctrl_select_state(ascport->pinctrl,
   561						     ascport->states[DEFAULT]);
   562			}
   563		} else {
   564			/* If flow-control disabled, it's safe to handle RTS manually */
   565			if (!ascport->rts && ascport->states[NO_HW_FLOWCTRL]) {
   566				pinctrl_select_state(ascport->pinctrl,
   567						     ascport->states[NO_HW_FLOWCTRL]);
   568	
   569				gpiod = devm_fwnode_gpiod_get(port->dev,
 > 570							      of_fwhandle_node(np),
   571							      "rts",
   572							      GPIOD_OUT_LOW,
   573							      np->name);
   574				if (!IS_ERR(gpiod))
   575					ascport->rts = gpiod;
   576			}
   577		}
   578	
   579		if ((baud < 19200) && !ascport->force_m1) {
   580			asc_out(port, ASC_BAUDRATE, (port->uartclk / (16 * baud)));
   581		} else {
   582			/*
   583			 * MODE 1: recommended for high bit rates (above 19.2K)
   584			 *
   585			 *                   baudrate * 16 * 2^16
   586			 * ASCBaudRate =   ------------------------
   587			 *                          inputclock
   588			 *
   589			 * To keep maths inside 64bits, we divide inputclock by 16.
   590			 */
   591			u64 dividend = (u64)baud * (1 << 16);
   592	
   593			do_div(dividend, port->uartclk / 16);
   594			asc_out(port, ASC_BAUDRATE, dividend);
   595			ctrl_val |= ASC_CTL_BAUDMODE;
   596		}
   597	
   598		uart_update_timeout(port, cflag, baud);
   599	
   600		ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE;
   601		if (termios->c_iflag & INPCK)
   602			ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
   603		if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
   604			ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE;
   605	
   606		/*
   607		 * Characters to ignore
   608		 */
   609		ascport->port.ignore_status_mask = 0;
   610		if (termios->c_iflag & IGNPAR)
   611			ascport->port.ignore_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
   612		if (termios->c_iflag & IGNBRK) {
   613			ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_BE;
   614			/*
   615			 * If we're ignoring parity and break indicators,
   616			 * ignore overruns too (for real raw support).
   617			 */
   618			if (termios->c_iflag & IGNPAR)
   619				ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_OE;
   620		}
   621	
   622		/*
   623		 * Ignore all characters if CREAD is not set.
   624		 */
   625		if (!(termios->c_cflag & CREAD))
   626			ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_RX;
   627	
   628		/* Set the timeout */
   629		asc_out(port, ASC_TIMEOUT, 20);
   630	
   631		/* write final value and enable port */
   632		asc_out(port, ASC_CTL, (ctrl_val | ASC_CTL_RUN));
   633	
   634		spin_unlock_irqrestore(&port->lock, flags);
   635	}
   636	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42960 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03  1:20 [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get() Dmitry Torokhov
2020-01-03 18:23 ` Dmitry Torokhov
2020-01-04  4:52 ` kbuild test robot

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git