kernel: reorganize 2.6.39 patches

SVN-Revision: 26691
master
Felix Fietkau 13 years ago
parent 71d8c66250
commit 3fa43f54a2
  1. 35
      target/linux/generic/patches-2.6.39/067-block2mtd_2.6.38_fix.patch
  2. 0
      target/linux/generic/patches-2.6.39/100-overlayfs.patch
  3. 0
      target/linux/generic/patches-2.6.39/200-fix_localversion.patch
  4. 0
      target/linux/generic/patches-2.6.39/201-extra_optimization.patch
  5. 0
      target/linux/generic/patches-2.6.39/210-darwin_scripts_include.patch
  6. 0
      target/linux/generic/patches-2.6.39/211-stddef_include.patch
  7. 0
      target/linux/generic/patches-2.6.39/220-module_exports.patch
  8. 0
      target/linux/generic/patches-2.6.39/230-openwrt_lzma_options.patch
  9. 0
      target/linux/generic/patches-2.6.39/250-netfilter_depends.patch
  10. 0
      target/linux/generic/patches-2.6.39/251-sound_kconfig.patch
  11. 0
      target/linux/generic/patches-2.6.39/252-mv_cesa_depends.patch
  12. 0
      target/linux/generic/patches-2.6.39/253-ssb_b43_default_on.patch
  13. 2
      target/linux/generic/patches-2.6.39/254-textsearch_kconfig_hacks.patch
  14. 0
      target/linux/generic/patches-2.6.39/255-lib80211_kconfig_hacks.patch
  15. 0
      target/linux/generic/patches-2.6.39/256-crypto_add_kconfig_prompts.patch
  16. 0
      target/linux/generic/patches-2.6.39/257-wireless_ext_kconfig_hack.patch
  17. 0
      target/linux/generic/patches-2.6.39/300-mips_expose_boot_raw.patch
  18. 0
      target/linux/generic/patches-2.6.39/301-mips_image_cmdline_hack.patch
  19. 0
      target/linux/generic/patches-2.6.39/302-mips_use_generic_thread_info_allocator.patch
  20. 0
      target/linux/generic/patches-2.6.39/303-mips_fix_kexec.patch
  21. 0
      target/linux/generic/patches-2.6.39/304-mips_disable_fpu.patch
  22. 0
      target/linux/generic/patches-2.6.39/305-mips_module_reloc.patch
  23. 0
      target/linux/generic/patches-2.6.39/306-mips_mem_functions_performance.patch
  24. 0
      target/linux/generic/patches-2.6.39/307-mips_oprofile_fix.patch
  25. 0
      target/linux/generic/patches-2.6.39/310-arm_module_unresolved_weak_sym.patch
  26. 0
      target/linux/generic/patches-2.6.39/320-ppc4xx_optimization.patch
  27. 0
      target/linux/generic/patches-2.6.39/321-powerpc_crtsavres_prereq.patch
  28. 290
      target/linux/generic/patches-2.6.39/400-rootfs_split.patch
  29. 0
      target/linux/generic/patches-2.6.39/401-partial_eraseblock_write.patch
  30. 0
      target/linux/generic/patches-2.6.39/410-mtd_info_move_forward_decl.patch
  31. 0
      target/linux/generic/patches-2.6.39/420-redboot_space.patch
  32. 0
      target/linux/generic/patches-2.6.39/421-redboot_boardconfig.patch
  33. 0
      target/linux/generic/patches-2.6.39/430-mtd_myloader_partition_parser.patch
  34. 2
      target/linux/generic/patches-2.6.39/440-block2mtd_init.patch
  35. 291
      target/linux/generic/patches-2.6.39/441-block2mtd_refresh.patch
  36. 4
      target/linux/generic/patches-2.6.39/442-block2mtd_probe.patch
  37. 0
      target/linux/generic/patches-2.6.39/450-mtd_plat_nand_chip_fixup.patch
  38. 0
      target/linux/generic/patches-2.6.39/451-mtd_fix_nand_correct_data_return_code.patch
  39. 0
      target/linux/generic/patches-2.6.39/460-cfi_show_amd_extended_table_version.patch
  40. 0
      target/linux/generic/patches-2.6.39/470-mtd_m25p80_add_pm25lv_flash_support.patch
  41. 0
      target/linux/generic/patches-2.6.39/472-mtd_m25p80_add_MX25L1606E_support.patch
  42. 0
      target/linux/generic/patches-2.6.39/500-yaffs_support.patch
  43. 0
      target/linux/generic/patches-2.6.39/501-yaffs_cvs_2009_04_24.patch
  44. 0
      target/linux/generic/patches-2.6.39/502-yaffs_git_2010_10_20.patch
  45. 0
      target/linux/generic/patches-2.6.39/503-yaffs_symlink_bug.patch
  46. 0
      target/linux/generic/patches-2.6.39/504-yaffs_mutex_fix.patch
  47. 0
      target/linux/generic/patches-2.6.39/510-jffs2_make_lzma_available.patch
  48. 0
      target/linux/generic/patches-2.6.39/511-debloat_lzma.patch
  49. 0
      target/linux/generic/patches-2.6.39/512-jffs2_eofdetect.patch
  50. 0
      target/linux/generic/patches-2.6.39/520-squashfs_update_xz_comp_opts.patch
  51. 2
      target/linux/generic/patches-2.6.39/600-netfilter_layer7_2.22.patch
  52. 0
      target/linux/generic/patches-2.6.39/601-netfilter_layer7_pktmatch.patch
  53. 0
      target/linux/generic/patches-2.6.39/602-netfilter_layer7_match.patch
  54. 4
      target/linux/generic/patches-2.6.39/603-netfilter_layer7_2.6.36_fix.patch
  55. 0
      target/linux/generic/patches-2.6.39/604-netfilter_cisco_794x_iphone.patch
  56. 0
      target/linux/generic/patches-2.6.39/605-netfilter_rtsp.patch
  57. 0
      target/linux/generic/patches-2.6.39/620-sched_esfq.patch
  58. 0
      target/linux/generic/patches-2.6.39/621-sched_act_connmark.patch
  59. 0
      target/linux/generic/patches-2.6.39/630-packet_socket_type.patch
  60. 0
      target/linux/generic/patches-2.6.39/640-bridge_no_eap_forward.patch
  61. 0
      target/linux/generic/patches-2.6.39/641-bridge_always_accept_eap.patch
  62. 0
      target/linux/generic/patches-2.6.39/642-bridge_port_isolate.patch
  63. 0
      target/linux/generic/patches-2.6.39/650-pppoe_header_pad.patch
  64. 0
      target/linux/generic/patches-2.6.39/651-wireless_mesh_header.patch
  65. 0
      target/linux/generic/patches-2.6.39/700-swconfig.patch
  66. 0
      target/linux/generic/patches-2.6.39/701-phy_extension.patch
  67. 0
      target/linux/generic/patches-2.6.39/702-phy_add_aneg_done_function.patch
  68. 4
      target/linux/generic/patches-2.6.39/720-phy_adm6996.patch
  69. 0
      target/linux/generic/patches-2.6.39/721-phy_packets.patch
  70. 0
      target/linux/generic/patches-2.6.39/722-phy_mvswitch.patch
  71. 0
      target/linux/generic/patches-2.6.39/723-phy_ip175c.patch
  72. 0
      target/linux/generic/patches-2.6.39/724-phy_ar8216.patch
  73. 0
      target/linux/generic/patches-2.6.39/725-phy_rtl8306.patch
  74. 0
      target/linux/generic/patches-2.6.39/726-phy_rtl8366.patch
  75. 0
      target/linux/generic/patches-2.6.39/750-hostap_txpower.patch
  76. 0
      target/linux/generic/patches-2.6.39/810-pci_disable_common_quirks.patch
  77. 0
      target/linux/generic/patches-2.6.39/811-pci_disable_usb_common_quirks.patch
  78. 0
      target/linux/generic/patches-2.6.39/820-usb_add_usb_find_device_by_name.patch
  79. 0
      target/linux/generic/patches-2.6.39/821-usb_serial_endpoint_size.patch
  80. 0
      target/linux/generic/patches-2.6.39/830-ledtrig_morse.patch
  81. 0
      target/linux/generic/patches-2.6.39/831-ledtrig_netdev.patch
  82. 0
      target/linux/generic/patches-2.6.39/832-ledtrig_usbdev.patch
  83. 0
      target/linux/generic/patches-2.6.39/833-gpio_buttons.patch
  84. 0
      target/linux/generic/patches-2.6.39/834-gpio_ioctl.patch
  85. 0
      target/linux/generic/patches-2.6.39/835-gpiodev.patch
  86. 0
      target/linux/generic/patches-2.6.39/840-rtc7301.patch
  87. 0
      target/linux/generic/patches-2.6.39/850-glamo_headers.patch
  88. 0
      target/linux/generic/patches-2.6.39/860-01_hotpluggable_spi_gpio.patch
  89. 0
      target/linux/generic/patches-2.6.39/861-04_spi_gpio_implement_spi_delay.patch
  90. 0
      target/linux/generic/patches-2.6.39/862-gpio_spi_driver.patch
  91. 0
      target/linux/generic/patches-2.6.39/863-gpiommc.patch
  92. 0
      target/linux/generic/patches-2.6.39/864-gpiommc_configfs_locking.patch
  93. 0
      target/linux/generic/patches-2.6.39/870-hifn795x_byteswap.patch
  94. 0
      target/linux/generic/patches-2.6.39/900-slab_maxsize.patch
  95. 0
      target/linux/generic/patches-2.6.39/910-kobject_uevent.patch
  96. 0
      target/linux/generic/patches-2.6.39/911-kobject_add_broadcast_uevent.patch
  97. 0
      target/linux/generic/patches-2.6.39/920-unable_to_open_console.patch
  98. 0
      target/linux/generic/patches-2.6.39/921-use_preinit_as_init.patch
  99. 0
      target/linux/generic/patches-2.6.39/940-ocf_kbuild_integration.patch
  100. 0
      target/linux/generic/patches-2.6.39/941-ocf_20100325.patch
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,35 +0,0 @@
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -264,12 +264,13 @@ static int _open_bdev(struct block2mtd_d
bdev = blkdev_get_by_path(dev->devname, mode, dev);
#ifndef MODULE
if (IS_ERR(bdev)) {
+ dev_t devt;
/* We might not have rootfs mounted at this point. Try
to resolve the device name by other means. */
wait_for_device_probe();
- dev_t devt = name_to_dev_t(dev->devname);
+ devt = name_to_dev_t(dev->devname);
if (devt)
bdev = blkdev_get_by_dev(devt, mode, dev);
}
@@ -330,7 +331,7 @@ static int block2mtd_refresh(struct mtd_
_close_bdev(dev);
/* open the whole disk, issue a partition rescan, then */
- bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ);
+ bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ, mtd);
if (!bdev || !bdev->bd_disk)
err = -EINVAL;
#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
@@ -395,7 +396,7 @@ static struct block2mtd_dev *add_device(
dev->mtd.refresh_device = block2mtd_refresh;
part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
- part->name = dev->mtd.name;
+ part->name = name;
part->offset = 0;
part->size = dev->mtd.size;
if (add_mtd_partitions(&dev->mtd, part, 1)) {

@ -1,6 +1,6 @@
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -206,16 +206,16 @@ config BCH_CONST_T
@@ -200,16 +200,16 @@ config BCH_CONST_T
# Textsearch support is select'ed if needed
#
config TEXTSEARCH

@ -256,296 +256,6 @@
static DEFINE_SPINLOCK(part_parser_lock);
static LIST_HEAD(part_parsers);
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -30,6 +30,8 @@ struct block2mtd_dev {
struct block_device *blkdev;
struct mtd_info mtd;
struct mutex write_mutex;
+ rwlock_t bdev_mutex;
+ char devname[0];
};
@@ -82,6 +84,12 @@ static int block2mtd_erase(struct mtd_in
size_t len = instr->len;
int err;
+ read_lock(&dev->bdev_mutex);
+ if (!dev->blkdev) {
+ err = -EINVAL;
+ goto done;
+ }
+
instr->state = MTD_ERASING;
mutex_lock(&dev->write_mutex);
err = _block2mtd_erase(dev, from, len);
@@ -93,6 +101,10 @@ static int block2mtd_erase(struct mtd_in
instr->state = MTD_ERASE_DONE;
mtd_erase_callback(instr);
+
+done:
+ read_unlock(&dev->bdev_mutex);
+
return err;
}
@@ -104,10 +116,14 @@ static int block2mtd_read(struct mtd_inf
struct page *page;
int index = from >> PAGE_SHIFT;
int offset = from & (PAGE_SIZE-1);
- int cpylen;
+ int cpylen, err = 0;
+
+ read_lock(&dev->bdev_mutex);
+ if (!dev->blkdev || (from > mtd->size)) {
+ err = -EINVAL;
+ goto done;
+ }
- if (from > mtd->size)
- return -EINVAL;
if (from + len > mtd->size)
len = mtd->size - from;
@@ -122,10 +138,14 @@ static int block2mtd_read(struct mtd_inf
len = len - cpylen;
page = page_read(dev->blkdev->bd_inode->i_mapping, index);
- if (!page)
- return -ENOMEM;
- if (IS_ERR(page))
- return PTR_ERR(page);
+ if (!page) {
+ err = -ENOMEM;
+ goto done;
+ }
+ if (IS_ERR(page)) {
+ err = PTR_ERR(page);
+ goto done;
+ }
memcpy(buf, page_address(page) + offset, cpylen);
page_cache_release(page);
@@ -136,7 +156,10 @@ static int block2mtd_read(struct mtd_inf
offset = 0;
index++;
}
- return 0;
+
+done:
+ read_unlock(&dev->bdev_mutex);
+ return err;
}
@@ -188,12 +211,22 @@ static int block2mtd_write(struct mtd_in
size_t *retlen, const u_char *buf)
{
struct block2mtd_dev *dev = mtd->priv;
- int err;
+ int err = 0;
+
+ read_lock(&dev->bdev_mutex);
+ if (!dev->blkdev) {
+ err = -EINVAL;
+ goto done;
+ }
if (!len)
- return 0;
- if (to >= mtd->size)
- return -ENOSPC;
+ goto done;
+
+ if (to >= mtd->size) {
+ err = -ENOSPC;
+ goto done;
+ }
+
if (to + len > mtd->size)
len = mtd->size - to;
@@ -202,6 +235,9 @@ static int block2mtd_write(struct mtd_in
mutex_unlock(&dev->write_mutex);
if (err > 0)
err = 0;
+
+done:
+ read_unlock(&dev->bdev_mutex);
return err;
}
@@ -210,33 +246,109 @@ static int block2mtd_write(struct mtd_in
static void block2mtd_sync(struct mtd_info *mtd)
{
struct block2mtd_dev *dev = mtd->priv;
+ read_lock(&dev->bdev_mutex);
+ if (dev->blkdev)
sync_blockdev(dev->blkdev);
+ read_unlock(&dev->bdev_mutex);
+
return;
}
+static int _open_bdev(struct block2mtd_dev *dev)
+{
+ const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
+ struct block_device *bdev;
+
+ /* Get a handle on the device */
+ bdev = blkdev_get_by_path(dev->devname, mode, dev);
+#ifndef MODULE
+ if (IS_ERR(bdev)) {
+
+ /* We might not have rootfs mounted at this point. Try
+ to resolve the device name by other means. */
+
+ dev_t devt = name_to_dev_t(dev->devname);
+ if (devt)
+ bdev = blkdev_get_by_dev(devt, mode, dev);
+ }
+#endif
+
+ if (IS_ERR(bdev)) {
+ ERROR("error: cannot open device %s", dev->devname);
+ return 1;
+ }
+ dev->blkdev = bdev;
+
+ if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
+ ERROR("attempting to use an MTD device as a block device");
+ return 1;
+ }
+
+ return 0;
+}
+
+static void _close_bdev(struct block2mtd_dev *dev)
+{
+ struct block_device *bdev;
+
+ if (!dev->blkdev)
+ return;
+
+ bdev = dev->blkdev;
+ invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1);
+ blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
+ dev->blkdev = NULL;
+}
+
static void block2mtd_free_device(struct block2mtd_dev *dev)
{
if (!dev)
return;
kfree(dev->mtd.name);
-
- if (dev->blkdev) {
- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
- 0, -1);
- blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
- }
-
+ _close_bdev(dev);
kfree(dev);
}
-/* FIXME: ensure that mtd->size % erase_size == 0 */
-static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
+static int block2mtd_refresh(struct mtd_info *mtd)
{
- const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
+ struct block2mtd_dev *dev = mtd->priv;
struct block_device *bdev;
+ dev_t devt;
+ int err = 0;
+
+ /* no other mtd function can run at this point */
+ write_lock(&dev->bdev_mutex);
+
+ /* get the device number for the whole disk */
+ devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0);
+
+ /* close the old block device */
+ _close_bdev(dev);
+
+ /* open the whole disk, issue a partition rescan, then */
+ bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ);
+ if (!bdev || !bdev->bd_disk)
+ err = -EINVAL;
+#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
+ else
+ err = rescan_partitions(bdev->bd_disk, bdev);
+#endif
+ if (bdev)
+ blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
+
+ /* try to open the partition block device again */
+ _open_bdev(dev);
+ write_unlock(&dev->bdev_mutex);
+
+ return err;
+}
+
+/* FIXME: ensure that mtd->size % erase_size == 0 */
+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
+{
struct block2mtd_dev *dev;
struct mtd_partition *part;
char *name;
@@ -244,36 +356,17 @@ static struct block2mtd_dev *add_device(
if (!devname)
return NULL;
- dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL);
if (!dev)
return NULL;
- /* Get a handle on the device */
- bdev = blkdev_get_by_path(devname, mode, dev);
-#ifndef MODULE
- if (IS_ERR(bdev)) {
-
- /* We might not have rootfs mounted at this point. Try
- to resolve the device name by other means. */
+ strcpy(dev->devname, devname);
- dev_t devt = name_to_dev_t(devname);
- if (devt)
- bdev = blkdev_get_by_dev(devt, mode, dev);
- }
-#endif
-
- if (IS_ERR(bdev)) {
- ERROR("error: cannot open device %s", devname);
+ if (_open_bdev(dev))
goto devinit_err;
- }
- dev->blkdev = bdev;
-
- if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
- ERROR("attempting to use an MTD device as a block device");
- goto devinit_err;
- }
mutex_init(&dev->write_mutex);
+ rwlock_init(&dev->bdev_mutex);
/* Setup the MTD structure */
/* make the name contain the block device in */
@@ -298,6 +391,7 @@ static struct block2mtd_dev *add_device(
dev->mtd.read = block2mtd_read;
dev->mtd.priv = dev;
dev->mtd.owner = THIS_MODULE;
+ dev->mtd.refresh_device = block2mtd_refresh;
part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
part->name = dev->mtd.name;
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -841,6 +841,13 @@ static int mtd_ioctl(struct file *file,

@ -47,7 +47,7 @@
- if (add_mtd_device(&dev->mtd)) {
+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
+ part->name = dev->mtd.name;
+ part->name = name;
+ part->offset = 0;
+ part->size = dev->mtd.size;
+ if (add_mtd_partitions(&dev->mtd, part, 1)) {

@ -0,0 +1,291 @@
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -30,6 +30,8 @@ struct block2mtd_dev {
struct block_device *blkdev;
struct mtd_info mtd;
struct mutex write_mutex;
+ rwlock_t bdev_mutex;
+ char devname[0];
};
@@ -82,6 +84,12 @@ static int block2mtd_erase(struct mtd_in
size_t len = instr->len;
int err;
+ read_lock(&dev->bdev_mutex);
+ if (!dev->blkdev) {
+ err = -EINVAL;
+ goto done;
+ }
+
instr->state = MTD_ERASING;
mutex_lock(&dev->write_mutex);
err = _block2mtd_erase(dev, from, len);
@@ -93,6 +101,10 @@ static int block2mtd_erase(struct mtd_in
instr->state = MTD_ERASE_DONE;
mtd_erase_callback(instr);
+
+done:
+ read_unlock(&dev->bdev_mutex);
+
return err;
}
@@ -104,10 +116,14 @@ static int block2mtd_read(struct mtd_inf
struct page *page;
int index = from >> PAGE_SHIFT;
int offset = from & (PAGE_SIZE-1);
- int cpylen;
+ int cpylen, err = 0;
+
+ read_lock(&dev->bdev_mutex);
+ if (!dev->blkdev || (from > mtd->size)) {
+ err = -EINVAL;
+ goto done;
+ }
- if (from > mtd->size)
- return -EINVAL;
if (from + len > mtd->size)
len = mtd->size - from;
@@ -122,10 +138,14 @@ static int block2mtd_read(struct mtd_inf
len = len - cpylen;
page = page_read(dev->blkdev->bd_inode->i_mapping, index);
- if (!page)
- return -ENOMEM;
- if (IS_ERR(page))
- return PTR_ERR(page);
+ if (!page) {
+ err = -ENOMEM;
+ goto done;
+ }
+ if (IS_ERR(page)) {
+ err = PTR_ERR(page);
+ goto done;
+ }
memcpy(buf, page_address(page) + offset, cpylen);
page_cache_release(page);
@@ -136,7 +156,10 @@ static int block2mtd_read(struct mtd_inf
offset = 0;
index++;
}
- return 0;
+
+done:
+ read_unlock(&dev->bdev_mutex);
+ return err;
}
@@ -188,12 +211,22 @@ static int block2mtd_write(struct mtd_in
size_t *retlen, const u_char *buf)
{
struct block2mtd_dev *dev = mtd->priv;
- int err;
+ int err = 0;
+
+ read_lock(&dev->bdev_mutex);
+ if (!dev->blkdev) {
+ err = -EINVAL;
+ goto done;
+ }
if (!len)
- return 0;
- if (to >= mtd->size)
- return -ENOSPC;
+ goto done;
+
+ if (to >= mtd->size) {
+ err = -ENOSPC;
+ goto done;
+ }
+
if (to + len > mtd->size)
len = mtd->size - to;
@@ -202,6 +235,9 @@ static int block2mtd_write(struct mtd_in
mutex_unlock(&dev->write_mutex);
if (err > 0)
err = 0;
+
+done:
+ read_unlock(&dev->bdev_mutex);
return err;
}
@@ -210,33 +246,110 @@ static int block2mtd_write(struct mtd_in
static void block2mtd_sync(struct mtd_info *mtd)
{
struct block2mtd_dev *dev = mtd->priv;
+ read_lock(&dev->bdev_mutex);
+ if (dev->blkdev)
sync_blockdev(dev->blkdev);
+ read_unlock(&dev->bdev_mutex);
+
return;
}
+static int _open_bdev(struct block2mtd_dev *dev)
+{
+ const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
+ struct block_device *bdev;
+
+ /* Get a handle on the device */
+ bdev = blkdev_get_by_path(dev->devname, mode, dev);
+#ifndef MODULE
+ if (IS_ERR(bdev)) {
+ dev_t devt;
+
+ /* We might not have rootfs mounted at this point. Try
+ to resolve the device name by other means. */
+
+ devt = name_to_dev_t(dev->devname);
+ if (devt)
+ bdev = blkdev_get_by_dev(devt, mode, dev);
+ }
+#endif
+
+ if (IS_ERR(bdev)) {
+ ERROR("error: cannot open device %s", dev->devname);
+ return 1;
+ }
+ dev->blkdev = bdev;
+
+ if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
+ ERROR("attempting to use an MTD device as a block device");
+ return 1;
+ }
+
+ return 0;
+}
+
+static void _close_bdev(struct block2mtd_dev *dev)
+{
+ struct block_device *bdev;
+
+ if (!dev->blkdev)
+ return;
+
+ bdev = dev->blkdev;
+ invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1);
+ blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
+ dev->blkdev = NULL;
+}
+
static void block2mtd_free_device(struct block2mtd_dev *dev)
{
if (!dev)
return;
kfree(dev->mtd.name);
-
- if (dev->blkdev) {
- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
- 0, -1);
- blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
- }
-
+ _close_bdev(dev);
kfree(dev);
}
-/* FIXME: ensure that mtd->size % erase_size == 0 */
-static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
+static int block2mtd_refresh(struct mtd_info *mtd)
{
- const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
+ struct block2mtd_dev *dev = mtd->priv;
struct block_device *bdev;
+ dev_t devt;
+ int err = 0;
+
+ /* no other mtd function can run at this point */
+ write_lock(&dev->bdev_mutex);
+
+ /* get the device number for the whole disk */
+ devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0);
+
+ /* close the old block device */
+ _close_bdev(dev);
+
+ /* open the whole disk, issue a partition rescan, then */
+ bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ, mtd);
+ if (!bdev || !bdev->bd_disk)
+ err = -EINVAL;
+#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
+ else
+ err = rescan_partitions(bdev->bd_disk, bdev);
+#endif
+ if (bdev)
+ blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
+
+ /* try to open the partition block device again */
+ _open_bdev(dev);
+ write_unlock(&dev->bdev_mutex);
+
+ return err;
+}
+
+/* FIXME: ensure that mtd->size % erase_size == 0 */
+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
+{
struct block2mtd_dev *dev;
struct mtd_partition *part;
char *name;
@@ -244,36 +357,17 @@ static struct block2mtd_dev *add_device(
if (!devname)
return NULL;
- dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL);
if (!dev)
return NULL;
- /* Get a handle on the device */
- bdev = blkdev_get_by_path(devname, mode, dev);
-#ifndef MODULE
- if (IS_ERR(bdev)) {
-
- /* We might not have rootfs mounted at this point. Try
- to resolve the device name by other means. */
+ strcpy(dev->devname, devname);
- dev_t devt = name_to_dev_t(devname);
- if (devt)
- bdev = blkdev_get_by_dev(devt, mode, dev);
- }
-#endif
-
- if (IS_ERR(bdev)) {
- ERROR("error: cannot open device %s", devname);
+ if (_open_bdev(dev))
goto devinit_err;
- }
- dev->blkdev = bdev;
-
- if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
- ERROR("attempting to use an MTD device as a block device");
- goto devinit_err;
- }
mutex_init(&dev->write_mutex);
+ rwlock_init(&dev->bdev_mutex);
/* Setup the MTD structure */
/* make the name contain the block device in */
@@ -298,6 +392,7 @@ static struct block2mtd_dev *add_device(
dev->mtd.read = block2mtd_read;
dev->mtd.priv = dev;
dev->mtd.owner = THIS_MODULE;
+ dev->mtd.refresh_device = block2mtd_refresh;
part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
part->name = name;

@ -1,10 +1,10 @@
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -268,6 +268,7 @@ static int _open_bdev(struct block2mtd_d
@@ -269,6 +269,7 @@ static int _open_bdev(struct block2mtd_d
/* We might not have rootfs mounted at this point. Try
to resolve the device name by other means. */
+ wait_for_device_probe();
dev_t devt = name_to_dev_t(dev->devname);
devt = name_to_dev_t(dev->devname);
if (devt)
bdev = blkdev_get_by_dev(devt, mode, dev);

@ -1,6 +1,6 @@
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -1020,6 +1020,27 @@ config NETFILTER_XT_MATCH_STATE
@@ -1018,6 +1018,27 @@ config NETFILTER_XT_MATCH_STATE
To compile it as a module, choose M here. If unsure, say N.

@ -1,6 +1,6 @@
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -834,6 +834,27 @@ config NETFILTER_XT_MATCH_IPVS
@@ -832,6 +832,27 @@ config NETFILTER_XT_MATCH_IPVS
If unsure, say N.
@ -28,7 +28,7 @@
config NETFILTER_XT_MATCH_LENGTH
tristate '"length" match support'
depends on NETFILTER_ADVANCED
@@ -1020,26 +1041,11 @@ config NETFILTER_XT_MATCH_STATE
@@ -1018,26 +1039,11 @@ config NETFILTER_XT_MATCH_STATE
To compile it as a module, choose M here. If unsure, say N.

@ -1,6 +1,6 @@
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -91,6 +91,11 @@ config MICREL_PHY
@@ -97,6 +97,11 @@ config MICREL_PHY
---help---
Supports the KSZ9021, VSC8201, KS8001 PHYs.
@ -14,7 +14,7 @@
depends on PHYLIB=y
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o
@@ -14,6 +14,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o
obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o
obj-$(CONFIG_ICPLUS_PHY) += icplus.o

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save