Skip to contentSkip to conversation

stmmac: platform: adjust messages and move to dev level

PATCH In review Andy Shevchenko 2 participants 6 messages Dec 9, 2014 – Jan 27, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stmmac: platform: adjust messages and move to dev level

This patch amendes error and warning messages across the platform driver. It includes the following changes:
- remove unneccessary message when no memory is available
- change info level to warn in the validation functions
- append \n to the end of messages
- change pr_* macros to dev_*

---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 37 ++++++++++++----------
 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +21 -16
index 4032b17..e809b30 100644
@@ -53,6 +53,7 @@ MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
 
 /**
  * dwmac1000_validate_mcast_bins - validates the number of Multicast filter bins
+ * @dev: struct device of the platform device
  * @mcast_bins: Multicast filtering bins
  * Description:
  * this function validates the number of Multicast filtering bins specified
@@ -63,7 +64,7 @@ MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
  * invalid and will cause the filtering algorithm to use Multicast
  * promiscuous mode.
  */
-static int dwmac1000_validate_mcast_bins(int mcast_bins)
+static int dwmac1000_validate_mcast_bins(struct device *dev, int mcast_bins)
 {
 	int x = mcast_bins;
 
@@ -74,8 +75,8 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins)
 		break;
 	default:
 		x = 0;
-		pr_info("Hash table entries set to unexpected value %d",
-			mcast_bins);
+		dev_warn(dev, "Hash table entries set to unexpected value %d\n",
+			 mcast_bins);
 		break;
 	}
 	return x;
@@ -83,6 +84,7 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins)
 
 /**
  * dwmac1000_validate_ucast_entries - validate the Unicast address entries
+ * @dev: struct device of the platform device
  * @ucast_entries: number of Unicast address entries
  * Description:
  * This function validates the number of Unicast address entries supported
@@ -92,7 +94,8 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins)
  * selected, and defaults to 1 Unicast address if an unsupported
  * configuration is selected.
  */
-static int dwmac1000_validate_ucast_entries(int ucast_entries)
+static int dwmac1000_validate_ucast_entries(struct device *dev,
+					    int ucast_entries)
 {
 	int x = ucast_entries;
 
@@ -104,8 +107,9 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries)
 		break;
 	default:
 		x = 1;
-		pr_info("Unicast table entries set to unexpected value %d\n",
-			ucast_entries);
+		dev_warn(dev,
+			 "Unicast table entries set to unexpected value %d\n",
+			 ucast_entries);
 		break;
 	}
 	return x;
@@ -209,9 +213,9 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 		of_property_read_u32(np, "snps,perfect-filter-entries",
 				     &plat->unicast_filter_entries);
 		plat->unicast_filter_entries = dwmac1000_validate_ucast_entries(
-					       plat->unicast_filter_entries);
+				&pdev->dev, plat->unicast_filter_entries);
 		plat->multicast_filter_bins = dwmac1000_validate_mcast_bins(
-					      plat->multicast_filter_bins);
+				&pdev->dev, plat->multicast_filter_bins);
 		plat->has_gmac = 1;
 		plat->pmt = 1;
 	}
@@ -238,7 +242,8 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 	plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
 	if (plat->force_thresh_dma_mode) {
 		plat->force_sf_dma_mode = 0;
-		pr_warn("force_sf_dma_mode is ignored if force_thresh_dma_mode is set.");
+		dev_warn(&pdev->dev,
+			 "force_sf_dma_mode is ignored if force_thresh_dma_mode is set.\n");
 	}
 
 	return 0;
@@ -280,10 +285,8 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 		plat_dat = devm_kzalloc(&pdev->dev,
 					sizeof(struct plat_stmmacenet_data),
 					GFP_KERNEL);
-	if (!plat_dat) {
-		pr_err("%s: ERROR: no memory", __func__);
+	if (!plat_dat)
 		return  -ENOMEM;
-	}
 
 	/* Set default value for multicast hash bins */
 	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
@@ -294,7 +297,8 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node) {
 		ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
 		if (ret) {
-			pr_err("%s: main dt probe failed", __func__);
+			dev_err(&pdev->dev, "%s: main dt probe failed\n",
+				__func__);
 			return ret;
 		}
 	}
@@ -313,9 +317,10 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr);
+	priv = stmmac_dvr_probe(&pdev->dev, plat_dat, addr);
 	if (IS_ERR(priv)) {
-		pr_err("%s: main driver probe failed", __func__);
+		dev_err(&pdev->dev, "%s: main driver probe failed\n",
+			__func__);
 		return PTR_ERR(priv);
 	}
 
@@ -354,7 +359,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv->dev);
 
-	pr_debug("STMMAC platform driver registration completed");
+	dev_dbg(&pdev->dev, "STMMAC platform driver registration completed\n");
 
 	return 0;
 }
Signature · 1 line
2.1.3
maintainer
#1 lore raw

From: Andy Shevchenko <[email protected]>
Date: Tue, 9 Dec 2014 11:59:13 +0200

Quoted 8 lines

This patch amendes error and warning messages across the platform driver. It includes the following changes:
- remove unneccessary message when no memory is available
- change info level to warn in the validation functions
- append \n to the end of messages
- change pr_* macros to dev_*

This does not apply to the net-next tree, please respin.

#2 lore raw
Quoted 10 lines · David Miller

From: Andy Shevchenko <[email protected]>
Date: Tue, 9 Dec 2014 11:59:13 +0200

Quoted 7 lines

This patch amendes error and warning messages across the platform driver. It includes the following changes:
- remove unneccessary message when no memory is available
- change info level to warn in the validation functions
- append \n to the end of messages
- change pr_* macros to dev_*

Quoted 3 lines
Quoted 1 line

This does not apply to the net-next tree, please respin.

Yeah, maybe because the fix (*) you mentioned in previos mail is not in net-next by some reason?

(*) I refer to commit 28603d13997e2ef47f18589cc9a44553aad49c86

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
maintainer
#3 lore raw

From: Andy Shevchenko <[email protected]>
Date: Wed, 10 Dec 2014 12:47:51 +0200

Quoted 11 lines · David Miller
Quoted 10 lines

From: Andy Shevchenko <[email protected]>
Date: Tue, 9 Dec 2014 11:59:13 +0200

Quoted 7 lines

This patch amendes error and warning messages across the platform driver. It includes the following changes:
- remove unneccessary message when no memory is available
- change info level to warn in the validation functions
- append \n to the end of messages
- change pr_* macros to dev_*

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This does not apply to the net-next tree, please respin.

Yeah, maybe because the fix (*) you mentioned in previos mail is not in net-next by some reason?

(*) I refer to commit 28603d13997e2ef47f18589cc9a44553aad49c86

It's in the 'net' tree which hasn't been merged into net-next.

#4 lore raw
Quoted 16 lines · David Miller

From: Andy Shevchenko <[email protected]>
Date: Wed, 10 Dec 2014 12:47:51 +0200

Quoted 13 lines · David Miller
Quoted 12 lines

From: Andy Shevchenko <[email protected]>
Date: Tue, 9 Dec 2014 11:59:13 +0200

Quoted 8 lines

This patch amendes error and warning messages across the platform driver. It includes the following changes:
- remove unneccessary message when no memory is available
- change info level to warn in the validation functions
- append \n to the end of messages
- change pr_* macros to dev_*

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

This does not apply to the net-next tree, please respin.

Yeah, maybe because the fix (*) you mentioned in previos mail is not in net-next by some reason?

(*) I refer to commit 28603d13997e2ef47f18589cc9a44553aad49c86

It's in the 'net' tree which hasn't been merged into net-next.

It seems it can be clearly applied on top of recent net-next.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#5 lore raw
In reply to David Miller
Quoted 10 lines · David Miller

From: Andy Shevchenko <[email protected]>
Date: Tue, 9 Dec 2014 11:59:13 +0200

Quoted 7 lines

This patch amendes error and warning messages across the platform driver. It includes the following changes:
- remove unneccessary message when no memory is available
- change info level to warn in the validation functions
- append \n to the end of messages
- change pr_* macros to dev_*

Quoted 3 lines
Quoted 1 line

This does not apply to the net-next tree, please respin.

Gently ping on this patch. It smoothly applies to the current net-next, IIUC.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy