Skip to contentSkip to conversation

pinctrl: tegra: xusb: Silence sparse warnings

PATCH In review Thierry Reding 2 participants 2 messages Apr 24, 2017 1 message not in the archive

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

PATCH 1/1 pinctrl: tegra: xusb: Silence sparse warnings

From: Thierry Reding <[email protected]>

Commit 53d2a715c240 ("phy: Add Tegra XUSB pad controller support") added a new driver for the XUSB pad controller that implements a more flexible devicetree binding. In order to preserve backwards compatibility the old driver can be probed if the obsolete bindings are detected.

In order to hide the legacy code, these prototypes were defined in a header private to the new driver. This has the disadvantage of making the sparse code checker complain about the missing declarations when compiling the old driver and suggesting to make the functions static.

Avoid these sparse warnings by adding local prototype declarations into the compatibility driver.

---
 drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/pinctrl/tegra/pinctrl-tegra-xusb.c +4 -0
index 6f68a9eebc58..ebedc2d32411 100644
@@ -873,6 +873,10 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_xusb_padctl_of_match);
 
+/* predeclare these in order to silence sparse */
+int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev);
+int tegra_xusb_padctl_legacy_remove(struct platform_device *pdev);
+
 int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev)
 {
 	struct tegra_xusb_padctl *padctl;
Signature · 1 line
2.12.0

A message that is not in the archive (sent off-list or not yet received): 20170424115649.17424-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 12 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Commit 53d2a715c240 ("phy: Add Tegra XUSB pad controller support") added a new driver for the XUSB pad controller that implements a more flexible devicetree binding. In order to preserve backwards compatibility the old driver can be probed if the obsolete bindings are detected.

In order to hide the legacy code, these prototypes were defined in a header private to the new driver. This has the disadvantage of making the sparse code checker complain about the missing declarations when compiling the old driver and suggesting to make the functions static.

Quoted 4 lines

Avoid these sparse warnings by adding local prototype declarations into the compatibility driver.

Patch applied.

Yours,
Linus Walleij