]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'driver-core/driver-core-next'
authorThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:59:08 +0000 (14:59 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:59:08 +0000 (14:59 +0200)
Conflicts:
include/linux/netdevice.h

1  2 
arch/powerpc/kernel/vio.c
drivers/md/md.c
drivers/mmc/core/bus.c
drivers/mmc/host/mvsdio.c
drivers/mtd/nand/atmel_nand.c
drivers/net/bonding/bond_sysfs.c
include/linux/netdevice.h
kernel/events/core.c

index 089de12b9ab0946e324c4521e11936ae685b15da,408956fbf4f617b67a284e9bd19f22c2fb86abd4..05a6acb3a341b35cbcce812f10827e1c9fcf4596
@@@ -997,21 -997,36 +997,36 @@@ static struct device_attribute vio_cmo_
  /* sysfs bus functions and data structures for CMO */
  
  #define viobus_cmo_rd_attr(name)                                        \
- static ssize_t                                                          \
- viobus_cmo_##name##_show(struct bus_type *bt, char *buf)                \
+ static ssize_t cmo_##name##_show(struct bus_type *bt, char *buf)        \
  {                                                                       \
        return sprintf(buf, "%lu\n", vio_cmo.name);                     \
- }
+ }                                                                       \
+ static BUS_ATTR_RO(cmo_##name)
  
  #define viobus_cmo_pool_rd_attr(name, var)                              \
  static ssize_t                                                          \
viobus_cmo_##name##_pool_show_##var(struct bus_type *bt, char *buf)     \
cmo_##name##_##var##_show(struct bus_type *bt, char *buf)               \
  {                                                                       \
        return sprintf(buf, "%lu\n", vio_cmo.name.var);                 \
+ }                                                                       \
+ static BUS_ATTR_RO(cmo_##name##_##var)
+ viobus_cmo_rd_attr(entitled);
+ viobus_cmo_rd_attr(spare);
+ viobus_cmo_rd_attr(min);
+ viobus_cmo_rd_attr(desired);
+ viobus_cmo_rd_attr(curr);
+ viobus_cmo_pool_rd_attr(reserve, size);
+ viobus_cmo_pool_rd_attr(excess, size);
+ viobus_cmo_pool_rd_attr(excess, free);
+ static ssize_t cmo_high_show(struct bus_type *bt, char *buf)
+ {
+       return sprintf(buf, "%lu\n", vio_cmo.high);
  }
  
- static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf,
-                                      size_t count)
+ static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
+                             size_t count)
  {
        unsigned long flags;
  
  
        return count;
  }
- viobus_cmo_rd_attr(entitled);
- viobus_cmo_pool_rd_attr(reserve, size);
- viobus_cmo_pool_rd_attr(excess, size);
- viobus_cmo_pool_rd_attr(excess, free);
- viobus_cmo_rd_attr(spare);
- viobus_cmo_rd_attr(min);
- viobus_cmo_rd_attr(desired);
- viobus_cmo_rd_attr(curr);
- viobus_cmo_rd_attr(high);
- static struct bus_attribute vio_cmo_bus_attrs[] = {
-       __ATTR(cmo_entitled, S_IRUGO, viobus_cmo_entitled_show, NULL),
-       __ATTR(cmo_reserve_size, S_IRUGO, viobus_cmo_reserve_pool_show_size, NULL),
-       __ATTR(cmo_excess_size, S_IRUGO, viobus_cmo_excess_pool_show_size, NULL),
-       __ATTR(cmo_excess_free, S_IRUGO, viobus_cmo_excess_pool_show_free, NULL),
-       __ATTR(cmo_spare,   S_IRUGO, viobus_cmo_spare_show,   NULL),
-       __ATTR(cmo_min,     S_IRUGO, viobus_cmo_min_show,     NULL),
-       __ATTR(cmo_desired, S_IRUGO, viobus_cmo_desired_show, NULL),
-       __ATTR(cmo_curr,    S_IRUGO, viobus_cmo_curr_show,    NULL),
-       __ATTR(cmo_high,    S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
-              viobus_cmo_high_show, viobus_cmo_high_reset),
-       __ATTR_NULL
+ static BUS_ATTR_RW(cmo_high);
+ static struct attribute *vio_bus_attrs[] = {
+       &bus_attr_cmo_entitled.attr,
+       &bus_attr_cmo_spare.attr,
+       &bus_attr_cmo_min.attr,
+       &bus_attr_cmo_desired.attr,
+       &bus_attr_cmo_curr.attr,
+       &bus_attr_cmo_high.attr,
+       &bus_attr_cmo_reserve_size.attr,
+       &bus_attr_cmo_excess_size.attr,
+       &bus_attr_cmo_excess_free.attr,
+       NULL,
  };
+ ATTRIBUTE_GROUPS(vio_bus);
  
  static void vio_cmo_sysfs_init(void)
  {
        vio_bus_type.dev_attrs = vio_cmo_dev_attrs;
-       vio_bus_type.bus_attrs = vio_cmo_bus_attrs;
+       vio_bus_type.bus_groups = vio_bus_groups;
  }
  #else /* CONFIG_PPC_SMLPAR */
  int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
@@@ -1413,7 -1419,8 +1419,7 @@@ struct vio_dev *vio_register_device_nod
  
                /* needed to ensure proper operation of coherent allocations
                 * later, in case driver doesn't set it explicitly */
 -              dma_set_mask(&viodev->dev, DMA_BIT_MASK(64));
 -              dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64));
 +              dma_set_mask_and_coherent(&viodev->dev, DMA_BIT_MASK(64));
        }
  
        /* register with generic device framework */
diff --combined drivers/md/md.c
index 628cd529343f0b5bc38d44899c89adbb17e69e65,8a0d7625681c081889a0d4cafee5422df451eea0..2a4e3fb0837f52d7f2b96cda03680e8f551de009
@@@ -112,7 -112,7 +112,7 @@@ static inline int speed_max(struct mdde
  
  static struct ctl_table_header *raid_table_header;
  
 -static ctl_table raid_table[] = {
 +static struct ctl_table raid_table[] = {
        {
                .procname       = "speed_limit_min",
                .data           = &sysctl_speed_limit_min,
        { }
  };
  
 -static ctl_table raid_dir_table[] = {
 +static struct ctl_table raid_dir_table[] = {
        {
                .procname       = "raid",
                .maxlen         = 0,
        { }
  };
  
 -static ctl_table raid_root_table[] = {
 +static struct ctl_table raid_root_table[] = {
        {
                .procname       = "dev",
                .maxlen         = 0,
@@@ -3555,7 -3555,7 +3555,7 @@@ level_store(struct mddev *mddev, const 
                        printk(KERN_WARNING
                               "md: cannot register extra attributes for %s\n",
                               mdname(mddev));
-               mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, NULL, "sync_action");
+               mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
        }               
        if (mddev->pers->sync_request != NULL &&
            pers->sync_request == NULL) {
@@@ -5331,31 -5331,20 +5331,31 @@@ EXPORT_SYMBOL_GPL(md_stop)
  static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
  {
        int err = 0;
 +      int did_freeze = 0;
 +
 +      if (!test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) {
 +              did_freeze = 1;
 +              set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 +              md_wakeup_thread(mddev->thread);
 +      }
 +      if (mddev->sync_thread)
 +              set_bit(MD_RECOVERY_INTR, &mddev->recovery);
 +      mddev_unlock(mddev);
 +      wait_event(resync_wait, mddev->sync_thread == NULL);
 +      mddev_lock(mddev);
 +
        mutex_lock(&mddev->open_mutex);
 -      if (atomic_read(&mddev->openers) > !!bdev) {
 +      if (atomic_read(&mddev->openers) > !!bdev ||
 +          mddev->sync_thread ||
 +          (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags))) {
                printk("md: %s still in use.\n",mdname(mddev));
 +              if (did_freeze) {
 +                      clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 +                      md_wakeup_thread(mddev->thread);
 +              }
                err = -EBUSY;
                goto out;
        }
 -      if (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags)) {
 -              /* Someone opened the device since we flushed it
 -               * so page cache could be dirty and it is too late
 -               * to flush.  So abort
 -               */
 -              mutex_unlock(&mddev->open_mutex);
 -              return -EBUSY;
 -      }
        if (mddev->pers) {
                __md_stop_writes(mddev);
  
                set_disk_ro(mddev->gendisk, 1);
                clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
                sysfs_notify_dirent_safe(mddev->sysfs_state);
 -              err = 0;        
 +              err = 0;
        }
  out:
        mutex_unlock(&mddev->open_mutex);
@@@ -5382,30 -5371,20 +5382,30 @@@ static int do_md_stop(struct mddev * md
  {
        struct gendisk *disk = mddev->gendisk;
        struct md_rdev *rdev;
 +      int did_freeze = 0;
 +
 +      if (!test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) {
 +              did_freeze = 1;
 +              set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 +              md_wakeup_thread(mddev->thread);
 +      }
 +      if (mddev->sync_thread)
 +              set_bit(MD_RECOVERY_INTR, &mddev->recovery);
 +      mddev_unlock(mddev);
 +      wait_event(resync_wait, mddev->sync_thread == NULL);
 +      mddev_lock(mddev);
  
        mutex_lock(&mddev->open_mutex);
        if (atomic_read(&mddev->openers) > !!bdev ||
 -          mddev->sysfs_active) {
 +          mddev->sysfs_active ||
 +          mddev->sync_thread ||
 +          (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags))) {
                printk("md: %s still in use.\n",mdname(mddev));
                mutex_unlock(&mddev->open_mutex);
 -              return -EBUSY;
 -      }
 -      if (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags)) {
 -              /* Someone opened the device since we flushed it
 -               * so page cache could be dirty and it is too late
 -               * to flush.  So abort
 -               */
 -              mutex_unlock(&mddev->open_mutex);
 +              if (did_freeze) {
 +                      clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 +                      md_wakeup_thread(mddev->thread);
 +              }
                return -EBUSY;
        }
        if (mddev->pers) {
@@@ -7955,7 -7934,6 +7955,7 @@@ void md_reap_sync_thread(struct mddev *
  
        /* resync has finished, collect result */
        md_unregister_thread(&mddev->sync_thread);
 +      wake_up(&resync_wait);
        if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
            !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
                /* success...*/
@@@ -8133,7 -8111,6 +8133,7 @@@ static int md_set_badblocks(struct badb
        u64 *p;
        int lo, hi;
        int rv = 1;
 +      unsigned long flags;
  
        if (bb->shift < 0)
                /* badblocks are disabled */
                sectors = next - s;
        }
  
 -      write_seqlock_irq(&bb->lock);
 +      write_seqlock_irqsave(&bb->lock, flags);
  
        p = bb->page;
        lo = 0;
        bb->changed = 1;
        if (!acknowledged)
                bb->unacked_exist = 1;
 -      write_sequnlock_irq(&bb->lock);
 +      write_sequnlock_irqrestore(&bb->lock, flags);
  
        return rv;
  }
diff --combined drivers/mmc/core/bus.c
index cdca8a70da38bfcc9cace78dde9afe563afaef24,3e227bd91e81935eaf3f4ffce830de99b3e1321d..64145a32b917b37ce862e392fe3600417c99c336
@@@ -27,7 -27,7 +27,7 @@@
  
  #define to_mmc_driver(d)      container_of(d, struct mmc_driver, drv)
  
- static ssize_t mmc_type_show(struct device *dev,
+ static ssize_t type_show(struct device *dev,
        struct device_attribute *attr, char *buf)
  {
        struct mmc_card *card = mmc_dev_to_card(dev);
                return -EFAULT;
        }
  }
+ static DEVICE_ATTR_RO(type);
  
- static struct device_attribute mmc_dev_attrs[] = {
-       __ATTR(type, S_IRUGO, mmc_type_show, NULL),
-       __ATTR_NULL,
+ static struct attribute *mmc_dev_attrs[] = {
+       &dev_attr_type.attr,
+       NULL,
  };
+ ATTRIBUTE_GROUPS(mmc_dev);
  
  /*
   * This currently matches any MMC driver to any MMC card - drivers
@@@ -218,7 -220,7 +220,7 @@@ static const struct dev_pm_ops mmc_bus_
  
  static struct bus_type mmc_bus_type = {
        .name           = "mmc",
-       .dev_attrs      = mmc_dev_attrs,
+       .dev_groups     = mmc_dev_groups,
        .match          = mmc_bus_match,
        .uevent         = mmc_bus_uevent,
        .probe          = mmc_bus_probe,
@@@ -340,7 -342,7 +342,7 @@@ int mmc_add_card(struct mmc_card *card
                break;
        }
  
 -      if (mmc_sd_card_uhs(card) &&
 +      if (mmc_card_uhs(card) &&
                (card->sd_bus_speed < ARRAY_SIZE(uhs_speeds)))
                uhs_bus_speed_mode = uhs_speeds[card->sd_bus_speed];
  
index a592407d2de616d85cb442d6ead34e72f5fc6649,deecee08c2881d0ee6ad34a9d049368e5d05ceec..8ad79864022fd5f9c226c8c0b3f115b7eb21811a
@@@ -655,7 -655,7 +655,7 @@@ static const struct mmc_host_ops mvsd_o
        .enable_sdio_irq        = mvsd_enable_sdio_irq,
  };
  
- static void __init
+ static void
  mv_conf_mbus_windows(struct mvsd_host *host,
                     const struct mbus_dram_target_info *dram)
  {
        }
  }
  
- static int __init mvsd_probe(struct platform_device *pdev)
+ static int mvsd_probe(struct platform_device *pdev)
  {
        struct device_node *np = pdev->dev.of_node;
        struct mmc_host *mmc = NULL;
  
        spin_lock_init(&host->lock);
  
 -      host->base = devm_request_and_ioremap(&pdev->dev, r);
 -      if (!host->base) {
 -              ret = -ENOMEM;
 +      host->base = devm_ioremap_resource(&pdev->dev, r);
 +      if (IS_ERR(host->base)) {
 +              ret = PTR_ERR(host->base);
                goto out;
        }
  
@@@ -819,7 -819,7 +819,7 @@@ out
        return ret;
  }
  
- static int __exit mvsd_remove(struct platform_device *pdev)
+ static int mvsd_remove(struct platform_device *pdev)
  {
        struct mmc_host *mmc = platform_get_drvdata(pdev);
  
@@@ -872,7 -872,8 +872,8 @@@ static const struct of_device_id mvsdio
  MODULE_DEVICE_TABLE(of, mvsdio_dt_ids);
  
  static struct platform_driver mvsd_driver = {
-       .remove         = __exit_p(mvsd_remove),
+       .probe          = mvsd_probe,
+       .remove         = mvsd_remove,
        .suspend        = mvsd_suspend,
        .resume         = mvsd_resume,
        .driver         = {
        },
  };
  
- module_platform_driver_probe(mvsd_driver, mvsd_probe);
+ module_platform_driver(mvsd_driver);
  
  /* maximum card clock frequency (default 50MHz) */
  module_param(maxfreq, int, 0);
index ef9c9f547c01fffe391235e3a6d9dffe95944321,bd1ce7d137023fed1f42bc606166a111946466c1..2dbd9133c395c98c4d1bb124c83a532358946215
@@@ -1062,28 -1062,56 +1062,28 @@@ static void atmel_pmecc_core_init(struc
  }
  
  /*
 - * Get ECC requirement in ONFI parameters, returns -1 if ONFI
 - * parameters is not supported.
 - * return 0 if success to get the ECC requirement.
 - */
 -static int get_onfi_ecc_param(struct nand_chip *chip,
 -              int *ecc_bits, int *sector_size)
 -{
 -      *ecc_bits = *sector_size = 0;
 -
 -      if (chip->onfi_params.ecc_bits == 0xff)
 -              /* TODO: the sector_size and ecc_bits need to be find in
 -               * extended ecc parameter, currently we don't support it.
 -               */
 -              return -1;
 -
 -      *ecc_bits = chip->onfi_params.ecc_bits;
 -
 -      /* The default sector size (ecc codeword size) is 512 */
 -      *sector_size = 512;
 -
 -      return 0;
 -}
 -
 -/*
 - * Get ecc requirement from ONFI parameters ecc requirement.
 + * Get minimum ecc requirements from NAND.
   * If pmecc-cap, pmecc-sector-size in DTS are not specified, this function
 - * will set them according to ONFI ecc requirement. Otherwise, use the
 + * will set them according to minimum ecc requirement. Otherwise, use the
   * value in DTS file.
   * return 0 if success. otherwise return error code.
   */
  static int pmecc_choose_ecc(struct atmel_nand_host *host,
                int *cap, int *sector_size)
  {
 -      /* Get ECC requirement from ONFI parameters */
 -      *cap = *sector_size = 0;
 -      if (host->nand_chip.onfi_version) {
 -              if (!get_onfi_ecc_param(&host->nand_chip, cap, sector_size))
 -                      dev_info(host->dev, "ONFI params, minimum required ECC: %d bits in %d bytes\n",
 +      /* Get minimum ECC requirements */
 +      if (host->nand_chip.ecc_strength_ds) {
 +              *cap = host->nand_chip.ecc_strength_ds;
 +              *sector_size = host->nand_chip.ecc_step_ds;
 +              dev_info(host->dev, "minimum ECC: %d bits in %d bytes\n",
                                *cap, *sector_size);
 -              else
 -                      dev_info(host->dev, "NAND chip ECC reqirement is in Extended ONFI parameter, we don't support yet.\n");
        } else {
 -              dev_info(host->dev, "NAND chip is not ONFI compliant, assume ecc_bits is 2 in 512 bytes");
 -      }
 -      if (*cap == 0 && *sector_size == 0) {
                *cap = 2;
                *sector_size = 512;
 +              dev_info(host->dev, "can't detect min. ECC, assume 2 bits in 512 bytes\n");
        }
  
 -      /* If dts file doesn't specify then use the one in ONFI parameters */
 +      /* If device tree doesn't specify, use NAND's minimum ECC parameters */
        if (host->pmecc_corr_cap == 0) {
                /* use the most fitable ecc bits (the near bigger one ) */
                if (*cap <= 2)
        return 0;
  }
  
- static int __init atmel_pmecc_nand_init_params(struct platform_device *pdev,
+ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
                                         struct atmel_nand_host *host)
  {
        struct mtd_info *mtd = &host->mtd;
@@@ -1421,6 -1449,7 +1421,6 @@@ static void atmel_nand_hwctl(struct mtd
                ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
  }
  
 -#if defined(CONFIG_OF)
  static int atmel_of_init_port(struct atmel_nand_host *host,
                              struct device_node *np)
  {
        u32 offset[2];
        int ecc_mode;
        struct atmel_nand_data *board = &host->board;
 -      enum of_gpio_flags flags;
 +      enum of_gpio_flags flags = 0;
  
        if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) {
                if (val >= 32) {
  
        return 0;
  }
 -#else
 -static int atmel_of_init_port(struct atmel_nand_host *host,
 -                            struct device_node *np)
 -{
 -      return -EINVAL;
 -}
 -#endif
  
- static int __init atmel_hw_nand_init_params(struct platform_device *pdev,
+ static int atmel_hw_nand_init_params(struct platform_device *pdev,
                                         struct atmel_nand_host *host)
  {
        struct mtd_info *mtd = &host->mtd;
@@@ -1951,7 -1987,7 +1951,7 @@@ static struct platform_driver atmel_nan
  /*
   * Probe for the NAND device.
   */
- static int __init atmel_nand_probe(struct platform_device *pdev)
+ static int atmel_nand_probe(struct platform_device *pdev)
  {
        struct atmel_nand_host *host;
        struct mtd_info *mtd;
        mtd = &host->mtd;
        nand_chip = &host->nand_chip;
        host->dev = &pdev->dev;
 -      if (pdev->dev.of_node) {
 +      if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
 +              /* Only when CONFIG_OF is enabled of_node can be parsed */
                res = atmel_of_init_port(host, pdev->dev.of_node);
                if (res)
                        goto err_nand_ioremap;
@@@ -2149,7 -2184,7 +2149,7 @@@ err_nand_ioremap
  /*
   * Remove a NAND device.
   */
- static int __exit atmel_nand_remove(struct platform_device *pdev)
+ static int atmel_nand_remove(struct platform_device *pdev)
  {
        struct atmel_nand_host *host = platform_get_drvdata(pdev);
        struct mtd_info *mtd = &host->mtd;
        return 0;
  }
  
 -#if defined(CONFIG_OF)
  static const struct of_device_id atmel_nand_dt_ids[] = {
        { .compatible = "atmel,at91rm9200-nand" },
        { /* sentinel */ }
  };
  
  MODULE_DEVICE_TABLE(of, atmel_nand_dt_ids);
 -#endif
  
  static int atmel_nand_nfc_probe(struct platform_device *pdev)
  {
        return 0;
  }
  
 -#if defined(CONFIG_OF)
 -static struct of_device_id atmel_nand_nfc_match[] = {
 +static const struct of_device_id atmel_nand_nfc_match[] = {
        { .compatible = "atmel,sama5d3-nfc" },
        { /* sentinel */ }
  };
 -#endif
 +MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match);
  
  static struct platform_driver atmel_nand_nfc_driver = {
        .driver = {
  };
  
  static struct platform_driver atmel_nand_driver = {
-       .remove         = __exit_p(atmel_nand_remove),
+       .probe          = atmel_nand_probe,
+       .remove         = atmel_nand_remove,
        .driver         = {
                .name   = "atmel_nand",
                .owner  = THIS_MODULE,
        },
  };
  
- module_platform_driver_probe(atmel_nand_driver, atmel_nand_probe);
+ module_platform_driver(atmel_nand_driver);
  
  MODULE_LICENSE("GPL");
  MODULE_AUTHOR("Rick Bronson");
index 47749c970a01a67c189188767c41e94e2ff1fbd1,ec9b6460a38dd0549b5b69f281b36f6cce0a3e7d..b9d8f1175ff500bd5cc290e676c5f1322fd7c72b
@@@ -149,14 -149,6 +149,6 @@@ err_no_cmd
        return -EPERM;
  }
  
- static const void *bonding_namespace(struct class *cls,
-                                    const struct class_attribute *attr)
- {
-       const struct bond_net *bn =
-               container_of(attr, struct bond_net, class_attr_bonding_masters);
-       return bn->net;
- }
  /* class attribute for bond_masters file.  This ends up in /sys/class/net */
  static const struct class_attribute class_attr_bonding_masters = {
        .attr = {
        },
        .show = bonding_show_bonds,
        .store = bonding_store_bonds,
-       .namespace = bonding_namespace,
  };
  
 -int bond_create_slave_symlinks(struct net_device *master,
 -                             struct net_device *slave)
 -{
 -      char linkname[IFNAMSIZ+7];
 -      int ret = 0;
 -
 -      /* first, create a link from the slave back to the master */
 -      ret = sysfs_create_link(&(slave->dev.kobj), &(master->dev.kobj),
 -                              "master");
 -      if (ret)
 -              return ret;
 -      /* next, create a link from the master to the slave */
 -      sprintf(linkname, "slave_%s", slave->name);
 -      ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj),
 -                              linkname);
 -
 -      /* free the master link created earlier in case of error */
 -      if (ret)
 -              sysfs_remove_link(&(slave->dev.kobj), "master");
 -
 -      return ret;
 -
 -}
 -
 -void bond_destroy_slave_symlinks(struct net_device *master,
 -                               struct net_device *slave)
 -{
 -      char linkname[IFNAMSIZ+7];
 -
 -      sysfs_remove_link(&(slave->dev.kobj), "master");
 -      sprintf(linkname, "slave_%s", slave->name);
 -      sysfs_remove_link(&(master->dev.kobj), linkname);
 -}
 -
 -
  /*
   * Show the slaves in the current bond.
   */
@@@ -175,14 -201,11 +166,14 @@@ static ssize_t bonding_show_slaves(stru
                                   struct device_attribute *attr, char *buf)
  {
        struct bonding *bond = to_bond(d);
 +      struct list_head *iter;
        struct slave *slave;
        int res = 0;
  
 -      read_lock(&bond->lock);
 -      bond_for_each_slave(bond, slave) {
 +      if (!rtnl_trylock())
 +              return restart_syscall();
 +
 +      bond_for_each_slave(bond, slave, iter) {
                if (res > (PAGE_SIZE - IFNAMSIZ)) {
                        /* not enough space for another interface name */
                        if ((PAGE_SIZE - res) > 10)
                }
                res += sprintf(buf + res, "%s ", slave->dev->name);
        }
 -      read_unlock(&bond->lock);
 +
 +      rtnl_unlock();
 +
        if (res)
                buf[res-1] = '\n'; /* eat the leftover space */
  
@@@ -283,26 -304,50 +274,26 @@@ static ssize_t bonding_store_mode(struc
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
  {
 -      int new_value, ret = count;
 +      int new_value, ret;
        struct bonding *bond = to_bond(d);
  
 -      if (!rtnl_trylock())
 -              return restart_syscall();
 -
 -      if (bond->dev->flags & IFF_UP) {
 -              pr_err("unable to update mode of %s because interface is up.\n",
 -                     bond->dev->name);
 -              ret = -EPERM;
 -              goto out;
 -      }
 -
 -      if (!list_empty(&bond->slave_list)) {
 -              pr_err("unable to update mode of %s because it has slaves.\n",
 -                      bond->dev->name);
 -              ret = -EPERM;
 -              goto out;
 -      }
 -
        new_value = bond_parse_parm(buf, bond_mode_tbl);
        if (new_value < 0)  {
                pr_err("%s: Ignoring invalid mode value %.*s.\n",
                       bond->dev->name, (int)strlen(buf) - 1, buf);
 -              ret = -EINVAL;
 -              goto out;
 +              return -EINVAL;
        }
 -      if ((new_value == BOND_MODE_ALB ||
 -           new_value == BOND_MODE_TLB) &&
 -          bond->params.arp_interval) {
 -              pr_err("%s: %s mode is incompatible with arp monitoring.\n",
 -                     bond->dev->name, bond_mode_tbl[new_value].modename);
 -              ret = -EINVAL;
 -              goto out;
 +      if (!rtnl_trylock())
 +              return restart_syscall();
 +
 +      ret = bond_option_mode_set(bond, new_value);
 +      if (!ret) {
 +              pr_info("%s: setting mode to %s (%d).\n",
 +                      bond->dev->name, bond_mode_tbl[new_value].modename,
 +                      new_value);
 +              ret = count;
        }
  
 -      /* don't cache arp_validate between modes */
 -      bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
 -      bond->params.mode = new_value;
 -      bond_set_mode_ops(bond, bond->params.mode);
 -      pr_info("%s: setting mode to %s (%d).\n",
 -              bond->dev->name, bond_mode_tbl[new_value].modename,
 -              new_value);
 -out:
        rtnl_unlock();
        return ret;
  }
@@@ -338,6 -383,7 +329,6 @@@ static ssize_t bonding_store_xmit_hash(
                ret = -EINVAL;
        } else {
                bond->params.xmit_policy = new_value;
 -              bond_set_mode_ops(bond, bond->params.mode);
                pr_info("%s: setting xmit hash policy to %s (%d).\n",
                        bond->dev->name,
                        xmit_hashtype_tbl[new_value].modename, new_value);
@@@ -467,7 -513,7 +458,7 @@@ static ssize_t bonding_store_fail_over_
        if (!rtnl_trylock())
                return restart_syscall();
  
 -      if (!list_empty(&bond->slave_list)) {
 +      if (bond_has_slaves(bond)) {
                pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n",
                       bond->dev->name);
                ret = -EPERM;
@@@ -601,15 -647,11 +592,15 @@@ static ssize_t bonding_store_arp_target
                                         const char *buf, size_t count)
  {
        struct bonding *bond = to_bond(d);
 +      struct list_head *iter;
        struct slave *slave;
        __be32 newtarget, *targets;
        unsigned long *targets_rx;
        int ind, i, j, ret = -EINVAL;
  
 +      if (!rtnl_trylock())
 +              return restart_syscall();
 +
        targets = bond->params.arp_targets;
        newtarget = in_aton(buf + 1);
        /* look for adds */
                         &newtarget);
                /* not to race with bond_arp_rcv */
                write_lock_bh(&bond->lock);
 -              bond_for_each_slave(bond, slave)
 +              bond_for_each_slave(bond, slave, iter)
                        slave->target_last_arp_rx[ind] = jiffies;
                targets[ind] = newtarget;
                write_unlock_bh(&bond->lock);
                        &newtarget);
  
                write_lock_bh(&bond->lock);
 -              bond_for_each_slave(bond, slave) {
 +              bond_for_each_slave(bond, slave, iter) {
                        targets_rx = slave->target_last_arp_rx;
                        j = ind;
                        for (; (j < BOND_MAX_ARP_TARGETS-1) && targets[j+1]; j++)
  
        ret = count;
  out:
 +      rtnl_unlock();
        return ret;
  }
  static DEVICE_ATTR(arp_ip_target, S_IRUGO | S_IWUSR , bonding_show_arp_targets, bonding_store_arp_targets);
@@@ -1061,7 -1102,6 +1052,7 @@@ static ssize_t bonding_store_primary(st
                                     const char *buf, size_t count)
  {
        struct bonding *bond = to_bond(d);
 +      struct list_head *iter;
        char ifname[IFNAMSIZ];
        struct slave *slave;
  
                goto out;
        }
  
 -      bond_for_each_slave(bond, slave) {
 +      bond_for_each_slave(bond, slave, iter) {
                if (strncmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
                        pr_info("%s: Setting %s as primary slave.\n",
                                bond->dev->name, slave->dev->name);
@@@ -1219,13 -1259,13 +1210,13 @@@ static ssize_t bonding_show_active_slav
                                         char *buf)
  {
        struct bonding *bond = to_bond(d);
 -      struct slave *curr;
 +      struct net_device *slave_dev;
        int count = 0;
  
        rcu_read_lock();
 -      curr = rcu_dereference(bond->curr_active_slave);
 -      if (USES_PRIMARY(bond->params.mode) && curr)
 -              count = sprintf(buf, "%s\n", curr->dev->name);
 +      slave_dev = bond_option_active_slave_get_rcu(bond);
 +      if (slave_dev)
 +              count = sprintf(buf, "%s\n", slave_dev->name);
        rcu_read_unlock();
  
        return count;
@@@ -1235,33 -1275,80 +1226,33 @@@ static ssize_t bonding_store_active_sla
                                          struct device_attribute *attr,
                                          const char *buf, size_t count)
  {
 -      struct slave *slave, *old_active, *new_active;
 +      int ret;
        struct bonding *bond = to_bond(d);
        char ifname[IFNAMSIZ];
 +      struct net_device *dev;
  
        if (!rtnl_trylock())
                return restart_syscall();
  
 -      old_active = new_active = NULL;
 -      block_netpoll_tx();
 -      read_lock(&bond->lock);
 -      write_lock_bh(&bond->curr_slave_lock);
 -
 -      if (!USES_PRIMARY(bond->params.mode)) {
 -              pr_info("%s: Unable to change active slave; %s is in mode %d\n",
 -                      bond->dev->name, bond->dev->name, bond->params.mode);
 -              goto out;
 -      }
 -
        sscanf(buf, "%15s", ifname); /* IFNAMSIZ */
 -
 -      /* check to see if we are clearing active */
        if (!strlen(ifname) || buf[0] == '\n') {
 -              pr_info("%s: Clearing current active slave.\n",
 -                      bond->dev->name);
 -              rcu_assign_pointer(bond->curr_active_slave, NULL);
 -              bond_select_active_slave(bond);
 -              goto out;
 -      }
 -
 -      bond_for_each_slave(bond, slave) {
 -              if (strncmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
 -                      old_active = bond->curr_active_slave;
 -                      new_active = slave;
 -                      if (new_active == old_active) {
 -                              /* do nothing */
 -                              pr_info("%s: %s is already the current"
 -                                      " active slave.\n",
 -                                      bond->dev->name,
 -                                      slave->dev->name);
 -                              goto out;
 -                      } else {
 -                              if ((new_active) &&
 -                                  (old_active) &&
 -                                  (new_active->link == BOND_LINK_UP) &&
 -                                  IS_UP(new_active->dev)) {
 -                                      pr_info("%s: Setting %s as active"
 -                                              " slave.\n",
 -                                              bond->dev->name,
 -                                              slave->dev->name);
 -                                      bond_change_active_slave(bond,
 -                                                               new_active);
 -                              } else {
 -                                      pr_info("%s: Could not set %s as"
 -                                              " active slave; either %s is"
 -                                              " down or the link is down.\n",
 -                                              bond->dev->name,
 -                                              slave->dev->name,
 -                                              slave->dev->name);
 -                              }
 -                              goto out;
 -                      }
 +              dev = NULL;
 +      } else {
 +              dev = __dev_get_by_name(dev_net(bond->dev), ifname);
 +              if (!dev) {
 +                      ret = -ENODEV;
 +                      goto out;
                }
        }
  
 -      pr_info("%s: Unable to set %.*s as active slave.\n",
 -              bond->dev->name, (int)strlen(buf) - 1, buf);
 - out:
 -      write_unlock_bh(&bond->curr_slave_lock);
 -      read_unlock(&bond->lock);
 -      unblock_netpoll_tx();
 +      ret = bond_option_active_slave_set(bond, dev);
 +      if (!ret)
 +              ret = count;
  
 + out:
        rtnl_unlock();
  
 -      return count;
 +      return ret;
  
  }
  static DEVICE_ATTR(active_slave, S_IRUGO | S_IWUSR,
@@@ -1397,14 -1484,14 +1388,14 @@@ static ssize_t bonding_show_queue_id(st
                                     char *buf)
  {
        struct bonding *bond = to_bond(d);
 +      struct list_head *iter;
        struct slave *slave;
        int res = 0;
  
        if (!rtnl_trylock())
                return restart_syscall();
  
 -      read_lock(&bond->lock);
 -      bond_for_each_slave(bond, slave) {
 +      bond_for_each_slave(bond, slave, iter) {
                if (res > (PAGE_SIZE - IFNAMSIZ - 6)) {
                        /* not enough space for another interface_name:queue_id pair */
                        if ((PAGE_SIZE - res) > 10)
                res += sprintf(buf + res, "%s:%d ",
                               slave->dev->name, slave->queue_id);
        }
 -      read_unlock(&bond->lock);
        if (res)
                buf[res-1] = '\n'; /* eat the leftover space */
 +
        rtnl_unlock();
  
        return res;
@@@ -1433,7 -1520,6 +1424,7 @@@ static ssize_t bonding_store_queue_id(s
  {
        struct slave *slave, *update_slave;
        struct bonding *bond = to_bond(d);
 +      struct list_head *iter;
        u16 qid;
        int ret = count;
        char *delim;
        if (!sdev)
                goto err_no_cmd;
  
 -      read_lock(&bond->lock);
 -
        /* Search for thes slave and check for duplicate qids */
        update_slave = NULL;
 -      bond_for_each_slave(bond, slave) {
 +      bond_for_each_slave(bond, slave, iter) {
                if (sdev == slave->dev)
                        /*
                         * We don't need to check the matching
                         */
                        update_slave = slave;
                else if (qid && qid == slave->queue_id) {
 -                      goto err_no_cmd_unlock;
 +                      goto err_no_cmd;
                }
        }
  
        if (!update_slave)
 -              goto err_no_cmd_unlock;
 +              goto err_no_cmd;
  
        /* Actually set the qids for the slave */
        update_slave->queue_id = qid;
  
 -      read_unlock(&bond->lock);
  out:
        rtnl_unlock();
        return ret;
  
 -err_no_cmd_unlock:
 -      read_unlock(&bond->lock);
  err_no_cmd:
        pr_info("invalid input for queue_id set for %s.\n",
                bond->dev->name);
@@@ -1519,12 -1610,8 +1510,12 @@@ static ssize_t bonding_store_slaves_act
  {
        struct bonding *bond = to_bond(d);
        int new_value, ret = count;
 +      struct list_head *iter;
        struct slave *slave;
  
 +      if (!rtnl_trylock())
 +              return restart_syscall();
 +
        if (sscanf(buf, "%d", &new_value) != 1) {
                pr_err("%s: no all_slaves_active value specified.\n",
                       bond->dev->name);
                goto out;
        }
  
 -      read_lock(&bond->lock);
 -      bond_for_each_slave(bond, slave) {
 +      bond_for_each_slave(bond, slave, iter) {
                if (!bond_is_active_slave(slave)) {
                        if (new_value)
                                slave->inactive = 0;
                                slave->inactive = 1;
                }
        }
 -      read_unlock(&bond->lock);
  out:
 +      rtnl_unlock();
        return ret;
  }
  static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR,
@@@ -1690,7 -1778,8 +1681,8 @@@ int bond_create_sysfs(struct bond_net *
        bn->class_attr_bonding_masters = class_attr_bonding_masters;
        sysfs_attr_init(&bn->class_attr_bonding_masters.attr);
  
-       ret = netdev_class_create_file(&bn->class_attr_bonding_masters);
+       ret = netdev_class_create_file_ns(&bn->class_attr_bonding_masters,
+                                         bn->net);
        /*
         * Permit multiple loads of the module by ignoring failures to
         * create the bonding_masters sysfs file.  Bonding devices
   */
  void bond_destroy_sysfs(struct bond_net *bn)
  {
-       netdev_class_remove_file(&bn->class_attr_bonding_masters);
+       netdev_class_remove_file_ns(&bn->class_attr_bonding_masters, bn->net);
  }
  
  /*
index c893f2295f496ffb7785b24ad27f4123e41251cb,42421ed49a4739f738f6edd6ed97aeee3ffe5df5..809afccf7a60b11e3807ec485b4ea9d7b633d73a
@@@ -60,8 -60,8 +60,8 @@@ struct wireless_dev
  #define SET_ETHTOOL_OPS(netdev,ops) \
        ( (netdev)->ethtool_ops = (ops) )
  
 -extern void netdev_set_default_ethtool_ops(struct net_device *dev,
 -                                         const struct ethtool_ops *ops);
 +void netdev_set_default_ethtool_ops(struct net_device *dev,
 +                                  const struct ethtool_ops *ops);
  
  /* hardware address assignment types */
  #define NET_ADDR_PERM         0       /* address is permanent (default) */
@@@ -298,7 -298,7 +298,7 @@@ struct netdev_boot_setup 
  };
  #define NETDEV_BOOT_SETUP_MAX 8
  
 -extern int __init netdev_boot_setup(char *str);
 +int __init netdev_boot_setup(char *str);
  
  /*
   * Structure for NAPI scheduling similar to tasklet but with weighting
@@@ -394,7 -394,7 +394,7 @@@ enum rx_handler_result 
  typedef enum rx_handler_result rx_handler_result_t;
  typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
  
 -extern void __napi_schedule(struct napi_struct *n);
 +void __napi_schedule(struct napi_struct *n);
  
  static inline bool napi_disable_pending(struct napi_struct *n)
  {
@@@ -445,8 -445,8 +445,8 @@@ static inline bool napi_reschedule(stru
   *
   * Mark NAPI processing as complete.
   */
 -extern void __napi_complete(struct napi_struct *n);
 -extern void napi_complete(struct napi_struct *n);
 +void __napi_complete(struct napi_struct *n);
 +void napi_complete(struct napi_struct *n);
  
  /**
   *    napi_by_id - lookup a NAPI by napi_id
   * lookup @napi_id in napi_hash table
   * must be called under rcu_read_lock()
   */
 -extern struct napi_struct *napi_by_id(unsigned int napi_id);
 +struct napi_struct *napi_by_id(unsigned int napi_id);
  
  /**
   *    napi_hash_add - add a NAPI to global hashtable
   *
   * generate a new napi_id and store a @napi under it in napi_hash
   */
 -extern void napi_hash_add(struct napi_struct *napi);
 +void napi_hash_add(struct napi_struct *napi);
  
  /**
   *    napi_hash_del - remove a NAPI from global table
   * Warning: caller must observe rcu grace period
   * before freeing memory containing @napi
   */
 -extern void napi_hash_del(struct napi_struct *napi);
 +void napi_hash_del(struct napi_struct *napi);
  
  /**
   *    napi_disable - prevent NAPI from scheduling
@@@ -664,8 -664,8 +664,8 @@@ static inline void rps_reset_sock_flow(
  extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
  
  #ifdef CONFIG_RFS_ACCEL
 -extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
 -                              u32 flow_id, u16 filter_id);
 +bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
 +                       u16 filter_id);
  #endif
  
  /* This structure contains an instance of an RX queue. */
@@@ -1143,19 -1143,8 +1143,19 @@@ struct net_device 
        struct list_head        dev_list;
        struct list_head        napi_list;
        struct list_head        unreg_list;
 -      struct list_head        upper_dev_list; /* List of upper devices */
 -      struct list_head        lower_dev_list;
 +      struct list_head        close_list;
 +
 +      /* directly linked devices, like slaves for bonding */
 +      struct {
 +              struct list_head upper;
 +              struct list_head lower;
 +      } adj_list;
 +
 +      /* all linked devices, *including* neighbours */
 +      struct {
 +              struct list_head upper;
 +              struct list_head lower;
 +      } all_adj_list;
  
  
        /* currently active device features */
@@@ -1498,9 -1487,9 +1498,9 @@@ static inline void netdev_for_each_tx_q
                f(dev, &dev->_tx[i], arg);
  }
  
 -extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
 -                                         struct sk_buff *skb);
 -extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
 +struct netdev_queue *netdev_pick_tx(struct net_device *dev,
 +                                  struct sk_buff *skb);
 +u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
  
  /*
   * Net namespace inlines
@@@ -1557,7 -1546,7 +1557,7 @@@ static inline void *netdev_priv(const s
  #define SET_NETDEV_DEV(net, pdev)     ((net)->dev.parent = (pdev))
  
  /* Set the sysfs device type for the network logical device to allow
 - * fin grained indentification of different network device types. For
 + * fine-grained identification of different network device types. For
   * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc.
   */
  #define SET_NETDEV_DEVTYPE(net, devtype)      ((net)->dev.type = (devtype))
@@@ -1684,8 -1673,8 +1684,8 @@@ struct packet_offload 
  #define NETDEV_CHANGEUPPER    0x0015
  #define NETDEV_RESEND_IGMP    0x0016
  
 -extern int register_netdevice_notifier(struct notifier_block *nb);
 -extern int unregister_netdevice_notifier(struct notifier_block *nb);
 +int register_netdevice_notifier(struct notifier_block *nb);
 +int unregister_netdevice_notifier(struct notifier_block *nb);
  
  struct netdev_notifier_info {
        struct net_device *dev;
@@@ -1708,9 -1697,9 +1708,9 @@@ netdev_notifier_info_to_dev(const struc
        return info->dev;
  }
  
 -extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
 -                                       struct netdev_notifier_info *info);
 -extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
 +int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
 +                                struct netdev_notifier_info *info);
 +int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
  
  
  extern rwlock_t                               dev_base_lock;          /* Device list lock */
@@@ -1765,52 -1754,54 +1765,52 @@@ static inline struct net_device *first_
        return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
  }
  
 -extern int                    netdev_boot_setup_check(struct net_device *dev);
 -extern unsigned long          netdev_boot_base(const char *prefix, int unit);
 -extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
 -                                            const char *hwaddr);
 -extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
 -extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
 -extern void           dev_add_pack(struct packet_type *pt);
 -extern void           dev_remove_pack(struct packet_type *pt);
 -extern void           __dev_remove_pack(struct packet_type *pt);
 -extern void           dev_add_offload(struct packet_offload *po);
 -extern void           dev_remove_offload(struct packet_offload *po);
 -extern void           __dev_remove_offload(struct packet_offload *po);
 -
 -extern struct net_device      *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
 -                                                    unsigned short mask);
 -extern struct net_device      *dev_get_by_name(struct net *net, const char *name);
 -extern struct net_device      *dev_get_by_name_rcu(struct net *net, const char *name);
 -extern struct net_device      *__dev_get_by_name(struct net *net, const char *name);
 -extern int            dev_alloc_name(struct net_device *dev, const char *name);
 -extern int            dev_open(struct net_device *dev);
 -extern int            dev_close(struct net_device *dev);
 -extern void           dev_disable_lro(struct net_device *dev);
 -extern int            dev_loopback_xmit(struct sk_buff *newskb);
 -extern int            dev_queue_xmit(struct sk_buff *skb);
 -extern int            register_netdevice(struct net_device *dev);
 -extern void           unregister_netdevice_queue(struct net_device *dev,
 -                                                 struct list_head *head);
 -extern void           unregister_netdevice_many(struct list_head *head);
 +int netdev_boot_setup_check(struct net_device *dev);
 +unsigned long netdev_boot_base(const char *prefix, int unit);
 +struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
 +                                     const char *hwaddr);
 +struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
 +struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
 +void dev_add_pack(struct packet_type *pt);
 +void dev_remove_pack(struct packet_type *pt);
 +void __dev_remove_pack(struct packet_type *pt);
 +void dev_add_offload(struct packet_offload *po);
 +void dev_remove_offload(struct packet_offload *po);
 +void __dev_remove_offload(struct packet_offload *po);
 +
 +struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
 +                                      unsigned short mask);
 +struct net_device *dev_get_by_name(struct net *net, const char *name);
 +struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
 +struct net_device *__dev_get_by_name(struct net *net, const char *name);
 +int dev_alloc_name(struct net_device *dev, const char *name);
 +int dev_open(struct net_device *dev);
 +int dev_close(struct net_device *dev);
 +void dev_disable_lro(struct net_device *dev);
 +int dev_loopback_xmit(struct sk_buff *newskb);
 +int dev_queue_xmit(struct sk_buff *skb);
 +int register_netdevice(struct net_device *dev);
 +void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
 +void unregister_netdevice_many(struct list_head *head);
  static inline void unregister_netdevice(struct net_device *dev)
  {
        unregister_netdevice_queue(dev, NULL);
  }
  
 -extern int            netdev_refcnt_read(const struct net_device *dev);
 -extern void           free_netdev(struct net_device *dev);
 -extern void           synchronize_net(void);
 -extern int            init_dummy_netdev(struct net_device *dev);
 +int netdev_refcnt_read(const struct net_device *dev);
 +void free_netdev(struct net_device *dev);
 +void synchronize_net(void);
 +int init_dummy_netdev(struct net_device *dev);
  
 -extern struct net_device      *dev_get_by_index(struct net *net, int ifindex);
 -extern struct net_device      *__dev_get_by_index(struct net *net, int ifindex);
 -extern struct net_device      *dev_get_by_index_rcu(struct net *net, int ifindex);
 -extern int            netdev_get_name(struct net *net, char *name, int ifindex);
 -extern int            dev_restart(struct net_device *dev);
 +struct net_device *dev_get_by_index(struct net *net, int ifindex);
 +struct net_device *__dev_get_by_index(struct net *net, int ifindex);
 +struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
 +int netdev_get_name(struct net *net, char *name, int ifindex);
 +int dev_restart(struct net_device *dev);
  #ifdef CONFIG_NETPOLL_TRAP
 -extern int            netpoll_trap(void);
 +int netpoll_trap(void);
  #endif
 -extern int           skb_gro_receive(struct sk_buff **head,
 -                                     struct sk_buff *skb);
 +int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
  
  static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
  {
@@@ -1882,7 -1873,7 +1882,7 @@@ static inline int dev_parse_header(cons
  }
  
  typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
 -extern int            register_gifconf(unsigned int family, gifconf_func_t * gifconf);
 +int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
  static inline int unregister_gifconf(unsigned int family)
  {
        return register_gifconf(family, NULL);
@@@ -1953,7 -1944,7 +1953,7 @@@ static inline void input_queue_tail_inc
  
  DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
  
 -extern void __netif_schedule(struct Qdisc *q);
 +void __netif_schedule(struct Qdisc *q);
  
  static inline void netif_schedule_queue(struct netdev_queue *txq)
  {
@@@ -2273,11 -2264,11 +2273,11 @@@ static inline void netif_wake_subqueue(
  }
  
  #ifdef CONFIG_XPS
 -extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask,
 -                             u16 index);
 +int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
 +                      u16 index);
  #else
  static inline int netif_set_xps_queue(struct net_device *dev,
 -                                    struct cpumask *mask,
 +                                    const struct cpumask *mask,
                                      u16 index)
  {
        return 0;
@@@ -2305,10 -2296,12 +2305,10 @@@ static inline bool netif_is_multiqueue(
        return dev->num_tx_queues > 1;
  }
  
 -extern int netif_set_real_num_tx_queues(struct net_device *dev,
 -                                      unsigned int txq);
 +int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
  
  #ifdef CONFIG_RPS
 -extern int netif_set_real_num_rx_queues(struct net_device *dev,
 -                                      unsigned int rxq);
 +int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
  #else
  static inline int netif_set_real_num_rx_queues(struct net_device *dev,
                                                unsigned int rxq)
@@@ -2335,27 -2328,28 +2335,27 @@@ static inline int netif_copy_real_num_q
  }
  
  #define DEFAULT_MAX_NUM_RSS_QUEUES    (8)
 -extern int netif_get_num_default_rss_queues(void);
 +int netif_get_num_default_rss_queues(void);
  
  /* Use this variant when it is known for sure that it
   * is executing from hardware interrupt context or with hardware interrupts
   * disabled.
   */
 -extern void dev_kfree_skb_irq(struct sk_buff *skb);
 +void dev_kfree_skb_irq(struct sk_buff *skb);
  
  /* Use this variant in places where it could be invoked
   * from either hardware interrupt or other context, with hardware interrupts
   * either disabled or enabled.
   */
 -extern void dev_kfree_skb_any(struct sk_buff *skb);
 +void dev_kfree_skb_any(struct sk_buff *skb);
  
 -extern int            netif_rx(struct sk_buff *skb);
 -extern int            netif_rx_ni(struct sk_buff *skb);
 -extern int            netif_receive_skb(struct sk_buff *skb);
 -extern gro_result_t   napi_gro_receive(struct napi_struct *napi,
 -                                       struct sk_buff *skb);
 -extern void           napi_gro_flush(struct napi_struct *napi, bool flush_old);
 -extern struct sk_buff *       napi_get_frags(struct napi_struct *napi);
 -extern gro_result_t   napi_gro_frags(struct napi_struct *napi);
 +int netif_rx(struct sk_buff *skb);
 +int netif_rx_ni(struct sk_buff *skb);
 +int netif_receive_skb(struct sk_buff *skb);
 +gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
 +void napi_gro_flush(struct napi_struct *napi, bool flush_old);
 +struct sk_buff *napi_get_frags(struct napi_struct *napi);
 +gro_result_t napi_gro_frags(struct napi_struct *napi);
  
  static inline void napi_free_frags(struct napi_struct *napi)
  {
        napi->skb = NULL;
  }
  
 -extern int netdev_rx_handler_register(struct net_device *dev,
 -                                    rx_handler_func_t *rx_handler,
 -                                    void *rx_handler_data);
 -extern void netdev_rx_handler_unregister(struct net_device *dev);
 -
 -extern bool           dev_valid_name(const char *name);
 -extern int            dev_ioctl(struct net *net, unsigned int cmd, void __user *);
 -extern int            dev_ethtool(struct net *net, struct ifreq *);
 -extern unsigned int   dev_get_flags(const struct net_device *);
 -extern int            __dev_change_flags(struct net_device *, unsigned int flags);
 -extern int            dev_change_flags(struct net_device *, unsigned int);
 -extern void           __dev_notify_flags(struct net_device *, unsigned int old_flags);
 -extern int            dev_change_name(struct net_device *, const char *);
 -extern int            dev_set_alias(struct net_device *, const char *, size_t);
 -extern int            dev_change_net_namespace(struct net_device *,
 -                                               struct net *, const char *);
 -extern int            dev_set_mtu(struct net_device *, int);
 -extern void           dev_set_group(struct net_device *, int);
 -extern int            dev_set_mac_address(struct net_device *,
 -                                          struct sockaddr *);
 -extern int            dev_change_carrier(struct net_device *,
 -                                         bool new_carrier);
 -extern int            dev_get_phys_port_id(struct net_device *dev,
 -                                           struct netdev_phys_port_id *ppid);
 -extern int            dev_hard_start_xmit(struct sk_buff *skb,
 -                                          struct net_device *dev,
 -                                          struct netdev_queue *txq);
 -extern int            dev_forward_skb(struct net_device *dev,
 -                                      struct sk_buff *skb);
 +int netdev_rx_handler_register(struct net_device *dev,
 +                             rx_handler_func_t *rx_handler,
 +                             void *rx_handler_data);
 +void netdev_rx_handler_unregister(struct net_device *dev);
 +
 +bool dev_valid_name(const char *name);
 +int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
 +int dev_ethtool(struct net *net, struct ifreq *);
 +unsigned int dev_get_flags(const struct net_device *);
 +int __dev_change_flags(struct net_device *, unsigned int flags);
 +int dev_change_flags(struct net_device *, unsigned int);
 +void __dev_notify_flags(struct net_device *, unsigned int old_flags,
 +                      unsigned int gchanges);
 +int dev_change_name(struct net_device *, const char *);
 +int dev_set_alias(struct net_device *, const char *, size_t);
 +int dev_change_net_namespace(struct net_device *, struct net *, const char *);
 +int dev_set_mtu(struct net_device *, int);
 +void dev_set_group(struct net_device *, int);
 +int dev_set_mac_address(struct net_device *, struct sockaddr *);
 +int dev_change_carrier(struct net_device *, bool new_carrier);
 +int dev_get_phys_port_id(struct net_device *dev,
 +                       struct netdev_phys_port_id *ppid);
 +int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 +                      struct netdev_queue *txq);
 +int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
  
  extern int            netdev_budget;
  
  /* Called by rtnetlink.c:rtnl_unlock() */
 -extern void netdev_run_todo(void);
 +void netdev_run_todo(void);
  
  /**
   *    dev_put - release reference to device
@@@ -2425,9 -2423,9 +2425,9 @@@ static inline void dev_hold(struct net_
   * kind of lower layer not just hardware media.
   */
  
 -extern void linkwatch_init_dev(struct net_device *dev);
 -extern void linkwatch_fire_event(struct net_device *dev);
 -extern void linkwatch_forget_dev(struct net_device *dev);
 +void linkwatch_init_dev(struct net_device *dev);
 +void linkwatch_fire_event(struct net_device *dev);
 +void linkwatch_forget_dev(struct net_device *dev);
  
  /**
   *    netif_carrier_ok - test if carrier present
@@@ -2440,13 -2438,13 +2440,13 @@@ static inline bool netif_carrier_ok(con
        return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
  }
  
 -extern unsigned long dev_trans_start(struct net_device *dev);
 +unsigned long dev_trans_start(struct net_device *dev);
  
 -extern void __netdev_watchdog_up(struct net_device *dev);
 +void __netdev_watchdog_up(struct net_device *dev);
  
 -extern void netif_carrier_on(struct net_device *dev);
 +void netif_carrier_on(struct net_device *dev);
  
 -extern void netif_carrier_off(struct net_device *dev);
 +void netif_carrier_off(struct net_device *dev);
  
  /**
   *    netif_dormant_on - mark device as dormant.
@@@ -2514,9 -2512,9 +2514,9 @@@ static inline bool netif_device_present
        return test_bit(__LINK_STATE_PRESENT, &dev->state);
  }
  
 -extern void netif_device_detach(struct net_device *dev);
 +void netif_device_detach(struct net_device *dev);
  
 -extern void netif_device_attach(struct net_device *dev);
 +void netif_device_attach(struct net_device *dev);
  
  /*
   * Network interface message level settings
@@@ -2725,138 -2723,119 +2725,138 @@@ static inline void netif_addr_unlock_bh
  
  /* These functions live elsewhere (drivers/net/net_init.c, but related) */
  
 -extern void           ether_setup(struct net_device *dev);
 +void ether_setup(struct net_device *dev);
  
  /* Support for loadable net-drivers */
 -extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 -                                     void (*setup)(struct net_device *),
 -                                     unsigned int txqs, unsigned int rxqs);
 +struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 +                                  void (*setup)(struct net_device *),
 +                                  unsigned int txqs, unsigned int rxqs);
  #define alloc_netdev(sizeof_priv, name, setup) \
        alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
  
  #define alloc_netdev_mq(sizeof_priv, name, setup, count) \
        alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
  
 -extern int            register_netdev(struct net_device *dev);
 -extern void           unregister_netdev(struct net_device *dev);
 +int register_netdev(struct net_device *dev);
 +void unregister_netdev(struct net_device *dev);
  
  /* General hardware address lists handling functions */
 -extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
 -                                struct netdev_hw_addr_list *from_list,
 -                                int addr_len, unsigned char addr_type);
 -extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
 -                                 struct netdev_hw_addr_list *from_list,
 -                                 int addr_len, unsigned char addr_type);
 -extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
 -                        struct netdev_hw_addr_list *from_list,
 -                        int addr_len);
 -extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
 -                           struct netdev_hw_addr_list *from_list,
 -                           int addr_len);
 -extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
 -extern void __hw_addr_init(struct netdev_hw_addr_list *list);
 +int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
 +                         struct netdev_hw_addr_list *from_list,
 +                         int addr_len, unsigned char addr_type);
 +void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
 +                          struct netdev_hw_addr_list *from_list,
 +                          int addr_len, unsigned char addr_type);
 +int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
 +                 struct netdev_hw_addr_list *from_list, int addr_len);
 +void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
 +                    struct netdev_hw_addr_list *from_list, int addr_len);
 +void __hw_addr_flush(struct netdev_hw_addr_list *list);
 +void __hw_addr_init(struct netdev_hw_addr_list *list);
  
  /* Functions used for device addresses handling */
 -extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
 -                      unsigned char addr_type);
 -extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
 -                      unsigned char addr_type);
 -extern int dev_addr_add_multiple(struct net_device *to_dev,
 -                               struct net_device *from_dev,
 -                               unsigned char addr_type);
 -extern int dev_addr_del_multiple(struct net_device *to_dev,
 -                               struct net_device *from_dev,
 -                               unsigned char addr_type);
 -extern void dev_addr_flush(struct net_device *dev);
 -extern int dev_addr_init(struct net_device *dev);
 +int dev_addr_add(struct net_device *dev, const unsigned char *addr,
 +               unsigned char addr_type);
 +int dev_addr_del(struct net_device *dev, const unsigned char *addr,
 +               unsigned char addr_type);
 +int dev_addr_add_multiple(struct net_device *to_dev,
 +                        struct net_device *from_dev, unsigned char addr_type);
 +int dev_addr_del_multiple(struct net_device *to_dev,
 +                        struct net_device *from_dev, unsigned char addr_type);
 +void dev_addr_flush(struct net_device *dev);
 +int dev_addr_init(struct net_device *dev);
  
  /* Functions used for unicast addresses handling */
 -extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
 -extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
 -extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
 -extern int dev_uc_sync(struct net_device *to, struct net_device *from);
 -extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
 -extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
 -extern void dev_uc_flush(struct net_device *dev);
 -extern void dev_uc_init(struct net_device *dev);
 +int dev_uc_add(struct net_device *dev, const unsigned char *addr);
 +int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
 +int dev_uc_del(struct net_device *dev, const unsigned char *addr);
 +int dev_uc_sync(struct net_device *to, struct net_device *from);
 +int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
 +void dev_uc_unsync(struct net_device *to, struct net_device *from);
 +void dev_uc_flush(struct net_device *dev);
 +void dev_uc_init(struct net_device *dev);
  
  /* Functions used for multicast addresses handling */
 -extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_sync(struct net_device *to, struct net_device *from);
 -extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
 -extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
 -extern void dev_mc_flush(struct net_device *dev);
 -extern void dev_mc_init(struct net_device *dev);
 +int dev_mc_add(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_del(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_sync(struct net_device *to, struct net_device *from);
 +int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
 +void dev_mc_unsync(struct net_device *to, struct net_device *from);
 +void dev_mc_flush(struct net_device *dev);
 +void dev_mc_init(struct net_device *dev);
  
  /* Functions used for secondary unicast and multicast support */
 -extern void           dev_set_rx_mode(struct net_device *dev);
 -extern void           __dev_set_rx_mode(struct net_device *dev);
 -extern int            dev_set_promiscuity(struct net_device *dev, int inc);
 -extern int            dev_set_allmulti(struct net_device *dev, int inc);
 -extern void           netdev_state_change(struct net_device *dev);
 -extern void           netdev_notify_peers(struct net_device *dev);
 -extern void           netdev_features_change(struct net_device *dev);
 +void dev_set_rx_mode(struct net_device *dev);
 +void __dev_set_rx_mode(struct net_device *dev);
 +int dev_set_promiscuity(struct net_device *dev, int inc);
 +int dev_set_allmulti(struct net_device *dev, int inc);
 +void netdev_state_change(struct net_device *dev);
 +void netdev_notify_peers(struct net_device *dev);
 +void netdev_features_change(struct net_device *dev);
  /* Load a device via the kmod */
 -extern void           dev_load(struct net *net, const char *name);
 -extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 -                                             struct rtnl_link_stats64 *storage);
 -extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
 -                                  const struct net_device_stats *netdev_stats);
 +void dev_load(struct net *net, const char *name);
 +struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 +                                      struct rtnl_link_stats64 *storage);
 +void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
 +                           const struct net_device_stats *netdev_stats);
  
  extern int            netdev_max_backlog;
  extern int            netdev_tstamp_prequeue;
  extern int            weight_p;
  extern int            bpf_jit_enable;
  
 -extern bool netdev_has_upper_dev(struct net_device *dev,
 -                               struct net_device *upper_dev);
 -extern bool netdev_has_any_upper_dev(struct net_device *dev);
 -extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
 -                                                      struct list_head **iter);
 +bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
 +bool netdev_has_any_upper_dev(struct net_device *dev);
 +struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
 +                                                   struct list_head **iter);
  
  /* iterate through upper list, must be called under RCU read lock */
 -#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \
 -      for (iter = &(dev)->upper_dev_list, \
 -           upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
 -           upper; \
 -           upper = netdev_upper_get_next_dev_rcu(dev, &(iter)))
 -
 -extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
 -extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
 -extern int netdev_upper_dev_link(struct net_device *dev,
 +#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
 +      for (iter = &(dev)->all_adj_list.upper, \
 +           updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
 +           updev; \
 +           updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
 +
 +void *netdev_lower_get_next_private(struct net_device *dev,
 +                                  struct list_head **iter);
 +void *netdev_lower_get_next_private_rcu(struct net_device *dev,
 +                                      struct list_head **iter);
 +
 +#define netdev_for_each_lower_private(dev, priv, iter) \
 +      for (iter = (dev)->adj_list.lower.next, \
 +           priv = netdev_lower_get_next_private(dev, &(iter)); \
 +           priv; \
 +           priv = netdev_lower_get_next_private(dev, &(iter)))
 +
 +#define netdev_for_each_lower_private_rcu(dev, priv, iter) \
 +      for (iter = &(dev)->adj_list.lower, \
 +           priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \
 +           priv; \
 +           priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
 +
 +void *netdev_adjacent_get_private(struct list_head *adj_list);
 +struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
 +struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
 +int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
 +int netdev_master_upper_dev_link(struct net_device *dev,
                                 struct net_device *upper_dev);
 -extern int netdev_master_upper_dev_link(struct net_device *dev,
 -                                      struct net_device *upper_dev);
 -extern void netdev_upper_dev_unlink(struct net_device *dev,
 -                                  struct net_device *upper_dev);
 -extern int skb_checksum_help(struct sk_buff *skb);
 -extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 -      netdev_features_t features, bool tx_path);
 -extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
 -                                        netdev_features_t features);
 +int netdev_master_upper_dev_link_private(struct net_device *dev,
 +                                       struct net_device *upper_dev,
 +                                       void *private);
 +void netdev_upper_dev_unlink(struct net_device *dev,
 +                           struct net_device *upper_dev);
 +void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
 +                                     struct net_device *lower_dev);
 +void *netdev_lower_dev_get_private(struct net_device *dev,
 +                                 struct net_device *lower_dev);
 +int skb_checksum_help(struct sk_buff *skb);
 +struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 +                                netdev_features_t features, bool tx_path);
 +struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
 +                                  netdev_features_t features);
  
  static inline
  struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
@@@ -2878,30 -2857,42 +2878,42 @@@ static inline bool can_checksum_protoco
  }
  
  #ifdef CONFIG_BUG
 -extern void netdev_rx_csum_fault(struct net_device *dev);
 +void netdev_rx_csum_fault(struct net_device *dev);
  #else
  static inline void netdev_rx_csum_fault(struct net_device *dev)
  {
  }
  #endif
  /* rx skb timestamps */
 -extern void           net_enable_timestamp(void);
 -extern void           net_disable_timestamp(void);
 +void net_enable_timestamp(void);
 +void net_disable_timestamp(void);
  
  #ifdef CONFIG_PROC_FS
 -extern int __init dev_proc_init(void);
 +int __init dev_proc_init(void);
  #else
  #define dev_proc_init() 0
  #endif
  
- int netdev_class_create_file(struct class_attribute *class_attr);
- void netdev_class_remove_file(struct class_attribute *class_attr);
 -extern int netdev_class_create_file_ns(struct class_attribute *class_attr,
 -                                     const void *ns);
 -extern void netdev_class_remove_file_ns(struct class_attribute *class_attr,
 -                                      const void *ns);
++int netdev_class_create_file_ns(struct class_attribute *class_attr,
++                              const void *ns);
++void netdev_class_remove_file_ns(struct class_attribute *class_attr,
++                               const void *ns);
+ static inline int netdev_class_create_file(struct class_attribute *class_attr)
+ {
+       return netdev_class_create_file_ns(class_attr, NULL);
+ }
+ static inline void netdev_class_remove_file(struct class_attribute *class_attr)
+ {
+       netdev_class_remove_file_ns(class_attr, NULL);
+ }
  
  extern struct kobj_ns_type_operations net_ns_type_operations;
  
 -extern const char *netdev_drivername(const struct net_device *dev);
 +const char *netdev_drivername(const struct net_device *dev);
  
 -extern void linkwatch_run_queue(void);
 +void linkwatch_run_queue(void);
  
  static inline netdev_features_t netdev_get_wanted_features(
        struct net_device *dev)
@@@ -2993,22 -2984,22 +3005,22 @@@ static inline const char *netdev_name(c
        return dev->name;
  }
  
 -extern __printf(3, 4)
 +__printf(3, 4)
  int netdev_printk(const char *level, const struct net_device *dev,
                  const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_emerg(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_alert(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_crit(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_err(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_warn(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_notice(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_info(const struct net_device *dev, const char *format, ...);
  
  #define MODULE_ALIAS_NETDEV(device) \
@@@ -3049,7 -3040,7 +3061,7 @@@ do {                                                            
   * file/line information and a backtrace.
   */
  #define netdev_WARN(dev, format, args...)                     \
 -      WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args);
 +      WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args)
  
  /* netif printk helpers, similar to netdev_printk */
  
diff --combined kernel/events/core.c
index 5bd7fe43a7a22197379991a589fc4185c50a2e0c,10c3728d39afbe331a1fcb8daa21db23f1085dff..354a59cd6130050fc633b95c1d6f1595e790fd2f
@@@ -193,7 -193,7 +193,7 @@@ int perf_proc_update_handler(struct ctl
                void __user *buffer, size_t *lenp,
                loff_t *ppos)
  {
 -      int ret = proc_dointvec(table, write, buffer, lenp, ppos);
 +      int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  
        if (ret || !write)
                return ret;
@@@ -1201,9 -1201,6 +1201,9 @@@ static void perf_event__header_size(str
        if (sample_type & PERF_SAMPLE_DATA_SRC)
                size += sizeof(data->data_src.val);
  
 +      if (sample_type & PERF_SAMPLE_TRANSACTION)
 +              size += sizeof(data->txn);
 +
        event->header_size = size;
  }
  
@@@ -4575,9 -4572,6 +4575,9 @@@ void perf_output_sample(struct perf_out
        if (sample_type & PERF_SAMPLE_DATA_SRC)
                perf_output_put(handle, data->data_src.val);
  
 +      if (sample_type & PERF_SAMPLE_TRANSACTION)
 +              perf_output_put(handle, data->txn);
 +
        if (!event->attr.watermark) {
                int wakeup_events = event->attr.wakeup_events;
  
@@@ -6298,6 -6292,7 +6298,7 @@@ type_show(struct device *dev, struct de
  
        return snprintf(page, PAGE_SIZE-1, "%d\n", pmu->type);
  }
+ static DEVICE_ATTR_RO(type);
  
  static ssize_t
  perf_event_mux_interval_ms_show(struct device *dev,
@@@ -6342,17 -6337,19 +6343,19 @@@ perf_event_mux_interval_ms_store(struc
  
        return count;
  }
+ static DEVICE_ATTR_RW(perf_event_mux_interval_ms);
  
- static struct device_attribute pmu_dev_attrs[] = {
-       __ATTR_RO(type),
-       __ATTR_RW(perf_event_mux_interval_ms),
-       __ATTR_NULL,
+ static struct attribute *pmu_dev_attrs[] = {
+       &dev_attr_type.attr,
+       &dev_attr_perf_event_mux_interval_ms.attr,
+       NULL,
  };
+ ATTRIBUTE_GROUPS(pmu_dev);
  
  static int pmu_bus_running;
  static struct bus_type pmu_bus = {
        .name           = "event_source",
-       .dev_attrs      = pmu_dev_attrs,
+       .dev_groups     = pmu_dev_groups,
  };
  
  static void pmu_dev_release(struct device *dev)
@@@ -6773,10 -6770,6 +6776,10 @@@ static int perf_copy_attr(struct perf_e
        if (ret)
                return -EFAULT;
  
 +      /* disabled for now */
 +      if (attr->mmap2)
 +              return -EINVAL;
 +
        if (attr->__reserved_1)
                return -EINVAL;