]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
12 years ago[media] V4L: OV5642:remove redundant code to set cropping w/h
Liu Ying [Fri, 30 Mar 2012 08:41:27 +0000 (05:41 -0300)]
[media] V4L: OV5642:remove redundant code to set cropping w/h

This patch contains code change only to remove redundant
code to set priv->crop_rect.width/height in probe function.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
Acked-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: Make em28xx-input.c a separate module
Ezequiel García [Mon, 26 Mar 2012 12:13:35 +0000 (09:13 -0300)]
[media] em28xx: Make em28xx-input.c a separate module

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
[mchehab@redhat.com: Changed the default to follow the em28xx selection]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: Change scope of em28xx-input local functions to static
Ezequiel García [Mon, 26 Mar 2012 12:13:34 +0000 (09:13 -0300)]
[media] em28xx: Change scope of em28xx-input local functions to static

This functions are no longer used from another file,
so they should be declared as static.
Also is it necessary to move some of them before they
are used, since they are no longer header-declared.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: Move em28xx_register_i2c_ir() to em28xx-input.c
Ezequiel García [Mon, 26 Mar 2012 12:13:33 +0000 (09:13 -0300)]
[media] em28xx: Move em28xx_register_i2c_ir() to em28xx-input.c

This function is only used in em28xx-input.c so it
makes no sense to have it anywhere but in em28xx-input.c.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: Move ir/rc related initialization to em28xx_ir_init()
Ezequiel García [Mon, 26 Mar 2012 12:13:32 +0000 (09:13 -0300)]
[media] em28xx: Move ir/rc related initialization to em28xx_ir_init()

Moving this helps isolating em28xx_input and will help
converting it into a separate module.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: Export em28xx_[read,write]_reg functions as SYMBOL_GPL
Ezequiel García [Mon, 26 Mar 2012 12:13:31 +0000 (09:13 -0300)]
[media] em28xx: Export em28xx_[read,write]_reg functions as SYMBOL_GPL

Those functions will be needed by em28xx-input module, to be
added on the next patches.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] staging/media/as102: Don't call release_firmware() on uninitialized variable
Jesper Juhl [Sat, 24 Mar 2012 21:39:18 +0000 (18:39 -0300)]
[media] staging/media/as102: Don't call release_firmware() on uninitialized variable

If, in drivers/staging/media/as102/as102_fw.c::as102_fw_upload(), the call
cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL);
should fail and return NULL so that we jump to the 'error:' label,
then we'll end up calling 'release_firmware(firmware);' with
'firmware' still uninitialized - not good.

The easy fix is to just initialize 'firmware' to NULL when we declare
it, since release_firmware() deals gracefully with being passed NULL
pointers.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: Remove redundant dev->ctl_input set
Ezequiel García [Fri, 23 Mar 2012 21:09:34 +0000 (18:09 -0300)]
[media] em28xx: Remove redundant dev->ctl_input set

dev->ctl_input() is always set before a call to video_mux(),
but then video_mux() sets it again with the same value.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] radio-gemtek: add PnP support for AOpen FX-3D/Pro Radio
Ondrej Zary [Thu, 22 Mar 2012 17:53:29 +0000 (14:53 -0300)]
[media] radio-gemtek: add PnP support for AOpen FX-3D/Pro Radio

Add PnP support to radio-gemtek for AOpen FX-3D/Pro Radio card
(AD1816 + Gemtek radio).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] radio-isa: PnP support for the new ISA radio framework
Ondrej Zary [Thu, 22 Mar 2012 17:53:01 +0000 (14:53 -0300)]
[media] radio-isa: PnP support for the new ISA radio framework

Add PnP support to the new ISA radio framework.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Mark VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP obsolete
Sakari Ailus [Sat, 7 Jan 2012 09:23:36 +0000 (06:23 -0300)]
[media] v4l: Mark VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP obsolete

These two IOCTLS are obsoleted by VIDIOC_SUBDEV_G_SELECTION and
VIDIOC_SUBDEV_S_SELECTION. Mark them obsolete.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Add subdev selections documentation
Sakari Ailus [Mon, 12 Dec 2011 21:17:25 +0000 (18:17 -0300)]
[media] v4l: Add subdev selections documentation

Add documentation for V4L2 subdev selection API. This changes also
experimental V4L2 subdev API so that scaling now works through selection API
only.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Add subdev selections documentation: svg and dia files
Sakari Ailus [Thu, 2 Feb 2012 12:30:00 +0000 (09:30 -0300)]
[media] v4l: Add subdev selections documentation: svg and dia files

Add svga and dia files for V4L2 subdev selections documentation.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx: clean-up several unused parametrs in struct em28xx_usb_isoc_ctl
Gianluca Gennari [Thu, 22 Mar 2012 14:13:55 +0000 (11:13 -0300)]
[media] em28xx: clean-up several unused parametrs in struct em28xx_usb_isoc_ctl

Get rid of several unused parameters in struct em28xx_usb_isoc_ctl.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] em28xx-dvb: stop URBs when stopping the streaming
Gianluca Gennari [Thu, 22 Mar 2012 11:48:17 +0000 (08:48 -0300)]
[media] em28xx-dvb: stop URBs when stopping the streaming

Stop the URBs in em28xx_stop_streaming(), so that em28xx_irq_callback()
cannot be called after the streaming has stopped.

This should eliminate the crashes reported by Antti Palosaari and the warnings
reported by Andy Furniss.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer...
Bhupesh Sharma [Thu, 22 Mar 2012 03:50:37 +0000 (00:50 -0300)]
[media] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine

This patch removes the non-required spinlock acquire/release calls on
'queue_irqlock' from 'uvc_queue_next_buffer' routine.

This routine is called from 'video->encode' function (which translates to either
'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
As, the 'video->encode' routines are called with 'queue_irqlock' already held,
so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer' routine causes
a spin lock recursion.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] mm/drivers: use vm_flags_t for vma flags
Konstantin Khlebnikov [Wed, 21 Mar 2012 05:56:33 +0000 (02:56 -0300)]
[media] mm/drivers: use vm_flags_t for vma flags

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] uvcvideo: remove unneeded access_ok() check
Dan Carpenter [Wed, 21 Mar 2012 05:35:23 +0000 (02:35 -0300)]
[media] uvcvideo: remove unneeded access_ok() check

copy_in_user() already checks for write permission, so we don't need to
do it here.  This was added in 1a5e4c867c "[media] uvcvideo: Implement
compat_ioctl32 for custom ioctls".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] [3.3.0] ir-raw: remove BUG_ON in ir_raw_event_thread
Srinivas Kandagatla [Tue, 20 Mar 2012 17:05:40 +0000 (14:05 -0300)]
[media] [3.3.0] ir-raw: remove BUG_ON in ir_raw_event_thread

This patch removes BUG_ON in ir_raw_event_thread which IMO is a
over-kill, and this kills the ir_raw_event_thread too. With a bit of
additional logic in this patch, we nomore need to kill this thread.
Other disadvantage of having a BUG-ON is,
wake_up_process(dev->raw->thread) called on dead thread via
ir_raw_event_handle will result in total lockup in SMP system.

Advantage of this patch is ir-raw event thread is left in a usable state
even if the fifo does not have enough bytes.

This patch sets the thread into TASK_INTERRUPTIBLE if raw-fifo has less
then sizeof(struct ir_raw_event) bytes.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] i.MX2: eMMa-PrP: Allow userptr IO mode
Javier Martin [Tue, 20 Mar 2012 14:33:59 +0000 (11:33 -0300)]
[media] i.MX2: eMMa-PrP: Allow userptr IO mode

Userptr can be very useful if this device
is requested to use video buffers allocated
by another processing device. So that
buffers don't need to be copied.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] lirc: delete unused init/exit function prototypes
Gianluca Gennari [Tue, 20 Mar 2012 13:10:39 +0000 (10:10 -0300)]
[media] lirc: delete unused init/exit function prototypes

The lirc sasem and imon drivers now use the module_usb_driver macro, so the old
init/exit function prototypes are useless.

This patch eliminates this warnings:

media_build/v4l/lirc_imon.c:74:19: warning: 'imon_init' declared 'static' but never defined [-Wunused-function]
media_build/v4l/lirc_imon.c:75:20: warning: 'imon_exit' declared 'static' but never defined [-Wunused-function]
media_build/v4l/lirc_sasem.c:84:19: warning: 'sasem_init' declared 'static' but never defined [-Wunused-function]
media_build/v4l/lirc_sasem.c:85:20: warning: 'sasem_exit' declared 'static' but never defined [-Wunused-function]

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] s5p-fimc: Handle sub-device interdependencies using deferred probing
Sylwester Nawrocki [Wed, 21 Mar 2012 12:58:09 +0000 (09:58 -0300)]
[media] s5p-fimc: Handle sub-device interdependencies using deferred probing

In this driver there are several entities associated with separate
platform or I2C client devices, which may get probed in random order.

When the platform device bound to the media device driver is probed
all other entity drivers need to be already in place and initialized.
If any of them is not, fail the media device probe and return an error
indicating we need to be retried once any new driver gets registered.
The media device driver probe will not succeed until there are available
all needed sub-drivers, as specified in the platform data.

While at it, make sure the s5p-csis module (MIPI-CSI receiver driver)
does not get unloaded when in use, by guarding its usage with
try_module_get/module_put.

This patch is a prerequisite for adding the device tree support.
It now also allows again to unbind/bind the driver at runtime from
user space via sysfs.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] s5p-fimc: Remove unneeded fields from struct fimc_dev
Sylwester Nawrocki [Sat, 17 Mar 2012 21:31:33 +0000 (18:31 -0300)]
[media] s5p-fimc: Remove unneeded fields from struct fimc_dev

irq is used only locally and num_clocks is constant, so remove them.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] s5p-fimc: Refactor hardware setup for m2m transaction
Sylwester Nawrocki [Mon, 19 Mar 2012 13:02:41 +0000 (10:02 -0300)]
[media] s5p-fimc: Refactor hardware setup for m2m transaction

Remove redundant H/W setup logic by merging fimc_prepare_config()
and the device_run() callback.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] s5p-fimc: Simplify locking by removing the context data structure spinlock
Sylwester Nawrocki [Mon, 19 Mar 2012 16:11:40 +0000 (13:11 -0300)]
[media] s5p-fimc: Simplify locking by removing the context data structure spinlock

Access to the memory-to-memory video node is serialized through a
mutex so now there is no point in having per device context structure
spinlock.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] s5p-fimc: Reinitialize the pipeline properly after VIDIOC_STREAMOFF
Sylwester Nawrocki [Fri, 16 Mar 2012 14:47:51 +0000 (11:47 -0300)]
[media] s5p-fimc: Reinitialize the pipeline properly after VIDIOC_STREAMOFF

This patch prevents blocking on DQBUF at a video capture node in some
conditions, after STREAOMOFF/STREAMON sequence. The ST_CAPT_SUSPEND
flag should not be set during normal stream off, otherwise the
capture engine is not properly enabled at stream on.

Reported-by: Bernard Debbasch <b.debbasch@ssi.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] s5p-fimc: Don't use platform data for CSI data alignment configuration
Sylwester Nawrocki [Wed, 21 Mar 2012 09:21:30 +0000 (06:21 -0300)]
[media] s5p-fimc: Don't use platform data for CSI data alignment configuration

The MIPI-CSI2 data alignment parameter can be derived from media bus
pixel code, so it can be now dropped from the platform data structure.
This is a prerequisite for adding the device tree support. Once this
patch is merged the corresponding fields will be removed from the
drivers' public headers and corresponding board files.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Support s_crop and g_crop through s/g_selection
Sakari Ailus [Mon, 14 Nov 2011 18:30:24 +0000 (15:30 -0300)]
[media] v4l: Support s_crop and g_crop through s/g_selection

Fall back to s_selection if s_crop isn't implemented by a driver. Same for
g_selection / g_crop.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Check pad number in get try pointer functions
Sakari Ailus [Thu, 16 Feb 2012 01:57:22 +0000 (22:57 -0300)]
[media] v4l: Check pad number in get try pointer functions

Unify functions to get try pointers and validate the pad number accessed by
the user.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: vdev_to_v4l2_subdev() should have return type "struct v4l2_subdev *"
Sakari Ailus [Thu, 16 Feb 2012 01:58:12 +0000 (22:58 -0300)]
[media] v4l: vdev_to_v4l2_subdev() should have return type "struct v4l2_subdev *"

vdev_to_v4l2_subdev() should return struct v4l2_subdev *, not void *. Fix
this.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
Sakari Ailus [Fri, 14 Oct 2011 17:14:26 +0000 (14:14 -0300)]
[media] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs

Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION
IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and
VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing).

VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] vivi: Add an integer menu test control
Sakari Ailus [Fri, 5 Aug 2011 09:38:05 +0000 (06:38 -0300)]
[media] vivi: Add an integer menu test control

Add an integer menu test control for the vivi driver.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Document integer menu controls
Sakari Ailus [Sat, 6 Aug 2011 19:13:47 +0000 (16:13 -0300)]
[media] v4l: Document integer menu controls

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] v4l: Introduce integer menu controls
Sakari Ailus [Thu, 4 Aug 2011 16:51:11 +0000 (13:51 -0300)]
[media] v4l: Introduce integer menu controls

Create a new control type called V4L2_CTRL_TYPE_INTEGER_MENU. Integer menu
controls are just like menu controls but the menu items are 64-bit integers
rather than strings.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] mxl111sf: remove an unused variable
Dan Carpenter [Fri, 23 Mar 2012 07:35:33 +0000 (04:35 -0300)]
[media] mxl111sf: remove an unused variable

We don't use this any more after 3be5bb71fb "[media] mxl111sf: fix error
on stream stop in mxl111sf_ep6_streaming_ctrl()" and it makes GCC
complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: disable frontend0 I2C-gate control
Antti Palosaari [Fri, 6 Apr 2012 10:09:23 +0000 (07:09 -0300)]
[media] af9035: disable frontend0 I2C-gate control

Seems like tuners used for frontend0 are not behind demodulator
I2C-gate thus gate control is not needed. Disable it for sure as
it can cause problems some situations.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: reorganise USB ID and device list
Antti Palosaari [Fri, 6 Apr 2012 00:58:09 +0000 (21:58 -0300)]
[media] af9035: reorganise USB ID and device list

Add and rename "Afatech AF9035 reference design" as a first
device in the list since it sounds logical to keep reference
design IDs on top of the list.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: minor changes for af9035_fc0011_tuner_callback()
Antti Palosaari [Fri, 6 Apr 2012 00:52:21 +0000 (21:52 -0300)]
[media] af9035: minor changes for af9035_fc0011_tuner_callback()

Change function to use same logic than existing functions.
Debugs log writings are done in error case, earlier it was
just returning error code.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: add AVerMedia Twinstar (A825) [07ca:0825]
Pierangelo Terzulli [Fri, 6 Apr 2012 00:26:18 +0000 (21:26 -0300)]
[media] af9035: add AVerMedia Twinstar (A825) [07ca:0825]

[crope@iki.fi: applied manually since erroneous patch]
Signed-off-by: Pierangelo Terzulli <pierigno@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9033: do some minor changes for .get_frontend()
Antti Palosaari [Fri, 6 Apr 2012 00:14:32 +0000 (21:14 -0300)]
[media] af9033: do some minor changes for .get_frontend()

Minor functionality and style changes.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9033: implement get_frontend
Gianluca Gennari [Thu, 5 Apr 2012 15:47:19 +0000 (12:47 -0300)]
[media] af9033: implement get_frontend

Implement the get_frontend function.
The code is derived from the old af9033 driver by Antti Palosaari.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: initial support for IT9135 chip
Antti Palosaari [Thu, 5 Apr 2012 23:28:51 +0000 (20:28 -0300)]
[media] af9035: initial support for IT9135 chip

AF9035 code needed for IT9135 chip support. Needs still small
changes for AF9033 and totally new tuner driver in order to
get that chip version working.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] fc0011: Reduce number of retries
Michael Büsch [Tue, 3 Apr 2012 08:05:03 +0000 (05:05 -0300)]
[media] fc0011: Reduce number of retries

Now that i2c transfers are fixed, 3 retries are enough.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: Use usleep_range() in fc0011 support code
Michael Büsch [Tue, 3 Apr 2012 08:11:30 +0000 (05:11 -0300)]
[media] af9035: Use usleep_range() in fc0011 support code

Use usleep_range() instead of msleep() to improve power saving opportunities.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] fc0011: use usleep_range()
Michael Büsch [Tue, 3 Apr 2012 08:08:45 +0000 (05:08 -0300)]
[media] fc0011: use usleep_range()

Use usleep_range() instead of msleep() to improve power saving opportunities.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: fix and enhance I2C adapter
Antti Palosaari [Mon, 2 Apr 2012 23:18:59 +0000 (20:18 -0300)]
[media] af9035: fix and enhance I2C adapter

There was a bug I2C adapter writes and reads one byte too much.
As the most I2C clients has auto-increment register addressing
this leads next register from the target register overwritten by
garbage data.

As a change remove whole register address byte usage and write
data directly to the I2C bus without saying what are register
address bytes to firmware.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: Michael Buesch <m@bues.ch>
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Cc: Gianluca Gennari <gennarone@gmail.com>
Tested-by: Michael Buesch <m@bues.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: use module_usb_driver macro
Gianluca Gennari [Mon, 2 Apr 2012 20:25:17 +0000 (17:25 -0300)]
[media] af9035: use module_usb_driver macro

Let's save a few lines of code using the module_usb_driver macro.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: add support for the tda18218 tuner
Gianluca Gennari [Mon, 2 Apr 2012 20:25:14 +0000 (17:25 -0300)]
[media] af9035: add support for the tda18218 tuner

Add basic support for the tda18218 tuner and the AVerMedia A835 devices.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: add USB id for 07ca:a867
Gianluca Gennari [Mon, 2 Apr 2012 20:25:13 +0000 (17:25 -0300)]
[media] af9035: add USB id for 07ca:a867

New USB id for the Avermedia A867 stick (Sky Digital Key with blue led).

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: add Avermedia Volar HD (A867R) support
Hans-Frieder Vogt [Mon, 2 Apr 2012 17:18:16 +0000 (14:18 -0300)]
[media] af9035: add Avermedia Volar HD (A867R) support

Support of AVerMedia AVerTV HD Volar, with tuner MxL5007t.

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: Add Afatech USB PIDs
Michael Büsch [Mon, 2 Apr 2012 15:34:52 +0000 (12:34 -0300)]
[media] af9035: Add Afatech USB PIDs

Add some generic Afatech USB PIDs used by "Cabstone" sticks and others.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: Add fc0011 tuner support
Michael Büsch [Mon, 2 Apr 2012 15:18:36 +0000 (12:18 -0300)]
[media] af9035: Add fc0011 tuner support

This adds Fitipower fc0011 tuner support to the af9035 driver.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] Add fc0011 tuner driver
Michael Büsch [Mon, 2 Apr 2012 15:14:32 +0000 (12:14 -0300)]
[media] Add fc0011 tuner driver

This adds support for the Fitipower fc0011 DVB-t tuner.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: fix warning
Gianluca Gennari [Mon, 2 Apr 2012 23:32:58 +0000 (20:32 -0300)]
[media] af9035: fix warning

On a 32 bit system:

af9035.c: In function 'af9035_download_firmware':
af9035.c:446:3: warning: format '%lu' expects argument of type 'long unsigned
int', but argument 3 has type 'unsigned int' [-Wformat]

%zu avoids any warning on both 32 and 64 bit systems.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: Add USB read checksumming
Michael Büsch [Sun, 1 Apr 2012 19:33:48 +0000 (16:33 -0300)]
[media] af9035: Add USB read checksumming

This adds USB message read checksumming to protect against
device and bus errors.
It also adds a read length check to avoid returning garbage from
the buffer, if the device truncated the message.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: i2c read fix
Hans-Frieder Vogt [Sun, 1 Apr 2012 17:11:29 +0000 (14:11 -0300)]
[media] af9035: i2c read fix

Enable i2c read requests.

I2C read fix (necessary e.g. for mxl5007t tuner, because it
sends a 2 bytes for a read request, thus msg[0].len != msg[1].len).

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: add log writing if unsupported Xtal freq is given
Antti Palosaari [Sun, 1 Apr 2012 17:13:36 +0000 (14:13 -0300)]
[media] af9035: add log writing if unsupported Xtal freq is given

Supports currently only 12 MHz Xtals. It is better to print log
and not to attach frontend in that case.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9033: implement .read_snr()
Antti Palosaari [Sun, 1 Apr 2012 15:50:02 +0000 (12:50 -0300)]
[media] af9033: implement .read_snr()

Returns values as 0.1 dB resolution as preferred nowadays.
Actual resolution is 1 dB.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9033: correct debug print
Antti Palosaari [Sun, 1 Apr 2012 14:14:59 +0000 (11:14 -0300)]
[media] af9033: correct debug print

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: add missing error check
Antti Palosaari [Sun, 1 Apr 2012 14:06:23 +0000 (11:06 -0300)]
[media] af9035: add missing error check

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: reimplement firmware downloader
Antti Palosaari [Sun, 1 Apr 2012 04:32:23 +0000 (01:32 -0300)]
[media] af9035: reimplement firmware downloader

Big thanks to Daniel Glöckner <daniel-gl@gmx.net> for
revealing firmware structure on Linux Media mailing
list.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: Daniel Glöckner <daniel-gl@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] af9035: enhancement for unknown tuner ID handling
Antti Palosaari [Fri, 30 Mar 2012 20:15:16 +0000 (17:15 -0300)]
[media] af9035: enhancement for unknown tuner ID handling

* do not attach frontend when tuner is not supported
* fix unkown tuner ID log write format
* add prefix for dvb-usb log writings

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] Afatech AF9035 DVB USB driver
Antti Palosaari [Fri, 30 Mar 2012 12:10:08 +0000 (09:10 -0300)]
[media] Afatech AF9035 DVB USB driver

AF9035 is integrated DVB USB interface and DVB-T demodulator.
Integrated demodulator is AF9033 and its driver is attached
runtime as a own module.

Driver currently supports only one device,
TerraTec Cinergy T Stick [0ccd:0093].

TerraTec Cinergy T Stick is based of Afatech AF9035 +
Infineon TUA 9001 silicon tuner.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] Afatech AF9033 DVB-T demodulator driver
Antti Palosaari [Fri, 30 Mar 2012 11:21:25 +0000 (08:21 -0300)]
[media] Afatech AF9033 DVB-T demodulator driver

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] Infineon TUA 9001 silicon tuner driver
Antti Palosaari [Fri, 30 Mar 2012 09:37:26 +0000 (06:37 -0300)]
[media] Infineon TUA 9001 silicon tuner driver

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years agopwc: Add support for control events
Hans de Goede [Tue, 27 Mar 2012 16:57:55 +0000 (18:57 +0200)]
pwc: Add support for control events

Since the pwc driver already uses v4l2-device, v4l2-fh, and the control
framework, all that is needed is hooking up event subscription.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] radio-rtrack2: add missing slab.h
Hans Verkuil [Tue, 27 Mar 2012 08:39:21 +0000 (05:39 -0300)]
[media] radio-rtrack2: add missing slab.h

Missed this one, this patch should solve this issue:

http://www.spinics.net/lists/linux-media/msg45880.html

Slab.h was added to all the other isa drivers, but not radio-rtrack2.c.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] pwc: poll(): Check that the device has not beem claimed for streaming already
Hans de Goede [Sun, 9 Oct 2011 13:28:27 +0000 (10:28 -0300)]
[media] pwc: poll(): Check that the device has not beem claimed for streaming already

Some apps which use read() start the streaming through a call to poll(),
this means that if another app has already claimed the device for streaming
(through for example a s_fmt, or a reqbufs), that the poll should fail instead
of getting passed through to vb2_poll.

We only check for this when the app is polling for reads, so that ctrl events
still work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] vivi: let vb2_poll handle events
Hans Verkuil [Wed, 13 Jul 2011 07:28:27 +0000 (04:28 -0300)]
[media] vivi: let vb2_poll handle events

The vb2_poll function now tests for events and sets POLLPRI accordingly.
So there it is no longer necessary to test for it in the vivi driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] videobuf2-core: also test for pending events
Hans Verkuil [Wed, 13 Jul 2011 07:26:52 +0000 (04:26 -0300)]
[media] videobuf2-core: also test for pending events

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] videobuf: only start streaming in poll() if so requested by the poll mask
Hans Verkuil [Wed, 13 Jul 2011 07:03:52 +0000 (04:03 -0300)]
[media] videobuf: only start streaming in poll() if so requested by the poll mask

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] videobuf2: only start streaming in poll() if so requested by the poll mask
Hans Verkuil [Wed, 13 Jul 2011 07:01:30 +0000 (04:01 -0300)]
[media] videobuf2: only start streaming in poll() if so requested by the poll mask

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years ago[media] ivtv: only start streaming in poll() if polling for input
Hans Verkuil [Fri, 3 Feb 2012 08:12:18 +0000 (05:12 -0300)]
[media] ivtv: only start streaming in poll() if polling for input

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 years agoMerge branch 'poll' into staging/for_v3.4
Mauro Carvalho Chehab [Tue, 27 Mar 2012 14:32:29 +0000 (11:32 -0300)]
Merge branch 'poll' into staging/for_v3.4

* poll: (5970 commits)
  poll: add poll_requested_events() and poll_does_not_wait() functions
  crc32: select an algorithm via Kconfig
  crc32: add self-test code for crc32c
  crypto: crc32c should use library implementation
  crc32: bolt on crc32c
  crc32: add note about this patchset to crc32.c
  crc32: optimize loop counter for x86
  crc32: add slice-by-8 algorithm to existing code
  crc32: make CRC_*_BITS definition correspond to actual bit counts
  crc32: fix mixing of endian-specific types
  crc32: miscellaneous cleanups
  crc32: simplify unit test code
  crc32: move long comment about crc32 fundamentals to Documentation/
  crc32: remove two instances of trailing whitespaces
  checkpatch: check for quoted strings broken across lines
  checkpatch: whitespace - add/remove blank lines
  checkpatch: warn on use of yield()
  checkpatch: add --strict tests for braces, comments and casts
  checkpatch: add [] to type extensions
  checkpatch: high precedence operators do not require additional parentheses in #defines
  ...

12 years agopoll: add poll_requested_events() and poll_does_not_wait() functions
Hans Verkuil [Fri, 23 Mar 2012 22:02:27 +0000 (15:02 -0700)]
poll: add poll_requested_events() and poll_does_not_wait() functions

In some cases the poll() implementation in a driver has to do different
things depending on the events the caller wants to poll for.  An example
is when a driver needs to start a DMA engine if the caller polls for
POLLIN, but doesn't want to do that if POLLIN is not requested but instead
only POLLOUT or POLLPRI is requested.  This is something that can happen
in the video4linux subsystem among others.

Unfortunately, the current epoll/poll/select implementation doesn't
provide that information reliably.  The poll_table_struct does have it: it
has a key field with the event mask.  But once a poll() call matches one
or more bits of that mask any following poll() calls are passed a NULL
poll_table pointer.

Also, the eventpoll implementation always left the key field at ~0 instead
of using the requested events mask.

This was changed in eventpoll.c so the key field now contains the actual
events that should be polled for as set by the caller.

The solution to the NULL poll_table pointer is to set the qproc field to
NULL in poll_table once poll() matches the events, not the poll_table
pointer itself.  That way drivers can obtain the mask through a new
poll_requested_events inline.

The poll_table_struct can still be NULL since some kernel code calls it
internally (netfs_state_poll() in ./drivers/staging/pohmelfs/netfs.h).  In
that case poll_requested_events() returns ~0 (i.e.  all events).

Very rarely drivers might want to know whether poll_wait will actually
wait.  If another earlier file descriptor in the set already matched the
events the caller wanted to wait for, then the kernel will return from the
select() call without waiting.  This might be useful information in order
to avoid doing expensive work.

A new helper function poll_does_not_wait() is added that drivers can use
to detect this situation.  This is now used in sock_poll_wait() in
include/net/sock.h.  This was the only place in the kernel that needed
this information.

Drivers should no longer access any of the poll_table internals, but use
the poll_requested_events() and poll_does_not_wait() access functions
instead.  In order to enforce that the poll_table fields are now prepended
with an underscore and a comment was added warning against using them
directly.

This required a change in unix_dgram_poll() in unix/af_unix.c which used
the key field to get the requested events.  It's been replaced by a call
to poll_requested_events().

For qproc it was especially important to change its name since the
behavior of that field changes with this patch since this function pointer
can now be NULL when that wasn't possible in the past.

Any driver accessing the qproc or key fields directly will now fail to compile.

Some notes regarding the correctness of this patch: the driver's poll()
function is called with a 'struct poll_table_struct *wait' argument.  This
pointer may or may not be NULL, drivers can never rely on it being one or
the other as that depends on whether or not an earlier file descriptor in
the select()'s fdset matched the requested events.

There are only three things a driver can do with the wait argument:

1) obtain the key field:

events = wait ? wait->key : ~0;

   This will still work although it should be replaced with the new
   poll_requested_events() function (which does exactly the same).
   This will now even work better, since wait is no longer set to NULL
   unnecessarily.

2) use the qproc callback. This could be deadly since qproc can now be
   NULL. Renaming qproc should prevent this from happening. There are no
   kernel drivers that actually access this callback directly, BTW.

3) test whether wait == NULL to determine whether poll would return without
   waiting. This is no longer sufficient as the correct test is now
   wait == NULL || wait->_qproc == NULL.

   However, the worst that can happen here is a slight performance hit in
   the case where wait != NULL and wait->_qproc == NULL. In that case the
   driver will assume that poll_wait() will actually add the fd to the set
   of waiting file descriptors. Of course, poll_wait() will not do that
   since it tests for wait->_qproc. This will not break anything, though.

   There is only one place in the whole kernel where this happens
   (sock_poll_wait() in include/net/sock.h) and that code will be replaced
   by a call to poll_does_not_wait() in the next patch.

   Note that even if wait->_qproc != NULL drivers cannot rely on poll_wait()
   actually waiting. The next file descriptor from the set might match the
   event mask and thus any possible waits will never happen.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Jonathan Corbet <corbet@lwn.net>
Reviewed-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: select an algorithm via Kconfig
Darrick J. Wong [Fri, 23 Mar 2012 22:02:26 +0000 (15:02 -0700)]
crc32: select an algorithm via Kconfig

Allow the kernel builder to choose a crc32* algorithm for the kernel.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: add self-test code for crc32c
Darrick J. Wong [Fri, 23 Mar 2012 22:02:26 +0000 (15:02 -0700)]
crc32: add self-test code for crc32c

Add self-test code for crc32c.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrypto: crc32c should use library implementation
Darrick J. Wong [Fri, 23 Mar 2012 22:02:25 +0000 (15:02 -0700)]
crypto: crc32c should use library implementation

Since lib/crc32.c now provides crc32c, remove the software implementation
here and call the library function instead.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: bolt on crc32c
Darrick J. Wong [Fri, 23 Mar 2012 22:02:25 +0000 (15:02 -0700)]
crc32: bolt on crc32c

Reuse the existing crc32 code to stamp out a crc32c implementation.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Bob Pearson <rpearson@systemfabricworks.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: add note about this patchset to crc32.c
Bob Pearson [Fri, 23 Mar 2012 22:02:24 +0000 (15:02 -0700)]
crc32: add note about this patchset to crc32.c

Add a comment at the top of crc32.c

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: optimize loop counter for x86
Bob Pearson [Fri, 23 Mar 2012 22:02:24 +0000 (15:02 -0700)]
crc32: optimize loop counter for x86

Add two changes that improve the performance of x86 systems

1. replace main loop with incrementing counter this change improves
   the performance of the selftest by about 5-6% on Nehalem CPUs.  The
   apparent reason is that the compiler can use the loop index to perform
   an indexed memory access.  This is reported to make the performance of
   PowerPC CPUs to get worse.

2. replace the rem_len loop with incrementing counter this change
   improves the performance of the selftest, which has more than the usual
   number of occurances, by about 1-2% on x86 CPUs.  In actual work loads
   the length is most often a multiple of 4 bytes and this code does not
   get executed as often if at all.  Again this change is reported to make
   the performance of PowerPC get worse.

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: add slice-by-8 algorithm to existing code
Bob Pearson [Fri, 23 Mar 2012 22:02:24 +0000 (15:02 -0700)]
crc32: add slice-by-8 algorithm to existing code

Add slicing-by-8 algorithm to the existing slicing-by-4 algorithm.  This
consists of:

- extend largest BITS size from 32 to 64
- extend tables from tab[4][256] to up to tab[8][256]
- Add code for inner loop.

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: make CRC_*_BITS definition correspond to actual bit counts
Bob Pearson [Fri, 23 Mar 2012 22:02:23 +0000 (15:02 -0700)]
crc32: make CRC_*_BITS definition correspond to actual bit counts

crc32.c provides a choice of one of several algorithms for computing the
LSB and LSB versions of the CRC32 checksum based on the parameters
CRC_LE_BITS and CRC_BE_BITS.

In the original version the values 1, 2, 4 and 8 respectively selected
versions of the alrogithm that computed the crc 1, 2, 4 and 32 bits as a
time.

This patch series adds a new version that computes the CRC 64 bits at a
time.  To make things easier to understand the parameter has been
reinterpreted to actually stand for the number of bits processed in each
step of the algorithm so that the old value 8 has been replaced with the
value 32.

This also allows us to add in a widely used crc algorithm that computes
the crc 8 bits at a time called the Sarwate algorithm.

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: fix mixing of endian-specific types
Bob Pearson [Fri, 23 Mar 2012 22:02:23 +0000 (15:02 -0700)]
crc32: fix mixing of endian-specific types

crc32.c in its original version freely mixed u32, __le32 and __be32 types
which caused warnings from sparse with __CHECK_ENDIAN__.  This patch fixes
these by forcing the types to u32.

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: miscellaneous cleanups
Bob Pearson [Fri, 23 Mar 2012 22:02:22 +0000 (15:02 -0700)]
crc32: miscellaneous cleanups

Misc cleanup of lib/crc32.c and related files.

- remove unnecessary header files.

- straighten out some convoluted ifdef's

- rewrite some references to 2 dimensional arrays as 1 dimensional
  arrays to make them correct.  I.e.  replace tab[i] with tab[0][i].

- a few trivial whitespace changes

- fix a warning in gen_crc32tables.c caused by a mismatch in the type of
  the pointer passed to output table.  Since the table is only used at
  kernel compile time, it is simpler to make the table big enough to hold
  the largest column size used.  One cannot make the column size smaller
  in output_table because it has to be used by both the le and be tables
  and they can have different column sizes.

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: simplify unit test code
Bob Pearson [Fri, 23 Mar 2012 22:02:22 +0000 (15:02 -0700)]
crc32: simplify unit test code

Replace the unit test provided in crc32.c, which doesn't have a makefile
and doesn't compile with current headers, with a simpler self test
routine that also gives a measure of performance and runs at module init
time.  The self test option can be enabled through a configuration
option CONFIG_CRC32_SELFTEST.

The test stresses the pre and post loops and is thus not very realistic
since actual uses will likely have addresses and lengths that are at
least 4 byte aligned.  However, the main loop is long enough so that the
performance is dominated by that loop.

The expected values for crc32_le and crc32_be were generated with the
original version of crc32.c using CRC_BITS_LE = 8 and CRC_BITS_BE = 8.
These values were then used to check all the values of the BITS
parameters in both the original and new versions.

The performance results show some variability from run to run in spite
of attempts to both warm the cache and reduce the amount of OS noise by
limiting interrutps during the test.  To get comparable results and to
analyse options wrt performance the best time reported over a small
sample of runs has been taken.

[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: move long comment about crc32 fundamentals to Documentation/
Bob Pearson [Fri, 23 Mar 2012 22:02:22 +0000 (15:02 -0700)]
crc32: move long comment about crc32 fundamentals to Documentation/

Move a long comment from lib/crc32.c to Documentation/crc32.txt where it
will more likely get read.

Edited the resulting document to add an explanation of the slicing-by-n
algorithm.

[djwong@us.ibm.com: minor changelog tweaks]
[akpm@linux-foundation.org: fix typo, per George]
Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocrc32: remove two instances of trailing whitespaces
Bob Pearson [Fri, 23 Mar 2012 22:02:21 +0000 (15:02 -0700)]
crc32: remove two instances of trailing whitespaces

This patchset (re)uses Bob Pearson's crc32 slice-by-8 code to stamp out
a software crc32c implementation.  It removes the crc32c implementation
in crypto/ in favor of using the stamped-out one in lib/.  There is also
a change to Kconfig so that the kernel builder can pick an
implementation best suited for the hardware.

The motivation for this patchset is that I am working on adding full
metadata checksumming to ext4.  As far as performance impact of adding
checksumming goes, I see nearly no change with a standard mail server
ffsb simulation.  On a test that involves only file creation and
deletion and extent tree writes, I see a drop of about 50 pcercent with
the current kernel crc32c implementation; this improves to a drop of
about 20 percent with the enclosed crc32c code.

When metadata is usually a small fraction of total IO, this new
implementation doesn't help much because metadata is usually a small
fraction of total IO.  However, when we are doing IO that is almost all
metadata (such as rm -rf'ing a tree), then this patch speeds up the
operation substantially.

Incidentally, given that iscsi, sctp, and btrfs also use crc32c, this
patchset should improve their speed as well.  I have not yet quantified
that, however.  This latest submission combines Bob's patches from late
August 2011 with mine so that they can be one coherent patch set.
Please excuse my inability to combine some of the patches; I've been
advised to leave Bob's patches alone and build atop them instead.  :/

Since the last posting, I've also collected some crc32c test results on
a bunch of different x86/powerpc/sparc platforms.  The results can be
viewed here: http://goo.gl/sgt3i ; the "crc32-kern-le" and "crc32c"
columns describe the performance of the kernel's current crc32 and
crc32c software implementations.  The "crc32c-by8-le" column shows
crc32c performance with this patchset applied.  I expect crc32
performance to be roughly the same.

The two _boost columns at the right side of the spreadsheet shows how much
faster the new implementation is over the old one.  As you can see, crc32
rises substantially, and crc32c experiences a huge increase.

This patch:

- remove trailing whitespace from lib/crc32.c
- remove trailing whitespace from lib/crc32defs.h

[djwong@us.ibm.com: changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: check for quoted strings broken across lines
Josh Triplett [Fri, 23 Mar 2012 22:02:21 +0000 (15:02 -0700)]
checkpatch: check for quoted strings broken across lines

checkpatch already makes an exception to the 80-column rule for quoted
strings, and Documentation/CodingStyle recommends not splitting quoted
strings across lines, because it breaks the ability to grep for the
string.  Rather than just permitting this, actively warn about quoted
strings split across lines.

Test case:

void context(void)
{
struct { unsigned magic; const char *strdata; } foo[] = {
{ 42, "these strings"
      "do not produce warnings" },
{ 256, "though perhaps"
       "they should" },
};
pr_err("this string"
       " should produce a warning\n");
pr_err("this multi-line string\n"
       "should not produce a warning\n");
asm ("this asm\n\t"
     "should not produce a warning");
}

Results of checkpatch on that test case:

WARNING: quoted string split across lines
+        " should produce a warning\n");

total: 0 errors, 1 warnings, 15 lines checked

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: whitespace - add/remove blank lines
Joe Perches [Fri, 23 Mar 2012 22:02:20 +0000 (15:02 -0700)]
checkpatch: whitespace - add/remove blank lines

Add blank lines between a few tests, remove an extraneous one.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: warn on use of yield()
Joe Perches [Fri, 23 Mar 2012 22:02:20 +0000 (15:02 -0700)]
checkpatch: warn on use of yield()

Using yield() is generally wrong.  Warn on its use.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: add --strict tests for braces, comments and casts
Joe Perches [Fri, 23 Mar 2012 22:02:19 +0000 (15:02 -0700)]
checkpatch: add --strict tests for braces, comments and casts

Add some more subjective --strict tests.

Add a test for block comments that start with a blank line followed only
by a line with just the comment block initiator.  Prefer a blank line
followed by /* comment...

Add a test for unnecessary spaces after a cast.

Add a test for symmetric uses of braces in if/else blocks.
If one branch needs braces, then all branches should use braces.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: add [] to type extensions
Andy Whitcroft [Fri, 23 Mar 2012 22:02:18 +0000 (15:02 -0700)]
checkpatch: add [] to type extensions

Add [] to a type extensions.  Fixes false positives on:

    .attrs = (struct attribute *[]) {

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: high precedence operators do not require additional parentheses in #defines
Andy Whitcroft [Fri, 23 Mar 2012 22:02:18 +0000 (15:02 -0700)]
checkpatch: high precedence operators do not require additional parentheses in #defines

With any very high precedence operator it is not necessary to enforce
additional parentheses around simple negated expressions.  This prevents
us requesting further perentheses around the following:

    #define PMEM_IS_FREE(id, index) !(pmem[id].bitmap[index].allocated)

For now add logical and bitwise not and unary minus.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: handle string concatenation in simple #defines
Andy Whitcroft [Fri, 23 Mar 2012 22:02:18 +0000 (15:02 -0700)]
checkpatch: handle string concatenation in simple #defines

Adjacent strings indicate concatentation, therefore look at identifiers
directly adjacent to literal strings as strings too.  This allows us to
better detect the form below and accept it as a simple constant:

    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: allow simple character constants in #defines
Andy Whitcroft [Fri, 23 Mar 2012 22:02:17 +0000 (15:02 -0700)]
checkpatch: allow simple character constants in #defines

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: catch [ ... ] usage when not at the beginning of definition
Andy Whitcroft [Fri, 23 Mar 2012 22:02:17 +0000 (15:02 -0700)]
checkpatch: catch [ ... ] usage when not at the beginning of definition

Handle the [ A ... B ] form deeper into a definition, for example:

    static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
    {0, 0, 0, 0, 0, 0, 0, 27, 27, [9 ... PCI_MAX_DEVICES - 1] = 0 },
    {0, 0, 0, 0, 0, 0, 0, 29, 29, [9 ... PCI_MAX_DEVICES - 1] = 0 },
    };

Reported-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch.pl: be silent when -q and --ignore is given
Artem Bityutskiy [Fri, 23 Mar 2012 22:02:17 +0000 (15:02 -0700)]
checkpatch.pl: be silent when -q and --ignore is given

Fix checkpatch.pl when both -q and --ignore are given and prevents it from
printing a

NOTE: Ignored message types: blah

messages.

E.g., if I use -q --ignore PREFER_PACKED,PREFER_ALIGNED, i see:

NOTE: Ignored message types: PREFER_ALIGNED PREFER_PACKED

It makes no sense to print this when -q is given.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocheckpatch: add some --strict coding style checks
Joe Perches [Fri, 23 Mar 2012 22:02:16 +0000 (15:02 -0700)]
checkpatch: add some --strict coding style checks

Argument alignment across multiple lines should match the open
parenthesis.

Logical continuations should be at the end of the previous line, not the
start of a new line.

These are not required by CodingStyle so make the tests active only when
using --strict.

Improved by some examples from Bruce Allen.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Bruce W. Allen" <bruce.w.allan@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoinclude/ and checkpatch: prefer __scanf to __attribute__((format(scanf,...)
Joe Perches [Fri, 23 Mar 2012 22:02:16 +0000 (15:02 -0700)]
include/ and checkpatch: prefer __scanf to __attribute__((format(scanf,...)

It's equivalent to __printf, so prefer __scanf.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>