Commit 21c328dc authored by Rob Herring's avatar Rob Herring Committed by David S. Miller

net: ethernet: Convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
Cc: Salil Mehta <salil.mehta@huawei.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Cc: John Crispin <john@phrozen.org>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Nelson Chang <nelson.chang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Wingman Kwok <w-kwok2@ti.com>
Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Acked-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8bad008e
......@@ -446,8 +446,8 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
goto error;
}
snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s@%llx", np->name,
(unsigned long long)res.start);
snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np,
(unsigned long long)res.start);
priv->map = of_iomap(np, 0);
if (!priv->map) {
......
......@@ -807,8 +807,8 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
*/
put_device(&mac_cb->phy_dev->mdio.dev);
dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
mac_cb->mac_id, np->name);
dev_dbg(mac_cb->dev, "mac%d phy_node: %pOFn\n",
mac_cb->mac_id, np);
}
of_node_put(np);
......@@ -825,8 +825,8 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
* if the phy_dev is found
*/
put_device(&mac_cb->phy_dev->mdio.dev);
dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
mac_cb->mac_id, np->name);
dev_dbg(mac_cb->dev, "mac%d phy_node: %pOFn\n",
mac_cb->mac_id, np);
}
of_node_put(np);
......
......@@ -2733,17 +2733,17 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
memset(&res, 0, sizeof(res));
if (of_irq_to_resource(pnp, 0, &res) <= 0) {
dev_err(&pdev->dev, "missing interrupt on %s\n", pnp->name);
dev_err(&pdev->dev, "missing interrupt on %pOFn\n", pnp);
return -EINVAL;
}
if (of_property_read_u32(pnp, "reg", &ppd.port_number)) {
dev_err(&pdev->dev, "missing reg property on %s\n", pnp->name);
dev_err(&pdev->dev, "missing reg property on %pOFn\n", pnp);
return -EINVAL;
}
if (ppd.port_number >= 3) {
dev_err(&pdev->dev, "invalid reg property on %s\n", pnp->name);
dev_err(&pdev->dev, "invalid reg property on %pOFn\n", pnp);
return -EINVAL;
}
......
......@@ -405,7 +405,7 @@ static int mtk_mdio_init(struct mtk_eth *eth)
eth->mii_bus->priv = eth;
eth->mii_bus->parent = eth->dev;
snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name);
snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%pOFn", mii_np);
ret = of_mdiobus_register(eth->mii_bus, mii_np);
err_put_node:
......
......@@ -2999,7 +2999,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
/* Now make sure pci_dev cookie is there. */
#ifdef CONFIG_SPARC
dp = pci_device_to_OF_node(pdev);
strcpy(prom_name, dp->name);
snprintf(prom_name, sizeof(prom_name), "%pOFn", dp);
#else
if (is_quattro_p(pdev))
strcpy(prom_name, "SUNW,qfe");
......
......@@ -225,17 +225,6 @@ static int emac_arch_get_mac_addr(char *x, void __iomem *efuse_mac, u32 swap)
return 0;
}
static const char *netcp_node_name(struct device_node *node)
{
const char *name;
if (of_property_read_string(node, "label", &name) < 0)
name = node->name;
if (!name)
name = "unknown";
return name;
}
/* Module management routines */
static int netcp_register_interface(struct netcp_intf *netcp)
{
......@@ -267,8 +256,13 @@ static int netcp_module_probe(struct netcp_device *netcp_device,
}
for_each_available_child_of_node(devices, child) {
const char *name = netcp_node_name(child);
const char *name;
char node_name[32];
if (of_property_read_string(node, "label", &name) < 0) {
snprintf(node_name, sizeof(node_name), "%pOFn", child);
name = node_name;
}
if (!strcasecmp(module->name, name))
break;
}
......@@ -2209,8 +2203,8 @@ static int netcp_probe(struct platform_device *pdev)
for_each_available_child_of_node(interfaces, child) {
ret = netcp_create_interface(netcp_device, child);
if (ret) {
dev_err(dev, "could not create interface(%s)\n",
child->name);
dev_err(dev, "could not create interface(%pOFn)\n",
child);
goto probe_quit_interface;
}
}
......
......@@ -3137,15 +3137,15 @@ static void init_secondary_ports(struct gbe_priv *gbe_dev,
for_each_child_of_node(node, port) {
slave = devm_kzalloc(dev, sizeof(*slave), GFP_KERNEL);
if (!slave) {
dev_err(dev, "memory alloc failed for secondary port(%s), skipping...\n",
port->name);
dev_err(dev, "memory alloc failed for secondary port(%pOFn), skipping...\n",
port);
continue;
}
if (init_slave(gbe_dev, slave, port)) {
dev_err(dev,
"Failed to initialize secondary port(%s), skipping...\n",
port->name);
"Failed to initialize secondary port(%pOFn), skipping...\n",
port);
devm_kfree(dev, slave);
continue;
}
......@@ -3239,8 +3239,8 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, XGBE_SS_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't xlate xgbe of node(%s) ss address at %d\n",
node->name, XGBE_SS_REG_INDEX);
"Can't xlate xgbe of node(%pOFn) ss address at %d\n",
node, XGBE_SS_REG_INDEX);
return ret;
}
......@@ -3254,8 +3254,8 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, XGBE_SM_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't xlate xgbe of node(%s) sm address at %d\n",
node->name, XGBE_SM_REG_INDEX);
"Can't xlate xgbe of node(%pOFn) sm address at %d\n",
node, XGBE_SM_REG_INDEX);
return ret;
}
......@@ -3269,8 +3269,8 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, XGBE_SERDES_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't xlate xgbe serdes of node(%s) address at %d\n",
node->name, XGBE_SERDES_REG_INDEX);
"Can't xlate xgbe serdes of node(%pOFn) address at %d\n",
node, XGBE_SERDES_REG_INDEX);
return ret;
}
......@@ -3347,8 +3347,8 @@ static int get_gbe_resource_version(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, GBE_SS_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't translate of node(%s) of gbe ss address at %d\n",
node->name, GBE_SS_REG_INDEX);
"Can't translate of node(%pOFn) of gbe ss address at %d\n",
node, GBE_SS_REG_INDEX);
return ret;
}
......@@ -3372,8 +3372,8 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, GBE_SGMII34_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't translate of gbe node(%s) address at index %d\n",
node->name, GBE_SGMII34_REG_INDEX);
"Can't translate of gbe node(%pOFn) address at index %d\n",
node, GBE_SGMII34_REG_INDEX);
return ret;
}
......@@ -3388,8 +3388,8 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, GBE_SM_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't translate of gbe node(%s) address at index %d\n",
node->name, GBE_SM_REG_INDEX);
"Can't translate of gbe node(%pOFn) address at index %d\n",
node, GBE_SM_REG_INDEX);
return ret;
}
......@@ -3498,8 +3498,8 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev,
ret = of_address_to_resource(node, GBENU_SM_REG_INDEX, &res);
if (ret) {
dev_err(gbe_dev->dev,
"Can't translate of gbenu node(%s) addr at index %d\n",
node->name, GBENU_SM_REG_INDEX);
"Can't translate of gbenu node(%pOFn) addr at index %d\n",
node, GBENU_SM_REG_INDEX);
return ret;
}
......@@ -3642,7 +3642,7 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
ret = netcp_xgbe_serdes_init(gbe_dev->xgbe_serdes_regs,
gbe_dev->ss_regs);
} else {
dev_err(dev, "unknown GBE node(%s)\n", node->name);
dev_err(dev, "unknown GBE node(%pOFn)\n", node);
ret = -ENODEV;
}
......@@ -3667,8 +3667,8 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
for_each_child_of_node(interfaces, interface) {
ret = of_property_read_u32(interface, "slave-port", &slave_num);
if (ret) {
dev_err(dev, "missing slave-port parameter, skipping interface configuration for %s\n",
interface->name);
dev_err(dev, "missing slave-port parameter, skipping interface configuration for %pOFn\n",
interface);
continue;
}
gbe_dev->num_slaves++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment