From patchwork Wed Jan 21 15:14:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 3462 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0LFBI92023064 for ; Wed, 21 Jan 2009 07:11:42 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760534AbZAUPQU (ORCPT ); Wed, 21 Jan 2009 10:16:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760202AbZAUPQT (ORCPT ); Wed, 21 Jan 2009 10:16:19 -0500 Received: from rv-out-0506.google.com ([209.85.198.232]:37964 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759615AbZAUPQS (ORCPT ); Wed, 21 Jan 2009 10:16:18 -0500 Received: by rv-out-0506.google.com with SMTP id k40so3654714rvb.1 for ; Wed, 21 Jan 2009 07:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=oNyHrmQnaEOpOaYOE2Jds/MWoIznTLTmwXr8lG/jj48=; b=kERLcAX44HOj+8nyp0TtUC+voMIBXr9KTE0KxCPgsM1R5rsoNFQbLRG/Sot6dWFsTb yiih0n2xLWhrMtY4LfmwOamxu92rlj2VHBTQxA1OkVtbbfvkySrkbRfQs5pOE71t7RvM 9SUdxKQdukgijtucIQ6sc/LnS/QiV7t4ywvU8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=x3oylN4ctEM+U3u9ZUaUsnBCEuuR4emUvb3A3dpsunXl+I+2BRESh4oqfgI1zbXVy7 8gQDuLSnm7A7fB3f6H957rJ6B9waMMKnjYlqMjp2GY+8gujCOZSMQyLmhrcRTUR0PrCq 39/TrmLZ24cbFRpdpX0sHD3zGIZFaJSmWOToM= Received: by 10.141.5.3 with SMTP id h3mr3130860rvi.213.1232550977999; Wed, 21 Jan 2009 07:16:17 -0800 (PST) Received: from rx1.opensource.se (114.8.221.202.ts.2iij.net [202.221.8.114]) by mx.google.com with ESMTPS id b8sm15593412rvf.9.2009.01.21.07.16.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 21 Jan 2009 07:16:17 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 22 Jan 2009 00:14:22 +0900 Message-Id: <20090121151422.29269.32455.sendpatchset@rx1.opensource.se> In-Reply-To: <20090121151334.29269.55519.sendpatchset@rx1.opensource.se> References: <20090121151334.29269.55519.sendpatchset@rx1.opensource.se> Subject: [PATCH 006/013] sh-sci: ioremap() in a single place Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Handle ioremap() in sci_config_port only. Signed-off-by: Magnus Damm --- drivers/serial/sh-sci.c | 47 ++++++++++++----------------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0006/drivers/serial/sh-sci.c +++ work/drivers/serial/sh-sci.c 2009-01-21 19:21:15.000000000 +0900 @@ -992,16 +992,19 @@ static void sci_config_port(struct uart_ port->type = s->type; - if (port->flags & UPF_IOREMAP && !port->membase) { + if (port->membase) + return; + + if (port->flags & UPF_IOREMAP) { #if defined(CONFIG_SUPERH64) port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); port->membase = (void __iomem *)port->mapbase; #else port->membase = ioremap_nocache(port->mapbase, 0x40); #endif - dev_err(port->dev, "can't remap port#%d\n", port->line); - } + } else + port->membase = (void __iomem *)port->mapbase; } static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) @@ -1040,9 +1043,9 @@ static struct uart_ops sci_uart_ops = { #endif }; -static int __devinit sci_init_single(struct sci_port *sci_port, - unsigned int index, - struct plat_sci_port *p) +static void __devinit sci_init_single(struct sci_port *sci_port, + unsigned int index, + struct plat_sci_port *p) { sci_port->port.ops = &sci_uart_ops; sci_port->port.iotype = UPIO_MEM; @@ -1073,22 +1076,6 @@ static int __devinit sci_init_single(str init_timer(&sci_port->break_timer); sci_port->port.mapbase = p->mapbase; - - if (p->mapbase && !p->membase) { - if (p->flags & UPF_IOREMAP) { - p->membase = ioremap_nocache(p->mapbase, 0x40); - if (IS_ERR(p->membase)) - return PTR_ERR(p->membase); - } else { - /* - * For the simple (and majority of) cases - * where we don't need to do any remapping, - * just cast the cookie directly. - */ - p->membase = (void __iomem *)p->mapbase; - } - } - sci_port->port.membase = p->membase; sci_port->port.irq = p->irqs[SCIx_TXI_IRQ]; @@ -1096,8 +1083,6 @@ static int __devinit sci_init_single(str sci_port->type = sci_port->port.type = p->type; memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs)); - - return 0; } #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE @@ -1160,8 +1145,7 @@ static int __init serial_console_setup(s sci_port->clk = clk_get(NULL, "module_clk"); #endif - if (port->flags & UPF_IOREMAP) - sci_config_port(port, 0); + sci_config_port(port, 0); if (sci_port->enable) sci_port->enable(port); @@ -1255,18 +1239,11 @@ static int __devinit sci_probe_single(st } sciport->port.dev = &dev->dev; - ret = sci_init_single(sciport, index, p); - if (ret) - return ret; + sci_init_single(sciport, index, p); ret = uart_add_one_port(&sci_uart_driver, &sciport->port); - - if (ret) { - if (p->flags & UPF_IOREMAP) - iounmap(p->membase); - + if (ret) return ret; - } INIT_LIST_HEAD(&sciport->node);