netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rami Rosen <roszenrami@gmail.com>
To: Noam Camus <noamc@ezchip.com>
Cc: Netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alexey.Brodkin@synopsys.com, vgupta@synopsys.com,
	giladb@ezchip.com, cmetcalf@ezchip.com,
	Tal Zilcer <talz@ezchip.com>
Subject: Re: [PATCH v6] NET: Add ezchip ethernet driver
Date: Tue, 23 Jun 2015 00:04:56 +0300	[thread overview]
Message-ID: <CAKoUArmpRk4LJNCTkANtcB69qOOS8N0JuDS_VXhCpp2gTZCmPw@mail.gmail.com> (raw)
In-Reply-To: <1435006284-15445-1-git-send-email-noamc@ezchip.com>

Hi, Noam,

Just a typo and a nitpick:

+/**
+ * nps_enet_open - Open the network device.
+ * @ndev:       Pointer to the network device.
+ *
+ * returns: 0, on success or non-zero error value on failure.
+ *

Maybe better:  This function enables IRQs

+ * This function enables an IRQs for the ENET device and starts the Tx queue.



+static s32 nps_enet_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct net_device *ndev;
+       struct nps_enet_priv *priv;
+       s32 err = 0;
+       const char *mac_addr;
+       struct resource *res_regs;
+
+       if (!dev->of_node)
+               return -ENODEV;
+
+       ndev = alloc_etherdev(sizeof(struct nps_enet_priv));
+       if (!ndev)
+               return -ENOMEM;
+
+       platform_set_drvdata(pdev, ndev);
+       SET_NETDEV_DEV(ndev, dev);
+       priv = netdev_priv(ndev);
+
+       /* The EZ NET specific entries in the device structure. */
+       ndev->netdev_ops = &nps_netdev_ops;
+       ndev->watchdog_timeo = (400 * HZ / 1000);
+       /* FIXME :: no multicast support yet */
+       ndev->flags &= ~IFF_MULTICAST;
+
+       res_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       priv->regs_base = devm_ioremap_resource(dev, res_regs);
+       if (IS_ERR(priv->regs_base)) {
+               err = PTR_ERR(priv->regs_base);
+               goto out_netdev;
+       }
+       dev_dbg(dev, "Registers base address is 0x%p\n", priv->regs_base);
+
+       /* set kernel MAC address to dev */
+       mac_addr = of_get_mac_address(dev->of_node);
+       if (mac_addr)
+               ether_addr_copy(ndev->dev_addr, mac_addr);
+       else
+               eth_hw_addr_random(ndev);
+
+       /* Get IRQ number */
+       priv->irq = platform_get_irq(pdev, 0);
+       if (!priv->irq) {
+               dev_err(dev, "failed to retrieve <irq Rx-Tx> value
from device tree\n");
+               err = -ENODEV;
+               goto out_netdev;
+       }
+
+       netif_napi_add(ndev, &priv->napi, nps_enet_poll,
+                      NPS_ENET_NAPI_POLL_WEIGHT);

+
+       /* Register the driver. Should be the last thing in probe */
+       err = register_netdev(ndev);
+       if (err) {
+               dev_err(dev, "Failed to register ndev for %s, err = 0x%08x\n",
+                       ndev->name, (s32)err);

Wouldn't it be better not to assign any value at this point to err, so
that the returned err will reflect the true return value of
register_netdev(), which can have various error values ?

+               err = -ENODEV;
+               goto out_netif_api;
+       }
+
+       dev_info(dev, "(rx/tx=%d)\n", priv->irq);
+       return 0;
+
+out_netif_api:
+       netif_napi_del(&priv->napi);
+out_netdev:
+       if (err)
+               free_netdev(ndev);
+
+       return err;
+}


Regards,
Rami Rosen

  reply	other threads:[~2015-06-22 21:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 12:44 [PATCH] NET: Add ezchip ethernet driver Noam Camus
2015-06-09 14:11 ` Alexey Brodkin
2015-06-10  7:54 ` Paul Bolle
2015-06-11  8:33 ` [PATCH v2] " Noam Camus
2015-06-11 17:41   ` [PATCH v3] " Noam Camus
2015-06-14  6:26     ` [PATCH v4] " Noam Camus
2015-06-14 20:25       ` Florian Fainelli
2015-06-16 14:35       ` [PATCH v5] " Noam Camus
2015-06-21 16:22         ` David Miller
2015-06-22 14:52           ` Noam Camus
2015-06-22 17:45         ` Mahesh Bandewar
2015-06-22 23:47           ` Paul Gortmaker
2015-06-23  6:05           ` Noam Camus
2015-06-23  7:31           ` David Miller
2015-06-22 20:51         ` [PATCH v6] " Noam Camus
2015-06-22 21:04           ` Rami Rosen [this message]
2015-06-23  8:43           ` [PATCH v7] " Noam Camus
2015-06-23 14:17             ` David Miller
2015-06-24  3:40             ` Paul Gortmaker
2015-06-11 22:43   ` [PATCH v2] " David Miller

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=CAKoUArmpRk4LJNCTkANtcB69qOOS8N0JuDS_VXhCpp2gTZCmPw@mail.gmail.com \
    --to=roszenrami@gmail.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=cmetcalf@ezchip.com \
    --cc=giladb@ezchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noamc@ezchip.com \
    --cc=talz@ezchip.com \
    --cc=vgupta@synopsys.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).