[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <E5B679BA-48C8-47D9-9299-BC8C32000E2A@intel.com>
Date: Mon, 17 Nov 2014 23:29:45 +0000
From: "Rustad, Mark D" <mark.d.rustad@...el.com>
To: "Martin K. Petersen" <martin.petersen@...cle.com>
CC: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Linux NICS <Linux-nics@...tope.jf.intel.com>
Subject: Re: [PATCH] ixgbe: Look up MAC address in Open Firmware
On Nov 14, 2014, at 12:20 PM, Martin K. Petersen <martin.petersen@...cle.com> wrote:
> /**
> + * ixgbe_of_mac_addr - Look up MAC address in Open Firmware
> + * @adapter: Pointer to adapter struct
> + */
> +static void ixgbe_of_mac_addr(struct ixgbe_adapter *adapter)
> +{
> +#ifdef CONFIG_OF
> + struct device_node *dp = pci_device_to_OF_node(adapter->pdev);
> + struct ixgbe_hw *hw = &adapter->hw;
> + const unsigned char *addr;
> + int len;
> +
> + addr = of_get_property(dp, "local-mac-address", &len);
> + if (addr && len == 6) {
> + e_dev_info("Using OpenPROM MAC address\n");
> + memcpy(hw->mac.perm_addr, addr, 6);
> + }
> +
> + if (!is_valid_ether_addr(hw->mac.perm_addr)) {
> + e_dev_info("Using IDPROM MAC address\n");
> + memcpy(hw->mac.perm_addr, idprom->id_ethaddr, 6);
> + }
> +#endif
> +}
I would prefer that the entire function be wrapped by the #if so that a null implementation can include the prototype. That allows the unused parameter to properly be declared as __always_unused as in:
#else
static void ixgbe_of_mac_addr(struct ixgbe_adapter __always_unused *adapter)
{}
#endif /* CONFIG_OF */
Otherwise, it will throw warnings when compiled with enhanced warning messages.
--
Mark Rustad, Networking Division, Intel Corporation
Download attachment "signature.asc" of type "application/pgp-signature" (842 bytes)
Powered by blists - more mailing lists