Message ID | 1454933272-45005-6-git-send-email-sunil.kovvuri@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello. On 2/8/2016 3:07 PM, sunil.kovvuri@gmail.com wrote: > From: Robert Richter <rrichter@cavium.com> > > Signed-off-by: Robert Richter <rrichter@cavium.com> > Signed-off-by: Sunil Goutham <sgoutham@cavium.com> > --- > drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 11 ++++++++--- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c > index 111835b..cfee496 100644 > --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c > +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c [...] > @@ -897,10 +898,13 @@ static int acpi_get_mac_address(struct acpi_device *adev, u8 *dst) > goto out; > > if (!is_valid_ether_addr(mac)) { > + dev_warn(dev, "MAC address invalid: %pM\n", mac); dev_er(), maybe? > ret = -EINVAL; > goto out; > } > > + dev_info(dev, "MAC address set to: %pM\n", mac); > + > memcpy(dst, mac, ETH_ALEN); > out: > return ret; [...] MBR, Sergei
On 08.02.16 16:30:37, Sergei Shtylyov wrote: > >@@ -897,10 +898,13 @@ static int acpi_get_mac_address(struct acpi_device *adev, u8 *dst) > > goto out; > > > > if (!is_valid_ether_addr(mac)) { > >+ dev_warn(dev, "MAC address invalid: %pM\n", mac); > > dev_er(), maybe? Since the driver may continue, my choice was a warning only. -Robert > > > ret = -EINVAL; > > goto out; > > } > > > >+ dev_info(dev, "MAC address set to: %pM\n", mac); > >+ > > memcpy(dst, mac, ETH_ALEN); > > out: > > return ret; > [...]
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> writes:
> dev_er(), maybe?
I like that!
It's often hard to know whether to print something or be quiet.
pr_er(), dev_er(), netdev_er() etc would be the perfect solution to that
problem.
Bjørn
On 02/08/2016 04:49 PM, Bjørn Mork wrote: >> dev_er(), maybe? > > I like that! > > It's often hard to know whether to print something or be quiet. > pr_er(), dev_er(), netdev_er() etc would be the perfect solution to that > problem. :-D Sorry for the typo... > Bjørn MBR, Sergei
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 111835b..cfee496 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -886,7 +886,8 @@ static void bgx_get_qlm_mode(struct bgx *bgx) #ifdef CONFIG_ACPI -static int acpi_get_mac_address(struct acpi_device *adev, u8 *dst) +static int acpi_get_mac_address(struct device *dev, struct acpi_device *adev, + u8 *dst) { u8 mac[ETH_ALEN]; int ret; @@ -897,10 +898,13 @@ static int acpi_get_mac_address(struct acpi_device *adev, u8 *dst) goto out; if (!is_valid_ether_addr(mac)) { + dev_warn(dev, "MAC address invalid: %pM\n", mac); ret = -EINVAL; goto out; } + dev_info(dev, "MAC address set to: %pM\n", mac); + memcpy(dst, mac, ETH_ALEN); out: return ret; @@ -911,14 +915,15 @@ static acpi_status bgx_acpi_register_phy(acpi_handle handle, u32 lvl, void *context, void **rv) { struct bgx *bgx = context; + struct device *dev = &bgx->pdev->dev; struct acpi_device *adev; if (acpi_bus_get_device(handle, &adev)) goto out; - acpi_get_mac_address(adev, bgx->lmac[bgx->lmac_count].mac); + acpi_get_mac_address(dev, adev, bgx->lmac[bgx->lmac_count].mac); - SET_NETDEV_DEV(&bgx->lmac[bgx->lmac_count].netdev, &bgx->pdev->dev); + SET_NETDEV_DEV(&bgx->lmac[bgx->lmac_count].netdev, dev); bgx->lmac[bgx->lmac_count].lmacid = bgx->lmac_count; out: