From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754729Ab3A2R71 (ORCPT ); Tue, 29 Jan 2013 12:59:27 -0500 Received: from quartz.orcorp.ca ([184.70.90.242]:34095 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751586Ab3A2R7Z (ORCPT ); Tue, 29 Jan 2013 12:59:25 -0500 Date: Tue, 29 Jan 2013 10:59:12 -0700 From: Jason Gunthorpe To: Florian Fainelli Cc: davem@davemloft.net, Thomas Petazzoni , Andrew Lunn , Russell King , Jason Cooper , linux-doc@vger.kernel.org, Benjamin Herrenschmidt , devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, Rob Herring , Grant Likely , netdev@vger.kernel.org, Paul Mackerras , linux-arm-kernel@lists.infradead.org, Rob Landley , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, Lennert Buytenhek Subject: Re: [PATCH 4/5] net: mvmdio: allow Device Tree and platform device to coexist Message-ID: <20130129175912.GE25646@obsidianresearch.com> References: <1359473048-26551-1-git-send-email-florian@openwrt.org> <1359473048-26551-5-git-send-email-florian@openwrt.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1359473048-26551-5-git-send-email-florian@openwrt.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.162 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2013 at 04:24:07PM +0100, Florian Fainelli wrote: > - dev->err_interrupt = irq_of_parse_and_map(pdev->dev.of_node, 0); > + if (pdev->dev.of_node) { > + dev->regs = of_iomap(pdev->dev.of_node, 0); > + if (!dev->regs) { > + dev_err(&pdev->dev, "No SMI register address given in DT\n"); > + ret = -ENODEV; > + goto out_free; > + } > + > + dev->err_interrupt = irq_of_parse_and_map(pdev->dev.of_node, 0); > + } else { > + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + > + dev->regs = ioremap(r->start, resource_size(r)); > + if (!dev->regs) { > + dev_err(&pdev->dev, "No SMI register address given\n"); > + ret = -ENODEV; > + goto out_free; > + } > + > + dev->err_interrupt = platform_get_irq(pdev, 0); > + } Why do you have these different paths for OF and platform? AFAIK these days when a OF device is automatically converted into a platform device all the struct resources are created too, so you can't you just use platform_get_resource and devm_request_and_ioremap for both flows? Ditto for the interrupt - platform_get_irq should work in both cases? Jason