]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
11 years agostaging: dgrp: prefix function names with dgrp_ in dgrp_specproc.c
Tommi Rantala [Fri, 8 Feb 2013 11:41:26 +0000 (13:41 +0200)]
staging: dgrp: prefix function names with dgrp_ in dgrp_specproc.c

Prefix the functions in dgrp_specproc.c to avoid ambiguity in backtraces, such
as the "info_proc_open" in this one:

unreferenced object 0xffff88003b6696e0 (size 32):
  comm "cat", pid 2321, jiffies 4294705179 (age 29.434s)
  hex dump (first 32 bytes):
    40 79 1c 81 ff ff ff ff 60 79 1c 81 ff ff ff ff  @y......`y......
    50 79 1c 81 ff ff ff ff b0 62 89 81 ff ff ff ff  Py.......b......
  backtrace:
    [<ffffffff81c7e3b1>] kmemleak_alloc+0x21/0x50
    [<ffffffff811955cb>] kmem_cache_alloc_trace+0x11b/0x190
    [<ffffffff811c87dc>] single_open+0x3c/0xc0
    [<ffffffff81896495>] info_proc_open+0x15/0x20
    [<ffffffff8120c6d7>] proc_reg_open+0xb7/0x160
    [<ffffffff811a1a5c>] do_dentry_open+0x1cc/0x280
    [<ffffffff811a296a>] finish_open+0x4a/0x60
    [<ffffffff811b14d7>] do_last+0xb07/0xdb0
    [<ffffffff811b1842>] path_openat+0xc2/0x4f0
    [<ffffffff811b1cac>] do_filp_open+0x3c/0xa0
    [<ffffffff811a2dcc>] do_sys_open+0x11c/0x1c0
    [<ffffffff811a2e8c>] sys_open+0x1c/0x20
    [<ffffffff81ca3d69>] system_call_fastpath+0x16/0x1b
    [<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgrp: use correct release op for /proc/dgrp/info
Tommi Rantala [Fri, 8 Feb 2013 11:41:25 +0000 (13:41 +0200)]
staging: dgrp: use correct release op for /proc/dgrp/info

Trinity (the syscall fuzzer) discovered that reading /proc/dgrp/info was
leaking some memory. Fix by using the correct release op in info_proc_file_ops.

unreferenced object 0xffff88003b6696e0 (size 32):
  comm "cat", pid 2321, jiffies 4294705179 (age 29.434s)
  hex dump (first 32 bytes):
    40 79 1c 81 ff ff ff ff 60 79 1c 81 ff ff ff ff  @y......`y......
    50 79 1c 81 ff ff ff ff b0 62 89 81 ff ff ff ff  Py.......b......
  backtrace:
    [<ffffffff81c7e3b1>] kmemleak_alloc+0x21/0x50
    [<ffffffff811955cb>] kmem_cache_alloc_trace+0x11b/0x190
    [<ffffffff811c87dc>] single_open+0x3c/0xc0
    [<ffffffff81896495>] info_proc_open+0x15/0x20
    [<ffffffff8120c6d7>] proc_reg_open+0xb7/0x160
    [<ffffffff811a1a5c>] do_dentry_open+0x1cc/0x280
    [<ffffffff811a296a>] finish_open+0x4a/0x60
    [<ffffffff811b14d7>] do_last+0xb07/0xdb0
    [<ffffffff811b1842>] path_openat+0xc2/0x4f0
    [<ffffffff811b1cac>] do_filp_open+0x3c/0xa0
    [<ffffffff811a2dcc>] do_sys_open+0x11c/0x1c0
    [<ffffffff811a2e8c>] sys_open+0x1c/0x20
    [<ffffffff81ca3d69>] system_call_fastpath+0x16/0x1b
    [<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: correct error message in comedi_alloc_subdevice_minor()
Ian Abbott [Thu, 7 Feb 2013 16:03:01 +0000 (16:03 +0000)]
staging: comedi: correct error message in comedi_alloc_subdevice_minor()

`comedi_alloc_subdevice_minors()` currently prints a message about
running out of minor numbers board device files if it runs out of minor
device numbers.  Change it to complain about running out of minor device
numbers for subdevice files as these are in a different range, not
shared with those for board device files.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: don't return minor from comedi_alloc_subdevice_minor()
Ian Abbott [Thu, 7 Feb 2013 16:03:00 +0000 (16:03 +0000)]
staging: comedi: don't return minor from comedi_alloc_subdevice_minor()

`comedi_alloc_subdevice_minor()` currently returns the allocated minor
device number on success.  This is not really of any interest to the
caller (in fact the return value is not even checked), so just return 0
on success.  If the caller really needs to know the allocated minor
device number it can look in `s->minor`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/goldfish: Add MTD dependency to KCONFIG
Peter Huewe [Thu, 7 Feb 2013 22:46:38 +0000 (23:46 +0100)]
staging/goldfish: Add MTD dependency to KCONFIG

If CONFIG_MTD is not set goldfish_nand fails to compile with the
following linker warnings:

drivers/built-in.o: In function `goldfish_nand_remove':
goldfish_nand.c:(.text+0x6e7d0e): undefined reference to
`mtd_device_unregister'
drivers/built-in.o: In function `goldfish_nand_erase':
goldfish_nand.c:(.text+0x6e8ba2): undefined reference to
`mtd_erase_callback'
drivers/built-in.o: In function `goldfish_nand_init_device':
goldfish_nand.c:(.text+0x6e8eba): undefined reference to
`mtd_device_parse_register'

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/goldfish: Use %zx for printing size_t variables
Peter Huewe [Thu, 7 Feb 2013 22:57:07 +0000 (23:57 +0100)]
staging/goldfish: Use %zx for printing size_t variables

When building the driver, gcc emits the following warnings:
.../drivers/staging/goldfish/goldfish_nand.c:
In function 'goldfish_nand_read_oob':
goldfish_nand.c:159:2:
warning: format '%x' expects argument of type 'unsigned int', but
argument 3 has type 'size_t' [-Wformat]
goldfish_nand.c:159:2:
warning: format '%x' expects argument of type 'unsigned int', but
argument 4 has type 'size_t' [-Wformat]

In function 'goldfish_nand_write_oob':
goldfish_nand.c:191:2:
warning: format '%x' expects argument of type 'unsigned int', but
argument 3 has type 'size_t' [-Wformat]
goldfish_nand.c:191:2:
warning: format '%x' expects argument of type 'unsigned int', but
argument 4 has type 'size_t' [-Wformat]

In function 'goldfish_nand_read':
goldfish_nand.c:215:2:
warning: format '%x' expects argument of type 'unsigned int', but
argument 3 has type 'size_t' [-Wformat]

In function 'goldfish_nand_write':
goldfish_nand.c:239:2:
warning: format '%x' expects argument of type 'unsigned int', but
argument 3 has type 'size_t' [-Wformat]

-> As defined in the printk-formats use %zx for size_t variables

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_dio24: add back missing 'if (ret)'
H Hartley Sweeten [Thu, 7 Feb 2013 20:27:10 +0000 (13:27 -0700)]
staging: comedi: ni_daq_dio24: add back missing 'if (ret)'

The 'if (ret)' after calling comedi_pcmcia_enable() was accidentally
removed in:

Commit: 573a964882065f9b2cb71db8a225ba067b4b5b7a
staging: comedi: ni_daq_dio24: use comedi_pcmcia_{enable,disable}

Put if back so that dio24_auto_attach() can finish attaching to
the board after enabling the pcmcia device.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: xgifb: initialize register 3cc address
Aaro Koskinen [Thu, 7 Feb 2013 16:45:40 +0000 (18:45 +0200)]
staging: xgifb: initialize register 3cc address

Commit 56810a92c689c64d586a51a1078c5d307b24e8eb (staging: xgifb: use
XGIRegInit()) left 3cc uninitialized, and it may trigger a panic during
probe. Fix this.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: fix build error
H Hartley Sweeten [Wed, 6 Feb 2013 21:12:07 +0000 (14:12 -0700)]
staging: comedi: quatech_daqp_cs: fix build error

The kbuild test robot reported a build error in this driver caused by:

commit: a3ac95195b020a0a8fa2a9b0649145324ba64c83
staging: comedi: comedi_pcmcia: allow drivers to use a custom conf_check()

This commit changed the comedi_pcmcia_enable() function so that it now
takes two arguments. The new argument is an optional (*conf_check)
function that is passed to pcmcia_loop_config().

This driver uses the default (*conf_check) in comedi_pcmcia.c so just
pass a NULL as the second arg.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_mio_cs: use pcmcia_request_irq()
H Hartley Sweeten [Wed, 6 Feb 2013 01:16:53 +0000 (18:16 -0700)]
staging: comedi: ni_mio_cs: use pcmcia_request_irq()

Use pcmcia_request_irq() instead of request_irq() to request the
shared irq for the PCMCIA device. This allows the PCMCIA core to
clean up the registration in pcmcia_disable_device().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_mio_cs: use comedi_pcmcia_{enable, disable}
H Hartley Sweeten [Wed, 6 Feb 2013 01:16:28 +0000 (18:16 -0700)]
staging: comedi: ni_mio_cs: use comedi_pcmcia_{enable, disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

This driver uses a local (*conf_check) to check the pcmcia_device
configuration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_pcmcia: allow drivers to use a custom conf_check()
H Hartley Sweeten [Wed, 6 Feb 2013 01:16:07 +0000 (18:16 -0700)]
staging: comedi: comedi_pcmcia: allow drivers to use a custom conf_check()

Allow comedi pcmcia drivers to use a custom conf_check() when calling
comedi_pcmcia_enable() to enable the pcmcia device. If a conf_check()
is not passed the internal comedi_pcmcia_conf_check() will be used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc_cs: use comedi_pcmcia_{enable,disable}
H Hartley Sweeten [Wed, 6 Feb 2013 01:15:42 +0000 (18:15 -0700)]
staging: comedi: ni_labpc_cs: use comedi_pcmcia_{enable,disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

This driver is not an audio device, remove CONF_AUTO_AUDIO from
the link->config_flags.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_dio24: use comedi_pcmcia_{enable,disable}
H Hartley Sweeten [Wed, 6 Feb 2013 01:15:20 +0000 (18:15 -0700)]
staging: comedi: ni_daq_dio24: use comedi_pcmcia_{enable,disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

This driver does not use interrupts and is not an audio device, remove
CONF_ENABLE_IRQ and CONF_AUTO_AUDIO from the link->config_flags.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: rename vmk80xx_attach_common()
H Hartley Sweeten [Wed, 6 Feb 2013 00:31:10 +0000 (17:31 -0700)]
staging: comedi: vmk80xx: rename vmk80xx_attach_common()

In comedi drivers typically *_attach_common() is used as the 'common'
part of the comedi_driver attach code for drivers that support various
bus types (ISA, PCI, etc.). This driver is specific to a USB device.

To avoid confusion when grepping, rename this function to something
more appropriate.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove the 'Changelog' comments
H Hartley Sweeten [Wed, 6 Feb 2013 00:30:48 +0000 (17:30 -0700)]
staging: comedi: vmk80xx: remove the 'Changelog' comments

git history provides a better Changelog for the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup the comedi_lrange tables
H Hartley Sweeten [Wed, 6 Feb 2013 00:30:21 +0000 (17:30 -0700)]
staging: comedi: vmk80xx: cleanup the comedi_lrange tables

The vmk8055_range table is a duplicate of the comedi core provided
range_unipolar5 table. Use that instead.

For aesthetic reasons, clean up the formating of the vmk8061_range
table.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove CONFIG_COMEDI_DEBUG code
H Hartley Sweeten [Wed, 6 Feb 2013 00:30:01 +0000 (17:30 -0700)]
staging: comedi: vmk80xx: remove CONFIG_COMEDI_DEBUG code

If CONFIG_COMEDI_DEBUG is defined a macro is enabled to output some
printk(KERN_REBUG ...) messages. These are just added noise. Remove
it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove unused #define
H Hartley Sweeten [Wed, 6 Feb 2013 00:29:35 +0000 (17:29 -0700)]
staging: comedi: vmk80xx: remove unused #define

This define is no longer used by the driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove digital input (*insn_read)
H Hartley Sweeten [Wed, 6 Feb 2013 00:29:13 +0000 (17:29 -0700)]
staging: comedi: vmk80xx: remove digital input (*insn_read)

The comedi core can use the (*insn_bits) function to emulate the
(*insn_read) function. Remove the unnecessary (*insn_read) function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove digital output (*insn_write)
H Hartley Sweeten [Wed, 6 Feb 2013 00:28:51 +0000 (17:28 -0700)]
staging: comedi: vmk80xx: remove digital output (*insn_write)

The comedi core can use the (*insn_bits) function to emulate the
(*insn_write) function. Remove the unnecessary (*insn_read)
function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove digital output (*insn_read)
H Hartley Sweeten [Wed, 6 Feb 2013 00:28:27 +0000 (17:28 -0700)]
staging: comedi: vmk80xx: remove digital output (*insn_read)

The comedi core can use the (*insn_bits) function to emulate the
(*insn_read) function.

The digital output (*insn_bits) function properly handles the
VMK8061_MODEL to read the digital output states before returning.

Remove the unnecessary (*insn_read) function. It's also not
necessary to set the SDF_READABLE flag so remove the entire
conditional in the attach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup pwm subdevice init
H Hartley Sweeten [Wed, 6 Feb 2013 00:27:56 +0000 (17:27 -0700)]
staging: comedi: vmk80xx: cleanup pwm subdevice init

Change the 'pwm_bits' in the boardinfo to 'pwm_maxdata' so that the
calculation of s->maxdata can be removed. Also, change the type to
match the comedi_subdevice type. For aesthetic reasons, rename the
'pwm_chans' boardinfo and change its type also.

Remove the '0' values in the boardinfo.

Rename the (*insn_read) and (*insn_write) functions for the pwm
subdevice to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup counter subdevice init
H Hartley Sweeten [Wed, 6 Feb 2013 00:27:37 +0000 (17:27 -0700)]
staging: comedi: vmk80xx: cleanup counter subdevice init

Change the 'cnt_bits' in the boardinfo to 'cnt_maxdata' so that the
calculation of s->maxdata can be removed. Also, change the type to
match the comedi_subdevice type. Add a comment about the '0' value
for DEVICE_VMK8061.

The s->maxdata should always be set for the subdevice. Move it out
of the conditional.

Rename the (*insn_read), (*insn_config_, and (*insn_write) functions
for the counter subdevice to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup digital input subdevice init
H Hartley Sweeten [Wed, 6 Feb 2013 00:25:49 +0000 (17:25 -0700)]
staging: comedi: vmk80xx: cleanup digital input subdevice init

Remove the SDF_GROUND flag from s->subdev_flags. This flag only has
meaning for analog subdevices.

Add the missing s->range_table for the subdevice.

Rename the (*insn_write), (*insn_bits), and (*insn_read) functions
for the digital input subdevice to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup digital input subdevice init
H Hartley Sweeten [Wed, 6 Feb 2013 00:25:28 +0000 (17:25 -0700)]
staging: comedi: vmk80xx: cleanup digital input subdevice init

Change the type for the digital input 'di_chans' boardinfo to match
the comedi_subdevice type it is set to. For aesthetic reasons, rename
the variable also.

Remove the SDF_GROUND flag from s->subdev_flags. This flag only has
meaning for analog subdevices.

Add the missing s->range_table for the subdevice.

Rename the (*insn_read) and (*insn_bits) functions for the digital
input subdevice to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup analog output subdevice init
H Hartley Sweeten [Wed, 6 Feb 2013 00:25:07 +0000 (17:25 -0700)]
staging: comedi: vmk80xx: cleanup analog output subdevice init

Change the type for the analog output 'ao_chans' boardinfo to match
the comedi_subdevice type it is set to. For aesthetic reasons, rename
the variable also.

Rename the (*insn_write) and (*insn_read) functions for the analog
output subdevice to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: cleanup analog input subdevice init
H Hartley Sweeten [Wed, 6 Feb 2013 00:24:45 +0000 (17:24 -0700)]
staging: comedi: vmk80xx: cleanup analog input subdevice init

Change the 'ai_bits' in the boardinfo to 'ai_maxdata' so that the
calculation of s->maxdata can be removed.

Change the types for the analog input boardinfo to match the
comedi_subdevice types they are set to.

Rename the (*insn_read) function for the analog input subdevice from
vmk80xx_ai_rinsn to vmk80xx_ai_insn_read to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove need for boardinfo in private_data
H Hartley Sweeten [Wed, 6 Feb 2013 00:24:24 +0000 (17:24 -0700)]
staging: comedi: vmk80xx: remove need for boardinfo in private_data

The only information in the boardinfo that is used outside of the
attach of the driver is the 'model' of the device.

Remove the 'board' pointer from the private data and replace it with
the 'model' enum and just copy that information over during the attach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: push usb (*probe) into comedi (*auto_attach)
H Hartley Sweeten [Wed, 6 Feb 2013 00:24:03 +0000 (17:24 -0700)]
staging: comedi: vmk80xx: push usb (*probe) into comedi (*auto_attach)

Make the usb_driver (*probe) simply call comedi_usb_auto_config()
and move all the (*probe) code into the (*auto_attach) function.

This allows getting rid of the static private data array since we
no longer do part of the initialization in the (*probe) and then
finish it in the (*auto_attach). We can simply kzalloc the private
data instead. The comedi core will then handle the kfree of the
data when the driver is detached.

We can also get rid of the static 'glb_mutex' since this mutex was
only used to protect the static private data array.

Change the parameters for a couple of the helper functions used
during the auto attach. Now that the comedi_device is available
we can simply pass that pointer and get the specific pointers
needed by the helper functions from it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_usb: allow comedi usb drivers to pass a 'context'
H Hartley Sweeten [Wed, 6 Feb 2013 00:23:40 +0000 (17:23 -0700)]
staging: comedi: comedi_usb: allow comedi usb drivers to pass a 'context'

Allow the comedi usb drivers to pass a 'context' from their (*probe)
functions to the comedi core's comedi_usb_auto_config(). This 'context'
is then passed to comedi_auto_config() and then to the comedi_driver's
(*auto_attach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove private data 'attached'
H Hartley Sweeten [Wed, 6 Feb 2013 00:23:16 +0000 (17:23 -0700)]
staging: comedi: vmk80xx: remove private data 'attached'

The 'attached' flag in the private data is set after the comedi_driver
(*auto_attach) function has completed successfully.

The only places it's checked are in rudimentary_check(), which does
some basic sanity checks before doing any of the subdevice operations,
and vmk80xx_auto_attach(), which is the comedi_driver (*auto_attach)
function.

The (*auto_attach) function can only be called as the result of a
successfull usb_driver (*probe). Part of the probe is to locate a
free slot in the static private data array. All free slots are
initialized to '0' so the 'attached' flag will always be cleared.

Remove the unneccessary 'attached' flag in the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove private data 'probed'
H Hartley Sweeten [Wed, 6 Feb 2013 00:22:49 +0000 (17:22 -0700)]
staging: comedi: vmk80xx: remove private data 'probed'

The 'probed' variable is used in the usb driver (*probe) to detect an
unused element in the static private data arry. This variable is then
set after the usb driver has completed its (*probe) before calling
comedi_usb_auto_config(). When the comedi core does the auto config
it will call the (*auto_attach) function, vmk80xx_auto_attach(), which
then locates the correct private data in the static array by checking
to see if it has been 'probed' and that the 'intf' variable matches
the usb_interface pointer for the usb device.

Now that the private data is clean after failed usb probes and disconnects
we don't have to worry about have a garbage 'intf' value in the private
data that might match.

Remove the 'probed' flag from the private data and just use the 'intf'
pointer to detect the match.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: make sure private data is clean when detached
H Hartley Sweeten [Wed, 6 Feb 2013 00:22:27 +0000 (17:22 -0700)]
staging: comedi: vmk80xx: make sure private data is clean when detached

Currently the private data used in this driver is stored in a static
array. During the usb (*probe) and empty location is found in this
array for use by the usb device. Some initialization of the private
data is then done before comedi_usb_auto_config() is called to allow
the comedi core to attach its comedi_device to the usb device.

The (*probe) can fail for various reasons. If it does, make sure that
the private data is clean before returning an error.

The usb (*disconnect) simply calls comedi_usb_auto_unconfig() to
allow the comedi core to disconnect its comedi_device from the usb
device. Since the private data points to the static array it cannot
be kfree'ed during the detach. Instead make sure it clean before
leaving the detach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove private data 'count'
H Hartley Sweeten [Wed, 6 Feb 2013 00:22:03 +0000 (17:22 -0700)]
staging: comedi: vmk80xx: remove private data 'count'

The 'count' in the private data is only used in a couple dev_info()
kernel messages. These messages are just added noise.

Remove the 'count' variable in the private data as well as the
dev_info() messages.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: factor out usb buffer allocation
H Hartley Sweeten [Wed, 6 Feb 2013 00:21:40 +0000 (17:21 -0700)]
staging: comedi: vmk80xx: factor out usb buffer allocation

Factor the code that allocates the usb buffers out of vmk80xx_usb_probe().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: factor out usb endpoint detection
H Hartley Sweeten [Wed, 6 Feb 2013 00:21:19 +0000 (17:21 -0700)]
staging: comedi: vmk80xx: factor out usb endpoint detection

Factor the code that detects the usb endpoints out of vmk80xx_usb_probe().

Cleanup the detection code in the new function,

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: consistently use the same local var names
H Hartley Sweeten [Wed, 6 Feb 2013 00:20:58 +0000 (17:20 -0700)]
staging: comedi: vmk80xx: consistently use the same local var names

Rename some of the local variables used in this driver to make the
code easier to maintain and understand.

s/udev/usb the usb_device that the comedi_driver is attached to
s/dev/devpriv the private data of the comedi_device
s/cdev/dev the comedi_device

Also, use some local variables in a couple of the functions to tidy
up the code a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: rename struct vmk80xx_usb
H Hartley Sweeten [Wed, 6 Feb 2013 00:20:22 +0000 (17:20 -0700)]
staging: comedi: vmk80xx: rename struct vmk80xx_usb

The struct vmk80xx_usb is actually the private data for the
comedi_device. For aesthetic reasons, rename the struct to
vmk80xx_private.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove VMK80XX_SUBD_* enum
H Hartley Sweeten [Wed, 6 Feb 2013 00:20:01 +0000 (17:20 -0700)]
staging: comedi: vmk80xx: remove VMK80XX_SUBD_* enum

These enum values are only used in the initialization of the
comedi_subdevices. They don't help make the code any clearer
so just remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove common and unused boardinfo
H Hartley Sweeten [Wed, 6 Feb 2013 00:19:40 +0000 (17:19 -0700)]
staging: comedi: vmk80xx: remove common and unused boardinfo

Some of the information in the boardinfo is common for both boards
supported by this driver. Remove that information from the boardinfo
and just initialize the subdevice values directly.

Also, remove any information in the boardinfo that is not used in
the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: save the boardinfo in the comedi_device
H Hartley Sweeten [Wed, 6 Feb 2013 00:19:18 +0000 (17:19 -0700)]
staging: comedi: vmk80xx: save the boardinfo in the comedi_device

Save a copy of the boardinfo pointer in the comedi_device 'board_ptr'.
The subdevice functions can then simply get it using the comedi_board()
helper.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: move boardinfo into a const array
H Hartley Sweeten [Wed, 6 Feb 2013 00:18:52 +0000 (17:18 -0700)]
staging: comedi: vmk80xx: move boardinfo into a const array

The normal way of presenting the board specific information in comedi
drivers is store the data in a static const array. This data is then
accessed using a pointer, normally the comedi_device 'board_ptr',

Move the boardinfo for the two boards supported by this driver from
the vmk80xx_usb_probe() function into a static const array.

Change the access of this information so a pointer is used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: use comedi_auto_unconfig() for (*disconnect)
H Hartley Sweeten [Wed, 6 Feb 2013 00:18:26 +0000 (17:18 -0700)]
staging: comedi: vmk80xx: use comedi_auto_unconfig() for (*disconnect)

The usb_driver (*disconnect) in this driver is simply a wrapper around
comedi_auto_unconfig(). Just use comedi_auto_unconfig() directly for
the (*disconnect).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: move usb_driver (*disconnect) code
H Hartley Sweeten [Wed, 6 Feb 2013 00:18:04 +0000 (17:18 -0700)]
staging: comedi: vmk80xx: move usb_driver (*disconnect) code

The usb_driver (*disconnect) in this driver calls the comedi core
comedi_usb_auto_unconfig() which calls the comedi_driver (*detach).

Move the code in the (*disconnect) to the (*detach) to get all the
disconnect/detach in one place.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: vmk80xx: remove support for manual attaching
H Hartley Sweeten [Wed, 6 Feb 2013 00:17:36 +0000 (17:17 -0700)]
staging: comedi: vmk80xx: remove support for manual attaching

This comedi USB driver supports attaching with the auto config
mechanism. Remove the manual attaching support using the
COMEDI_DEVCONFIG ioctl.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozram: get rid of lockdep warning
Minchan Kim [Tue, 5 Feb 2013 23:48:53 +0000 (08:48 +0900)]
zram: get rid of lockdep warning

Lockdep complains about recursive deadlock of zram->init_lock.
[1] made it false positive because we can't request IO to zram
before setting disksize. Anyway, we should shut lockdep up to
avoid many reporting from user.

[1] : zram: force disksize setting before using zram

Acked-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozram: fix warning of print format
Minchan Kim [Tue, 5 Feb 2013 23:45:22 +0000 (08:45 +0900)]
zram: fix warning of print format

kbuild bot whinges due to print format mistmatch caused by
zram: force disksize setting before using zram.

This patch fixes it.

Reported-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/vt6656: Fix sparse warning constant 0xffffffff00000000U is so big it is unsig...
Peter Huewe [Tue, 5 Feb 2013 22:31:37 +0000 (23:31 +0100)]
staging/vt6656: Fix sparse warning constant 0xffffffff00000000U is so big it is unsigned long

Since 7c65fa2a4c176c9bfab1ef954c4cef005dd9fb8b
'staging: vt6656: Remove QWORD from source and replace with u64.'
a new sparse warning showed up:

'drivers/staging/vt6656/card.c:798:26: sparse: constant
 0xffffffff00000000U is so big it is unsigned long'

-> Append L to fix the warning.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Cc: Forest Bond <forest@alittletooquiet.net>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Cc: "Justin P. Mattock" <justinmattock@gmail.com>
Cc: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove always false if statement
Peter Huewe [Tue, 5 Feb 2013 21:32:34 +0000 (22:32 +0100)]
staging/xgifb: Remove always false if statement

MCLKData does not contain any 0x1C value for its field SR28 nor does
XGI340_ECLKData contain any 0x1C or 0x22 value for its field SR2E.

-> the statement always evaluates to false.
-> remove

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unneeded conditional assignment
Peter Huewe [Tue, 5 Feb 2013 21:32:33 +0000 (22:32 +0100)]
staging/xgifb: Remove unneeded conditional assignment

pVBInfo->ram_type is assigned the return value of
XGINew_GetXG20DRAMType which can only be 0, 1 or 2

-> The conditional assignment is not needed here as it always evaluates
to true.
-> remove

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused values in XGI340_ECLKData
Peter Huewe [Tue, 5 Feb 2013 21:32:32 +0000 (22:32 +0100)]
staging/xgifb: Remove unused values in XGI340_ECLKData

In the lookup table XGI340_ECLKData only the first three 'lines' are
used, thus the remaining entries can be removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type as the index for XGI340_ECLKData.

- pVBInfo->ram_type is assigned the return value of
XGINew_GetXG20DRAMType which can only be 0, 1 or 2

-> only the first three values are used.
-> remove the remeining entries.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused entries in XGI340New_MCLKData and XGI27New_MCLKData
Peter Huewe [Tue, 5 Feb 2013 21:32:31 +0000 (22:32 +0100)]
staging/xgifb: Remove unused entries in XGI340New_MCLKData and XGI27New_MCLKData

In the lookup tables XGI340New_MCLKData and XGI27New_MCLKData only the
first three 'lines' are used, thus the remaining fields can be removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type as the index for pVBInfo->MCLKData

- pVBInfo->ram_type is assigned the return value of
XGINew_GetXG20DRAMType which can only be 0, 1 or 2

- pVBInfo->MCLKData is assigned to either XGI340New_MCLKData or
XGI27New_MCLKData in vb_setmode.c

-> only the first three values are used, the rest can be removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused values in XG27_SR13 and XGI340_SR13
Peter Huewe [Tue, 5 Feb 2013 21:32:30 +0000 (22:32 +0100)]
staging/xgifb: Remove unused values in XG27_SR13 and XGI340_SR13

 In the lookup tables XG27_SR13 and XGI340_SR13 only the first three
 values are used of each 'line', thus the remaining fields can be
 removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type for the 'column' index for
pVBInfo->SR15.

- pVBInfo->ram_type is assigned the return value of
XGINew_GetXG20DRAMType which can only be 0, 1 or 2

- pVBInfo->SR15 is assigned to either XG27_SR13 or XGI340_SR13 in
vb_setmode.c

-> only the first three values are used.
This becomes also evident as values 3-7 are all 0.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused values in XGI340_cr41 and XGI27_cr41
Peter Huewe [Tue, 5 Feb 2013 21:32:29 +0000 (22:32 +0100)]
staging/xgifb: Remove unused values in XGI340_cr41 and XGI27_cr41

In the lookup tables XGI340_cr41 and XGI27_cr41 only the first three
values are used of each 'line', thus the remaining fields can be
removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type for the 'column' index for
pVBInfo->CR40.

- pVBInfo->ram_type is assigned the return value of
  XGINew_GetXG20DRAMType which can only be 0, 1 or 2

- pVBInfo->CR40 is assigned to either XGI340_cr41 or XGI27_cr41 in
vb_setmode.c

-> only the first three values are used.
This becomes also evident as values 3-7 are all 0.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused variable
Peter Huewe [Tue, 5 Feb 2013 19:38:35 +0000 (20:38 +0100)]
staging/xgifb: Remove unused variable

After the patch
'staging/xgifb: Don't write the same values x times'
the local variable i is unused, which leads to the following warning:

driverrs/staging/xgifb/vb_init.c: In function
‘XGINew_SetDRAMDefaultRegister340’:
drivers/staging/xgifb/vb_init.c:433:43: warning: unused variable â€˜i’
[-Wunused-variable]

This patch fixes this

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag 'iio-for-3.9c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Tue, 5 Feb 2013 19:25:37 +0000 (11:25 -0800)]
Merge tag 'iio-for-3.9c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

"Third set of IIO new drivers, cleanups and fixes for the 3.9 cycle

New drivers
1) A driver for ST microelectronics sensors.  This driver already covers
   a large set of new parts (20 gyros, accelerometer and magnetometers)
   not currently covered by the existing drivers.  The intent moving forward
   is to merge this with the other drivers for similar parts already in tree.
   The lis3l02dq driver currently in staging/iio will be trivial, the lis3
   driver in misc more complex as it has a number of additional interfaces.
   Any merging in of the lis3 driver will rely on the not currently
   merged iio_input bridge driver and handling of freefall notifications
   etc.

2) A driver for the itg3200 gyroscope.

Graduations from staging
1) Cleanup and move out of staging of the adxrs450 gyroscope driver.  The
   cleanup required was all minor but there were a couple of fixes hidden in
   there.

Core and driver additions
1) Initial work from Guenter Roeck on device tree support for IIO's provider/
   consumer code. Focuses on the iio_hwmon driver and the max1363 adc driver.
   The full device tree syntax is currently under discussion but should
   follow shortly.

Cleanups and fixes
1) Remove a noop function __iio_update_buffer
2) Couple of small fixes and cleanups for the max1363
"

11 years agostaging: comedi: check s->async for poll(), read() and write()
Ian Abbott [Tue, 5 Feb 2013 12:50:40 +0000 (12:50 +0000)]
staging: comedi: check s->async for poll(), read() and write()

Some low-level comedi drivers (incorrectly) point `dev->read_subdev` or
`dev->write_subdev` to a subdevice that does not support asynchronous
commands.  Comedi's poll(), read() and write() file operation handlers
assume these subdevices do support asynchronous commands.  In
particular, they assume `s->async` is valid (where `s` points to the
read or write subdevice), which it won't be if it has been set
incorrectly.  This can lead to a NULL pointer dereference.

Check `s->async` is non-NULL in `comedi_poll()`, `comedi_read()` and
`comedi_write()` to avoid the bug.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove 'comedi_autoconfig' module parameter
H Hartley Sweeten [Tue, 5 Feb 2013 00:13:01 +0000 (17:13 -0700)]
staging: comedi: remove 'comedi_autoconfig' module parameter

This module parameter is used to enable the auto config mechanism
in the comedi core. Most of the PCI, PCMCIA, and USB drivers have
been converted to use the auto config mechanism and will not attach
if it is disabled.

Since the 'comedi_autoconfig' parameter is defaulted to true, just
remove it so that the comedi drivers that use auto config will
always be able to attach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: factor out common ai scanlist code
H Hartley Sweeten [Mon, 4 Feb 2013 23:44:57 +0000 (16:44 -0700)]
staging: comedi: quatech_daqp_cs: factor out common ai scanlist code

Factor the code that programs the analog input scanlist out of the
daqp_ai_insn_read() and daqp_ai_cmd() functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: fix daqp_ao_insn_write()
H Hartley Sweeten [Mon, 4 Feb 2013 23:44:37 +0000 (16:44 -0700)]
staging: comedi: quatech_daqp_cs: fix daqp_ao_insn_write()

The (*insn_write) functions are expected to write 'insn->n' number
of samples to the channel. Fix this function so it works as the
comedi core expects.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: use (*insn_bits) for digital outputs
H Hartley Sweeten [Mon, 4 Feb 2013 23:44:17 +0000 (16:44 -0700)]
staging: comedi: quatech_daqp_cs: use (*insn_bits) for digital outputs

Change the subdevice operation used to write the digital outputs from
a (*insn_write) to a (*insn_bits) function. The (*insn_write) functions
are expected to write 'insn->n' number of samples. The (*insn_bits)
functions just write a single sample (insn->n = 1). Change the return
from '1' to 'insn->n' to clarify what the return is.

Using an (*insn_bits) function to write the digital outputs also allows
the user to read the current state of the output channels.

Fix the io operation used to update the digital outputs. The register is
only 8-bits and should by updated with an outb() not an outw().

Also, set the 'maxdata' for the subdevice. For digital io this value
should be '1' (digital io can only be 1 or 0).

Remove the setting of the len_chanlist for the subdevice. This variable
only has meaning for subdevices that support asynchronous commands. The
comedi core will initialize it appropriately during the postconfig.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: use (*insn_bits) for digital inputs
H Hartley Sweeten [Mon, 4 Feb 2013 23:43:56 +0000 (16:43 -0700)]
staging: comedi: quatech_daqp_cs: use (*insn_bits) for digital inputs

Change the subdevice operation used to read the digital inputs from
a (*insn_read) to a (*insn_bits) function. The (*insn_read) functions
are expected to read 'insn->n' number of samples. The (*insn_bits)
functions just read a single sample (insn->n = 1). Change the return
from '1' to 'insn->n' to clarify what the return is.

Also, set the 'maxdata' for the subdevice. For digital io this value
should be '1' (digital io can only be 1 or 0).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: remove unused define
H Hartley Sweeten [Mon, 4 Feb 2013 23:43:37 +0000 (16:43 -0700)]
staging: comedi: quatech_daqp_cs: remove unused define

The MAX_DEV define is no longer used in this driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: rename the private data struct
H Hartley Sweeten [Mon, 4 Feb 2013 23:43:19 +0000 (16:43 -0700)]
staging: comedi: quatech_daqp_cs: rename the private data struct

The private data in this driver is associated with the comedi_device
pointer not the pcmcia_device. For aesthetic reasons, rename the
private data struct from local_into_t to daqp_private.

Also, rename the local variables used for the private data from
local to devpriv as that is more common in the comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: store private data in the comedi_device
H Hartley Sweeten [Mon, 4 Feb 2013 23:42:56 +0000 (16:42 -0700)]
staging: comedi: quatech_daqp_cs: store private data in the comedi_device

All the comedi_subdevices in this driver use the same 'local' private data.
Instead of storing the pointer to the private data in each subdevice, just
store it in the comedi_device.

Also, instead of passing the private data pointer to pcmcia_request_irq()
in link->priv, pass the comedi_device pointer. This allows removing the
comedi_device and comedi_subdevice pointers from the private data. We can
get them as needed from the void * in the interrupt function.

Fix the pcmcia suspend/resume functions so they use the comedi_device
pointer stored in link->priv to then get the private data pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: ao subdevice does not support commands
H Hartley Sweeten [Mon, 4 Feb 2013 23:42:32 +0000 (16:42 -0700)]
staging: comedi: quatech_daqp_cs: ao subdevice does not support commands

The analog output subdevice does not support aynchronous commands.
Don't set the dev->write_subdev to this subdevice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: use comedi_pcmcia_disable() for (*detach)
H Hartley Sweeten [Mon, 4 Feb 2013 23:42:09 +0000 (16:42 -0700)]
staging: comedi: quatech_daqp_cs: use comedi_pcmcia_disable() for (*detach)

The (*detach) function, daqp_detach() is now a simple wrapper around
comedi_pcmcia_disable(). Just use comedi_pcmcia_disable() directly for
the (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: use comedi_pcmcia_{enable, disable}
H Hartley Sweeten [Mon, 4 Feb 2013 23:41:49 +0000 (16:41 -0700)]
staging: comedi: quatech_daqp_cs: use comedi_pcmcia_{enable, disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: quatech_daqp_cs: convert to auto attach
H Hartley Sweeten [Mon, 4 Feb 2013 23:41:30 +0000 (16:41 -0700)]
staging: comedi: quatech_daqp_cs: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the static data that held "A list of
"instances" of the device" that was used to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver.

Also, remove the now unused variables in the private data that
were used to pass the pcmcia_device.

Remove the code that pulled the model number of the card out of
the PCMCIA CIS and stashed it in the private data since it is
not used in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Consolidate if branches with similar conditions
Peter Huewe [Mon, 4 Feb 2013 23:29:47 +0000 (00:29 +0100)]
staging/xgifb: Consolidate if branches with similar conditions

1) The same condition (pVBInfo->IF_DEF_LVDS == 0) was checked in the if
clause directly in front of this one.

2) The same condition pVBInfo->VBType & (VB_SIS301B | VB_SIS302B |
VB_SIS301LV | VB_SIS302LV | VB_XGI301C) was checked in the if
clause directly in front of this one.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Consolidate if/else for 'identical' branches
Peter Huewe [Mon, 4 Feb 2013 23:29:46 +0000 (00:29 +0100)]
staging/xgifb: Consolidate if/else for 'identical' branches

Since XGI_LCDDesStruct is fully contained in XGI330_LCDDataDesStruct2
and the offsets for the first members is identical we can consolidate
the if/else branches here and use XGI330_LCDDataDesStruct2 for
everything.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Don't write the same values x times
Peter Huewe [Mon, 4 Feb 2013 23:29:45 +0000 (00:29 +0100)]
staging/xgifb: Don't write the same values x times

With the previous patch 'Move duplicated code for dram to helper
function' it becomes evident that the code is performing the same
thing 4 or 8 times in a row without changing arguments to the function
and thus writing the same values over and over again.

It was tested that these repeats are unnecessary.

-> we can safely remove them.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Move duplicated code for dram to helper function
Peter Huewe [Mon, 4 Feb 2013 23:29:44 +0000 (00:29 +0100)]
staging/xgifb: Move duplicated code for dram to helper function

XGINew_SetDRAMDefaultRegister340 uses the same code fragment 4 times
with only a slight variation each time.
-> Move this code to a helper function - this saves some lines and
~450bytes in the .o / .ko

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Replace XGI340_CR6B table with simple if/else
Peter Huewe [Mon, 4 Feb 2013 23:29:43 +0000 (00:29 +0100)]
staging/xgifb: Replace XGI340_CR6B table with simple if/else

The XGI340_CR6B lookup table consists of the entries
{0xaa, 0xaa, 0xaa, 0xaa} for an index <= 2 and
{0x00, 0x00, 0x00, 0x00} for all other indices.

The only user XGINew_SetDRAMDefaultRegister340 loops over these 4 values
of a line with a for loop and since all entries are the same for each line
we can simply replace the whole lookup table with a simple if/else assignment.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_700: use comedi_pcmcia_disable() for (*detach)
H Hartley Sweeten [Mon, 4 Feb 2013 21:22:17 +0000 (14:22 -0700)]
staging: comedi: ni_daq_700: use comedi_pcmcia_disable() for (*detach)

The (*detach) function, daq700_detach() is now a simple wrapper around
comedi_pcmcia_disable(). Just use comedi_pcmcia_disable() directly for
the (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_700: use comedi_pcmcia_{enable, disable}
H Hartley Sweeten [Mon, 4 Feb 2013 21:21:56 +0000 (14:21 -0700)]
staging: comedi: ni_daq_700: use comedi_pcmcia_{enable, disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

This driver does not use interrupts and is not an audio device,
remove CONF_ENABLE_IRQ and CONF_AUTO_AUDIO from the link->config_flags.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: das08_cs: use comedi_pcmcia_{enable, disable}
H Hartley Sweeten [Mon, 4 Feb 2013 21:21:31 +0000 (14:21 -0700)]
staging: comedi: das08_cs: use comedi_pcmcia_{enable, disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

This driver does not use interrupts so remove CONF_ENABLE_IRQ from
the link->config_flags.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cb_das16_cs: use comedi_pcmcia_disable() for (*detach)
H Hartley Sweeten [Mon, 4 Feb 2013 21:21:09 +0000 (14:21 -0700)]
staging: comedi: cb_das16_cs: use comedi_pcmcia_disable() for (*detach)

The (*detach) function, das16cs_detach() is a simple wrapper around
comedi_pcmcia_disable(). Just use comedi_pcmcia_disable() directly
for the (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cb_das16_cs: use pcmcia_request_irq()
H Hartley Sweeten [Mon, 4 Feb 2013 21:20:29 +0000 (14:20 -0700)]
staging: comedi: cb_das16_cs: use pcmcia_request_irq()

Use pcmcia_request_irq() instead of request_irq() to request the
irq for the PCMCIA device. This allows the PCMCIA core to clean
up the registration in pcmcia_disable_device().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cb_das16_cs: use comedi_pcmcia_{enable, disable}
H Hartley Sweeten [Mon, 4 Feb 2013 21:20:08 +0000 (14:20 -0700)]
staging: comedi: cb_das16_cs: use comedi_pcmcia_{enable, disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_pcmcia: introduce comedi_pcmcia_{enable, disable}
H Hartley Sweeten [Mon, 4 Feb 2013 21:19:35 +0000 (14:19 -0700)]
staging: comedi: comedi_pcmcia: introduce comedi_pcmcia_{enable, disable}

Introduce some helper functions to enable/disable the PCMCIA device.
This will allow removing some of the boilerplate code in the comedi
PCMCIA drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Simplify XGISetModeNew
Peter Huewe [Sun, 3 Feb 2013 21:54:39 +0000 (22:54 +0100)]
staging/xgifb: Simplify XGISetModeNew

This patch simplifies the code of XGISetModeNew by reordering the
if/else if/case conditions when both branches are doing exactly the
same.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Consolidate XGI_EnableChISLCD and XGI_DisableChISLCD
Peter Huewe [Sun, 3 Feb 2013 21:54:38 +0000 (22:54 +0100)]
staging/xgifb: Consolidate XGI_EnableChISLCD and XGI_DisableChISLCD

These two functions share the same code except one line - thus we can
simply merge them and add a parameter to switch between both variants.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegs
Peter Huewe [Sun, 3 Feb 2013 21:54:37 +0000 (22:54 +0100)]
staging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegs

Since data can only be 0x0000, 0x0035 or 0x0048 we can simply skip the
bit shifting and masking as data & 0xFF is always equal to data and
data & 0xFF00 is always 0.
So we simply use data and 0 directly and save the assignment.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddata
Peter Huewe [Sun, 3 Feb 2013 21:54:36 +0000 (22:54 +0100)]
staging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddata

Instead of subtracting one and then assign a different name and add 1
again we simply use HDE directly. HDE wasn't used directly before, so no
change in functionality.
Same applies to VDE.

-> now we can remove the variable with the very descriptive name E ;)

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: rewrite XGIfb_get_cmap_len
Peter Huewe [Sun, 3 Feb 2013 21:54:35 +0000 (22:54 +0100)]
staging/xgifb: rewrite XGIfb_get_cmap_len

We don't need to use this switch-case here for a simple two case
if-else.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Simplify XGI_SetSeqRegs
Peter Huewe [Sun, 3 Feb 2013 21:54:34 +0000 (22:54 +0100)]
staging/xgifb: Simplify XGI_SetSeqRegs

Since SR[0] in the (readonly) XGI330_StandTable is always 0x01 we can
skip or'ing with 0x01 and make the code simpler by removing the if
statements.

Since this function is the only user of the XGI330_StandTable we can
also include the unconditional |= 0x20 into the input data and move the
assignment to SR1 into the loop, which I prefer to start at 0.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Fix return of uninitialized variable
Peter Huewe [Sun, 3 Feb 2013 21:54:33 +0000 (22:54 +0100)]
staging/xgifb: Fix return of uninitialized variable

Clang warning:
drivers/staging/xgifb/XGI_main_26.c: warning: variable 'ret' is
used uninitialized whenever 'if' condition:
if (xgifb_info->mode_idx < 0) {
evaluates to true.

drivers/staging/xgifb/XGI_main_26.c:
note: uninitialized use occurs here
return ret;

This patch initializes the variable in this case.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: mttr must be (signed) int
Peter Huewe [Sun, 3 Feb 2013 21:54:32 +0000 (22:54 +0100)]
staging/xgifb: mttr must be (signed) int

The mttr field must be declared as signed int (as in every other fb
driver) for the mttr functions to work properly.
Moreover the value should be initialized with -1.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove always false comparisons
Peter Huewe [Sun, 3 Feb 2013 21:54:31 +0000 (22:54 +0100)]
staging/xgifb: Remove always false comparisons

This patch removes some comparisons that always evaluate to false since
xoffset and yoffset are defined as __u32 in fb_var_screeninfo in
include/linux/fb.h and thus can never be negative.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Simplify XGI_GetRatePtrCRT2
Peter Huewe [Sun, 3 Feb 2013 21:54:30 +0000 (22:54 +0100)]
staging/xgifb: Simplify XGI_GetRatePtrCRT2

Since the smaller LCDRefreshIndex is contained identically in LCDARefreshIndex
we can simply use LCDARefreshIndex and skip the if/else.

Since LCDARefreshIndex is only used readonly and contains only small
unsigned values we also change its declaration to const u8.

In order to prevent an out-of-bounds access I changed the mask from 0x0F
to 0x07 and added a dummy value.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozram: give up lazy initialization of zram metadata
Minchan Kim [Wed, 30 Jan 2013 02:41:41 +0000 (11:41 +0900)]
zram: give up lazy initialization of zram metadata

1) User of zram normally do mkfs.xxx or mkswap before using
   the zram block device(ex, normally, do it at booting time)
   It ends up allocating such metadata of zram before real usage so
   benefit of lazy initialzation would be mitigated.

2) Some user want to use zram when memory pressure is high.(ie, load zram
   dynamically, NOT booting time). It does make sense because people don't
   want to waste memory until memory pressure is high(ie, where zram is really
   helpful time). In this case, lazy initialzation could be failed easily
   because we will use GFP_NOIO instead of GFP_KERNEL for avoiding deadlock.
   So the benefit of lazy initialzation would be mitigated, too.

3) Metadata overhead is not critical and Nitin has a plan to diet it.
   4K : 12 byte(64bit machine) -> 64G : 192M so 0.3% isn't big overhead
   If insane user use such big zram device up to 20, it could consume 6% of ram
   but efficieny of zram will cover the waste.

So this patch gives up lazy initialization and instead we initialize metadata
at disksize setting time.

Acked-by: Jerome Marchand <jmarchand@redhat.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozram: force disksize setting before using zram
Minchan Kim [Wed, 30 Jan 2013 02:41:40 +0000 (11:41 +0900)]
zram: force disksize setting before using zram

Now zram document syas "set disksize is optional"
but partly it's wrong. When you try to use zram firstly after
booting, you must set disksize, otherwise zram can't work because
zram gendisk's size is 0. But once you do it, you can use zram freely
after reset because reset doesn't reset to zero paradoxically.
So in this time, disksize setting is optional.:(
It's inconsitent for user behavior and not straightforward.

This patch forces always setting disksize firstly before using zram.
Yes. It changes current behavior so someone could complain when
he upgrades zram. Apparently it could be a problem if zram is mainline
but it still lives in staging so behavior could be changed for right
way to go. Let them excuse.

Acked-by: Jerome Marchand <jmarchand@redhat.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozram: Fix deadlock bug in partial read/write
Minchan Kim [Wed, 30 Jan 2013 02:41:39 +0000 (11:41 +0900)]
zram: Fix deadlock bug in partial read/write

Now zram allocates new page with GFP_KERNEL in zram I/O path
if IO is partial. Unfortunately, It may cause deadlock with
reclaim path like below.

write_page from fs
fs_lock
allocation(GFP_KERNEL)
reclaim
pageout
write_page from fs
fs_lock <-- deadlock

This patch fixes it by using GFP_NOIO.  In read path, we
reorganize code flow so that kmap_atomic is called after the
GFP_NOIO allocation.

Cc: stable@vger.kernel.org
Acked-by: Jerome Marchand <jmarchand@redhat.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
[ penberg@kernel.org: don't use GFP_ATOMIC ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agopci_ids.h: add common pci vendor ids from comedi subsystem
H Hartley Sweeten [Thu, 31 Jan 2013 21:42:16 +0000 (14:42 -0700)]
pci_ids.h: add common pci vendor ids from comedi subsystem

There are a number of pci vendor ids that are used in multiple
drivers in the comedi subsystem. Move these ids to pci_ids.h.

This also fixes some build warnings reported by the kbuild test
robot about PCI_VENDOR_ID_AMPLICON being undeclared.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: correct differential channel sequence for AI commands
Ian Abbott [Fri, 1 Feb 2013 14:51:58 +0000 (14:51 +0000)]
staging: comedi: ni_labpc: correct differential channel sequence for AI commands

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings.  He tracked it down to two
problems, one of which is addressed by this patch.

It seems the setting of the channel bits for particular scanning modes
was incorrect for differential mode.  (Only half the number of channels
are available in differential mode; comedi refers to them as channels 0,
1, 2 and 3, but the hardware documentation refers to them as channels 0,
2, 4 and 6.)  In differential mode, the setting of the channel enable
bits in the command1 register should depend on whether the scan enable
bit is set.  Effectively, we need to double the comedi channel number
when the scan enable bit is not set in differential mode.  The scan
enable bit gets set when the AI scan mode is `MODE_MULT_CHAN_UP` or
`MODE_MULT_CHAN_DOWN`, and gets cleared when the AI scan mode is
`MODE_SINGLE_CHAN` or `MODE_SINGLE_CHAN_INTERVAL`.  The existing test
for whether the comedi channel number needs to be doubled in
differential mode is incorrect in `labpc_ai_cmd()`.  This patch corrects
the test.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7.x, 3.8.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: set up command4 register *after* command3
Ian Abbott [Fri, 1 Feb 2013 14:51:57 +0000 (14:51 +0000)]
staging: comedi: ni_labpc: set up command4 register *after* command3

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings.  He tracked it down to two
problems, one of which is addressed by this patch.

It seems that writing to the command3 register after writing to the
command4 register in `labpc_ai_cmd()` messes up the differential
reference bit setting in the command4 register.  Set up the command4
register after the command3 register (as in `labpc_ai_rinsn()`) to avoid
the problem.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7.x, 3.8.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: restrict comedi_set_hw_dev() usage
Ian Abbott [Fri, 1 Feb 2013 13:23:20 +0000 (13:23 +0000)]
staging: comedi: restrict comedi_set_hw_dev() usage

Don't allow comedi drivers to change `dev->hw_dev` using
`comedi_set_hw_dev()` if it's already been set.  Return `-EEXIST` in
that case.

`dev->hw_dev` needs to be set to NULL by the core during clean-up of the
comedi device, so add a local function `comedi_clear_hw_dev()` to do
that.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: export comedi_set_hw_dev()
Ian Abbott [Fri, 1 Feb 2013 13:23:19 +0000 (13:23 +0000)]
staging: comedi: export comedi_set_hw_dev()

Chnage the inline `comedi_set_hw_dev()` to an exported function and
change it's return type from `void` to `int` so we can impose some
restrictions (in a later patch) and return an error if necessary.

Only a few comedi drivers call this, although they don't need to if the
hardware device has been attached automatically via
`comedi_auto_config()` and the comedi driver's `auto_attach()` method.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>