]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
net: struct device - replace bus_id with dev_name(), dev_set_name()
authorKay Sievers <kay.sievers@vrfy.org>
Mon, 10 Nov 2008 21:55:14 +0000 (13:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Nov 2008 21:55:14 +0000 (13:55 -0800)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
25 files changed:
drivers/net/3c59x.c
drivers/net/defxx.c
drivers/net/enc28j60.c
drivers/net/fec_mpc52xx.c
drivers/net/gianfar.c
drivers/net/mlx4/mlx4_en.h
drivers/net/pasemi_mac.c
drivers/net/phy/mdio_bus.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/sh_eth.c
drivers/net/tg3.c
drivers/net/tulip/de4x5.c
drivers/net/ucc_geth.c
drivers/net/wireless/libertas/defs.h
drivers/net/wireless/orinoco/orinoco.c
drivers/net/wireless/orinoco/orinoco_cs.c
drivers/net/wireless/orinoco/spectrum_cs.c
include/net/wireless.h
net/atm/atm_sysfs.c
net/bluetooth/hci_sysfs.c
net/core/net-sysfs.c
net/dsa/slave.c
net/rfkill/rfkill.c
net/wireless/core.c

index b4168dfd6893c56be2a2b5af2469f09d187d524f..3893f505fb5fe3ced97ba8e239f16be3a2c8effd 100644 (file)
@@ -1025,7 +1025,7 @@ static int __devinit vortex_probe1(struct device *gendev,
                }
 
                if ((edev = DEVICE_EISA(gendev))) {
-                       print_name = edev->dev.bus_id;
+                       print_name = dev_name(&edev->dev);
                }
        }
 
@@ -2883,7 +2883,7 @@ static void vortex_get_drvinfo(struct net_device *dev,
                strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
        } else {
                if (VORTEX_EISA(vp))
-                       sprintf(info->bus_info, vp->gendev->bus_id);
+                       sprintf(info->bus_info, dev_name(vp->gendev));
                else
                        sprintf(info->bus_info, "EISA 0x%lx %d",
                                        dev->base_addr, dev->irq);
index f07887435247f3bb8f886e6146bb4c33236a6d5b..6e6583b609f702266eb4e4275c0488d2e5fac5da 100644 (file)
@@ -511,7 +511,7 @@ static int __devinit dfx_register(struct device *bdev)
        int dfx_bus_pci = DFX_BUS_PCI(bdev);
        int dfx_bus_tc = DFX_BUS_TC(bdev);
        int dfx_use_mmio = DFX_MMIO || dfx_bus_tc;
-       char *print_name = bdev->bus_id;
+       const char *print_name = dev_name(bdev);
        struct net_device *dev;
        DFX_board_t       *bp;                  /* board pointer */
        resource_size_t bar_start = 0;          /* pointer to port */
index d186a52cdb62831000286e7e7d3fd111f0b5f875..32c19790d0135f921ab8f89d90909a04fcffa057 100644 (file)
@@ -1448,7 +1448,7 @@ enc28j60_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
        strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
        strlcpy(info->version, DRV_VERSION, sizeof(info->version));
        strlcpy(info->bus_info,
-               dev->dev.parent->bus_id, sizeof(info->bus_info));
+               dev_name(dev->dev.parent), sizeof(info->bus_info));
 }
 
 static int
index 94054b4981f3699905b74619c1bdb38c94e71b72..cd8e98b45ec50d9e253dcc9251ce8e62f8703ab6 100644 (file)
@@ -216,7 +216,7 @@ static int mpc52xx_fec_init_phy(struct net_device *dev)
        struct phy_device *phydev;
        char phy_id[BUS_ID_SIZE];
 
-       snprintf(phy_id, BUS_ID_SIZE, "%x:%02x",
+       snprintf(phy_id, sizeof(phy_id), "%x:%02x",
                        (unsigned int)dev->base_addr, priv->phy_addr);
 
        priv->link = PHY_DOWN;
index a091db393615d0bc372e122f349d1a107188dcf8..451f6b8b6163e891b61d0a6ce12b23c0f1dd287b 100644 (file)
@@ -546,7 +546,7 @@ static int init_phy(struct net_device *dev)
        priv->oldspeed = 0;
        priv->oldduplex = -1;
 
-       snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id);
+       snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id);
 
        interface = gfar_get_interface(dev);
 
index 11fb17c6e97bfd4b51d831104ff7f0121bd4e4e8..cc022197e2a5290e221f469cec7a1dcc7851f0b8 100644 (file)
 #define mlx4_dbg(mlevel, priv, format, arg...) \
        if (NETIF_MSG_##mlevel & priv->msg_enable) \
        printk(KERN_DEBUG "%s %s: " format , DRV_NAME ,\
-               (&priv->mdev->pdev->dev)->bus_id , ## arg)
+               (dev_name(&priv->mdev->pdev->dev)) , ## arg)
 
 #define mlx4_err(mdev, format, arg...) \
        printk(KERN_ERR "%s %s: " format , DRV_NAME ,\
-               (&mdev->pdev->dev)->bus_id , ## arg)
+               (dev_name(&mdev->pdev->dev)) , ## arg)
 #define mlx4_info(mdev, format, arg...) \
        printk(KERN_INFO "%s %s: " format , DRV_NAME ,\
-               (&mdev->pdev->dev)->bus_id , ## arg)
+               (dev_name(&mdev->pdev->dev)) , ## arg)
 #define mlx4_warn(mdev, format, arg...) \
        printk(KERN_WARNING "%s %s: " format , DRV_NAME ,\
-               (&mdev->pdev->dev)->bus_id , ## arg)
+               (dev_name(&mdev->pdev->dev)) , ## arg)
 
 /*
  * Device constants
index b0270052c3a97d400c6a533093db60efa80ac241..fcbf6ccd0a85480125d63baef07b1a283abf9752 100644 (file)
@@ -1105,7 +1105,8 @@ static int pasemi_mac_phy_init(struct net_device *dev)
                goto err;
 
        phy_id = *prop;
-       snprintf(mac->phy_id, BUS_ID_SIZE, "%x:%02x", (int)r.start, phy_id);
+       snprintf(mac->phy_id, sizeof(mac->phy_id), "%x:%02x",
+                (int)r.start, phy_id);
 
        of_node_put(phy_dn);
 
index d0ed1ef284a80404510e8f169537f40e4cb678a3..6afd35f62d77e7fca83f0657ec6bfa3e8b227c53 100644 (file)
@@ -97,7 +97,7 @@ int mdiobus_register(struct mii_bus *bus)
        bus->dev.parent = bus->parent;
        bus->dev.class = &mdio_bus_class;
        bus->dev.groups = NULL;
-       memcpy(bus->dev.bus_id, bus->id, MII_BUS_ID_SIZE);
+       dev_set_name(&bus->dev, bus->id);
 
        err = device_register(&bus->dev);
        if (err) {
@@ -191,7 +191,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
 
        phydev->dev.parent = bus->parent;
        phydev->dev.bus = &mdio_bus_type;
-       snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, addr);
+       dev_set_name(&phydev->dev, PHY_ID_FMT, bus->id, addr);
 
        phydev->bus = bus;
 
index df4e6257d4a77e3e9bba739db57dec8543315d79..e4ede6080c9dcd327acfa37530263c6382d050db 100644 (file)
@@ -45,7 +45,7 @@
  */
 void phy_print_status(struct phy_device *phydev)
 {
-       pr_info("PHY: %s - Link is %s", phydev->dev.bus_id,
+       pr_info("PHY: %s - Link is %s", dev_name(&phydev->dev),
                        phydev->link ? "Up" : "Down");
        if (phydev->link)
                printk(" - %d/%s", phydev->speed,
index e11b03b2b25a776c2494951953feeb44777d2f84..e976c1c600958943ee42dd572e68d20748b84cf6 100644 (file)
@@ -74,7 +74,7 @@ int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
        if (!fixup)
                return -ENOMEM;
 
-       strncpy(fixup->bus_id, bus_id, BUS_ID_SIZE);
+       strlcpy(fixup->bus_id, bus_id, sizeof(fixup->bus_id));
        fixup->phy_uid = phy_uid;
        fixup->phy_uid_mask = phy_uid_mask;
        fixup->run = run;
@@ -109,7 +109,7 @@ EXPORT_SYMBOL(phy_register_fixup_for_id);
  */
 static int phy_needs_fixup(struct phy_device *phydev, struct phy_fixup *fixup)
 {
-       if (strcmp(fixup->bus_id, phydev->dev.bus_id) != 0)
+       if (strcmp(fixup->bus_id, dev_name(&phydev->dev)) != 0)
                if (strcmp(fixup->bus_id, PHY_ANY_ID) != 0)
                        return 0;
 
index c51bfc57d405546eb127bccd30f0068aa628af9b..077d796ccb70c74fe62d224b8fc454aa7f84d827 100644 (file)
@@ -799,7 +799,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
        char phy_id[BUS_ID_SIZE];
        struct phy_device *phydev = NULL;
 
-       snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT,
+       snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
                mdp->mii_bus->id , mdp->phy_id);
 
        mdp->link = PHY_DOWN;
index 546b9eeaa1713faa33d6f16686c714cf1cf8723e..e05849ee9000fe93dab53ca869097f43c04af95f 100644 (file)
@@ -1396,7 +1396,7 @@ static int tg3_phy_init(struct tg3 *tp)
        phydev = tp->mdio_bus->phy_map[PHY_ADDR];
 
        /* Attach the MAC to the PHY. */
-       phydev = phy_connect(tp->dev, phydev->dev.bus_id, tg3_adjust_link,
+       phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link,
                             phydev->dev_flags, phydev->interface);
        if (IS_ERR(phydev)) {
                printk(KERN_ERR "%s: Could not attach to PHY\n", tp->dev->name);
@@ -13645,7 +13645,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
                       "%s: attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
                       tp->dev->name,
                       tp->mdio_bus->phy_map[PHY_ADDR]->drv->name,
-                      tp->mdio_bus->phy_map[PHY_ADDR]->dev.bus_id);
+                      dev_name(&tp->mdio_bus->phy_map[PHY_ADDR]->dev));
        else
                printk(KERN_INFO
                       "%s: attached PHY is %s (%s Ethernet) (WireSpeed[%d])\n",
index f8a45253eaf8b51af2dfe51392fe5a31e66f6e23..67bfd6f4336617854f1c627544a4181b226ad585 100644 (file)
@@ -1118,7 +1118,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
     }
 
     dev->base_addr = iobase;
-    printk ("%s: %s at 0x%04lx", gendev->bus_id, name, iobase);
+    printk ("%s: %s at 0x%04lx", dev_name(gendev), name, iobase);
 
     status = get_hw_addr(dev);
     printk(", h/w address %pM\n", dev->dev_addr);
@@ -1153,7 +1153,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
             }
         }
        lp->fdx = lp->params.fdx;
-       sprintf(lp->adapter_name,"%s (%s)", name, gendev->bus_id);
+       sprintf(lp->adapter_name,"%s (%s)", name, dev_name(gendev));
 
        lp->dma_size = (NUM_RX_DESC + NUM_TX_DESC) * sizeof(struct de4x5_desc);
 #if defined(__alpha__) || defined(__powerpc__) || defined(CONFIG_SPARC) || defined(DE4X5_DO_MEMCPY)
index 4931af7366300d9780cc428cfe20e55038231fbe..0a5b817fd7ac9e66ac7a5c7ab379a973fdd3888b 100644 (file)
@@ -1615,8 +1615,8 @@ static int init_phy(struct net_device *dev)
        priv->oldspeed = 0;
        priv->oldduplex = -1;
 
-       snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->ug_info->mdio_bus,
-                       priv->ug_info->phy_address);
+       snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus,
+                priv->ug_info->phy_address);
 
        phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
 
index 076a636e8f62165252b8f931f88312187e64c1bf..2d4666f26808b8cd4f9029d143e9677697490f15 100644 (file)
@@ -79,7 +79,7 @@ do { if ((lbs_debug & (grp)) == (grp)) \
 #define lbs_deb_tx(fmt, args...)        LBS_DEB_LL(LBS_DEB_TX, " tx", fmt, ##args)
 #define lbs_deb_fw(fmt, args...)        LBS_DEB_LL(LBS_DEB_FW, " fw", fmt, ##args)
 #define lbs_deb_usb(fmt, args...)       LBS_DEB_LL(LBS_DEB_USB, " usb", fmt, ##args)
-#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usbd", "%s:" fmt, (dev)->bus_id, ##args)
+#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args)
 #define lbs_deb_cs(fmt, args...)        LBS_DEB_LL(LBS_DEB_CS, " cs", fmt, ##args)
 #define lbs_deb_thread(fmt, args...)    LBS_DEB_LL(LBS_DEB_THREAD, " thread", fmt, ##args)
 #define lbs_deb_sdio(fmt, args...)      LBS_DEB_LL(LBS_DEB_SDIO, " sdio", fmt, ##args)
index f4ea08f969706405987d50865744dedeadc630dd..072be44b37de5e92ed0db7727037f1925d3847ae 100644 (file)
@@ -5987,7 +5987,7 @@ static void orinoco_get_drvinfo(struct net_device *dev,
        strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
        strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1);
        if (dev->dev.parent)
-               strncpy(info->bus_info, dev->dev.parent->bus_id,
+               strncpy(info->bus_info, dev_name(dev->dev.parent),
                        sizeof(info->bus_info) - 1);
        else
                snprintf(info->bus_info, sizeof(info->bus_info) - 1,
index 6fcf2bda7cdfbe5e0e356ab5adfee8982a2f6b27..bf6a51da3b29ea8c3a181b10419a936c81ed0df8 100644 (file)
@@ -308,7 +308,7 @@ orinoco_cs_config(struct pcmcia_device *link)
 
        /* Finally, report what we've done */
        printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
-              "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
+              "0x%04x-0x%04x\n", dev->name, dev_name(dev->dev.parent),
               link->irq.AssignedIRQ, link->io.BasePort1,
               link->io.BasePort1 + link->io.NumPorts1 - 1);
        return 0;
index 852789ad34b3e33e0094bbc2bce4496096e00209..0bae3dcf9d5055b55205433a356720596704926d 100644 (file)
@@ -383,7 +383,7 @@ spectrum_cs_config(struct pcmcia_device *link)
 
        /* Finally, report what we've done */
        printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
-              "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
+              "0x%04x-0x%04x\n", dev->name, dev_name(dev->dev.parent),
               link->irq.AssignedIRQ, link->io.BasePort1,
               link->io.BasePort1 + link->io.NumPorts1 - 1);
 
index 17d4b582cf346a9370dbbb1fb99c37173e33c69a..412351560b764453570062387e835ad61a95cf29 100644 (file)
@@ -263,9 +263,9 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
 /**
  * wiphy_name - get wiphy name
  */
-static inline char *wiphy_name(struct wiphy *wiphy)
+static inline const char *wiphy_name(struct wiphy *wiphy)
 {
-       return wiphy->dev.bus_id;
+       return dev_name(&wiphy->dev);
 }
 
 /**
index 1b88311f2130b57598bc13ee82dc74bab3cc3fc2..b5674dc2083d6766bbe4754d3951439fde141c0c 100644 (file)
@@ -149,7 +149,7 @@ int atm_register_sysfs(struct atm_dev *adev)
        cdev->class = &atm_class;
        dev_set_drvdata(cdev, adev);
 
-       snprintf(cdev->bus_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number);
+       dev_set_name(cdev, "%s%d", adev->type, adev->number);
        err = device_register(cdev);
        if (err < 0)
                return err;
index f4f6615cad9f910c55f1cc70db8e633e010ce6eb..f2bbb2f654349445a13bc03a57cf48acd2c31ed9 100644 (file)
@@ -113,8 +113,7 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
        conn->dev.class = bt_class;
        conn->dev.parent = &hdev->dev;
 
-       snprintf(conn->dev.bus_id, BUS_ID_SIZE, "%s:%d",
-                                       hdev->name, conn->handle);
+       dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
 
        dev_set_drvdata(&conn->dev, conn);
 
@@ -132,7 +131,7 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
  */
 static int __match_tty(struct device *dev, void *data)
 {
-       return !strncmp(dev->bus_id, "rfcomm", 6);
+       return !strncmp(dev_name(dev), "rfcomm", 6);
 }
 
 static void del_conn(struct work_struct *work)
@@ -421,7 +420,7 @@ int hci_register_sysfs(struct hci_dev *hdev)
        dev->class = bt_class;
        dev->parent = hdev->parent;
 
-       strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE);
+       dev_set_name(dev, hdev->name);
 
        dev_set_drvdata(dev, hdev);
 
index 85cb8bdcfb8f4feb154d65c34be240eef3a46ba2..146dcfeb060e75c5090efdb12bf11ff6216cc12b 100644 (file)
@@ -494,7 +494,7 @@ int netdev_register_kobject(struct net_device *net)
        dev->groups = groups;
 
        BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ);
-       strlcpy(dev->bus_id, net->name, BUS_ID_SIZE);
+       dev_set_name(dev, net->name);
 
 #ifdef CONFIG_SYSFS
        *groups++ = &netstat_group;
index 37616884b8a9c624f85ecf9350b9758e16aa0bfb..7384bad816522639db7ca092959ebd59a5f6f991 100644 (file)
@@ -284,7 +284,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
        netif_carrier_off(slave_dev);
 
        if (p->phy != NULL) {
-               phy_attach(slave_dev, p->phy->dev.bus_id,
+               phy_attach(slave_dev, dev_name(&p->phy->dev),
                           0, PHY_INTERFACE_MODE_GMII);
 
                p->phy->autoneg = AUTONEG_ENABLE;
index 69f3a3b4dd61f13ec26c802a703ab5eaa1c57cc0..ec26eae8004d5c298d0e6c175e563c309532b7f9 100644 (file)
@@ -774,7 +774,7 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
        int error;
 
        if (!rfkill->led_trigger.name)
-               rfkill->led_trigger.name = rfkill->dev.bus_id;
+               rfkill->led_trigger.name = dev_name(&rfkill->dev);
        if (!rfkill->led_trigger.activate)
                rfkill->led_trigger.activate = rfkill_led_trigger_activate;
        error = led_trigger_register(&rfkill->led_trigger);
@@ -815,8 +815,7 @@ int __must_check rfkill_register(struct rfkill *rfkill)
                        "badly initialized rfkill struct\n"))
                return -EINVAL;
 
-       snprintf(dev->bus_id, sizeof(dev->bus_id),
-                "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
+       dev_set_name(dev, "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
 
        rfkill_led_trigger_register(rfkill);
 
index 72825afe2bf638d100fc1fe63c8968c5717bdba3..39e3d10fccdef5cf49761227e71868a88b997e79 100644 (file)
@@ -236,8 +236,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)
        mutex_unlock(&cfg80211_drv_mutex);
 
        /* give it a proper name */
-       snprintf(drv->wiphy.dev.bus_id, BUS_ID_SIZE,
-                PHY_NAME "%d", drv->idx);
+       dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->idx);
 
        mutex_init(&drv->mtx);
        mutex_init(&drv->devlist_mtx);