Browse Source

Merge tag 'staging-3.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging tree fixes from Greg Kroah-Hartman:
 "Here are a number of small fixes for the drivers/staging tree, as well
  as iio and pstore drivers (which came from the staging tree in the
  3.5-rc1 merge).  All of these are tiny, but resolve issues that people
  have been reporting.

  There's also a documentation update to reflect what the iio drivers
  really are doing, which is good to get straightened out.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'staging-3.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: r8712u: Add new USB IDs
  staging: gdm72xx: Release netlink socket properly
  iio: drop wrong reference from Kconfig
  pstore/inode: Make pstore_fill_super() static
  pstore/ram: Should zap persistent zone on unlink
  pstore/ram_core: Factor persistent_ram_zap() out of post_init()
  pstore/ram_core: Do not reset restored zone's position and size
  pstore/ram: Should update old dmesg buffer before reading
  staging:iio:ad7298: Fix linker error due to missing IIO kfifo buffer
  Revert "staging: usbip: bugfix for stack corruption on 64-bit architectures"
  staging: usbip: bugfix for stack corruption on 64-bit architectures
  staging/comedi: fix build for USB not enabled
  staging: omapdrm: fix crash when freeing bad fb
  staging:iio:ad7606: Re-add missing scale attribute
  iio: Fix potential use after free
  staging:iio: remove num_interrupt_lines from documentation
  iio: documentation: Add out_altvoltage and friends
Linus Torvalds 13 years ago
parent
commit
bc259adc9b

+ 31 - 0
Documentation/ABI/testing/sysfs-bus-iio

@@ -219,6 +219,7 @@ What:		/sys/bus/iio/devices/iio:deviceX/in_voltageY_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_voltage_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_voltage_scale
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_scale
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_scale
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_accel_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_accel_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_anglvel_scale
 What:		/sys/bus/iio/devices/iio:deviceX/in_anglvel_scale
@@ -273,6 +274,7 @@ What:		/sys/bus/iio/devices/iio:deviceX/in_accel_scale_available
 What:		/sys/.../iio:deviceX/in_voltageX_scale_available
 What:		/sys/.../iio:deviceX/in_voltageX_scale_available
 What:		/sys/.../iio:deviceX/in_voltage-voltage_scale_available
 What:		/sys/.../iio:deviceX/in_voltage-voltage_scale_available
 What:		/sys/.../iio:deviceX/out_voltageX_scale_available
 What:		/sys/.../iio:deviceX/out_voltageX_scale_available
+What:		/sys/.../iio:deviceX/out_altvoltageX_scale_available
 What:		/sys/.../iio:deviceX/in_capacitance_scale_available
 What:		/sys/.../iio:deviceX/in_capacitance_scale_available
 KernelVersion:	2.635
 KernelVersion:	2.635
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org
@@ -298,14 +300,19 @@ Description:
 		gives the 3dB frequency of the filter in Hz.
 		gives the 3dB frequency of the filter in Hz.
 
 
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_raw
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_raw
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_raw
 KernelVersion:	2.6.37
 KernelVersion:	2.6.37
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org
 Description:
 Description:
 		Raw (unscaled, no bias etc.) output voltage for
 		Raw (unscaled, no bias etc.) output voltage for
 		channel Y.  The number must always be specified and
 		channel Y.  The number must always be specified and
 		unique if the output corresponds to a single channel.
 		unique if the output corresponds to a single channel.
+		While DAC like devices typically use out_voltage,
+		a continuous frequency generating device, such as
+		a DDS or PLL should use out_altvoltage.
 
 
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY&Z_raw
 KernelVersion:	2.6.37
 KernelVersion:	2.6.37
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org
 Description:
 Description:
@@ -316,6 +323,8 @@ Description:
 
 
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown_mode
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown_mode
 KernelVersion:	2.6.38
 KernelVersion:	2.6.38
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org
 Description:
 Description:
@@ -330,6 +339,8 @@ Description:
 
 
 What:		/sys/.../iio:deviceX/out_votlageY_powerdown_mode_available
 What:		/sys/.../iio:deviceX/out_votlageY_powerdown_mode_available
 What:		/sys/.../iio:deviceX/out_voltage_powerdown_mode_available
 What:		/sys/.../iio:deviceX/out_voltage_powerdown_mode_available
+What:		/sys/.../iio:deviceX/out_altvotlageY_powerdown_mode_available
+What:		/sys/.../iio:deviceX/out_altvoltage_powerdown_mode_available
 KernelVersion:	2.6.38
 KernelVersion:	2.6.38
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org
 Description:
 Description:
@@ -338,6 +349,8 @@ Description:
 
 
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown
 KernelVersion:	2.6.38
 KernelVersion:	2.6.38
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org
 Description:
 Description:
@@ -346,6 +359,24 @@ Description:
 		normal operation. Y may be suppressed if all outputs are
 		normal operation. Y may be suppressed if all outputs are
 		controlled together.
 		controlled together.
 
 
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_frequency
+KernelVersion:	3.4.0
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Output frequency for channel Y in Hz. The number must always be
+		specified and unique if the output corresponds to a single
+		channel.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_phase
+KernelVersion:	3.4.0
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Phase in radians of one frequency/clock output Y
+		(out_altvoltageY) relative to another frequency/clock output
+		(out_altvoltageZ) of the device X. The number must always be
+		specified and unique if the output corresponds to a single
+		channel.
+
 What:		/sys/bus/iio/devices/iio:deviceX/events
 What:		/sys/bus/iio/devices/iio:deviceX/events
 KernelVersion:	2.6.35
 KernelVersion:	2.6.35
 Contact:	linux-iio@vger.kernel.org
 Contact:	linux-iio@vger.kernel.org

+ 1 - 2
drivers/iio/Kconfig

@@ -8,8 +8,7 @@ menuconfig IIO
 	help
 	help
 	  The industrial I/O subsystem provides a unified framework for
 	  The industrial I/O subsystem provides a unified framework for
 	  drivers for many different types of embedded sensors using a
 	  drivers for many different types of embedded sensors using a
-	  number of different physical interfaces (i2c, spi, etc). See
-	  Documentation/iio for more information.
+	  number of different physical interfaces (i2c, spi, etc).
 
 
 if IIO
 if IIO
 
 

+ 9 - 7
drivers/iio/industrialio-core.c

@@ -661,7 +661,6 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)
 	 * New channel registration method - relies on the fact a group does
 	 * New channel registration method - relies on the fact a group does
 	 * not need to be initialized if it is name is NULL.
 	 * not need to be initialized if it is name is NULL.
 	 */
 	 */
-	INIT_LIST_HEAD(&indio_dev->channel_attr_list);
 	if (indio_dev->channels)
 	if (indio_dev->channels)
 		for (i = 0; i < indio_dev->num_channels; i++) {
 		for (i = 0; i < indio_dev->num_channels; i++) {
 			ret = iio_device_add_channel_sysfs(indio_dev,
 			ret = iio_device_add_channel_sysfs(indio_dev,
@@ -725,12 +724,16 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
 static void iio_dev_release(struct device *device)
 static void iio_dev_release(struct device *device)
 {
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(device);
 	struct iio_dev *indio_dev = dev_to_iio_dev(device);
-	cdev_del(&indio_dev->chrdev);
+	if (indio_dev->chrdev.dev)
+		cdev_del(&indio_dev->chrdev);
 	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
 	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
 		iio_device_unregister_trigger_consumer(indio_dev);
 		iio_device_unregister_trigger_consumer(indio_dev);
 	iio_device_unregister_eventset(indio_dev);
 	iio_device_unregister_eventset(indio_dev);
 	iio_device_unregister_sysfs(indio_dev);
 	iio_device_unregister_sysfs(indio_dev);
 	iio_device_unregister_debugfs(indio_dev);
 	iio_device_unregister_debugfs(indio_dev);
+
+	ida_simple_remove(&iio_ida, indio_dev->id);
+	kfree(indio_dev);
 }
 }
 
 
 static struct device_type iio_dev_type = {
 static struct device_type iio_dev_type = {
@@ -761,6 +764,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
 		dev_set_drvdata(&dev->dev, (void *)dev);
 		dev_set_drvdata(&dev->dev, (void *)dev);
 		mutex_init(&dev->mlock);
 		mutex_init(&dev->mlock);
 		mutex_init(&dev->info_exist_lock);
 		mutex_init(&dev->info_exist_lock);
+		INIT_LIST_HEAD(&dev->channel_attr_list);
 
 
 		dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
 		dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
 		if (dev->id < 0) {
 		if (dev->id < 0) {
@@ -778,10 +782,8 @@ EXPORT_SYMBOL(iio_device_alloc);
 
 
 void iio_device_free(struct iio_dev *dev)
 void iio_device_free(struct iio_dev *dev)
 {
 {
-	if (dev) {
-		ida_simple_remove(&iio_ida, dev->id);
-		kfree(dev);
-	}
+	if (dev)
+		put_device(&dev->dev);
 }
 }
 EXPORT_SYMBOL(iio_device_free);
 EXPORT_SYMBOL(iio_device_free);
 
 
@@ -902,7 +904,7 @@ void iio_device_unregister(struct iio_dev *indio_dev)
 	mutex_lock(&indio_dev->info_exist_lock);
 	mutex_lock(&indio_dev->info_exist_lock);
 	indio_dev->info = NULL;
 	indio_dev->info = NULL;
 	mutex_unlock(&indio_dev->info_exist_lock);
 	mutex_unlock(&indio_dev->info_exist_lock);
-	device_unregister(&indio_dev->dev);
+	device_del(&indio_dev->dev);
 }
 }
 EXPORT_SYMBOL(iio_device_unregister);
 EXPORT_SYMBOL(iio_device_unregister);
 subsys_initcall(iio_init);
 subsys_initcall(iio_init);

+ 5 - 0
drivers/staging/comedi/drivers.c

@@ -30,6 +30,7 @@
 #include <linux/pci.h>
 #include <linux/pci.h>
 #include <linux/usb.h>
 #include <linux/usb.h>
 #include <linux/errno.h>
 #include <linux/errno.h>
+#include <linux/kconfig.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/sched.h>
 #include <linux/fcntl.h>
 #include <linux/fcntl.h>
@@ -981,6 +982,8 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
 }
 }
 EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister);
 EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister);
 
 
+#if IS_ENABLED(CONFIG_USB)
+
 static int comedi_old_usb_auto_config(struct usb_interface *intf,
 static int comedi_old_usb_auto_config(struct usb_interface *intf,
 				      struct comedi_driver *driver)
 				      struct comedi_driver *driver)
 {
 {
@@ -1043,3 +1046,5 @@ void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
 	comedi_driver_unregister(comedi_driver);
 	comedi_driver_unregister(comedi_driver);
 }
 }
 EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
 EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
+
+#endif

+ 1 - 1
drivers/staging/gdm72xx/netlink_k.c

@@ -104,7 +104,7 @@ struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type,
 
 
 void netlink_exit(struct sock *sock)
 void netlink_exit(struct sock *sock)
 {
 {
-	sock_release(sock->sk_socket);
+	netlink_kernel_release(sock);
 }
 }
 
 
 int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
 int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)

+ 0 - 2
drivers/staging/iio/Documentation/device.txt

@@ -29,8 +29,6 @@ Then fill in the following:
 	* info->driver_module:
 	* info->driver_module:
 		Set to THIS_MODULE. Used to ensure correct ownership
 		Set to THIS_MODULE. Used to ensure correct ownership
 		of various resources allocate by the core.
 		of various resources allocate by the core.
-	* info->num_interrupt_lines:
-		Number of event triggering hardware lines the device has.
 	* info->event_attrs:
 	* info->event_attrs:
 		Attributes used to enable / disable hardware events.
 		Attributes used to enable / disable hardware events.
 	* info->attrs:
 	* info->attrs:

+ 1 - 0
drivers/staging/iio/adc/Kconfig

@@ -13,6 +13,7 @@ config AD7291
 config AD7298
 config AD7298
 	tristate "Analog Devices AD7298 ADC driver"
 	tristate "Analog Devices AD7298 ADC driver"
 	depends on SPI
 	depends on SPI
+	select IIO_KFIFO_BUF if IIO_BUFFER
 	help
 	help
 	  Say yes here to build support for Analog Devices AD7298
 	  Say yes here to build support for Analog Devices AD7298
 	  8 Channel ADC with temperature sensor.
 	  8 Channel ADC with temperature sensor.

+ 2 - 1
drivers/staging/iio/adc/ad7606_core.c

@@ -235,7 +235,8 @@ static const struct attribute_group ad7606_attribute_group_range = {
 		.indexed = 1,					\
 		.indexed = 1,					\
 		.channel = num,					\
 		.channel = num,					\
 		.address = num,					\
 		.address = num,					\
-		.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,	\
+		.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |	\
+				IIO_CHAN_INFO_SCALE_SHARED_BIT, \
 		.scan_index = num,				\
 		.scan_index = num,				\
 		.scan_type = IIO_ST('s', 16, 16, 0),		\
 		.scan_type = IIO_ST('s', 16, 16, 0),		\
 	}
 	}

+ 7 - 3
drivers/staging/omapdrm/omap_fbdev.c

@@ -208,7 +208,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 	 */
 	 */
 	ret = omap_gem_get_paddr(fbdev->bo, &paddr, true);
 	ret = omap_gem_get_paddr(fbdev->bo, &paddr, true);
 	if (ret) {
 	if (ret) {
-		dev_err(dev->dev, "could not map (paddr)!\n");
+		dev_err(dev->dev,
+			"could not map (paddr)!  Skipping framebuffer alloc\n");
 		ret = -ENOMEM;
 		ret = -ENOMEM;
 		goto fail;
 		goto fail;
 	}
 	}
@@ -388,8 +389,11 @@ void omap_fbdev_free(struct drm_device *dev)
 
 
 	fbi = helper->fbdev;
 	fbi = helper->fbdev;
 
 
-	unregister_framebuffer(fbi);
-	framebuffer_release(fbi);
+	/* only cleanup framebuffer if it is present */
+	if (fbi) {
+		unregister_framebuffer(fbi);
+		framebuffer_release(fbi);
+	}
 
 
 	drm_fb_helper_fini(helper);
 	drm_fb_helper_fini(helper);
 
 

+ 2 - 0
drivers/staging/rtl8712/usb_intf.c

@@ -102,6 +102,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
 	/* - */
 	/* - */
 	{USB_DEVICE(0x20F4, 0x646B)},
 	{USB_DEVICE(0x20F4, 0x646B)},
 	{USB_DEVICE(0x083A, 0xC512)},
 	{USB_DEVICE(0x083A, 0xC512)},
+	{USB_DEVICE(0x25D4, 0x4CA1)},
+	{USB_DEVICE(0x25D4, 0x4CAB)},
 
 
 /* RTL8191SU */
 /* RTL8191SU */
 	/* Realtek */
 	/* Realtek */

+ 1 - 1
fs/pstore/inode.c

@@ -258,7 +258,7 @@ fail:
 	return rc;
 	return rc;
 }
 }
 
 
-int pstore_fill_super(struct super_block *sb, void *data, int silent)
+static int pstore_fill_super(struct super_block *sb, void *data, int silent)
 {
 {
 	struct inode *inode;
 	struct inode *inode;
 
 

+ 3 - 0
fs/pstore/ram.c

@@ -106,6 +106,8 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
 	time->tv_sec = 0;
 	time->tv_sec = 0;
 	time->tv_nsec = 0;
 	time->tv_nsec = 0;
 
 
+	/* Update old/shadowed buffer. */
+	persistent_ram_save_old(prz);
 	size = persistent_ram_old_size(prz);
 	size = persistent_ram_old_size(prz);
 	*buf = kmalloc(size, GFP_KERNEL);
 	*buf = kmalloc(size, GFP_KERNEL);
 	if (*buf == NULL)
 	if (*buf == NULL)
@@ -184,6 +186,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id,
 		return -EINVAL;
 		return -EINVAL;
 
 
 	persistent_ram_free_old(cxt->przs[id]);
 	persistent_ram_free_old(cxt->przs[id]);
+	persistent_ram_zap(cxt->przs[id]);
 
 
 	return 0;
 	return 0;
 }
 }

+ 17 - 10
fs/pstore/ram_core.c

@@ -250,23 +250,24 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz,
 	persistent_ram_update_ecc(prz, start, count);
 	persistent_ram_update_ecc(prz, start, count);
 }
 }
 
 
-static void __init
-persistent_ram_save_old(struct persistent_ram_zone *prz)
+void persistent_ram_save_old(struct persistent_ram_zone *prz)
 {
 {
 	struct persistent_ram_buffer *buffer = prz->buffer;
 	struct persistent_ram_buffer *buffer = prz->buffer;
 	size_t size = buffer_size(prz);
 	size_t size = buffer_size(prz);
 	size_t start = buffer_start(prz);
 	size_t start = buffer_start(prz);
-	char *dest;
 
 
-	persistent_ram_ecc_old(prz);
+	if (!size)
+		return;
 
 
-	dest = kmalloc(size, GFP_KERNEL);
-	if (dest == NULL) {
+	if (!prz->old_log) {
+		persistent_ram_ecc_old(prz);
+		prz->old_log = kmalloc(size, GFP_KERNEL);
+	}
+	if (!prz->old_log) {
 		pr_err("persistent_ram: failed to allocate buffer\n");
 		pr_err("persistent_ram: failed to allocate buffer\n");
 		return;
 		return;
 	}
 	}
 
 
-	prz->old_log = dest;
 	prz->old_log_size = size;
 	prz->old_log_size = size;
 	memcpy(prz->old_log, &buffer->data[start], size - start);
 	memcpy(prz->old_log, &buffer->data[start], size - start);
 	memcpy(prz->old_log + size - start, &buffer->data[0], start);
 	memcpy(prz->old_log + size - start, &buffer->data[0], start);
@@ -319,6 +320,13 @@ void persistent_ram_free_old(struct persistent_ram_zone *prz)
 	prz->old_log_size = 0;
 	prz->old_log_size = 0;
 }
 }
 
 
+void persistent_ram_zap(struct persistent_ram_zone *prz)
+{
+	atomic_set(&prz->buffer->start, 0);
+	atomic_set(&prz->buffer->size, 0);
+	persistent_ram_update_header_ecc(prz);
+}
+
 static void *persistent_ram_vmap(phys_addr_t start, size_t size)
 static void *persistent_ram_vmap(phys_addr_t start, size_t size)
 {
 {
 	struct page **pages;
 	struct page **pages;
@@ -405,6 +413,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
 				" size %zu, start %zu\n",
 				" size %zu, start %zu\n",
 			       buffer_size(prz), buffer_start(prz));
 			       buffer_size(prz), buffer_start(prz));
 			persistent_ram_save_old(prz);
 			persistent_ram_save_old(prz);
+			return 0;
 		}
 		}
 	} else {
 	} else {
 		pr_info("persistent_ram: no valid data in buffer"
 		pr_info("persistent_ram: no valid data in buffer"
@@ -412,8 +421,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
 	}
 	}
 
 
 	prz->buffer->sig = PERSISTENT_RAM_SIG;
 	prz->buffer->sig = PERSISTENT_RAM_SIG;
-	atomic_set(&prz->buffer->start, 0);
-	atomic_set(&prz->buffer->size, 0);
+	persistent_ram_zap(prz);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -448,7 +456,6 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
 		goto err;
 		goto err;
 
 
 	persistent_ram_post_init(prz, ecc);
 	persistent_ram_post_init(prz, ecc);
-	persistent_ram_update_header_ecc(prz);
 
 
 	return prz;
 	return prz;
 err:
 err:

+ 2 - 0
include/linux/pstore_ram.h

@@ -69,12 +69,14 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
 						       size_t size,
 						       size_t size,
 						       bool ecc);
 						       bool ecc);
 void persistent_ram_free(struct persistent_ram_zone *prz);
 void persistent_ram_free(struct persistent_ram_zone *prz);
+void persistent_ram_zap(struct persistent_ram_zone *prz);
 struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
 struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
 		bool ecc);
 		bool ecc);
 
 
 int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
 int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
 	unsigned int count);
 	unsigned int count);
 
 
+void persistent_ram_save_old(struct persistent_ram_zone *prz);
 size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
 size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
 void *persistent_ram_old(struct persistent_ram_zone *prz);
 void *persistent_ram_old(struct persistent_ram_zone *prz);
 void persistent_ram_free_old(struct persistent_ram_zone *prz);
 void persistent_ram_free_old(struct persistent_ram_zone *prz);