Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752588AbaGaRUF (ORCPT ); Thu, 31 Jul 2014 13:20:05 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:41256 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305AbaGaRUD (ORCPT ); Thu, 31 Jul 2014 13:20:03 -0400 Message-ID: <53DA7ABF.8000406@gmail.com> Date: Thu, 31 Jul 2014 10:19:59 -0700 From: David Daney User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Himangi Saraogi CC: Luka Perkov , Russell King , David Daney , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall Subject: Re: [PATCH] netdev: octeon_mgmt: Use devm_ioremap_resource References: <20140731070653.GA3759@himangi-Dell> In-Reply-To: <20140731070653.GA3759@himangi-Dell> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/31/2014 12:06 AM, Himangi Saraogi wrote: > This patch introduces the use of devm_ioremap_resource instead of > devm_request_mem_region and devm_ioremap. The error handling on the > platform_get_resource is done way with. The size and start fields in the > octeon_mgmt are no longer needed. So they are removed and there > initialization skipped. Also, error handling is added on the values > returned by devm_ioremap_resource. > > Signed-off-by: Himangi Saraogi > Acked-by: Julia Lawall > --- > Not compile tested. There are compilers available for systems with this device: ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_mips64-linux.tar.xz Could you try to at least see if it compiles? David Daney > drivers/net/ethernet/octeon/octeon_mgmt.c | 64 +++++++------------------------ > 1 file changed, 13 insertions(+), 51 deletions(-) > > diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c > index 979c698..5d61a26 100644 > --- a/drivers/net/ethernet/octeon/octeon_mgmt.c > +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c > @@ -148,12 +148,6 @@ struct octeon_mgmt { > struct tasklet_struct tx_clean_tasklet; > struct phy_device *phydev; > struct device_node *phy_np; > - resource_size_t mix_phys; > - resource_size_t mix_size; > - resource_size_t agl_phys; > - resource_size_t agl_size; > - resource_size_t agl_prt_ctl_phys; > - resource_size_t agl_prt_ctl_size; > }; > > static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable) > @@ -1418,6 +1412,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev) > struct resource *res_agl_prt_ctl; > int len; > int result; > + void *ret; > > netdev = alloc_etherdev(sizeof(struct octeon_mgmt)); > if (netdev == NULL) > @@ -1452,62 +1447,29 @@ static int octeon_mgmt_probe(struct platform_device *pdev) > p->irq = result; > > res_mix = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (res_mix == NULL) { > - dev_err(&pdev->dev, "no 'reg' resource\n"); > - result = -ENXIO; > + ret = devm_ioremap_resource(&pdev->dev, res_mix); > + if (IS_ERR(ret)) { > + result = PTR_ERR(ret); > goto err; > } > + p->mix = (u64)ret; > > res_agl = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - if (res_agl == NULL) { > - dev_err(&pdev->dev, "no 'reg' resource\n"); > - result = -ENXIO; > + ret = devm_ioremap_resource(&pdev->dev, res_agl); > + if (IS_ERR(ret)) { > + result = PTR_ERR(ret); > goto err; > } > + p->agl = (u64)ret; > > res_agl_prt_ctl = platform_get_resource(pdev, IORESOURCE_MEM, 3); > - if (res_agl_prt_ctl == NULL) { > - dev_err(&pdev->dev, "no 'reg' resource\n"); > - result = -ENXIO; > - goto err; > - } > - > - p->mix_phys = res_mix->start; > - p->mix_size = resource_size(res_mix); > - p->agl_phys = res_agl->start; > - p->agl_size = resource_size(res_agl); > - p->agl_prt_ctl_phys = res_agl_prt_ctl->start; > - p->agl_prt_ctl_size = resource_size(res_agl_prt_ctl); > - > - > - if (!devm_request_mem_region(&pdev->dev, p->mix_phys, p->mix_size, > - res_mix->name)) { > - dev_err(&pdev->dev, "request_mem_region (%s) failed\n", > - res_mix->name); > - result = -ENXIO; > - goto err; > - } > - > - if (!devm_request_mem_region(&pdev->dev, p->agl_phys, p->agl_size, > - res_agl->name)) { > - result = -ENXIO; > - dev_err(&pdev->dev, "request_mem_region (%s) failed\n", > - res_agl->name); > - goto err; > - } > - > - if (!devm_request_mem_region(&pdev->dev, p->agl_prt_ctl_phys, > - p->agl_prt_ctl_size, res_agl_prt_ctl->name)) { > - result = -ENXIO; > - dev_err(&pdev->dev, "request_mem_region (%s) failed\n", > - res_agl_prt_ctl->name); > + ret = devm_ioremap_resource(&pdev->dev, res_agl_prt_ctl); > + if (IS_ERR(ret)) { > + result = PTR_ERR(ret); > goto err; > } > + p->agl_prt_ctl = (u64)ret; > > - p->mix = (u64)devm_ioremap(&pdev->dev, p->mix_phys, p->mix_size); > - p->agl = (u64)devm_ioremap(&pdev->dev, p->agl_phys, p->agl_size); > - p->agl_prt_ctl = (u64)devm_ioremap(&pdev->dev, p->agl_prt_ctl_phys, > - p->agl_prt_ctl_size); > spin_lock_init(&p->lock); > > skb_queue_head_init(&p->tx_list); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/