Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+82 -27
+31
Documentation/ABI/testing/sysfs-bus-iio
··· 219 219 What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale 220 220 What: /sys/bus/iio/devices/iio:deviceX/in_voltage_scale 221 221 What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_scale 222 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_scale 222 223 What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale 223 224 What: /sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale 224 225 What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_scale ··· 274 273 What: /sys/.../iio:deviceX/in_voltageX_scale_available 275 274 What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available 276 275 What: /sys/.../iio:deviceX/out_voltageX_scale_available 276 + What: /sys/.../iio:deviceX/out_altvoltageX_scale_available 277 277 What: /sys/.../iio:deviceX/in_capacitance_scale_available 278 278 KernelVersion: 2.635 279 279 Contact: linux-iio@vger.kernel.org ··· 300 298 gives the 3dB frequency of the filter in Hz. 301 299 302 300 What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_raw 301 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_raw 303 302 KernelVersion: 2.6.37 304 303 Contact: linux-iio@vger.kernel.org 305 304 Description: 306 305 Raw (unscaled, no bias etc.) output voltage for 307 306 channel Y. The number must always be specified and 308 307 unique if the output corresponds to a single channel. 308 + While DAC like devices typically use out_voltage, 309 + a continuous frequency generating device, such as 310 + a DDS or PLL should use out_altvoltage. 309 311 310 312 What: /sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw 313 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY&Z_raw 311 314 KernelVersion: 2.6.37 312 315 Contact: linux-iio@vger.kernel.org 313 316 Description: ··· 323 316 324 317 What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode 325 318 What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode 319 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown_mode 320 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown_mode 326 321 KernelVersion: 2.6.38 327 322 Contact: linux-iio@vger.kernel.org 328 323 Description: ··· 339 330 340 331 What: /sys/.../iio:deviceX/out_votlageY_powerdown_mode_available 341 332 What: /sys/.../iio:deviceX/out_voltage_powerdown_mode_available 333 + What: /sys/.../iio:deviceX/out_altvotlageY_powerdown_mode_available 334 + What: /sys/.../iio:deviceX/out_altvoltage_powerdown_mode_available 342 335 KernelVersion: 2.6.38 343 336 Contact: linux-iio@vger.kernel.org 344 337 Description: ··· 349 338 350 339 What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown 351 340 What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown 341 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown 342 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown 352 343 KernelVersion: 2.6.38 353 344 Contact: linux-iio@vger.kernel.org 354 345 Description: ··· 358 345 by the corresponding outY_powerdown_mode. Clearing returns to 359 346 normal operation. Y may be suppressed if all outputs are 360 347 controlled together. 348 + 349 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_frequency 350 + KernelVersion: 3.4.0 351 + Contact: linux-iio@vger.kernel.org 352 + Description: 353 + Output frequency for channel Y in Hz. The number must always be 354 + specified and unique if the output corresponds to a single 355 + channel. 356 + 357 + What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_phase 358 + KernelVersion: 3.4.0 359 + Contact: linux-iio@vger.kernel.org 360 + Description: 361 + Phase in radians of one frequency/clock output Y 362 + (out_altvoltageY) relative to another frequency/clock output 363 + (out_altvoltageZ) of the device X. The number must always be 364 + specified and unique if the output corresponds to a single 365 + channel. 361 366 362 367 What: /sys/bus/iio/devices/iio:deviceX/events 363 368 KernelVersion: 2.6.35
+1 -2
drivers/iio/Kconfig
··· 8 8 help 9 9 The industrial I/O subsystem provides a unified framework for 10 10 drivers for many different types of embedded sensors using a 11 - number of different physical interfaces (i2c, spi, etc). See 12 - Documentation/iio for more information. 11 + number of different physical interfaces (i2c, spi, etc). 13 12 14 13 if IIO 15 14
+9 -7
drivers/iio/industrialio-core.c
··· 661 661 * New channel registration method - relies on the fact a group does 662 662 * not need to be initialized if it is name is NULL. 663 663 */ 664 - INIT_LIST_HEAD(&indio_dev->channel_attr_list); 665 664 if (indio_dev->channels) 666 665 for (i = 0; i < indio_dev->num_channels; i++) { 667 666 ret = iio_device_add_channel_sysfs(indio_dev, ··· 724 725 static void iio_dev_release(struct device *device) 725 726 { 726 727 struct iio_dev *indio_dev = dev_to_iio_dev(device); 727 - cdev_del(&indio_dev->chrdev); 728 + if (indio_dev->chrdev.dev) 729 + cdev_del(&indio_dev->chrdev); 728 730 if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) 729 731 iio_device_unregister_trigger_consumer(indio_dev); 730 732 iio_device_unregister_eventset(indio_dev); 731 733 iio_device_unregister_sysfs(indio_dev); 732 734 iio_device_unregister_debugfs(indio_dev); 735 + 736 + ida_simple_remove(&iio_ida, indio_dev->id); 737 + kfree(indio_dev); 733 738 } 734 739 735 740 static struct device_type iio_dev_type = { ··· 764 761 dev_set_drvdata(&dev->dev, (void *)dev); 765 762 mutex_init(&dev->mlock); 766 763 mutex_init(&dev->info_exist_lock); 764 + INIT_LIST_HEAD(&dev->channel_attr_list); 767 765 768 766 dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); 769 767 if (dev->id < 0) { ··· 782 778 783 779 void iio_device_free(struct iio_dev *dev) 784 780 { 785 - if (dev) { 786 - ida_simple_remove(&iio_ida, dev->id); 787 - kfree(dev); 788 - } 781 + if (dev) 782 + put_device(&dev->dev); 789 783 } 790 784 EXPORT_SYMBOL(iio_device_free); 791 785 ··· 904 902 mutex_lock(&indio_dev->info_exist_lock); 905 903 indio_dev->info = NULL; 906 904 mutex_unlock(&indio_dev->info_exist_lock); 907 - device_unregister(&indio_dev->dev); 905 + device_del(&indio_dev->dev); 908 906 } 909 907 EXPORT_SYMBOL(iio_device_unregister); 910 908 subsys_initcall(iio_init);
+5
drivers/staging/comedi/drivers.c
··· 30 30 #include <linux/pci.h> 31 31 #include <linux/usb.h> 32 32 #include <linux/errno.h> 33 + #include <linux/kconfig.h> 33 34 #include <linux/kernel.h> 34 35 #include <linux/sched.h> 35 36 #include <linux/fcntl.h> ··· 982 981 } 983 982 EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); 984 983 984 + #if IS_ENABLED(CONFIG_USB) 985 + 985 986 static int comedi_old_usb_auto_config(struct usb_interface *intf, 986 987 struct comedi_driver *driver) 987 988 { ··· 1046 1043 comedi_driver_unregister(comedi_driver); 1047 1044 } 1048 1045 EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); 1046 + 1047 + #endif
-2
drivers/staging/iio/Documentation/device.txt
··· 29 29 * info->driver_module: 30 30 Set to THIS_MODULE. Used to ensure correct ownership 31 31 of various resources allocate by the core. 32 - * info->num_interrupt_lines: 33 - Number of event triggering hardware lines the device has. 34 32 * info->event_attrs: 35 33 Attributes used to enable / disable hardware events. 36 34 * info->attrs:
+1
drivers/staging/iio/adc/Kconfig
··· 13 13 config AD7298 14 14 tristate "Analog Devices AD7298 ADC driver" 15 15 depends on SPI 16 + select IIO_KFIFO_BUF if IIO_BUFFER 16 17 help 17 18 Say yes here to build support for Analog Devices AD7298 18 19 8 Channel ADC with temperature sensor.
+2 -1
drivers/staging/iio/adc/ad7606_core.c
··· 235 235 .indexed = 1, \ 236 236 .channel = num, \ 237 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 240 .scan_index = num, \ 240 241 .scan_type = IIO_ST('s', 16, 16, 0), \ 241 242 }
+7 -3
drivers/staging/omapdrm/omap_fbdev.c
··· 208 208 */ 209 209 ret = omap_gem_get_paddr(fbdev->bo, &paddr, true); 210 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 213 ret = -ENOMEM; 213 214 goto fail; 214 215 } ··· 389 388 390 389 fbi = helper->fbdev; 391 390 392 - unregister_framebuffer(fbi); 393 - framebuffer_release(fbi); 391 + /* only cleanup framebuffer if it is present */ 392 + if (fbi) { 393 + unregister_framebuffer(fbi); 394 + framebuffer_release(fbi); 395 + } 394 396 395 397 drm_fb_helper_fini(helper); 396 398
+2
drivers/staging/rtl8712/usb_intf.c
··· 102 102 /* - */ 103 103 {USB_DEVICE(0x20F4, 0x646B)}, 104 104 {USB_DEVICE(0x083A, 0xC512)}, 105 + {USB_DEVICE(0x25D4, 0x4CA1)}, 106 + {USB_DEVICE(0x25D4, 0x4CAB)}, 105 107 106 108 /* RTL8191SU */ 107 109 /* Realtek */
+1 -1
fs/pstore/inode.c
··· 258 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 263 struct inode *inode; 264 264
+3
fs/pstore/ram.c
··· 106 106 time->tv_sec = 0; 107 107 time->tv_nsec = 0; 108 108 109 + /* Update old/shadowed buffer. */ 110 + persistent_ram_save_old(prz); 109 111 size = persistent_ram_old_size(prz); 110 112 *buf = kmalloc(size, GFP_KERNEL); 111 113 if (*buf == NULL) ··· 186 184 return -EINVAL; 187 185 188 186 persistent_ram_free_old(cxt->przs[id]); 187 + persistent_ram_zap(cxt->przs[id]); 189 188 190 189 return 0; 191 190 }
+17 -10
fs/pstore/ram_core.c
··· 250 250 persistent_ram_update_ecc(prz, start, count); 251 251 } 252 252 253 - static void __init 254 - persistent_ram_save_old(struct persistent_ram_zone *prz) 253 + void persistent_ram_save_old(struct persistent_ram_zone *prz) 255 254 { 256 255 struct persistent_ram_buffer *buffer = prz->buffer; 257 256 size_t size = buffer_size(prz); 258 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); 264 - if (dest == NULL) { 262 + if (!prz->old_log) { 263 + persistent_ram_ecc_old(prz); 264 + prz->old_log = kmalloc(size, GFP_KERNEL); 265 + } 266 + if (!prz->old_log) { 265 267 pr_err("persistent_ram: failed to allocate buffer\n"); 266 268 return; 267 269 } 268 270 269 - prz->old_log = dest; 270 271 prz->old_log_size = size; 271 272 memcpy(prz->old_log, &buffer->data[start], size - start); 272 273 memcpy(prz->old_log + size - start, &buffer->data[0], start); ··· 318 317 kfree(prz->old_log); 319 318 prz->old_log = NULL; 320 319 prz->old_log_size = 0; 320 + } 321 + 322 + void persistent_ram_zap(struct persistent_ram_zone *prz) 323 + { 324 + atomic_set(&prz->buffer->start, 0); 325 + atomic_set(&prz->buffer->size, 0); 326 + persistent_ram_update_header_ecc(prz); 321 327 } 322 328 323 329 static void *persistent_ram_vmap(phys_addr_t start, size_t size) ··· 413 405 " size %zu, start %zu\n", 414 406 buffer_size(prz), buffer_start(prz)); 415 407 persistent_ram_save_old(prz); 408 + return 0; 416 409 } 417 410 } else { 418 411 pr_info("persistent_ram: no valid data in buffer" ··· 421 412 } 422 413 423 414 prz->buffer->sig = PERSISTENT_RAM_SIG; 424 - atomic_set(&prz->buffer->start, 0); 425 - atomic_set(&prz->buffer->size, 0); 415 + persistent_ram_zap(prz); 426 416 427 417 return 0; 428 418 } ··· 456 448 goto err; 457 449 458 450 persistent_ram_post_init(prz, ecc); 459 - persistent_ram_update_header_ecc(prz); 460 451 461 452 return prz; 462 453 err:
+2
include/linux/pstore_ram.h
··· 69 69 size_t size, 70 70 bool ecc); 71 71 void persistent_ram_free(struct persistent_ram_zone *prz); 72 + void persistent_ram_zap(struct persistent_ram_zone *prz); 72 73 struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, 73 74 bool ecc); 74 75 75 76 int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, 76 77 unsigned int count); 77 78 79 + void persistent_ram_save_old(struct persistent_ram_zone *prz); 78 80 size_t persistent_ram_old_size(struct persistent_ram_zone *prz); 79 81 void *persistent_ram_old(struct persistent_ram_zone *prz); 80 82 void persistent_ram_free_old(struct persistent_ram_zone *prz);