- 07 6月, 2013 40 次提交
-
-
由 Jiang Liu 提交于
Some architectures provides architecture-specific, optimized version of clear_page()/copy_page(), which may have better performance than memset()/memcpy(). So use clear_page()/copy_page() to optimize zram performance if possible. Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
Now there's no caller of zram_get_num_devices(), so kill it. And change zram_devices to static because it's only used in zram_drv.c. Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
Simplify and optimize dev_to_zram() without walking the zram_devices array. Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
Use zram->init_lock to protect access to zram->meta, otherwise it may cause invalid memory access if zram->meta has been freed by zram_reset_device(). This issue may be triggered by: Thread 1: while true; do cat mem_used_total; done Thread 2: while true; do echo 8M > disksize; echo 1 > reset; done Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Acked-by: NMinchan Kim <minchan@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
Function valid_io_request() should verify the entire request are within the zram device address range. Otherwise it may cause invalid memory access when accessing/modifying zram->meta->table[index] because the 'index' is out of range. Then it may access non-exist memory, randomly modify memory belong to other subsystems, which is hard to track down. Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
When doing a patial write and the whole page is filled with zero, zram_bvec_write() will free uncmem twice. Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Acked-by: NMinchan Kim <minchan@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
On error recovery path of zram_init(), it leaks the zram device object causing the failure. So change create_device() to free allocated resources on error path. Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Acked-by: NMinchan Kim <minchan@kernel.org> Acked-by: NJerome Marchand <jmarchan@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
zram_slot_free_notify() is free-running without any protection from concurrent operations. So there are race conditions between zram_bvec_read()/zram_bvec_write() and zram_slot_free_notify(), and possible consequences include: 1) Trigger BUG_ON(!handle) on zram_bvec_write() side. 2) Access to freed pages on zram_bvec_read() side. 3) Break some fields (bad_compress, good_compress, pages_stored) in zram->stats if the swap layer makes concurrently call to zram_slot_free_notify(). So enhance zram_slot_free_notify() to acquire writer lock on zram->lock before calling zram_free_page(). Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Jiang Liu 提交于
Memory for zram->disk object may have already been freed after returning from destroy_device(zram), then it's unsafe for zram_reset_device(zram) to access zram->disk again. We can't solve this bug by flipping the order of destroy_device(zram) and zram_reset_device(zram), that will cause deadlock issues to the zram sysfs handler. So fix it by holding an extra reference to zram->disk before calling destroy_device(zram). Signed-off-by: NJiang Liu <jiang.liu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Tidy up the multi-line comment at the beginning of the file to follow the CodingStyle. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Rename the boardinfo table so it has namespace associated with the driver. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
For aesthetic reasons, add some whitespace to the subdevice init and reorder it a bit. Remove the blank line printk at the end of the attach. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
For aesthetic reasons, rename the function. Use a local variable for the 'reg' offset that is stored in the comedi_subdevice 'private' pointer to minimize the number of casts. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
For aesthetic reasons, rename the function. Use a local variable for the 'reg' offset that is stored in the comedi_subdevice 'private' pointer to minimize the number of casts. Also, add local variables for the 'mask' and 'bits'. The outputs only need to be updated if the 'mask' indicates that the 'bits' are changing. Move the update code into the main 'if (mask)' block. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Convert the boardinfo declaration to C99 format and move it near the struct definition. Since the *_SIZE defines are only used in the boardinfo, remove them and just open code the values in the boardinfo. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Introduce some helper functions to check if a given 'range' index to a comedi_subdevice 'range_table' is a bipolar or unipolar range. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
This driver does not use interrupts and the comedi core handles the allocation of the io resource so these includes are not required. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
According to the PCM-A/D-12/16 Operations Manual: NOTE: On the PCM-A/D-12 the lower nibble of the hex value will always be 0. Fix the pcmad_ai_insn_read() function to properly handle this by shifting the data after it has been read. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
The comedi_config utility is used to attach to this board. One of the configuration options passed by the user sets the analog input encoding for straight binary or two's complement data. The hardware produces straight binary data when jumpered for 5V unipolar inputs and two's complement data when jumpered for +-10V bipolar inputs. Use the configuration option to correctly set the comedi_subdevice range_table. We can then use a helper function to determine what the range is when reading the analog inputs. This allows removing the 'twos_comp' variable from the private data (which was actually never used). Since the private data is now empty, remove it completely. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
The comedi_config utility is used to attach to this board. One of the configuration options passed by the user sets the analog input reference for single-ended or differential inputs. Use the configuration option to correctly set the comedi_subdevice flags as well as the number of channels. Remove the 'differential' variable from the private data. Its not used by the driver. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
This information is only used to set the subdevice 'maxdata'. Change it so the calculation is not needed. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Remove the comment before the function, the options are documented at the beginning of the file. Remove the PCMAD_SIZE define. It's only used in the attach to specify the io region size. For aesthetic reasons, add some whitespace to the subdevice init and reorder them a bit. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Use a local variable to read and munge the analog input data instead of directly using the 'data' pointer passed to the function. (*insn_read) functions either return an errno or the number of data values read. Change the final return to insn->n to make this clearer. Tidy up the function. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
The const boardinfo pointer is only used in this function to work out the value needed to convert the data to its twos complement. Use the comedi_subdevice 'maxdata' to do this conversion and remove the 'board' pointer. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Instead of returning invalid data, return -ETIME if the analog input conversion times out. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
For aesthetic reasons, move the boardinfo declaration so it follows the definition. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 H Hartley Sweeten 提交于
Tidy up the multi-line comments at the beginning of the file to follow the CodingStyle. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Xenia Ragiadakou 提交于
read_nic_*() functions are defined in r8192U_core.c. They call internally usb_control_msg() to read the nic registers and return the value read. Following a remark made by Dan Carpenter, if usb_control_msg() fails, the value returned will be invalid. To accommodate for this, this patch changes the functions to take a pointer as argument to set the value read and return 0 on success and the error status on failure, so that callers of read_nic_*() can check the return status. Some other fixes introduced in read_nic_*() functions are: The expressions (1<<EPROM_*_SHIFT) used to address and set the individual bits of the eeprom register were replaced with EPROM_*_BIT bitmasks to make the code more intuitive. EPROM_*_BIT bitmasks were defined in r8192U_hw.h and EPROM_*_SHIFT were removed. In netdev_err(), which is called in case of failure, the hardcoded function name in the error log message was replaced with __func__ to reduce line size. Also, from the error log message, it was omitted the word "Timeout" and it is just reported the error code since the failure can not only be due to timeout expiration but also due to a memory allocation failure. In case of timeout expiration, usb_start_wait_urb() prints an appropriate log message when debug is enabled. Finally, some minor fixes to the coding style were applied in lines affected by the above changes, including the removal of ifdef DEBUG_RX (the debugging of reads and writes of the nic registers shall be done with explicit check on their return status which will be added in a follow on patch). Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Dan Carpenter 提交于
Sean MacLennan fixed this in the rtl8192e driver and we should fix it here as well. It's pretty harmless. This information comes from the firmware, if we were to hit this bug we would read beyond the end of the array once or twice before returning and update our statistics with bogus data. Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Johannes Schilling 提交于
resolves checkpatch errors and warnings regarding whitespace around operators, line lengths and indentation. Signed-off-by: NLaura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: NJohannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Laura Lawniczak 提交于
Function usb_stor_print_cmd was declared in init.c but only used in transport.c. So it was reasonable to move it there and declare it static Signed-off-by: NLaura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Laura Lawniczak 提交于
Signed-off-by: NLaura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: NJohannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Laura Lawniczak 提交于
as per suggestion of checkpatch.pl; this resolves warnings like "Prefer netdev_info .. then dev_info .. to printk". Changed signature of function usb_stor_print_cmd in init.c to enable usage of dev_err Signed-off-by: NLaura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: NJohannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Johannes Schilling 提交于
as advised by checkpatch, changed generic max(..) to max_t(int, .. Signed-off-by: NLaura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: NJohannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Johannes Schilling 提交于
resolves checkpatch.pl warning "do not add new typedefs" and renames allcaps structures. Signed-off-by: NLaura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: NJohannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Peng Tao 提交于
No need to cast count since it is already ssize_t. No need to cast payload to const, but need __force instead to avoid Sparse complaining. Reported-and-Suggested-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NPeng Tao <tao.peng@emc.com> Signed-off-by: NAndreas Dilger <andreas.dilger@intel.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Peng Tao 提交于
mdc_kuc_fops is missing open/release handlers. I fixed it before but somehow forgot to amend to the patch sent out. Sorry... Signed-off-by: NPeng Tao <tao.peng@emc.com> Signed-off-by: NAndreas Dilger <andreas.dilger@intel.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Peng Tao 提交于
This reverts commit 37d4093f. I've verified that we now don't break build on X86_64 allmodconfig. Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: NPeng Tao <tao.peng@emc.com> Signed-off-by: NAndreas Dilger <andreas.dilger@intel.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Peng Tao 提交于
We don't need to implement crc32 and crc32pclmul on our own. The crc32-pclmul support was merged into the 3.8 kernel in commit 78c37d19, no need to keep a local copy in Lustre anymore. The crc32 implementation is identical to crypto-crc32. So drop Lustre's private implementation and select kernel crypto in Kconfig. Reported-by: NStephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: NPeng Tao <tao.peng@emc.com> Signed-off-by: NAndreas Dilger <andreas.dilger@intel.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Peng Tao 提交于
module_refcount() is not available when CONFIG_MODULE_UNLOAD is off. Reported-by: NStephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: NPeng Tao <tao.peng@emc.com> Signed-off-by: NAndreas Dilger <andreas.dilger@intel.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-