Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250_dw: only setup the port from one place

This adds a flag "skip_autocfg" that the platforms that do
not have the ADDITIONAL_FEATURES implemented can use to skip
the port setup. It's then enough to call dw8250_setup_port
just from dw8250_probe based on that flag.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heikki Krogerus and committed by
Greg Kroah-Hartman
4f042054 2559318c

+6 -8
+6 -8
drivers/tty/serial/8250/8250_dw.c
··· 63 63 struct clk *pclk; 64 64 struct reset_control *rst; 65 65 struct uart_8250_dma dma; 66 + 67 + unsigned int skip_autocfg:1; 66 68 }; 67 69 68 70 #define BYT_PRV_CLK 0x800 ··· 287 285 struct dw8250_data *data) 288 286 { 289 287 struct device_node *np = p->dev->of_node; 290 - struct uart_8250_port *up = up_to_u8250p(p); 291 - bool has_ucv = true; 292 288 int id; 293 289 294 290 #ifdef CONFIG_64BIT ··· 296 296 p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; 297 297 p->type = PORT_OCTEON; 298 298 data->usr_reg = 0x27; 299 - has_ucv = false; 299 + data->skip_autocfg = true; 300 300 } 301 301 #endif 302 - if (has_ucv) 303 - dw8250_setup_port(up); 304 - 305 302 /* get index of serial line, if found in DT aliases */ 306 303 id = of_alias_get_id(np, "serial"); 307 304 if (id >= 0) ··· 321 324 struct dw8250_data *data) 322 325 { 323 326 struct uart_port *p = &up->port; 324 - 325 - dw8250_setup_port(up); 326 327 327 328 p->iotype = UPIO_MEM32; 328 329 p->serial_in = dw8250_serial_in32; ··· 480 485 err = -ENODEV; 481 486 goto err_reset; 482 487 } 488 + 489 + if (!data->skip_autocfg) 490 + dw8250_setup_port(&uart); 483 491 484 492 /* If we have a valid fifosize, try hooking up DMA */ 485 493 if (p->fifosize) {