From: Hauke Mehrtens <hauke@hauke-m.de> To: Markus Elfring <Markus.Elfring@web.de>, netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Radhey Shyam Pandey <radheys@xilinx.com> Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Date: Fri, 20 Sep 2019 21:23:58 +0200 [thread overview] Message-ID: <4b187ad3-a922-c6de-39f0-f8c4f06b8ae4@hauke-m.de> (raw) In-Reply-To: <43bed158-2af9-c518-2f97-a473c2b84eb7@web.de> [-- Attachment #1.1: Type: text/plain, Size: 2328 bytes --] On 9/20/19 12:57 PM, Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 20 Sep 2019 11:48:33 +0200 > > Simplify this function implementation by using the wrapper function > “devm_platform_ioremap_resource” instead of calling the functions > “platform_get_resource” and “devm_ioremap_resource” directly. > > * Thus reduce also a bit of exception handling code here. > * Delete the local variable “res”. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> But this can also wait till kernel 5.5. > --- > > v2: > Further changes were requested by Radhey Shyam Pandey. > > https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@CH2PR02MB7000.namprd02.prod.outlook.com/ > > > > * Updates for three modules were split into a separate patch for each driver. > > * The commit description was adjusted. > > > > > > drivers/net/ethernet/lantiq_xrx200.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c > index 900affbdcc0e..0a7ea45b9e59 100644 > --- a/drivers/net/ethernet/lantiq_xrx200.c > +++ b/drivers/net/ethernet/lantiq_xrx200.c > @@ -424,7 +424,6 @@ static int xrx200_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct device_node *np = dev->of_node; > - struct resource *res; > struct xrx200_priv *priv; > struct net_device *net_dev; > const u8 *mac; > @@ -443,15 +442,7 @@ static int xrx200_probe(struct platform_device *pdev) > SET_NETDEV_DEV(net_dev, dev); > net_dev->min_mtu = ETH_ZLEN; > net_dev->max_mtu = XRX200_DMA_DATA_LEN; > - > - /* load the memory ranges */ > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(dev, "failed to get resources\n"); > - return -ENOENT; > - } > - > - priv->pmac_reg = devm_ioremap_resource(dev, res); > + priv->pmac_reg = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(priv->pmac_reg)) { > dev_err(dev, "failed to request and remap io ranges\n"); > return PTR_ERR(priv->pmac_reg); > -- > 2.23.0 > [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Hauke Mehrtens <hauke@hauke-m.de> To: Markus Elfring <Markus.Elfring@web.de>, netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Radhey Shyam Pandey <radheys@xilinx.com> Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Date: Fri, 20 Sep 2019 19:23:58 +0000 [thread overview] Message-ID: <4b187ad3-a922-c6de-39f0-f8c4f06b8ae4@hauke-m.de> (raw) In-Reply-To: <43bed158-2af9-c518-2f97-a473c2b84eb7@web.de> [-- Attachment #1.1: Type: text/plain, Size: 2328 bytes --] On 9/20/19 12:57 PM, Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 20 Sep 2019 11:48:33 +0200 > > Simplify this function implementation by using the wrapper function > “devm_platform_ioremap_resource” instead of calling the functions > “platform_get_resource” and “devm_ioremap_resource” directly. > > * Thus reduce also a bit of exception handling code here. > * Delete the local variable “res”. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> But this can also wait till kernel 5.5. > --- > > v2: > Further changes were requested by Radhey Shyam Pandey. > > https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@CH2PR02MB7000.namprd02.prod.outlook.com/ > > > > * Updates for three modules were split into a separate patch for each driver. > > * The commit description was adjusted. > > > > > > drivers/net/ethernet/lantiq_xrx200.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c > index 900affbdcc0e..0a7ea45b9e59 100644 > --- a/drivers/net/ethernet/lantiq_xrx200.c > +++ b/drivers/net/ethernet/lantiq_xrx200.c > @@ -424,7 +424,6 @@ static int xrx200_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct device_node *np = dev->of_node; > - struct resource *res; > struct xrx200_priv *priv; > struct net_device *net_dev; > const u8 *mac; > @@ -443,15 +442,7 @@ static int xrx200_probe(struct platform_device *pdev) > SET_NETDEV_DEV(net_dev, dev); > net_dev->min_mtu = ETH_ZLEN; > net_dev->max_mtu = XRX200_DMA_DATA_LEN; > - > - /* load the memory ranges */ > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(dev, "failed to get resources\n"); > - return -ENOENT; > - } > - > - priv->pmac_reg = devm_ioremap_resource(dev, res); > + priv->pmac_reg = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(priv->pmac_reg)) { > dev_err(dev, "failed to request and remap io ranges\n"); > return PTR_ERR(priv->pmac_reg); > -- > 2.23.0 > [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-09-20 19:30 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-18 13:30 [PATCH] ethernet: Use devm_platform_ioremap_resource() in three functions Markus Elfring 2019-09-18 13:30 ` Markus Elfring 2019-09-18 13:30 ` Markus Elfring 2019-09-18 14:16 ` Radhey Shyam Pandey 2019-09-18 14:16 ` Radhey Shyam Pandey 2019-09-18 14:16 ` Radhey Shyam Pandey 2019-09-20 9:23 ` [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe() Markus Elfring 2019-09-20 9:23 ` Markus Elfring 2019-09-20 9:23 ` Markus Elfring 2019-10-04 21:08 ` Linus Walleij 2019-10-04 21:08 ` Linus Walleij 2019-10-04 21:08 ` Linus Walleij 2019-09-20 10:57 ` [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Markus Elfring 2019-09-20 10:57 ` Markus Elfring 2019-09-20 19:23 ` Hauke Mehrtens [this message] 2019-09-20 19:23 ` Hauke Mehrtens 2019-09-20 11:30 ` [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe() Markus Elfring 2019-09-20 11:30 ` Markus Elfring 2019-09-20 11:30 ` Markus Elfring 2019-09-20 11:57 ` Radhey Shyam Pandey 2019-09-20 11:57 ` Radhey Shyam Pandey 2019-09-20 11:57 ` Radhey Shyam Pandey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4b187ad3-a922-c6de-39f0-f8c4f06b8ae4@hauke-m.de \ --to=hauke@hauke-m.de \ --cc=Markus.Elfring@web.de \ --cc=davem@davemloft.net \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=radheys@xilinx.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.