Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6ce4ec0 authored by Vignesh R's avatar Vignesh R Committed by Greg Kroah-Hartman
Browse files

serial: 8250_omap: Drop check for of_node



8250_omap is DT only driver so dev->of_node always exists. Drop check
for existence of valid dev->of_node to simplify omap8250_probe().

Signed-off-by: default avatarVignesh R <vigneshr@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c24177b4
Loading
Loading
Loading
Loading
+28 −35
Original line number Diff line number Diff line
@@ -1134,10 +1134,12 @@ static int omap8250_probe(struct platform_device *pdev)
{
	struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	struct device_node *np = pdev->dev.of_node;
	struct omap8250_priv *priv;
	struct uart_8250_port up;
	int ret;
	void __iomem *membase;
	const struct of_device_id *id;

	if (!regs || !irq) {
		dev_err(&pdev->dev, "missing registers or irq\n");
@@ -1194,26 +1196,19 @@ static int omap8250_probe(struct platform_device *pdev)
	up.port.unthrottle = omap_8250_unthrottle;
	up.port.rs485_config = omap_8250_rs485_config;

	if (pdev->dev.of_node) {
		const struct of_device_id *id;

		ret = of_alias_get_id(pdev->dev.of_node, "serial");
	ret = of_alias_get_id(np, "serial");
	if (ret < 0) {
		dev_err(&pdev->dev, "failed to get alias\n");
		return ret;
	}
	up.port.line = ret;

		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
				     &up.port.uartclk);
		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
	of_property_read_u32(np, "clock-frequency", &up.port.uartclk);
	priv->wakeirq = irq_of_parse_and_map(np, 1);

	id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
	if (id && id->data)
		priv->habit |= *(u8 *)id->data;
	} else {
		ret = pdev->id;
	}
	if (ret < 0) {
		dev_err(&pdev->dev, "failed to get alias/pdev id\n");
		return ret;
	}
	up.port.line = ret;

	if (!up.port.uartclk) {
		up.port.uartclk = DEFAULT_CLK_SPEED;
@@ -1242,7 +1237,6 @@ static int omap8250_probe(struct platform_device *pdev)
	omap_serial_fill_features_erratas(&up, priv);
	up.port.handle_irq = omap8250_no_handle_irq;
#ifdef CONFIG_SERIAL_8250_DMA
	if (pdev->dev.of_node) {
	/*
	 * Oh DMA support. If there are no DMA properties in the DT then
	 * we will fall back to a generic DMA channel which does not
@@ -1251,7 +1245,7 @@ static int omap8250_probe(struct platform_device *pdev)
	 * To avoid "failed to request DMA" messages we check for DMA
	 * properties in DT.
	 */
		ret = of_property_count_strings(pdev->dev.of_node, "dma-names");
	ret = of_property_count_strings(np, "dma-names");
	if (ret == 2) {
		up.dma = &priv->omap8250_dma;
		priv->omap8250_dma.fn = the_no_dma_filter_fn;
@@ -1261,7 +1255,6 @@ static int omap8250_probe(struct platform_device *pdev)
		priv->omap8250_dma.rxconf.src_maxburst = RX_TRIGGER;
		priv->omap8250_dma.txconf.dst_maxburst = TX_TRIGGER;
	}
	}
#endif
	ret = serial8250_register_8250_port(&up);
	if (ret < 0) {