Thread (17 messages) flat view 17 messages, 4 authors, 2014-03-13

Re: [PATCH net-next v3 6/9] Altera TSE: Add main and header file for Altera Ethernet Driver

From: Vince Bridgers <hidden>
Date: 2014-03-12 15:25:26
Also in: linux-devicetree

On Tue, Mar 11, 2014 at 7:45 PM, Joe Perches [off-list ref] wrote:
On Tue, 2014-03-11 at 17:43 -0500, Vince Bridgers wrote:
quoted
This patch adds the main driver and header file for the Altera Triple
Speed Ethernet driver.
trivial notes about message logging:
quoted
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
[]
quoted
+static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE |
+                                     NETIF_MSG_LINK | NETIF_MSG_IFUP |
+                                     NETIF_MSG_IFDOWN);
[]
quoted
+static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
+{
[]
quoted
+     mdio->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
+     if (mdio->irq == NULL) {
+             dev_err(priv->device, "%s: Cannot allocate memory\n", __func__);
OOM messages aren't necessary as all allocs have
a generic OOM message as well as a dump_stack();
(well, any alloc without GFP_NOWARN)
quoted
+     ret = of_mdiobus_register(mdio, mdio_node);
+     if (ret != 0) {
+             dev_err(priv->device, "Cannot register MDIO bus %s\n",
+                     mdio->id);
Because you have a struct net_device * available,
you should probably use that.

                netdev_err(dev, "Cannot register MDIO bus %s\n", mdio->id);
quoted
+             goto out_free_mdio_irq;
+     }
+
+     if (netif_msg_drv(priv))
+             dev_info(priv->device, "MDIO bus %s: created\n", mdio->id);
There are generic functions for this with the struct net_device *

        netif_info(priv, drv, dev, "MDIO bus %s: created\n", mdio->id);
quoted
+static void altera_tse_mdio_destroy(struct net_device *dev)
+{
[]
quoted
+     if (netif_msg_drv(priv))
+             dev_info(priv->device, "MDIO bus %s: removed\n",
+                      priv->mdio->id);
        netif_info(priv, drv, dev, "MDIO bus %s: removed\n, priv->mdio->id);

[]
quoted
+static int tse_init_rx_buffer(struct altera_tse_private *priv,
+                           struct tse_buffer *rxbuffer, int len)
+{
+     rxbuffer->skb = netdev_alloc_skb_ip_align(priv->dev, len);
+     if (!rxbuffer->skb) {
+             dev_err(priv->device, "%s: Rx init fails; skb is NULL\n",
+                     __func__);
                netdev_err(priv->dev, "%s: etc...)

but this is also a generic alloc and will get the same generic OOM.
quoted
+     if (dma_mapping_error(priv->device, rxbuffer->dma_addr)) {
+             dev_err(priv->device, "%s: DMA mapping error\n", __func__);
                netdev_err(priv->dev, etc...)

etc...
Thank you for taking the time to review and provide constructive
comments. I'll address the comments and respin.

All the best,

Vince
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help