Ian Abbott [Thu, 14 Feb 2013 16:42:14 +0000 (16:42 +0000)]
staging: comedi: vmk80xx: simplify vmk80xx_reset_device()
vmk80xx_reset_device() is called during initialization of a Velleman
K8055 (aka VM110) to send a reset command to the hardware. The current
function is a bit long-winded and doesn't set the TRANS_OUT_BUSY flag to
prevent re-use of the transmit buffer while the URB is in progress.
Rewrite the function to use vmk80xx_write_packet() to send the command.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 14 Feb 2013 16:42:13 +0000 (16:42 +0000)]
staging: comedi: vmk80xx: zero buffers on allocation
Zero out `devpriv->usb_tx_buf` and `devpriv->usb_rx_buf` on allocation.
When sending data to the USB device, this ensures any unused part of the
buffer will not contain random crap.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Konrad Rzeszutek Wilk [Fri, 15 Feb 2013 17:53:44 +0000 (12:53 -0500)]
zcache/zbud: Fix __init mismatch
We get:
WARNING: drivers/staging/zcache/zcache.o(.text+0x13a1): Section mismatch
in reference from the function zcache_init() to the function
.init.text:zbud_init()
The function zcache_init() references
the function __init zbud_init().
This is often because zcache_init lacks a __init
annotation or the annotation of zbud_init is wrong.
And this fixes it.
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Konrad Rzeszutek Wilk [Fri, 15 Feb 2013 17:53:43 +0000 (12:53 -0500)]
zbud: Fix compile warnings due to usage of debugfs_create_size_t
.
drivers/staging/zcache/zbud.c:336: warning: passing argument 4 of ‘debugfs_create_size_t’ from incompatible pointer type
include/linux/debugfs.h:80: note: expected ‘size_t *’ but argument is of type ‘long unsigned int *’
..
which is b/c we end up using 'unsigned' or 'unsigned long' instead
of 'ssize_t'. So lets fix this up and use the proper type.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Konrad Rzeszutek Wilk [Fri, 15 Feb 2013 17:53:42 +0000 (12:53 -0500)]
ramster: Fix compile warnings due to usage of debugfs_create_size_t
We get tons of "note: expected ‘size_t *’ but argument is of type ‘long
int *’" warnings. This fixes it.
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Konrad Rzeszutek Wilk [Fri, 15 Feb 2013 17:53:41 +0000 (12:53 -0500)]
zcache: Fix compile warnings due to usage of debugfs_create_size_t
When we compile we get tons of:
include/linux/debugfs.h:80:16: note: expected ‘size_t *’ but argument is
of type ‘long int *’
drivers/staging/zcache/zcache-main.c:279:2: warning: passing argument 4
of ‘debugfs_create_size_t’ from incompatible pointer type [enabled by d
efault]
which is b/c we end up using 'unsigned' or 'unsigned long' instead
of 'ssize_t'. So lets fix this up and use the proper type.
[v2: Rebased directly on staging]
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Huewe [Thu, 14 Feb 2013 03:08:55 +0000 (04:08 +0100)]
staging/rtl8192u/ieee80211: Fix buffer overflow in ieee80211_softmac_wx.c
Clang/scan-build complains about a possible buffer overflow in
ieee80211_wx_get_name:
.../staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c:499:3:
warning: String copy function overflows destination buffer
strcat(wrqu->name," link..");
.../staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c:497:3:
warning: String copy function overflows destination buffer
strcat(wrqu->name," linked");
The buffer wrqu->name is only IFNAMSIZ bytes big (currently 16),
so if we have a "802.11b/g/n linked" device we overrun the buffer by 3
bytes.
-> Use strlcopy / strlcat to populate the name.
This is done in a similar fashion in
staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
While at it cleaned some whitespace issues.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Huewe [Thu, 14 Feb 2013 02:37:10 +0000 (03:37 +0100)]
staging/wlan-ng: Fix 'Branch condition evaluates to a garbage value' in p80211netdev.c
clang/scan-build complains that:
p80211netdev.c:451:6: warning: Branch condition evaluates to a garbage
value
if ((p80211_wep.data) && (p80211_wep.data != skb->data))
^~~~~~~~~~~~~~~~~
This can happen in p80211knetdev_hard_start_xmit if
- if (wlandev->state != WLAN_DEVICE_OPEN) evaluates to true.
the execution flow then continues at the 'failed' label where
p80211_wep.data is used without being initialized first.
-> Initialize the data field to NULL to fix this issue.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Magenheimer [Wed, 13 Feb 2013 18:13:06 +0000 (10:13 -0800)]
staging: zcache: add TODO file
Add zcache TODO file
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Huewe [Wed, 13 Feb 2013 14:28:14 +0000 (15:28 +0100)]
staging/comedi: Fix undefined array subscript
In vmk80xx_do_insn_bits the local variable reg, which is used as an
index to the tx_buf array, can be used uninitialized if
- data[0] == 0
and
- devpriv->model != VMK8061_MODEL
-> we get into the else branch without having reg initialized.
Since the driver usually differentiates between VMK8061_MODEL and
VMK8055_MODEL it's safe to assume that VMK8055_DO_REG was meant as an
initial value.
And to avoid duplication we can move the assignments to the top.
Acked-by: Ian Abbott <abbotti@mev.co.uk>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cyril Roelandt [Tue, 12 Feb 2013 04:01:52 +0000 (05:01 +0100)]
staging: tidspbridge: remove redundant NULL check before delete_msg_mgr().
delete_msg_mgr on a NULL pointer is a no-op, so the NULL check in
bridge_msg_delete can be removed.
Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cyril Roelandt [Tue, 12 Feb 2013 04:01:51 +0000 (05:01 +0100)]
staging: dgrp: remove redundant NULL check before unregister_dgrp_device().
unregister_dgrp_device on a NULL pointer is a no-op, so the NULL checks in
dgrp_remove_nd() can be removed.
Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Magenheimer [Mon, 11 Feb 2013 22:07:22 +0000 (14:07 -0800)]
staging/zcache: Fix/improve zcache writeback code, tie to a config option
It was observed by Andrea Arcangeli in 2011 that zcache can get "full"
and there must be some way for compressed swap pages to be (uncompressed
and then) sent through to the backing swap disk. A prototype of this
functionality, called "unuse", was added in 2012 as part of a major update
to zcache (aka "zcache2"), but was left unfinished due to the unfortunate
temporary fork of zcache.
This earlier version of the code had an unresolved memory leak
and was anyway dependent on not-yet-upstream frontswap and mm changes.
The code was meanwhile adapted by Seth Jennings for similar
functionality in zswap (which he calls "flush"). Seth also made some
clever simplifications which are herein ported back to zcache. As a
result of those simplifications, the frontswap changes are no longer
necessary, but a slightly different (and simpler) set of mm changes are
still required [1]. The memory leak is also fixed.
Due to feedback from akpm in a zswap thread, this functionality in zcache
has now been renamed from "unuse" to "writeback".
Although this zcache writeback code now works, there are open questions
as how best to handle the policy that drives it. As a result, this
patch also ties writeback to a new config option. And, since the
code still depends on not-yet-upstreamed mm patches, to avoid build
problems, the config option added by this patch temporarily depends
on "BROKEN"; this config dependency can be removed in trees that
contain the necessary mm patches.
[1] https://lkml.org/lkml/2013/1/29/540/ https://lkml.org/lkml/2013/1/29/539/
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Joe Perches [Mon, 11 Feb 2013 17:41:29 +0000 (09:41 -0800)]
staging: Remove unnecessary OOM messages
alloc failures already get standardized OOM
messages and a dump_stack.
For the affected mallocs around these OOM messages:
Converted kzallocs with multiplies to kcalloc.
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/strlen/strncpy to kstrdup.
Moved a spin_lock below a removed OOM message and
removed a now unnecessary spin_unlock.
Neatened alignment and whitespace.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Mon, 11 Feb 2013 17:58:02 +0000 (09:58 -0800)]
Merge tag 'iio-for-3.9d' of git://git./linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
"4th set of IIO new drivers cleanups and fixes for the 3.9 cycle
+ a new spi helper function.
1) Introduce spi_sync_transfer and use it within IIO. Originally
it was envisioned that this nice little boilerplate replacement
would go through the spi tree, but Grant Likely stated he'd
prefer we take it through IIO as the example usecases were all
in IIO (and are also in this pull request). Note that given
their may have been some unresolved elements related to the
coccinelle element of the patch, that has been stripped out
and will doubtlessly follow at a later date (along with
lots of other patches for drivers elsewhere in the tree).
2) New Invensense MPU6050 driver. This is stripped down to pretty
much the basics from the original submission with the intent
to build up all the fancy bits in an incremental (and hence
reviewable fashion). It's been through a good few revisions
so nice to finally merge this.
3) Change to iio_channel_get api to simplify device tree based
mappings. The actual mappings are currently under review.
4) Build fixes for !CONFIG_IIO_TRIGGER in the st_sensors driver.
This one snuck past during review and testing but got picked
up by Randy Dunlap in a randconfig build.
5) Some max1363 cleanups and enhancements.
6) Some comment fixes to make them coherent and comprehensible.
7) Trivial build warning fix in mxs-lradc"
Ge Gao [Sat, 2 Feb 2013 00:26:00 +0000 (00:26 +0000)]
Invensense MPU6050 Device Driver.
This the basic functional Invensense MPU6050 Device driver.
Signed-off-by: Ge Gao <ggao@invensense.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Sat, 9 Feb 2013 10:49:00 +0000 (10:49 +0000)]
iio:st_sensors fix build when !CONFIG_IIO_TRIGGER
Partly a case of removing unused headers and partly a case
of ifdefing out the iio_trigger_ops structures. This has
come about because of an 'unusual' separation of code in this
driver.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Jonathan Cameron [Sat, 9 Feb 2013 10:49:00 +0000 (10:49 +0000)]
iio:triggers Protect functions in triggers.h from use when not compiled
Also include a couple of forward defs of struct iio_trigger and struct
iio_trigger_ops to avoid doing this in each driver.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Lars-Peter Clausen [Wed, 9 Jan 2013 17:31:00 +0000 (17:31 +0000)]
staging:iio: Use spi_sync_transfer()
Use the new spi_sync_transfer() helper function instead of open-coding it.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 9 Jan 2013 17:31:00 +0000 (17:31 +0000)]
iio: Use spi_sync_transfer()
Use the new spi_sync_transfer() helper function instead of open-coding it.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 9 Jan 2013 17:31:00 +0000 (17:31 +0000)]
spi: Add helper functions for setting up transfers
Quite often the pattern used for setting up and transferring a synchronous SPI
transaction looks very much like the following:
struct spi_message msg;
struct spi_transfer xfers[] = {
...
};
spi_message_init(&msg);
spi_message_add_tail(&xfers[0], &msg);
...
spi_message_add_tail(&xfers[ARRAY_SIZE(xfers) - 1], &msg);
ret = spi_sync(&msg);
This patch adds two new helper functions for handling this case. The first
helper function spi_message_init_with_transfers() takes a spi_message and an
array of spi_transfers. It will initialize the message and then call
spi_message_add_tail() for each transfer in the array. E.g. the following
spi_message_init(&msg);
spi_message_add_tail(&xfers[0], &msg);
...
spi_message_add_tail(&xfers[ARRAY_SIZE(xfers) - 1], &msg);
can be rewritten as
spi_message_init_with_transfers(&msg, xfers, ARRAY_SIZE(xfers));
The second function spi_sync_transfer() takes a SPI device and an array of
spi_transfers. It will allocate a new spi_message (on the stack) and add all
transfers in the array to the message. Finally it will call spi_sync() on the
message.
E.g. the follwing
struct spi_message msg;
struct spi_transfer xfers[] = {
...
};
spi_message_init(&msg);
spi_message_add_tail(&xfers[0], &msg);
...
spi_message_add_tail(&xfers[ARRAY_SIZE(xfers) - 1], &msg);
ret = spi_sync(spi, &msg);
can be rewritten as
struct spi_transfer xfers[] = {
...
};
ret = spi_sync_transfer(spi, xfers, ARRAY_SIZE(xfers));
A coccinelle script to find such instances will follow.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fabio Estevam [Wed, 6 Feb 2013 02:54:00 +0000 (02:54 +0000)]
iio: mxs-lradc: Fix 'duplicate const' warning
The following warning is generated by sparse:
drivers/staging/iio/adc/mxs-lradc.c:118:47: warning: duplicate const
Remove the duplicate const.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Denis CIOCCA [Thu, 7 Feb 2013 09:46:00 +0000 (09:46 +0000)]
iio:common: added allocate and deallocate trigger functions when trigger is disabled.
This patch resolve a bugfix when driver is compiled without trigger.
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Aaro Koskinen [Fri, 8 Feb 2013 22:03:48 +0000 (00:03 +0200)]
staging: xgifb: XGI_SetDelayComp(): delete IF_DEF_LVDS check
Delete IF_DEF_LVDS check, this function is never called when it's true.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aaro Koskinen [Fri, 8 Feb 2013 22:03:47 +0000 (00:03 +0200)]
staging: xgifb: XGI_GetCRT2ResInfo(): delete IF_DEF_LVDS check
Delete IF_DEF_LVDS check, this function is never called when it's true.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aaro Koskinen [Fri, 8 Feb 2013 22:03:46 +0000 (00:03 +0200)]
staging: xgifb: XGI_GetLCDInfo(): delete IF_DEF_LVDS check
Delete IF_DEF_LVDS check, this function is never called when it's true.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aaro Koskinen [Fri, 8 Feb 2013 22:03:45 +0000 (00:03 +0200)]
staging: xgifb: XGI_GetTVInfo(): delete IF_DEF_LVDS checks
This function is never called when pVBInfo->IF_DEF_LVDS is true, so we
can remove checks and reduce complexity.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aaro Koskinen [Fri, 8 Feb 2013 22:03:44 +0000 (00:03 +0200)]
staging: xgifb: XGI_GetVBInfo(): delete IF_DEF_LVDS check
Delete IF_DEF_LVDS check, this function is never called when it's true.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aaro Koskinen [Fri, 8 Feb 2013 22:03:43 +0000 (00:03 +0200)]
staging: xgifb: XGI_GetVCLK2Ptr(): delete IF_DEF_LVDS check
Delete IF_DEF_LVDS check, this function is never called when it's true.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fengguang Wu [Fri, 8 Feb 2013 02:15:10 +0000 (10:15 +0800)]
staging: zram: __zram_reset_device() can be static
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Guenter Roeck [Mon, 4 Feb 2013 20:26:00 +0000 (20:26 +0000)]
iio: Update iio_channel_get API to use consumer device pointer as argument
For iio_channel_get to work with OF based configurations, it needs the
consumer device pointer instead of the consumer device name as argument.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Anton Vorontsov <anton@enomsg.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Mon, 4 Feb 2013 11:36:00 +0000 (11:36 +0000)]
iio: tweak language in industrialio-trigger comments
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Guenter Roeck [Sun, 3 Feb 2013 00:59:00 +0000 (00:59 +0000)]
iio/adc: (max1363) Add support for external reference voltage
Implement external reference voltage as regulator named "vref".
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Guenter Roeck [Sun, 3 Feb 2013 00:59:00 +0000 (00:59 +0000)]
iio: max1363: Use devm_ functions whereever possible to allocate resources
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Greg Kroah-Hartman [Tue, 5 Feb 2013 19:25:37 +0000 (11:25 -0800)]
Merge tag 'iio-for-3.9c' of git://git./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
"
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>
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>
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>
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>
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>
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>
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>
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>
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>