diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:57:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:57:09 -0400 |
commit | 89a86a2da30a6a90dda719874092905cd762b7ef (patch) | |
tree | 140a289a990e7810e9c365bce304af1e065ca649 | |
parent | 71f882fe71823c54ae095ce29ce050f814eefdbc (diff) | |
parent | 364ed2f4653d7c86ebedcc116a9cb34fd272867c (diff) |
Merge branch 'staging-linus' into staging-next
We need this for the pstore fixes that went into the staging-linus branch, so
that things apply properly for the pstore/android code merge.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-iio | 31 | ||||
-rw-r--r-- | drivers/iio/industrialio-core.c | 16 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers.c | 5 | ||||
-rw-r--r-- | drivers/staging/iio/Documentation/device.txt | 2 | ||||
-rw-r--r-- | drivers/staging/iio/adc/Kconfig | 1 | ||||
-rw-r--r-- | drivers/staging/iio/adc/ad7606_core.c | 3 | ||||
-rw-r--r-- | drivers/staging/omapdrm/omap_fbdev.c | 10 | ||||
-rw-r--r-- | fs/pstore/inode.c | 2 | ||||
-rw-r--r-- | fs/pstore/ram.c | 3 | ||||
-rw-r--r-- | fs/pstore/ram_core.c | 27 | ||||
-rw-r--r-- | include/linux/pstore_ram.h | 2 |
11 files changed, 78 insertions, 24 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index e0f68f6a0e2..05449c68952 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio | |||
@@ -218,6 +218,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_scale | |||
218 | What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale | 218 | What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale |
219 | What: /sys/bus/iio/devices/iio:deviceX/in_voltage_scale | 219 | What: /sys/bus/iio/devices/iio:deviceX/in_voltage_scale |
220 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_scale | 220 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_scale |
221 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_scale | ||
221 | What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale | 222 | What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale |
222 | What: /sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale | 223 | What: /sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale |
223 | What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_scale | 224 | What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_scale |
@@ -272,6 +273,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale_available | |||
272 | What: /sys/.../iio:deviceX/in_voltageX_scale_available | 273 | What: /sys/.../iio:deviceX/in_voltageX_scale_available |
273 | What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available | 274 | What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available |
274 | What: /sys/.../iio:deviceX/out_voltageX_scale_available | 275 | What: /sys/.../iio:deviceX/out_voltageX_scale_available |
276 | What: /sys/.../iio:deviceX/out_altvoltageX_scale_available | ||
275 | What: /sys/.../iio:deviceX/in_capacitance_scale_available | 277 | What: /sys/.../iio:deviceX/in_capacitance_scale_available |
276 | KernelVersion: 2.635 | 278 | KernelVersion: 2.635 |
277 | Contact: linux-iio@vger.kernel.org | 279 | Contact: linux-iio@vger.kernel.org |
@@ -297,14 +299,19 @@ Description: | |||
297 | gives the 3dB frequency of the filter in Hz. | 299 | gives the 3dB frequency of the filter in Hz. |
298 | 300 | ||
299 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_raw | 301 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_raw |
302 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_raw | ||
300 | KernelVersion: 2.6.37 | 303 | KernelVersion: 2.6.37 |
301 | Contact: linux-iio@vger.kernel.org | 304 | Contact: linux-iio@vger.kernel.org |
302 | Description: | 305 | Description: |
303 | Raw (unscaled, no bias etc.) output voltage for | 306 | Raw (unscaled, no bias etc.) output voltage for |
304 | channel Y. The number must always be specified and | 307 | channel Y. The number must always be specified and |
305 | unique if the output corresponds to a single channel. | 308 | unique if the output corresponds to a single channel. |
309 | While DAC like devices typically use out_voltage, | ||
310 | a continuous frequency generating device, such as | ||
311 | a DDS or PLL should use out_altvoltage. | ||
306 | 312 | ||
307 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw | 313 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw |
314 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY&Z_raw | ||
308 | KernelVersion: 2.6.37 | 315 | KernelVersion: 2.6.37 |
309 | Contact: linux-iio@vger.kernel.org | 316 | Contact: linux-iio@vger.kernel.org |
310 | Description: | 317 | Description: |
@@ -315,6 +322,8 @@ Description: | |||
315 | 322 | ||
316 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode | 323 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode |
317 | What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode | 324 | What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode |
325 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown_mode | ||
326 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown_mode | ||
318 | KernelVersion: 2.6.38 | 327 | KernelVersion: 2.6.38 |
319 | Contact: linux-iio@vger.kernel.org | 328 | Contact: linux-iio@vger.kernel.org |
320 | Description: | 329 | Description: |
@@ -331,6 +340,8 @@ Description: | |||
331 | 340 | ||
332 | What: /sys/.../iio:deviceX/out_votlageY_powerdown_mode_available | 341 | What: /sys/.../iio:deviceX/out_votlageY_powerdown_mode_available |
333 | What: /sys/.../iio:deviceX/out_voltage_powerdown_mode_available | 342 | What: /sys/.../iio:deviceX/out_voltage_powerdown_mode_available |
343 | What: /sys/.../iio:deviceX/out_altvotlageY_powerdown_mode_available | ||
344 | What: /sys/.../iio:deviceX/out_altvoltage_powerdown_mode_available | ||
334 | KernelVersion: 2.6.38 | 345 | KernelVersion: 2.6.38 |
335 | Contact: linux-iio@vger.kernel.org | 346 | Contact: linux-iio@vger.kernel.org |
336 | Description: | 347 | Description: |
@@ -339,6 +350,8 @@ Description: | |||
339 | 350 | ||
340 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown | 351 | What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown |
341 | What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown | 352 | What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown |
353 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown | ||
354 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown | ||
342 | KernelVersion: 2.6.38 | 355 | KernelVersion: 2.6.38 |
343 | Contact: linux-iio@vger.kernel.org | 356 | Contact: linux-iio@vger.kernel.org |
344 | Description: | 357 | Description: |
@@ -348,6 +361,24 @@ Description: | |||
348 | operation. Y may be suppressed if all outputs are controlled | 361 | operation. Y may be suppressed if all outputs are controlled |
349 | together. | 362 | together. |
350 | 363 | ||
364 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_frequency | ||
365 | KernelVersion: 3.4.0 | ||
366 | Contact: linux-iio@vger.kernel.org | ||
367 | Description: | ||
368 | Output frequency for channel Y in Hz. The number must always be | ||
369 | specified and unique if the output corresponds to a single | ||
370 | channel. | ||
371 | |||
372 | What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_phase | ||
373 | KernelVersion: 3.4.0 | ||
374 | Contact: linux-iio@vger.kernel.org | ||
375 | Description: | ||
376 | Phase in radians of one frequency/clock output Y | ||
377 | (out_altvoltageY) relative to another frequency/clock output | ||
378 | (out_altvoltageZ) of the device X. The number must always be | ||
379 | specified and unique if the output corresponds to a single | ||
380 | channel. | ||
381 | |||
351 | What: /sys/bus/iio/devices/iio:deviceX/events | 382 | What: /sys/bus/iio/devices/iio:deviceX/events |
352 | KernelVersion: 2.6.35 | 383 | KernelVersion: 2.6.35 |
353 | Contact: linux-iio@vger.kernel.org | 384 | Contact: linux-iio@vger.kernel.org |
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index cf9ecd0ae7c..a5a446beb2f 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
@@ -724,7 +724,6 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev) | |||
724 | * New channel registration method - relies on the fact a group does | 724 | * New channel registration method - relies on the fact a group does |
725 | * not need to be initialized if it is name is NULL. | 725 | * not need to be initialized if it is name is NULL. |
726 | */ | 726 | */ |
727 | INIT_LIST_HEAD(&indio_dev->channel_attr_list); | ||
728 | if (indio_dev->channels) | 727 | if (indio_dev->channels) |
729 | for (i = 0; i < indio_dev->num_channels; i++) { | 728 | for (i = 0; i < indio_dev->num_channels; i++) { |
730 | ret = iio_device_add_channel_sysfs(indio_dev, | 729 | ret = iio_device_add_channel_sysfs(indio_dev, |
@@ -788,12 +787,16 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev) | |||
788 | static void iio_dev_release(struct device *device) | 787 | static void iio_dev_release(struct device *device) |
789 | { | 788 | { |
790 | struct iio_dev *indio_dev = dev_to_iio_dev(device); | 789 | struct iio_dev *indio_dev = dev_to_iio_dev(device); |
791 | cdev_del(&indio_dev->chrdev); | 790 | if (indio_dev->chrdev.dev) |
791 | cdev_del(&indio_dev->chrdev); | ||
792 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) | 792 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) |
793 | iio_device_unregister_trigger_consumer(indio_dev); | 793 | iio_device_unregister_trigger_consumer(indio_dev); |
794 | iio_device_unregister_eventset(indio_dev); | 794 | iio_device_unregister_eventset(indio_dev); |
795 | iio_device_unregister_sysfs(indio_dev); | 795 | iio_device_unregister_sysfs(indio_dev); |
796 | iio_device_unregister_debugfs(indio_dev); | 796 | iio_device_unregister_debugfs(indio_dev); |
797 | |||
798 | ida_simple_remove(&iio_ida, indio_dev->id); | ||
799 | kfree(indio_dev); | ||
797 | } | 800 | } |
798 | 801 | ||
799 | static struct device_type iio_dev_type = { | 802 | static struct device_type iio_dev_type = { |
@@ -824,6 +827,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv) | |||
824 | dev_set_drvdata(&dev->dev, (void *)dev); | 827 | dev_set_drvdata(&dev->dev, (void *)dev); |
825 | mutex_init(&dev->mlock); | 828 | mutex_init(&dev->mlock); |
826 | mutex_init(&dev->info_exist_lock); | 829 | mutex_init(&dev->info_exist_lock); |
830 | INIT_LIST_HEAD(&dev->channel_attr_list); | ||
827 | 831 | ||
828 | dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); | 832 | dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); |
829 | if (dev->id < 0) { | 833 | if (dev->id < 0) { |
@@ -841,10 +845,8 @@ EXPORT_SYMBOL(iio_device_alloc); | |||
841 | 845 | ||
842 | void iio_device_free(struct iio_dev *dev) | 846 | void iio_device_free(struct iio_dev *dev) |
843 | { | 847 | { |
844 | if (dev) { | 848 | if (dev) |
845 | ida_simple_remove(&iio_ida, dev->id); | 849 | put_device(&dev->dev); |
846 | kfree(dev); | ||
847 | } | ||
848 | } | 850 | } |
849 | EXPORT_SYMBOL(iio_device_free); | 851 | EXPORT_SYMBOL(iio_device_free); |
850 | 852 | ||
@@ -965,7 +967,7 @@ void iio_device_unregister(struct iio_dev *indio_dev) | |||
965 | mutex_lock(&indio_dev->info_exist_lock); | 967 | mutex_lock(&indio_dev->info_exist_lock); |
966 | indio_dev->info = NULL; | 968 | indio_dev->info = NULL; |
967 | mutex_unlock(&indio_dev->info_exist_lock); | 969 | mutex_unlock(&indio_dev->info_exist_lock); |
968 | device_unregister(&indio_dev->dev); | 970 | device_del(&indio_dev->dev); |
969 | } | 971 | } |
970 | EXPORT_SYMBOL(iio_device_unregister); | 972 | EXPORT_SYMBOL(iio_device_unregister); |
971 | subsys_initcall(iio_init); | 973 | subsys_initcall(iio_init); |
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 6af4a5b302d..bac3bc11d51 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
33 | #include <linux/kconfig.h> | ||
33 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
34 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
35 | #include <linux/fcntl.h> | 36 | #include <linux/fcntl.h> |
@@ -1030,6 +1031,8 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver, | |||
1030 | } | 1031 | } |
1031 | EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); | 1032 | EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); |
1032 | 1033 | ||
1034 | #if IS_ENABLED(CONFIG_USB) | ||
1035 | |||
1033 | static int comedi_old_usb_auto_config(struct usb_interface *intf, | 1036 | static int comedi_old_usb_auto_config(struct usb_interface *intf, |
1034 | struct comedi_driver *driver) | 1037 | struct comedi_driver *driver) |
1035 | { | 1038 | { |
@@ -1092,3 +1095,5 @@ void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver, | |||
1092 | comedi_driver_unregister(comedi_driver); | 1095 | comedi_driver_unregister(comedi_driver); |
1093 | } | 1096 | } |
1094 | EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); | 1097 | EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); |
1098 | |||
1099 | #endif | ||
diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt index 0338c7cd0a8..f03fbd3bb45 100644 --- a/drivers/staging/iio/Documentation/device.txt +++ b/drivers/staging/iio/Documentation/device.txt | |||
@@ -29,8 +29,6 @@ Then fill in the following: | |||
29 | * info->driver_module: | 29 | * info->driver_module: |
30 | Set to THIS_MODULE. Used to ensure correct ownership | 30 | Set to THIS_MODULE. Used to ensure correct ownership |
31 | of various resources allocate by the core. | 31 | of various resources allocate by the core. |
32 | * info->num_interrupt_lines: | ||
33 | Number of event triggering hardware lines the device has. | ||
34 | * info->event_attrs: | 32 | * info->event_attrs: |
35 | Attributes used to enable / disable hardware events. | 33 | Attributes used to enable / disable hardware events. |
36 | * info->attrs: | 34 | * info->attrs: |
diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 2490dd25093..8f1b3af02f2 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig | |||
@@ -13,6 +13,7 @@ config AD7291 | |||
13 | config AD7298 | 13 | config AD7298 |
14 | tristate "Analog Devices AD7298 ADC driver" | 14 | tristate "Analog Devices AD7298 ADC driver" |
15 | depends on SPI | 15 | depends on SPI |
16 | select IIO_KFIFO_BUF if IIO_BUFFER | ||
16 | help | 17 | help |
17 | Say yes here to build support for Analog Devices AD7298 | 18 | Say yes here to build support for Analog Devices AD7298 |
18 | 8 Channel ADC with temperature sensor. | 19 | 8 Channel ADC with temperature sensor. |
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c index 10ab6dc823b..a13afff2dfe 100644 --- a/drivers/staging/iio/adc/ad7606_core.c +++ b/drivers/staging/iio/adc/ad7606_core.c | |||
@@ -235,7 +235,8 @@ static const struct attribute_group ad7606_attribute_group_range = { | |||
235 | .indexed = 1, \ | 235 | .indexed = 1, \ |
236 | .channel = num, \ | 236 | .channel = num, \ |
237 | .address = num, \ | 237 | .address = num, \ |
238 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, \ | 238 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ |
239 | IIO_CHAN_INFO_SCALE_SHARED_BIT, \ | ||
239 | .scan_index = num, \ | 240 | .scan_index = num, \ |
240 | .scan_type = IIO_ST('s', 16, 16, 0), \ | 241 | .scan_type = IIO_ST('s', 16, 16, 0), \ |
241 | } | 242 | } |
diff --git a/drivers/staging/omapdrm/omap_fbdev.c b/drivers/staging/omapdrm/omap_fbdev.c index 11acd4c35ed..8c6ed3b0c6f 100644 --- a/drivers/staging/omapdrm/omap_fbdev.c +++ b/drivers/staging/omapdrm/omap_fbdev.c | |||
@@ -208,7 +208,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, | |||
208 | */ | 208 | */ |
209 | ret = omap_gem_get_paddr(fbdev->bo, &paddr, true); | 209 | ret = omap_gem_get_paddr(fbdev->bo, &paddr, true); |
210 | if (ret) { | 210 | if (ret) { |
211 | dev_err(dev->dev, "could not map (paddr)!\n"); | 211 | dev_err(dev->dev, |
212 | "could not map (paddr)! Skipping framebuffer alloc\n"); | ||
212 | ret = -ENOMEM; | 213 | ret = -ENOMEM; |
213 | goto fail; | 214 | goto fail; |
214 | } | 215 | } |
@@ -388,8 +389,11 @@ void omap_fbdev_free(struct drm_device *dev) | |||
388 | 389 | ||
389 | fbi = helper->fbdev; | 390 | fbi = helper->fbdev; |
390 | 391 | ||
391 | unregister_framebuffer(fbi); | 392 | /* only cleanup framebuffer if it is present */ |
392 | framebuffer_release(fbi); | 393 | if (fbi) { |
394 | unregister_framebuffer(fbi); | ||
395 | framebuffer_release(fbi); | ||
396 | } | ||
393 | 397 | ||
394 | drm_fb_helper_fini(helper); | 398 | drm_fb_helper_fini(helper); |
395 | 399 | ||
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index aeb19e68e08..11a2aa2a56c 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -258,7 +258,7 @@ fail: | |||
258 | return rc; | 258 | return rc; |
259 | } | 259 | } |
260 | 260 | ||
261 | int pstore_fill_super(struct super_block *sb, void *data, int silent) | 261 | static int pstore_fill_super(struct super_block *sb, void *data, int silent) |
262 | { | 262 | { |
263 | struct inode *inode; | 263 | struct inode *inode; |
264 | 264 | ||
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 9123cce28c1..453030f9c5b 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -106,6 +106,8 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | |||
106 | time->tv_sec = 0; | 106 | time->tv_sec = 0; |
107 | time->tv_nsec = 0; | 107 | time->tv_nsec = 0; |
108 | 108 | ||
109 | /* Update old/shadowed buffer. */ | ||
110 | persistent_ram_save_old(prz); | ||
109 | size = persistent_ram_old_size(prz); | 111 | size = persistent_ram_old_size(prz); |
110 | *buf = kmalloc(size, GFP_KERNEL); | 112 | *buf = kmalloc(size, GFP_KERNEL); |
111 | if (*buf == NULL) | 113 | if (*buf == NULL) |
@@ -184,6 +186,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, | |||
184 | return -EINVAL; | 186 | return -EINVAL; |
185 | 187 | ||
186 | persistent_ram_free_old(cxt->przs[id]); | 188 | persistent_ram_free_old(cxt->przs[id]); |
189 | persistent_ram_zap(cxt->przs[id]); | ||
187 | 190 | ||
188 | return 0; | 191 | return 0; |
189 | } | 192 | } |
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 31f8d184f3a..c5fbdbbf81a 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c | |||
@@ -250,23 +250,24 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz, | |||
250 | persistent_ram_update_ecc(prz, start, count); | 250 | persistent_ram_update_ecc(prz, start, count); |
251 | } | 251 | } |
252 | 252 | ||
253 | static void __init | 253 | void persistent_ram_save_old(struct persistent_ram_zone *prz) |
254 | persistent_ram_save_old(struct persistent_ram_zone *prz) | ||
255 | { | 254 | { |
256 | struct persistent_ram_buffer *buffer = prz->buffer; | 255 | struct persistent_ram_buffer *buffer = prz->buffer; |
257 | size_t size = buffer_size(prz); | 256 | size_t size = buffer_size(prz); |
258 | size_t start = buffer_start(prz); | 257 | size_t start = buffer_start(prz); |
259 | char *dest; | ||
260 | 258 | ||
261 | persistent_ram_ecc_old(prz); | 259 | if (!size) |
260 | return; | ||
262 | 261 | ||
263 | dest = kmalloc(size, GFP_KERNEL); | 262 | if (!prz->old_log) { |
264 | if (dest == NULL) { | 263 | persistent_ram_ecc_old(prz); |
264 | prz->old_log = kmalloc(size, GFP_KERNEL); | ||
265 | } | ||
266 | if (!prz->old_log) { | ||
265 | pr_err("persistent_ram: failed to allocate buffer\n"); | 267 | pr_err("persistent_ram: failed to allocate buffer\n"); |
266 | return; | 268 | return; |
267 | } | 269 | } |
268 | 270 | ||
269 | prz->old_log = dest; | ||
270 | prz->old_log_size = size; | 271 | prz->old_log_size = size; |
271 | memcpy(prz->old_log, &buffer->data[start], size - start); | 272 | memcpy(prz->old_log, &buffer->data[start], size - start); |
272 | memcpy(prz->old_log + size - start, &buffer->data[0], start); | 273 | memcpy(prz->old_log + size - start, &buffer->data[0], start); |
@@ -319,6 +320,13 @@ void persistent_ram_free_old(struct persistent_ram_zone *prz) | |||
319 | prz->old_log_size = 0; | 320 | prz->old_log_size = 0; |
320 | } | 321 | } |
321 | 322 | ||
323 | void persistent_ram_zap(struct persistent_ram_zone *prz) | ||
324 | { | ||
325 | atomic_set(&prz->buffer->start, 0); | ||
326 | atomic_set(&prz->buffer->size, 0); | ||
327 | persistent_ram_update_header_ecc(prz); | ||
328 | } | ||
329 | |||
322 | static void *persistent_ram_vmap(phys_addr_t start, size_t size) | 330 | static void *persistent_ram_vmap(phys_addr_t start, size_t size) |
323 | { | 331 | { |
324 | struct page **pages; | 332 | struct page **pages; |
@@ -405,6 +413,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool | |||
405 | " size %zu, start %zu\n", | 413 | " size %zu, start %zu\n", |
406 | buffer_size(prz), buffer_start(prz)); | 414 | buffer_size(prz), buffer_start(prz)); |
407 | persistent_ram_save_old(prz); | 415 | persistent_ram_save_old(prz); |
416 | return 0; | ||
408 | } | 417 | } |
409 | } else { | 418 | } else { |
410 | pr_info("persistent_ram: no valid data in buffer" | 419 | 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 | |||
412 | } | 421 | } |
413 | 422 | ||
414 | prz->buffer->sig = PERSISTENT_RAM_SIG; | 423 | prz->buffer->sig = PERSISTENT_RAM_SIG; |
415 | atomic_set(&prz->buffer->start, 0); | 424 | persistent_ram_zap(prz); |
416 | atomic_set(&prz->buffer->size, 0); | ||
417 | 425 | ||
418 | return 0; | 426 | return 0; |
419 | } | 427 | } |
@@ -448,7 +456,6 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, | |||
448 | goto err; | 456 | goto err; |
449 | 457 | ||
450 | persistent_ram_post_init(prz, ecc); | 458 | persistent_ram_post_init(prz, ecc); |
451 | persistent_ram_update_header_ecc(prz); | ||
452 | 459 | ||
453 | return prz; | 460 | return prz; |
454 | err: | 461 | err: |
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 7ed7fd4dba4..3b823d49a85 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h | |||
@@ -69,12 +69,14 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, | |||
69 | size_t size, | 69 | size_t size, |
70 | bool ecc); | 70 | bool ecc); |
71 | void persistent_ram_free(struct persistent_ram_zone *prz); | 71 | void persistent_ram_free(struct persistent_ram_zone *prz); |
72 | void persistent_ram_zap(struct persistent_ram_zone *prz); | ||
72 | struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, | 73 | struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, |
73 | bool ecc); | 74 | bool ecc); |
74 | 75 | ||
75 | int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, | 76 | int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, |
76 | unsigned int count); | 77 | unsigned int count); |
77 | 78 | ||
79 | void persistent_ram_save_old(struct persistent_ram_zone *prz); | ||
78 | size_t persistent_ram_old_size(struct persistent_ram_zone *prz); | 80 | size_t persistent_ram_old_size(struct persistent_ram_zone *prz); |
79 | void *persistent_ram_old(struct persistent_ram_zone *prz); | 81 | void *persistent_ram_old(struct persistent_ram_zone *prz); |
80 | void persistent_ram_free_old(struct persistent_ram_zone *prz); | 82 | void persistent_ram_free_old(struct persistent_ram_zone *prz); |