diff options
Diffstat (limited to 'drivers/staging')
33 files changed, 163 insertions, 1439 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index defddf5..872bd60 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -167,7 +167,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) * infrastructure. There is no real reason why the selected * task should have access to the memory reserves. */ - mark_tsk_oom_victim(selected); + mark_oom_victim(selected); task_unlock(selected); lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n", selected->pid, selected->comm, diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 48454a5..4eb24a1 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -648,6 +648,7 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, kib_dev_t *dev; struct ib_qp_init_attr *init_qp_attr; struct kib_sched_info *sched; + struct ib_cq_init_attr cq_attr = {}; kib_conn_t *conn; struct ib_cq *cq; unsigned long flags; @@ -743,10 +744,11 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, kiblnd_map_rx_descs(conn); + cq_attr.cqe = IBLND_CQ_ENTRIES(version); + cq_attr.comp_vector = kiblnd_get_completion_vector(conn, cpt); cq = ib_create_cq(cmid->device, kiblnd_cq_completion, kiblnd_cq_event, conn, - IBLND_CQ_ENTRIES(version), - kiblnd_get_completion_vector(conn, cpt)); + &cq_attr); if (IS_ERR(cq)) { CERROR("Can't create CQ: %ld, cqe: %d\n", PTR_ERR(cq), IBLND_CQ_ENTRIES(version)); diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h index d726058..1456278 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h @@ -55,9 +55,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page) if (PagePrivate(page)) page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE); - if (TestClearPageDirty(page)) - account_page_cleaned(page, mapping); - + cancel_dirty_page(page); ClearPageMappedToDisk(page); ll_delete_from_page_cache(page); } diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index cc3ab35..f926224 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -87,7 +87,7 @@ static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask) /* return cpumask of HTs in the same core */ static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask) { - cpumask_copy(mask, topology_thread_cpumask(cpu)); + cpumask_copy(mask, topology_sibling_cpumask(cpu)); } static void cfs_node_to_cpumask(int node, cpumask_t *mask) diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 3711e67..69b2036 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -118,7 +118,7 @@ failed: return rc; } -static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) +static const char *ll_follow_link(struct dentry *dentry, void **cookie) { struct inode *inode = d_inode(dentry); struct ptlrpc_request *request = NULL; @@ -126,32 +126,22 @@ static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) char *symname = NULL; CDEBUG(D_VFSTRACE, "VFS Op\n"); - /* Limit the recursive symlink depth to 5 instead of default - * 8 links when kernel has 4k stack to prevent stack overflow. - * For 8k stacks we need to limit it to 7 for local servers. */ - if (THREAD_SIZE < 8192 && current->link_count >= 6) { - rc = -ELOOP; - } else if (THREAD_SIZE == 8192 && current->link_count >= 8) { - rc = -ELOOP; - } else { - ll_inode_size_lock(inode); - rc = ll_readlink_internal(inode, &request, &symname); - ll_inode_size_unlock(inode); - } + ll_inode_size_lock(inode); + rc = ll_readlink_internal(inode, &request, &symname); + ll_inode_size_unlock(inode); if (rc) { ptlrpc_req_finished(request); - request = NULL; - symname = ERR_PTR(rc); + return ERR_PTR(rc); } - nd_set_link(nd, symname); /* symname may contain a pointer to the request message buffer, * we delay request releasing until ll_put_link then. */ - return request; + *cookie = request; + return symname; } -static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) +static void ll_put_link(struct inode *unused, void *cookie) { ptlrpc_req_finished(cookie); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 0d33154..9117f1c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -559,7 +559,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, * there are. */ /* weight is # of HTs */ - if (cpumask_weight(topology_thread_cpumask(0)) > 1) { + if (cpumask_weight(topology_sibling_cpumask(0)) > 1) { /* depress thread factor for hyper-thread */ factor = factor - (factor >> 1) + (factor >> 3); } @@ -2776,7 +2776,7 @@ int ptlrpc_hr_init(void) init_waitqueue_head(&ptlrpc_hr.hr_waitq); - weight = cpumask_weight(topology_thread_cpumask(0)); + weight = cpumask_weight(topology_sibling_cpumask(0)); cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { hrp->hrp_cpt = i; diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 96498b7..1469768 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -25,8 +25,6 @@ source "drivers/staging/media/cxd2099/Kconfig" source "drivers/staging/media/davinci_vpfe/Kconfig" -source "drivers/staging/media/dt3155v4l/Kconfig" - source "drivers/staging/media/mn88472/Kconfig" source "drivers/staging/media/mn88473/Kconfig" diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index a9006bc..34c557b 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_I2C_BCM2048) += bcm2048/ obj-$(CONFIG_DVB_CXD2099) += cxd2099/ obj-$(CONFIG_LIRC_STAGING) += lirc/ -obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ obj-$(CONFIG_DVB_MN88472) += mn88472/ diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index cf91281..8bc68e2 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -2593,7 +2593,7 @@ static int bcm2048_i2c_driver_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct bcm2048_device *bdev; - int err, skip_release = 0; + int err; bdev = kzalloc(sizeof(*bdev), GFP_KERNEL); if (!bdev) { @@ -2646,7 +2646,6 @@ free_sysfs: bcm2048_sysfs_unregister_properties(bdev, ARRAY_SIZE(attrs)); free_registration: video_unregister_device(&bdev->videodev); - skip_release = 1; free_irq: if (client->irq) free_irq(client->irq, bdev); diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c index b649813..acb293e 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c +++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c @@ -321,6 +321,7 @@ static int resizer_configure_output_win(struct vpfe_resizer_device *resizer) outformat = &resizer->resizer_a.formats[RESIZER_PAD_SOURCE]; + memset(&output_specs, 0x0, sizeof(struct vpfe_rsz_output_spec)); output_specs.vst_y = param->user_config.vst; if (outformat->code == MEDIA_BUS_FMT_YDYUYDYV8_1X16) output_specs.vst_c = param->user_config.vst; diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h index 2632a80..8ad8d74 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h @@ -67,8 +67,6 @@ struct vpfe_device { /* CCDC IRQs used when CCDC/ISIF output to SDRAM */ unsigned int ccdc_irq0; unsigned int ccdc_irq1; - /* maximum video memory that is available*/ - unsigned int video_limit; /* media device */ struct media_device media_dev; /* ccdc subdevice */ diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 06d48d5..87048a1 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -27,9 +27,6 @@ #include "vpfe.h" #include "vpfe_mc_capture.h" -/* minimum number of buffers needed in cont-mode */ -#define MIN_NUM_BUFFERS 3 - static int debug; /* get v4l2 subdev pointer to external subdev which is active */ @@ -473,7 +470,7 @@ void vpfe_video_process_buffer_complete(struct vpfe_video_device *video) { struct vpfe_pipeline *pipe = &video->pipe; - do_gettimeofday(&video->cur_frm->vb.v4l2_buf.timestamp); + v4l2_get_timestamp(&video->cur_frm->vb.v4l2_buf.timestamp); vb2_buffer_done(&video->cur_frm->vb, VB2_BUF_STATE_DONE); if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) video->cur_frm = video->next_frm; @@ -1088,20 +1085,14 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, struct vpfe_fh *fh = vb2_get_drv_priv(vq); struct vpfe_video_device *video = fh->video; struct vpfe_device *vpfe_dev = video->vpfe_dev; - struct vpfe_pipeline *pipe = &video->pipe; unsigned long size; v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_queue_setup\n"); size = video->fmt.fmt.pix.sizeimage; - if (vpfe_dev->video_limit) { - while (size * *nbuffers > vpfe_dev->video_limit) - (*nbuffers)--; - } - if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) { - if (*nbuffers < MIN_NUM_BUFFERS) - *nbuffers = MIN_NUM_BUFFERS; - } + if (vq->num_buffers + *nbuffers < 3) + *nbuffers = 3 - vq->num_buffers; + *nplanes = 1; sizes[0] = size; alloc_ctxs[0] = video->alloc_ctx; @@ -1346,6 +1337,7 @@ static int vpfe_reqbufs(struct file *file, void *priv, q->ops = &video_qops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct vpfe_cap_buffer); + q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret) { diff --git a/drivers/staging/media/dt3155v4l/Kconfig b/drivers/staging/media/dt3155v4l/Kconfig deleted file mode 100644 index 2d49600..0000000 --- a/drivers/staging/media/dt3155v4l/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ -config VIDEO_DT3155 - tristate "DT3155 frame grabber, Video4Linux interface" - depends on PCI && VIDEO_DEV && VIDEO_V4L2 - depends on HAS_DMA - select VIDEOBUF2_DMA_CONTIG - default n - ---help--- - Enables dt3155 device driver for the DataTranslation DT3155 frame grabber. - Say Y here if you have this hardware. - In doubt, say N. - - To compile this driver as a module, choose M here: the - module will be called dt3155v4l. - -config DT3155_CCIR - bool "Selects CCIR/50Hz vertical refresh" - depends on VIDEO_DT3155 - default y - ---help--- - Select it for CCIR/50Hz (European region), - or leave it unselected for RS-170/60Hz (North America). - -config DT3155_STREAMING - bool "Selects streaming capture method" - depends on VIDEO_DT3155 - default y - ---help--- - Select it if you want to use streaming of memory mapped buffers - or leave it unselected if you want to use read method (one copy more). diff --git a/drivers/staging/media/dt3155v4l/Makefile b/drivers/staging/media/dt3155v4l/Makefile deleted file mode 100644 index ce7a3ec..0000000 --- a/drivers/staging/media/dt3155v4l/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l.o diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c deleted file mode 100644 index 1408b65..0000000 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ /dev/null @@ -1,980 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2010 by Marin Mitov * - * mitov@issp.bas.bg * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include <linux/module.h> -#include <linux/stringify.h> -#include <linux/delay.h> -#include <linux/kthread.h> -#include <linux/slab.h> -#include <media/v4l2-dev.h> -#include <media/v4l2-ioctl.h> -#include <media/v4l2-common.h> -#include <media/videobuf2-dma-contig.h> - -#include "dt3155v4l.h" - -#define DT3155_DEVICE_ID 0x1223 - -/* DT3155_CHUNK_SIZE is 4M (2^22) 8 full size buffers */ -#define DT3155_CHUNK_SIZE (1U << 22) - -#define DT3155_COH_FLAGS (GFP_KERNEL | GFP_DMA32 | __GFP_COLD | __GFP_NOWARN) - -#define DT3155_BUF_SIZE (768 * 576) - -#ifdef CONFIG_DT3155_STREAMING -#define DT3155_CAPTURE_METHOD V4L2_CAP_STREAMING -#else -#define DT3155_CAPTURE_METHOD V4L2_CAP_READWRITE -#endif - -/* global initializers (for all boards) */ -#ifdef CONFIG_DT3155_CCIR -static const u8 csr2_init = VT_50HZ; -#define DT3155_CURRENT_NORM V4L2_STD_625_50 -static const unsigned int img_width = 768; -static const unsigned int img_height = 576; -static const unsigned int frames_per_sec = 25; -static const struct v4l2_fmtdesc frame_std[] = { - { - .index = 0, - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, - .flags = 0, - .description = "CCIR/50Hz 8 bits gray", - .pixelformat = V4L2_PIX_FMT_GREY, - }, -}; -#else -static const u8 csr2_init = VT_60HZ; -#define DT3155_CURRENT_NORM V4L2_STD_525_60 -static const unsigned int img_width = 640; -static const unsigned int img_height = 480; -static const unsigned int frames_per_sec = 30; -static const struct v4l2_fmtdesc frame_std[] = { - { - .index = 0, - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, - .flags = 0, - .description = "RS-170/60Hz 8 bits gray", - .pixelformat = V4L2_PIX_FMT_GREY, - }, -}; -#endif - -#define NUM_OF_FORMATS ARRAY_SIZE(frame_std) - -static u8 config_init = ACQ_MODE_EVEN; - -/** - * read_i2c_reg - reads an internal i2c register - * - * @addr: dt3155 mmio base address - * @index: index (internal address) of register to read - * @data: pointer to byte the read data will be placed in - * - * returns: zero on success or error code - * - * This function starts reading the specified (by index) register - * and busy waits for the process to finish. The result is placed - * in a byte pointed by data. - */ -static int -read_i2c_reg(void __iomem *addr, u8 index, u8 *data) -{ - u32 tmp = index; - - iowrite32((tmp<<17) | IIC_READ, addr + IIC_CSR2); - mmiowb(); - udelay(45); /* wait at least 43 usec for NEW_CYCLE to clear */ - if (ioread32(addr + IIC_CSR2) & NEW_CYCLE) - return -EIO; /* error: NEW_CYCLE not cleared */ - tmp = ioread32(addr + IIC_CSR1); - if (tmp & DIRECT_ABORT) { - /* reset DIRECT_ABORT bit */ - iowrite32(DIRECT_ABORT, addr + IIC_CSR1); - return -EIO; /* error: DIRECT_ABORT set */ - } - *data = tmp>>24; - return 0; -} - -/** - * write_i2c_reg - writes to an internal i2c register - * - * @addr: dt3155 mmio base address - * @index: index (internal address) of register to read - * @data: data to be written - * - * returns: zero on success or error code - * - * This function starts writting the specified (by index) register - * and busy waits for the process to finish. - */ -static int -write_i2c_reg(void __iomem *addr, u8 index, u8 data) -{ - u32 tmp = index; - - iowrite32((tmp<<17) | IIC_WRITE | data, addr + IIC_CSR2); - mmiowb(); - udelay(65); /* wait at least 63 usec for NEW_CYCLE to clear */ - if (ioread32(addr + IIC_CSR2) & NEW_CYCLE) - return -EIO; /* error: NEW_CYCLE not cleared */ - if (ioread32(addr + IIC_CSR1) & DIRECT_ABORT) { - /* reset DIRECT_ABORT bit */ - iowrite32(DIRECT_ABORT, addr + IIC_CSR1); - return -EIO; /* error: DIRECT_ABORT set */ - } - return 0; -} - -/** - * write_i2c_reg_nowait - writes to an internal i2c register - * - * @addr: dt3155 mmio base address - * @index: index (internal address) of register to read - * @data: data to be written - * - * This function starts writting the specified (by index) register - * and then returns. - */ -static void write_i2c_reg_nowait(void __iomem *addr, u8 index, u8 data) -{ - u32 tmp = index; - - iowrite32((tmp<<17) | IIC_WRITE | data, addr + IIC_CSR2); - mmiowb(); -} - -/** - * wait_i2c_reg - waits the read/write to finish - * - * @addr: dt3155 mmio base address - * - * returns: zero on success or error code - * - * This function waits reading/writting to finish. - */ -static int wait_i2c_reg(void __iomem *addr) -{ - if (ioread32(addr + IIC_CSR2) & NEW_CYCLE) - udelay(65); /* wait at least 63 usec for NEW_CYCLE to clear */ - if (ioread32(addr + IIC_CSR2) & NEW_CYCLE) - return -EIO; /* error: NEW_CYCLE not cleared */ - if (ioread32(addr + IIC_CSR1) & DIRECT_ABORT) { - /* reset DIRECT_ABORT bit */ - iowrite32(DIRECT_ABORT, addr + IIC_CSR1); - return -EIO; /* error: DIRECT_ABORT set */ - } - return 0; -} - -static int -dt3155_start_acq(struct dt3155_priv *pd) -{ - struct vb2_buffer *vb = pd->curr_buf; - dma_addr_t dma_addr; - - dma_addr = vb2_dma_contig_plane_dma_addr(vb, 0); - iowrite32(dma_addr, pd->regs + EVEN_DMA_START); - iowrite32(dma_addr + img_width, pd->regs + ODD_DMA_START); - iowrite32(img_width, pd->regs + EVEN_DMA_STRIDE); - iowrite32(img_width, pd->regs + ODD_DMA_STRIDE); - /* enable interrupts, clear all irq flags */ - iowrite32(FLD_START_EN | FLD_END_ODD_EN | FLD_START | - FLD_END_EVEN | FLD_END_ODD, pd->regs + INT_CSR); - iowrite32(FIFO_EN | SRST | FLD_CRPT_ODD | FLD_CRPT_EVEN | - FLD_DN_ODD | FLD_DN_EVEN | CAP_CONT_EVEN | CAP_CONT_ODD, - pd->regs + CSR1); - wait_i2c_reg(pd->regs); - write_i2c_reg(pd->regs, CONFIG, pd->config); - write_i2c_reg(pd->regs, EVEN_CSR, CSR_ERROR | CSR_DONE); - write_i2c_reg(pd->regs, ODD_CSR, CSR_ERROR | CSR_DONE); - - /* start the board */ - write_i2c_reg(pd->regs, CSR2, pd->csr2 | BUSY_EVEN | BUSY_ODD); - return 0; /* success */ -} - -/* - * driver-specific callbacks (vb2_ops) - */ -static int -dt3155_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, - unsigned int *num_buffers, unsigned int *num_planes, - unsigned int sizes[], void *alloc_ctxs[]) - -{ - struct dt3155_priv *pd = vb2_get_drv_priv(q); - void *ret; - - if (*num_buffers == 0) - *num_buffers = 1; - *num_planes = 1; - sizes[0] = img_width * img_height; - if (pd->q->alloc_ctx[0]) - return 0; - ret = vb2_dma_contig_init_ctx(&pd->pdev->dev); - if (IS_ERR(ret)) - return PTR_ERR(ret); - pd->q->alloc_ctx[0] = ret; - return 0; -} - -static void -dt3155_wait_prepare(struct vb2_queue *q) -{ - struct dt3155_priv *pd = vb2_get_drv_priv(q); - - mutex_unlock(pd->vdev.lock); -} - -static void -dt3155_wait_finish(struct vb2_queue *q) -{ - struct dt3155_priv *pd = vb2_get_drv_priv(q); - - mutex_lock(pd->vdev.lock); -} - -static int -dt3155_buf_prepare(struct vb2_buffer *vb) -{ - vb2_set_plane_payload(vb, 0, img_width * img_height); - return 0; -} - -static void -dt3155_stop_streaming(struct vb2_queue *q) -{ - struct dt3155_priv *pd = vb2_get_drv_priv(q); - struct vb2_buffer *vb; - - spin_lock_irq(&pd->lock); - while (!list_empty(&pd->dmaq)) { - vb = list_first_entry(&pd->dmaq, typeof(*vb), done_entry); - list_del(&vb->done_entry); - vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); - } - spin_unlock_irq(&pd->lock); - msleep(45); /* irq hendler will stop the hardware */ -} - -static void -dt3155_buf_queue(struct vb2_buffer *vb) -{ - struct dt3155_priv *pd = vb2_get_drv_priv(vb->vb2_queue); - - /* pd->q->streaming = 1 when dt3155_buf_queue() is invoked */ - spin_lock_irq(&pd->lock); - if (pd->curr_buf) - list_add_tail(&vb->done_entry, &pd->dmaq); - else { - pd->curr_buf = vb; - dt3155_start_acq(pd); - } - spin_unlock_irq(&pd->lock); -} -/* - * end driver-specific callbacks - */ - -static const struct vb2_ops q_ops = { - .queue_setup = dt3155_queue_setup, - .wait_prepare = dt3155_wait_prepare, - .wait_finish = dt3155_wait_finish, - .buf_prepare = dt3155_buf_prepare, - .stop_streaming = dt3155_stop_streaming, - .buf_queue = dt3155_buf_queue, -}; - -static irqreturn_t -dt3155_irq_handler_even(int irq, void *dev_id) -{ - struct dt3155_priv *ipd = dev_id; - struct vb2_buffer *ivb; - dma_addr_t dma_addr; - u32 tmp; - - tmp = ioread32(ipd->regs + INT_CSR) & (FLD_START | FLD_END_ODD); - if (!tmp) - return IRQ_NONE; /* not our irq */ - if ((tmp & FLD_START) && !(tmp & FLD_END_ODD)) { - iowrite32(FLD_START_EN | FLD_END_ODD_EN | FLD_START, - ipd->regs + INT_CSR); - ipd->field_count++; - return IRQ_HANDLED; /* start of field irq */ - } - if ((tmp & FLD_START) && (tmp & FLD_END_ODD)) - ipd->stats.start_before_end++; - /* check for corrupted fields */ -/* write_i2c_reg(ipd->regs, EVEN_CSR, CSR_ERROR | CSR_DONE); */ -/* write_i2c_reg(ipd->regs, ODD_CSR, CSR_ERROR | CSR_DONE); */ - tmp = ioread32(ipd->regs + CSR1) & (FLD_CRPT_EVEN | FLD_CRPT_ODD); - if (tmp) { - ipd->stats.corrupted_fields++; - iowrite32(FIFO_EN | SRST | FLD_CRPT_ODD | FLD_CRPT_EVEN | - FLD_DN_ODD | FLD_DN_EVEN | - CAP_CONT_EVEN | CAP_CONT_ODD, - ipd->regs + CSR1); - mmiowb(); - } - - spin_lock(&ipd->lock); - if (ipd->curr_buf) { - v4l2_get_timestamp(&ipd->curr_buf->v4l2_buf.timestamp); - ipd->curr_buf->v4l2_buf.sequence = (ipd->field_count) >> 1; - vb2_buffer_done(ipd->curr_buf, VB2_BUF_STATE_DONE); - } - - if (!ipd->q->streaming || list_empty(&ipd->dmaq)) - goto stop_dma; - ivb = list_first_entry(&ipd->dmaq, typeof(*ivb), done_entry); - list_del(&ivb->done_entry); - ipd->curr_buf = ivb; - dma_addr = vb2_dma_contig_plane_dma_addr(ivb, 0); - iowrite32(dma_addr, ipd->regs + EVEN_DMA_START); - iowrite32(dma_addr + img_width, ipd->regs + ODD_DMA_START); - iowrite32(img_width, ipd->regs + EVEN_DMA_STRIDE); - iowrite32(img_width, ipd->regs + ODD_DMA_STRIDE); - mmiowb(); - /* enable interrupts, clear all irq flags */ - iowrite32(FLD_START_EN | FLD_END_ODD_EN | FLD_START | - FLD_END_EVEN | FLD_END_ODD, ipd->regs + INT_CSR); - spin_unlock(&ipd->lock); - return IRQ_HANDLED; - -stop_dma: - ipd->curr_buf = NULL; - /* stop the board */ - write_i2c_reg_nowait(ipd->regs, CSR2, ipd->csr2); - iowrite32(FIFO_EN | SRST | FLD_CRPT_ODD | FLD_CRPT_EVEN | - FLD_DN_ODD | FLD_DN_EVEN, ipd->regs + CSR1); - /* disable interrupts, clear all irq flags */ - iowrite32(FLD_START | FLD_END_EVEN | FLD_END_ODD, ipd->regs + INT_CSR); - spin_unlock(&ipd->lock); - return IRQ_HANDLED; -} - -static int -dt3155_open(struct file *filp) -{ - int ret = 0; - struct dt3155_priv *pd = video_drvdata(filp); - - if (mutex_lock_interruptible(&pd->mux)) - return -ERESTARTSYS; - if (!pd->users) { - pd->q = kzalloc(sizeof(*pd->q), GFP_KERNEL); - if (!pd->q) { - ret = -ENOMEM; - goto err_alloc_queue; - } - pd->q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - pd->q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - pd->q->io_modes = VB2_READ | VB2_MMAP; - pd->q->ops = &q_ops; - pd->q->mem_ops = &vb2_dma_contig_memops; - pd->q->drv_priv = pd; - pd->curr_buf = NULL; - pd->field_count = 0; - ret = vb2_queue_init(pd->q); - if (ret < 0) - goto err_request_irq; - INIT_LIST_HEAD(&pd->dmaq); - spin_lock_init(&pd->lock); - /* disable all irqs, clear all irq flags */ - iowrite32(FLD_START | FLD_END_EVEN | FLD_END_ODD, - pd->regs + INT_CSR); - ret = request_irq(pd->pdev->irq, dt3155_irq_handler_even, - IRQF_SHARED, DT3155_NAME, pd); - if (ret) - goto err_request_irq; - } - pd->users++; - mutex_unlock(&pd->mux); - return 0; /* success */ -err_request_irq: - kfree(pd->q); - pd->q = NULL; -err_alloc_queue: - mutex_unlock(&pd->mux); - return ret; -} - -static int -dt3155_release(struct file *filp) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - mutex_lock(&pd->mux); - pd->users--; - BUG_ON(pd->users < 0); - if (!pd->users) { - vb2_queue_release(pd->q); - free_irq(pd->pdev->irq, pd); - if (pd->q->alloc_ctx[0]) - vb2_dma_contig_cleanup_ctx(pd->q->alloc_ctx[0]); - kfree(pd->q); - pd->q = NULL; - } - mutex_unlock(&pd->mux); - return 0; -} - -static ssize_t -dt3155_read(struct file *filp, char __user *user, size_t size, loff_t *loff) -{ - struct dt3155_priv *pd = video_drvdata(filp); - ssize_t res; - - if (mutex_lock_interruptible(&pd->mux)) - return -ERESTARTSYS; - res = vb2_read(pd->q, user, size, loff, filp->f_flags & O_NONBLOCK); - mutex_unlock(&pd->mux); - return res; -} - -static unsigned int -dt3155_poll(struct file *filp, struct poll_table_struct *polltbl) -{ - struct dt3155_priv *pd = video_drvdata(filp); - unsigned int res; - - mutex_lock(&pd->mux); - res = vb2_poll(pd->q, filp, polltbl); - mutex_unlock(&pd->mux); - return res; -} - -static int -dt3155_mmap(struct file *filp, struct vm_area_struct *vma) -{ - struct dt3155_priv *pd = video_drvdata(filp); - int res; - - if (mutex_lock_interruptible(&pd->mux)) - return -ERESTARTSYS; - res = vb2_mmap(pd->q, vma); - mutex_unlock(&pd->mux); - return res; -} - -static const struct v4l2_file_operations dt3155_fops = { - .owner = THIS_MODULE, - .open = dt3155_open, - .release = dt3155_release, - .read = dt3155_read, - .poll = dt3155_poll, - .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ - .mmap = dt3155_mmap, -}; - -static int -dt3155_ioc_streamon(struct file *filp, void *p, enum v4l2_buf_type type) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - return vb2_streamon(pd->q, type); -} - -static int -dt3155_ioc_streamoff(struct file *filp, void *p, enum v4l2_buf_type type) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - return vb2_streamoff(pd->q, type); -} - -static int -dt3155_ioc_querycap(struct file *filp, void *p, struct v4l2_capability *cap) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - strcpy(cap->driver, DT3155_NAME); - strcpy(cap->card, DT3155_NAME " frame grabber"); - sprintf(cap->bus_info, "PCI:%s", pci_name(pd->pdev)); - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | - DT3155_CAPTURE_METHOD; - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - return 0; -} - -static int -dt3155_ioc_enum_fmt_vid_cap(struct file *filp, void *p, struct v4l2_fmtdesc *f) -{ - if (f->index >= NUM_OF_FORMATS) - return -EINVAL; - *f = frame_std[f->index]; - return 0; -} - -static int -dt3155_ioc_g_fmt_vid_cap(struct file *filp, void *p, struct v4l2_format *f) -{ - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - f->fmt.pix.width = img_width; - f->fmt.pix.height = img_height; - f->fmt.pix.pixelformat = V4L2_PIX_FMT_GREY; - f->fmt.pix.field = V4L2_FIELD_NONE; - f->fmt.pix.bytesperline = f->fmt.pix.width; - f->fmt.pix.sizeimage = f->fmt.pix.width * f->fmt.pix.height; - f->fmt.pix.colorspace = 0; - f->fmt.pix.priv = 0; - return 0; -} - -static int -dt3155_ioc_try_fmt_vid_cap(struct file *filp, void *p, struct v4l2_format *f) -{ - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - if (f->fmt.pix.width == img_width && - f->fmt.pix.height == img_height && - f->fmt.pix.pixelformat == V4L2_PIX_FMT_GREY && - f->fmt.pix.field == V4L2_FIELD_NONE && - f->fmt.pix.bytesperline == f->fmt.pix.width && - f->fmt.pix.sizeimage == f->fmt.pix.width * f->fmt.pix.height) - return 0; - else - return -EINVAL; -} - -static int -dt3155_ioc_s_fmt_vid_cap(struct file *filp, void *p, struct v4l2_format *f) -{ - return dt3155_ioc_g_fmt_vid_cap(filp, p, f); -} - -static int -dt3155_ioc_reqbufs(struct file *filp, void *p, struct v4l2_requestbuffers *b) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - return vb2_reqbufs(pd->q, b); -} - -static int -dt3155_ioc_querybuf(struct file *filp, void *p, struct v4l2_buffer *b) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - return vb2_querybuf(pd->q, b); -} - -static int -dt3155_ioc_qbuf(struct file *filp, void *p, struct v4l2_buffer *b) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - return vb2_qbuf(pd->q, b); -} - -static int -dt3155_ioc_dqbuf(struct file *filp, void *p, struct v4l2_buffer *b) -{ - struct dt3155_priv *pd = video_drvdata(filp); - - return vb2_dqbuf(pd->q, b, filp->f_flags & O_NONBLOCK); -} - -static int -dt3155_ioc_querystd(struct file *filp, void *p, v4l2_std_id *norm) -{ - *norm = DT3155_CURRENT_NORM; - return 0; -} - -static int -dt3155_ioc_g_std(struct file *filp, void *p, v4l2_std_id *norm) -{ - *norm = DT3155_CURRENT_NORM; - return 0; -} - -static int -dt3155_ioc_s_std(struct file *filp, void *p, v4l2_std_id norm) -{ - if (norm & DT3155_CURRENT_NORM) - return 0; - return -EINVAL; -} - -static int -dt3155_ioc_enum_input(struct file *filp, void *p, struct v4l2_input *input) -{ - if (input->index) - return -EINVAL; - strcpy(input->name, "Coax in"); - input->type = V4L2_INPUT_TYPE_CAMERA; - /* - * FIXME: input->std = 0 according to v4l2 API - * VIDIOC_G_STD, VIDIOC_S_STD, VIDIOC_QUERYSTD and VIDIOC_ENUMSTD - * should return -EINVAL - */ - input->std = DT3155_CURRENT_NORM; - input->status = 0;/* FIXME: add sync detection & V4L2_IN_ST_NO_H_LOCK */ - return 0; -} - -static int -dt3155_ioc_g_input(struct file *filp, void *p, unsigned int *i) -{ - *i = 0; - return 0; -} - -static int -dt3155_ioc_s_input(struct file *filp, void *p, unsigned int i) -{ - if (i) - return -EINVAL; - return 0; -} - -static int -dt3155_ioc_g_parm(struct file *filp, void *p, struct v4l2_streamparm *parms) -{ - if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - parms->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - parms->parm.capture.capturemode = 0; - parms->parm.capture.timeperframe.numerator = 1001; - parms->parm.capture.timeperframe.denominator = frames_per_sec * 1000; - parms->parm.capture.extendedmode = 0; - parms->parm.capture.readbuffers = 1; /* FIXME: 2 buffers? */ - return 0; -} - -static int -dt3155_ioc_s_parm(struct file *filp, void *p, struct v4l2_streamparm *parms) -{ - if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - parms->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - parms->parm.capture.capturemode = 0; - parms->parm.capture.timeperframe.numerator = 1001; - parms->parm.capture.timeperframe.denominator = frames_per_sec * 1000; - parms->parm.capture.extendedmode = 0; - parms->parm.capture.readbuffers = 1; /* FIXME: 2 buffers? */ - return 0; -} - -static const struct v4l2_ioctl_ops dt3155_ioctl_ops = { - .vidioc_streamon = dt3155_ioc_streamon, - .vidioc_streamoff = dt3155_ioc_streamoff, - .vidioc_querycap = dt3155_ioc_querycap, -/* - .vidioc_g_priority = dt3155_ioc_g_priority, - .vidioc_s_priority = dt3155_ioc_s_priority, -*/ - .vidioc_enum_fmt_vid_cap = dt3155_ioc_enum_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = dt3155_ioc_try_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = dt3155_ioc_g_fmt_vid_cap, - .vidioc_s_fmt_vid_cap = dt3155_ioc_s_fmt_vid_cap, - .vidioc_reqbufs = dt3155_ioc_reqbufs, - .vidioc_querybuf = dt3155_ioc_querybuf, - .vidioc_qbuf = dt3155_ioc_qbuf, - .vidioc_dqbuf = dt3155_ioc_dqbuf, - .vidioc_querystd = dt3155_ioc_querystd, - .vidioc_g_std = dt3155_ioc_g_std, - .vidioc_s_std = dt3155_ioc_s_std, - .vidioc_enum_input = dt3155_ioc_enum_input, - .vidioc_g_input = dt3155_ioc_g_input, - .vidioc_s_input = dt3155_ioc_s_input, -/* - .vidioc_queryctrl = dt3155_ioc_queryctrl, - .vidioc_g_ctrl = dt3155_ioc_g_ctrl, - .vidioc_s_ctrl = dt3155_ioc_s_ctrl, - .vidioc_querymenu = dt3155_ioc_querymenu, - .vidioc_g_ext_ctrls = dt3155_ioc_g_ext_ctrls, - .vidioc_s_ext_ctrls = dt3155_ioc_s_ext_ctrls, -*/ - .vidioc_g_parm = dt3155_ioc_g_parm, - .vidioc_s_parm = dt3155_ioc_s_parm, -/* - .vidioc_cropcap = dt3155_ioc_cropcap, - .vidioc_g_crop = dt3155_ioc_g_crop, - .vidioc_s_crop = dt3155_ioc_s_crop, - .vidioc_enum_framesizes = dt3155_ioc_enum_framesizes, - .vidioc_enum_frameintervals = dt3155_ioc_enum_frameintervals, -*/ -}; - -static int -dt3155_init_board(struct pci_dev *pdev) -{ - struct dt3155_priv *pd = pci_get_drvdata(pdev); - void *buf_cpu; - dma_addr_t buf_dma; - int i; - u8 tmp; - - pci_set_master(pdev); /* dt3155 needs it */ - - /* resetting the adapter */ - iowrite32(FLD_CRPT_ODD | FLD_CRPT_EVEN | FLD_DN_ODD | FLD_DN_EVEN, - pd->regs + CSR1); - mmiowb(); - msleep(20); - - /* initializing adaper registers */ - iowrite32(FIFO_EN | SRST, pd->regs + CSR1); - mmiowb(); - iowrite32(0xEEEEEE01, pd->regs + EVEN_PIXEL_FMT); - iowrite32(0xEEEEEE01, pd->regs + ODD_PIXEL_FMT); - iowrite32(0x00000020, pd->regs + FIFO_TRIGER); - iowrite32(0x00000103, pd->regs + XFER_MODE); - iowrite32(0, pd->regs + RETRY_WAIT_CNT); - iowrite32(0, pd->regs + INT_CSR); - iowrite32(1, pd->regs + EVEN_FLD_MASK); - iowrite32(1, pd->regs + ODD_FLD_MASK); - iowrite32(0, pd->regs + MASK_LENGTH); - iowrite32(0x0005007C, pd->regs + FIFO_FLAG_CNT); - iowrite32(0x01010101, pd->regs + IIC_CLK_DUR); - mmiowb(); - - /* verifying that we have a DT3155 board (not just a SAA7116 chip) */ - read_i2c_reg(pd->regs, DT_ID, &tmp); - if (tmp != DT3155_ID) - return -ENODEV; - - /* initialize AD LUT */ - write_i2c_reg(pd->regs, AD_ADDR, 0); - for (i = 0; i < 256; i++) - write_i2c_reg(pd->regs, AD_LUT, i); - - /* initialize ADC references */ - /* FIXME: pos_ref & neg_ref depend on VT_50HZ */ - write_i2c_reg(pd->regs, AD_ADDR, AD_CMD_REG); - write_i2c_reg(pd->regs, AD_CMD, VIDEO_CNL_1 | SYNC_CNL_1 | SYNC_LVL_3); - write_i2c_reg(pd->regs, AD_ADDR, AD_POS_REF); - write_i2c_reg(pd->regs, AD_CMD, 34); - write_i2c_reg(pd->regs, AD_ADDR, AD_NEG_REF); - write_i2c_reg(pd->regs, AD_CMD, 0); - - /* initialize PM LUT */ - write_i2c_reg(pd->regs, CONFIG, pd->config | PM_LUT_PGM); - for (i = 0; i < 256; i++) { - write_i2c_reg(pd->regs, PM_LUT_ADDR, i); - write_i2c_reg(pd->regs, PM_LUT_DATA, i); - } - write_i2c_reg(pd->regs, CONFIG, pd->config | PM_LUT_PGM | PM_LUT_SEL); - for (i = 0; i < 256; i++) { - write_i2c_reg(pd->regs, PM_LUT_ADDR, i); - write_i2c_reg(pd->regs, PM_LUT_DATA, i); - } - write_i2c_reg(pd->regs, CONFIG, pd->config); /* ACQ_MODE_EVEN */ - - /* select channel 1 for input and set sync level */ - write_i2c_reg(pd->regs, AD_ADDR, AD_CMD_REG); - write_i2c_reg(pd->regs, AD_CMD, VIDEO_CNL_1 | SYNC_CNL_1 | SYNC_LVL_3); - - /* allocate memory, and initialize the DMA machine */ - buf_cpu = dma_alloc_coherent(&pdev->dev, DT3155_BUF_SIZE, &buf_dma, - GFP_KERNEL); - if (!buf_cpu) - return -ENOMEM; - iowrite32(buf_dma, pd->regs + EVEN_DMA_START); - iowrite32(buf_dma, pd->regs + ODD_DMA_START); - iowrite32(0, pd->regs + EVEN_DMA_STRIDE); - iowrite32(0, pd->regs + ODD_DMA_STRIDE); - - /* Perform a pseudo even field acquire */ - iowrite32(FIFO_EN | SRST | CAP_CONT_ODD, pd->regs + CSR1); - write_i2c_reg(pd->regs, CSR2, pd->csr2 | SYNC_SNTL); - write_i2c_reg(pd->regs, CONFIG, pd->config); - write_i2c_reg(pd->regs, EVEN_CSR, CSR_SNGL); - write_i2c_reg(pd->regs, CSR2, pd->csr2 | BUSY_EVEN | SYNC_SNTL); - msleep(100); - read_i2c_reg(pd->regs, CSR2, &tmp); - write_i2c_reg(pd->regs, EVEN_CSR, CSR_ERROR | CSR_SNGL | CSR_DONE); - write_i2c_reg(pd->regs, ODD_CSR, CSR_ERROR | CSR_SNGL | CSR_DONE); - write_i2c_reg(pd->regs, CSR2, pd->csr2); - iowrite32(FIFO_EN | SRST | FLD_DN_EVEN | FLD_DN_ODD, pd->regs + CSR1); - - /* deallocate memory */ - dma_free_coherent(&pdev->dev, DT3155_BUF_SIZE, buf_cpu, buf_dma); - if (tmp & BUSY_EVEN) - return -EIO; - return 0; -} - -static struct video_device dt3155_vdev = { - .name = DT3155_NAME, - .fops = &dt3155_fops, - .ioctl_ops = &dt3155_ioctl_ops, - .minor = -1, - .release = video_device_release_empty, - .tvnorms = DT3155_CURRENT_NORM, -}; - -/* same as in drivers/base/dma-coherent.c */ -struct dma_coherent_mem { - void *virt_base; - dma_addr_t device_base; - int size; - int flags; - unsigned long *bitmap; -}; - -static int -dt3155_alloc_coherent(struct device *dev, size_t size, int flags) -{ - struct dma_coherent_mem *mem; - dma_addr_t dev_base; - int pages = size >> PAGE_SHIFT; - int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); - - if ((flags & DMA_MEMORY_MAP) == 0) - goto out; - if (!size) - goto out; - if (dev->dma_mem) - goto out; - - mem = kzalloc(sizeof(*mem), GFP_KERNEL); - if (!mem) - goto out; - mem->virt_base = dma_alloc_coherent(dev, size, &dev_base, - DT3155_COH_FLAGS); - if (!mem->virt_base) - goto err_alloc_coherent; - mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); - if (!mem->bitmap) - goto err_bitmap; - - /* coherent_dma_mask is already set to 32 bits */ - mem->device_base = dev_base; - mem->size = pages; - mem->flags = flags; - dev->dma_mem = mem; - return DMA_MEMORY_MAP; - -err_bitmap: - dma_free_coherent(dev, size, mem->virt_base, dev_base); -err_alloc_coherent: - kfree(mem); -out: - return 0; -} - -static void -dt3155_free_coherent(struct device *dev) -{ - struct dma_coherent_mem *mem = dev->dma_mem; - - if (!mem) - return; - dev->dma_mem = NULL; - dma_free_coherent(dev, mem->size << PAGE_SHIFT, - mem->virt_base, mem->device_base); - kfree(mem->bitmap); - kfree(mem); -} - -static int -dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) -{ - int err; - struct dt3155_priv *pd; - - err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); - if (err) - return -ENODEV; - pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL); - if (!pd) - return -ENOMEM; - - pd->vdev = dt3155_vdev; - pci_set_drvdata(pdev, pd); /* for use in dt3155_remove() */ - video_set_drvdata(&pd->vdev, pd); /* for use in video_fops */ - pd->users = 0; - pd->pdev = pdev; - INIT_LIST_HEAD(&pd->dmaq); - mutex_init(&pd->mux); - pd->vdev.lock = &pd->mux; /* for locking v4l2_file_operations */ - spin_lock_init(&pd->lock); - pd->csr2 = csr2_init; - pd->config = config_init; - err = pci_enable_device(pdev); - if (err) - return err; - err = pci_request_region(pdev, 0, pci_name(pdev)); - if (err) - goto err_req_region; - pd->regs = pci_iomap(pdev, 0, pci_resource_len(pd->pdev, 0)); - if (!pd->regs) { - err = -ENOMEM; - goto err_pci_iomap; - } - err = dt3155_init_board(pdev); - if (err) - goto err_init_board; - err = video_register_device(&pd->vdev, VFL_TYPE_GRABBER, -1); - if (err) - goto err_init_board; - if (dt3155_alloc_coherent(&pdev->dev, DT3155_CHUNK_SIZE, - DMA_MEMORY_MAP)) - dev_info(&pdev->dev, "preallocated 8 buffers\n"); - dev_info(&pdev->dev, "/dev/video%i is ready\n", pd->vdev.minor); - return 0; /* success */ - -err_init_board: - pci_iounmap(pdev, pd->regs); -err_pci_iomap: - pci_release_region(pdev, 0); -err_req_region: - pci_disable_device(pdev); - return err; -} - -static void -dt3155_remove(struct pci_dev *pdev) -{ - struct dt3155_priv *pd = pci_get_drvdata(pdev); - - dt3155_free_coherent(&pdev->dev); - video_unregister_device(&pd->vdev); - pci_iounmap(pdev, pd->regs); - pci_release_region(pdev, 0); - pci_disable_device(pdev); -} - -static const struct pci_device_id pci_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, DT3155_DEVICE_ID) }, - { 0, /* zero marks the end */ }, -}; -MODULE_DEVICE_TABLE(pci, pci_ids); - -static struct pci_driver pci_driver = { - .name = DT3155_NAME, - .id_table = pci_ids, - .probe = dt3155_probe, - .remove = dt3155_remove, -}; - -module_pci_driver(pci_driver); - -MODULE_DESCRIPTION("video4linux pci-driver for dt3155 frame grabber"); -MODULE_AUTHOR("Marin Mitov <mitov@issp.bas.bg>"); -MODULE_VERSION(DT3155_VERSION); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.h b/drivers/staging/media/dt3155v4l/dt3155v4l.h deleted file mode 100644 index 96f01a0..0000000 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.h +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2010 by Marin Mitov * - * mitov@issp.bas.bg * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -/* DT3155 header file */ -#ifndef _DT3155_H_ -#define _DT3155_H_ - -#ifdef __KERNEL__ - -#include <linux/pci.h> -#include <linux/interrupt.h> - -#define DT3155_NAME "dt3155" -#define DT3155_VER_MAJ 1 -#define DT3155_VER_MIN 1 -#define DT3155_VER_EXT 0 -#define DT3155_VERSION __stringify(DT3155_VER_MAJ) "." \ - __stringify(DT3155_VER_MIN) "." \ - __stringify(DT3155_VER_EXT) - -/* DT3155 Base Register offsets (memory mapped) */ -#define EVEN_DMA_START 0x00 -#define ODD_DMA_START 0x0C -#define EVEN_DMA_STRIDE 0x18 -#define ODD_DMA_STRIDE 0x24 -#define EVEN_PIXEL_FMT 0x30 -#define ODD_PIXEL_FMT 0x34 -#define FIFO_TRIGER 0x38 -#define XFER_MODE 0x3C -#define CSR1 0x40 -#define RETRY_WAIT_CNT 0x44 -#define INT_CSR 0x48 -#define EVEN_FLD_MASK 0x4C -#define ODD_FLD_MASK 0x50 -#define MASK_LENGTH 0x54 -#define FIFO_FLAG_CNT 0x58 -#define IIC_CLK_DUR 0x5C -#define IIC_CSR1 0x60 -#define IIC_CSR2 0x64 - -/* DT3155 Internal Registers indexes (i2c/IIC mapped) */ -#define CSR2 0x10 -#define EVEN_CSR 0x11 -#define ODD_CSR 0x12 -#define CONFIG 0x13 -#define DT_ID 0x1F -#define X_CLIP_START 0x20 -#define Y_CLIP_START 0x22 -#define X_CLIP_END 0x24 -#define Y_CLIP_END 0x26 -#define AD_ADDR 0x30 -#define AD_LUT 0x31 -#define AD_CMD 0x32 -#define DIG_OUT 0x40 -#define PM_LUT_ADDR 0x50 -#define PM_LUT_DATA 0x51 - -/* AD command register values */ -#define AD_CMD_REG 0x00 -#define AD_POS_REF 0x01 -#define AD_NEG_REF 0x02 - -/* CSR1 bit masks */ -#define CRPT_DIS 0x00004000 -#define FLD_CRPT_ODD 0x00000200 -#define FLD_CRPT_EVEN 0x00000100 -#define FIFO_EN 0x00000080 -#define SRST 0x00000040 -#define FLD_DN_ODD 0x00000020 -#define FLD_DN_EVEN 0x00000010 -/* These should not be used. - * Use CAP_CONT_ODD/EVEN instead -#define CAP_SNGL_ODD 0x00000008 -#define CAP_SNGL_EVEN 0x00000004 -*/ -#define CAP_CONT_ODD 0x00000002 -#define CAP_CONT_EVEN 0x00000001 - -/* INT_CSR bit masks */ -#define FLD_START_EN 0x00000400 -#define FLD_END_ODD_EN 0x00000200 -#define FLD_END_EVEN_EN 0x00000100 -#define FLD_START 0x00000004 -#define FLD_END_ODD 0x00000002 -#define FLD_END_EVEN 0x00000001 - -/* IIC_CSR1 bit masks */ -#define DIRECT_ABORT 0x00000200 - -/* IIC_CSR2 bit masks */ -#define NEW_CYCLE 0x01000000 -#define DIR_RD 0x00010000 -#define IIC_READ 0x01010000 -#define IIC_WRITE 0x01000000 - -/* CSR2 bit masks */ -#define DISP_PASS 0x40 -#define BUSY_ODD 0x20 -#define BUSY_EVEN 0x10 -#define SYNC_PRESENT 0x08 -#define VT_50HZ 0x04 -#define SYNC_SNTL 0x02 -#define CHROM_FILT 0x01 -#define VT_60HZ 0x00 - -/* CSR_EVEN/ODD bit masks */ -#define CSR_ERROR 0x04 -#define CSR_SNGL 0x02 -#define CSR_DONE 0x01 - -/* CONFIG bit masks */ -#define PM_LUT_PGM 0x80 -#define PM_LUT_SEL 0x40 -#define CLIP_EN 0x20 -#define HSCALE_EN 0x10 -#define EXT_TRIG_UP 0x0C -#define EXT_TRIG_DOWN 0x04 -#define ACQ_MODE_NEXT 0x02 -#define ACQ_MODE_ODD 0x01 -#define ACQ_MODE_EVEN 0x00 - -/* AD_CMD bit masks */ -#define VIDEO_CNL_1 0x00 -#define VIDEO_CNL_2 0x40 -#define VIDEO_CNL_3 0x80 -#define VIDEO_CNL_4 0xC0 -#define SYNC_CNL_1 0x00 -#define SYNC_CNL_2 0x10 -#define SYNC_CNL_3 0x20 -#define SYNC_CNL_4 0x30 -#define SYNC_LVL_1 0x00 -#define SYNC_LVL_2 0x04 -#define SYNC_LVL_3 0x08 -#define SYNC_LVL_4 0x0C - -/* DT3155 identificator */ -#define DT3155_ID 0x20 - -#ifdef CONFIG_DT3155_CCIR -#define DMA_STRIDE 768 -#else -#define DMA_STRIDE 640 -#endif - -/** - * struct dt3155_stats - statistics structure - * - * @free_bufs_empty: no free image buffers - * @corrupted_fields: corrupted fields - * @dma_map_failed: dma mapping failed - * @start_before_end: new started before old ended - */ -struct dt3155_stats { - int free_bufs_empty; - int corrupted_fields; - int dma_map_failed; - int start_before_end; -}; - -/* per board private data structure */ -/** - * struct dt3155_priv - private data structure - * - * @vdev: video_device structure - * @pdev: pointer to pci_dev structure - * @q pointer to vb2_queue structure - * @curr_buf: pointer to curren buffer - * @mux: mutex to protect the instance - * @dmaq queue for dma buffers - * @lock spinlock for dma queue - * @field_count fields counter - * @stats: statistics structure - * @users open count - * @regs: local copy of mmio base register - * @csr2: local copy of csr2 register - * @config: local copy of config register - */ -struct dt3155_priv { - struct video_device vdev; - struct pci_dev *pdev; - struct vb2_queue *q; - struct vb2_buffer *curr_buf; - struct mutex mux; - struct list_head dmaq; - spinlock_t lock; - unsigned int field_count; - struct dt3155_stats stats; - void __iomem *regs; - int users; - u8 csr2, config; -}; - -#endif /* __KERNEL__ */ - -#endif /* _DT3155_H_ */ diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 335b98a..62ec9f7 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -693,10 +693,9 @@ static int imon_probe(struct usb_interface *interface, int ifnum; int lirc_minor = 0; int num_endpts; - int retval = 0; + int retval = -ENOMEM; int display_ep_found = 0; int ir_ep_found = 0; - int alloc_status = 0; int vfd_proto_6p = 0; struct imon_context *context = NULL; int i; @@ -706,10 +705,8 @@ static int imon_probe(struct usb_interface *interface, mutex_lock(&driver_lock); context = kzalloc(sizeof(struct imon_context), GFP_KERNEL); - if (!context) { - alloc_status = 1; - goto alloc_status_switch; - } + if (!context) + goto driver_unlock; /* * Try to auto-detect the type of display if the user hasn't set @@ -775,8 +772,7 @@ static int imon_probe(struct usb_interface *interface, dev_err(dev, "%s: no valid input (IR) endpoint found.\n", __func__); retval = -ENODEV; - alloc_status = 2; - goto alloc_status_switch; + goto free_context; } /* Determine if display requires 6 packets */ @@ -790,31 +786,26 @@ static int imon_probe(struct usb_interface *interface, driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); if (!driver) { - alloc_status = 2; - goto alloc_status_switch; + goto free_context; } rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL); if (!rbuf) { - alloc_status = 3; - goto alloc_status_switch; + goto free_driver; } if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) { dev_err(dev, "%s: lirc_buffer_init failed\n", __func__); - alloc_status = 4; - goto alloc_status_switch; + goto free_rbuf; } rx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!rx_urb) { dev_err(dev, "%s: usb_alloc_urb failed for IR urb\n", __func__); - alloc_status = 5; - goto alloc_status_switch; + goto free_lirc_buf; } tx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!tx_urb) { dev_err(dev, "%s: usb_alloc_urb failed for display urb\n", __func__); - alloc_status = 6; - goto alloc_status_switch; + goto free_rx_urb; } mutex_init(&context->ctx_lock); @@ -840,11 +831,11 @@ static int imon_probe(struct usb_interface *interface, lirc_minor = lirc_register_driver(driver); if (lirc_minor < 0) { dev_err(dev, "%s: lirc_register_driver failed\n", __func__); - alloc_status = 7; - goto unlock; - } else - dev_info(dev, "Registered iMON driver (lirc minor: %d)\n", - lirc_minor); + goto free_tx_urb; + } + + dev_info(dev, "Registered iMON driver (lirc minor: %d)\n", + lirc_minor); /* Needed while unregistering! */ driver->minor = lirc_minor; @@ -872,11 +863,9 @@ static int imon_probe(struct usb_interface *interface, context->rx_endpoint->bInterval); retval = usb_submit_urb(context->rx_urb, GFP_KERNEL); - if (retval) { dev_err(dev, "usb_submit_urb failed for intf0 (%d)\n", retval); - alloc_status = 8; - goto unlock; + goto unregister_lirc; } usb_set_intfdata(interface, context); @@ -895,39 +884,31 @@ static int imon_probe(struct usb_interface *interface, dev_info(dev, "iMON device (%04x:%04x, intf%d) on usb<%d:%d> initialized\n", vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum); -unlock: - mutex_unlock(&context->ctx_lock); -alloc_status_switch: - - switch (alloc_status) { - case 8: - lirc_unregister_driver(driver->minor); - case 7: - usb_free_urb(tx_urb); - case 6: - usb_free_urb(rx_urb); - /* fall-through */ - case 5: - if (rbuf) - lirc_buffer_free(rbuf); - /* fall-through */ - case 4: - kfree(rbuf); - /* fall-through */ - case 3: - kfree(driver); - /* fall-through */ - case 2: - kfree(context); - context = NULL; - case 1: - if (retval != -ENODEV) - retval = -ENOMEM; - break; - case 0: - retval = 0; - } + /* Everything went fine. Just unlock and return retval (with is 0) */ + goto driver_unlock; + +unregister_lirc: + lirc_unregister_driver(driver->minor); + +free_tx_urb: + usb_free_urb(tx_urb); + +free_rx_urb: + usb_free_urb(rx_urb); + +free_lirc_buf: + lirc_buffer_free(rbuf); + +free_rbuf: + kfree(rbuf); + +free_driver: + kfree(driver); +free_context: + kfree(context); + context = NULL; +driver_unlock: mutex_unlock(&driver_lock); return retval; diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index 29087f6..4f326e9 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -44,7 +44,7 @@ #include <linux/ioport.h> #include <linux/kernel.h> #include <linux/serial_reg.h> -#include <linux/time.h> +#include <linux/ktime.h> #include <linux/string.h> #include <linux/types.h> #include <linux/wait.h> @@ -127,9 +127,9 @@ static int threshold = 3; static DEFINE_SPINLOCK(timer_lock); static struct timer_list timerlist; /* time of last signal change detected */ -static struct timeval last_tv = {0, 0}; +static ktime_t last; /* time of last UART data ready interrupt */ -static struct timeval last_intr_tv = {0, 0}; +static ktime_t last_intr_time; static int last_value; static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue); @@ -400,20 +400,6 @@ static void drop_chrdev(void) } /* SECTION: Hardware */ -static long delta(struct timeval *tv1, struct timeval *tv2) -{ - unsigned long deltv; - - deltv = tv2->tv_sec - tv1->tv_sec; - if (deltv > 15) - deltv = 0xFFFFFF; - else - deltv = deltv*1000000 + - tv2->tv_usec - - tv1->tv_usec; - return deltv; -} - static void sir_timeout(unsigned long data) { /* @@ -432,12 +418,14 @@ static void sir_timeout(unsigned long data) /* clear unread bits in UART and restart */ outb(UART_FCR_CLEAR_RCVR, io + UART_FCR); /* determine 'virtual' pulse end: */ - pulse_end = delta(&last_tv, &last_intr_tv); + pulse_end = min_t(unsigned long, + ktime_us_delta(last, last_intr_time), + PULSE_MASK); dev_dbg(driver.dev, "timeout add %d for %lu usec\n", last_value, pulse_end); add_read_queue(last_value, pulse_end); last_value = 0; - last_tv = last_intr_tv; + last = last_intr_time; } spin_unlock_irqrestore(&timer_lock, flags); } @@ -445,9 +433,9 @@ static void sir_timeout(unsigned long data) static irqreturn_t sir_interrupt(int irq, void *dev_id) { unsigned char data; - struct timeval curr_tv; - static unsigned long deltv; - unsigned long deltintrtv; + ktime_t curr_time; + static unsigned long delt; + unsigned long deltintr; unsigned long flags; int iir, lsr; @@ -471,49 +459,46 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) do { del_timer(&timerlist); data = inb(io + UART_RX); - do_gettimeofday(&curr_tv); - deltv = delta(&last_tv, &curr_tv); - deltintrtv = delta(&last_intr_tv, &curr_tv); + curr_time = ktime_get(); + delt = min_t(unsigned long, + ktime_us_delta(last, curr_time), + PULSE_MASK); + deltintr = min_t(unsigned long, + ktime_us_delta(last_intr_time, + curr_time), + PULSE_MASK); dev_dbg(driver.dev, "t %lu, d %d\n", - deltintrtv, (int)data); + deltintr, (int)data); /* * if nothing came in last X cycles, * it was gap */ - if (deltintrtv > TIME_CONST * threshold) { + if (deltintr > TIME_CONST * threshold) { if (last_value) { dev_dbg(driver.dev, "GAP\n"); /* simulate signal change */ add_read_queue(last_value, - deltv - - deltintrtv); + delt - + deltintr); last_value = 0; - last_tv.tv_sec = - last_intr_tv.tv_sec; - last_tv.tv_usec = - last_intr_tv.tv_usec; - deltv = deltintrtv; + last = last_intr_time; + delt = deltintr; } } data = 1; if (data ^ last_value) { /* - * deltintrtv > 2*TIME_CONST, remember? + * deltintr > 2*TIME_CONST, remember? * the other case is timeout */ add_read_queue(last_value, - deltv-TIME_CONST); + delt-TIME_CONST); last_value = data; - last_tv = curr_tv; - if (last_tv.tv_usec >= TIME_CONST) { - last_tv.tv_usec -= TIME_CONST; - } else { - last_tv.tv_sec--; - last_tv.tv_usec += 1000000 - - TIME_CONST; - } + last = curr_time; + last = ktime_sub_us(last, + TIME_CONST); } - last_intr_tv = curr_tv; + last_intr_time = curr_time; if (data) { /* * start timer for end of diff --git a/drivers/staging/media/mn88472/mn88472.c b/drivers/staging/media/mn88472/mn88472.c index a4cfcf5..a8d45f4 100644 --- a/drivers/staging/media/mn88472/mn88472.c +++ b/drivers/staging/media/mn88472/mn88472.c @@ -218,7 +218,7 @@ err: return ret; } -static int mn88472_read_status(struct dvb_frontend *fe, fe_status_t *status) +static int mn88472_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct i2c_client *client = fe->demodulator_priv; struct mn88472_dev *dev = i2c_get_clientdata(client); @@ -344,12 +344,12 @@ static int mn88472_init(struct dvb_frontend *fe) if (ret) { dev_err(&client->dev, "parity reg read failed=%d\n", ret); - goto err; + goto firmware_release; } if (tmp & 0x10) { dev_err(&client->dev, "firmware parity check failed=0x%x\n", tmp); - goto err; + goto firmware_release; } dev_err(&client->dev, "firmware parity check succeeded=0x%x\n", tmp); diff --git a/drivers/staging/media/mn88472/mn88472_priv.h b/drivers/staging/media/mn88472/mn88472_priv.h index 9ba8c8b..1a0de9e 100644 --- a/drivers/staging/media/mn88472/mn88472_priv.h +++ b/drivers/staging/media/mn88472/mn88472_priv.h @@ -29,7 +29,7 @@ struct mn88472_dev { struct regmap *regmap[3]; struct dvb_frontend fe; u16 i2c_wr_max; - fe_delivery_system_t delivery_system; + enum fe_delivery_system delivery_system; bool warm; /* FW running */ u32 xtal; int ts_mode; diff --git a/drivers/staging/media/mn88473/mn88473.c b/drivers/staging/media/mn88473/mn88473.c index 8b6736c..f9146a1 100644 --- a/drivers/staging/media/mn88473/mn88473.c +++ b/drivers/staging/media/mn88473/mn88473.c @@ -167,7 +167,7 @@ err: return ret; } -static int mn88473_read_status(struct dvb_frontend *fe, fe_status_t *status) +static int mn88473_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct i2c_client *client = fe->demodulator_priv; struct mn88473_dev *dev = i2c_get_clientdata(client); diff --git a/drivers/staging/media/mn88473/mn88473_priv.h b/drivers/staging/media/mn88473/mn88473_priv.h index ef6f013..54beb42 100644 --- a/drivers/staging/media/mn88473/mn88473_priv.h +++ b/drivers/staging/media/mn88473/mn88473_priv.h @@ -29,7 +29,7 @@ struct mn88473_dev { struct regmap *regmap[3]; struct dvb_frontend fe; u16 i2c_wr_max; - fe_delivery_system_t delivery_system; + enum fe_delivery_system delivery_system; bool warm; /* FW running */ u32 xtal; }; diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 7ced940..9bfb725 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -1489,7 +1489,7 @@ static int iss_remove(struct platform_device *pdev) return 0; } -static struct platform_device_id omap4iss_id_table[] = { +static const struct platform_device_id omap4iss_id_table[] = { { "omap4iss", 0 }, { }, }; diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index d7ff769..bc83f82 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -828,8 +828,10 @@ static const struct iss_video_operations csi2_issvideo_ops = { */ static struct v4l2_mbus_framefmt * -__csi2_get_format(struct iss_csi2_device *csi2, struct v4l2_subdev_pad_config *cfg, - unsigned int pad, enum v4l2_subdev_format_whence which) +__csi2_get_format(struct iss_csi2_device *csi2, + struct v4l2_subdev_pad_config *cfg, + unsigned int pad, + enum v4l2_subdev_format_whence which) { if (which == V4L2_SUBDEV_FORMAT_TRY) return v4l2_subdev_get_try_format(&csi2->subdev, cfg, pad); @@ -838,8 +840,10 @@ __csi2_get_format(struct iss_csi2_device *csi2, struct v4l2_subdev_pad_config *c } static void -csi2_try_format(struct iss_csi2_device *csi2, struct v4l2_subdev_pad_config *cfg, - unsigned int pad, struct v4l2_mbus_framefmt *fmt, +csi2_try_format(struct iss_csi2_device *csi2, + struct v4l2_subdev_pad_config *cfg, + unsigned int pad, + struct v4l2_mbus_framefmt *fmt, enum v4l2_subdev_format_whence which) { u32 pixelcode; @@ -967,7 +971,8 @@ static int csi2_enum_frame_size(struct v4l2_subdev *sd, * @fmt: pointer to v4l2 subdev format structure * return -EINVAL or zero on success */ -static int csi2_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +static int csi2_get_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd); @@ -988,7 +993,8 @@ static int csi2_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config * @fmt: pointer to v4l2 subdev format structure * return -EINVAL or zero on success */ -static int csi2_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +static int csi2_set_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd); diff --git a/drivers/staging/media/omap4iss/iss_ipipe.c b/drivers/staging/media/omap4iss/iss_ipipe.c index eaa82da..f94a592 100644 --- a/drivers/staging/media/omap4iss/iss_ipipe.c +++ b/drivers/staging/media/omap4iss/iss_ipipe.c @@ -24,8 +24,10 @@ #include "iss_ipipe.h" static struct v4l2_mbus_framefmt * -__ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_pad_config *cfg, - unsigned int pad, enum v4l2_subdev_format_whence which); +__ipipe_get_format(struct iss_ipipe_device *ipipe, + struct v4l2_subdev_pad_config *cfg, + unsigned int pad, + enum v4l2_subdev_format_whence which); static const unsigned int ipipe_fmts[] = { MEDIA_BUS_FMT_SGRBG10_1X10, @@ -176,8 +178,10 @@ static int ipipe_set_stream(struct v4l2_subdev *sd, int enable) } static struct v4l2_mbus_framefmt * -__ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_pad_config *cfg, - unsigned int pad, enum v4l2_subdev_format_whence which) +__ipipe_get_format(struct iss_ipipe_device *ipipe, + struct v4l2_subdev_pad_config *cfg, + unsigned int pad, + enum v4l2_subdev_format_whence which) { if (which == V4L2_SUBDEV_FORMAT_TRY) return v4l2_subdev_get_try_format(&ipipe->subdev, cfg, pad); @@ -193,9 +197,11 @@ __ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_pad_config * @fmt: Format */ static void -ipipe_try_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_pad_config *cfg, - unsigned int pad, struct v4l2_mbus_framefmt *fmt, - enum v4l2_subdev_format_whence which) +ipipe_try_format(struct iss_ipipe_device *ipipe, + struct v4l2_subdev_pad_config *cfg, + unsigned int pad, + struct v4l2_mbus_framefmt *fmt, + enum v4l2_subdev_format_whence which) { struct v4l2_mbus_framefmt *format; unsigned int width = fmt->width; @@ -306,8 +312,9 @@ static int ipipe_enum_frame_size(struct v4l2_subdev *sd, * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ -static int ipipe_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *fmt) +static int ipipe_get_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt) { struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; @@ -329,8 +336,9 @@ static int ipipe_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_confi * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ -static int ipipe_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *fmt) +static int ipipe_set_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt) { struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c index 530ac84..c0da13d 100644 --- a/drivers/staging/media/omap4iss/iss_ipipeif.c +++ b/drivers/staging/media/omap4iss/iss_ipipeif.c @@ -518,8 +518,9 @@ static int ipipeif_enum_frame_size(struct v4l2_subdev *sd, * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ -static int ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *fmt) +static int ipipeif_get_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt) { struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; @@ -541,8 +542,9 @@ static int ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_con * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ -static int ipipeif_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *fmt) +static int ipipeif_set_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt) { struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; diff --git a/drivers/staging/media/omap4iss/iss_resizer.c b/drivers/staging/media/omap4iss/iss_resizer.c index 5f69012..5030cf3 100644 --- a/drivers/staging/media/omap4iss/iss_resizer.c +++ b/drivers/staging/media/omap4iss/iss_resizer.c @@ -580,8 +580,9 @@ static int resizer_enum_frame_size(struct v4l2_subdev *sd, * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ -static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *fmt) +static int resizer_get_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt) { struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; @@ -603,7 +604,8 @@ static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_con * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ -static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +static int resizer_set_format(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index d670494..bda208d 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -2188,6 +2188,8 @@ static struct notifier_block panel_notifier = { static void panel_attach(struct parport *port) { + struct pardev_cb panel_cb; + if (port->number != parport) return; @@ -2197,10 +2199,11 @@ static void panel_attach(struct parport *port) return; } - pprt = parport_register_device(port, "panel", NULL, NULL, /* pf, kf */ - NULL, - /*PARPORT_DEV_EXCL */ - 0, (void *)&pprt); + memset(&panel_cb, 0, sizeof(panel_cb)); + panel_cb.private = &pprt; + /* panel_cb.flags = 0 should be PARPORT_DEV_EXCL? */ + + pprt = parport_register_dev_model(port, "panel", &panel_cb, 0); if (pprt == NULL) { pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n", __func__, port->number, parport); @@ -2274,8 +2277,9 @@ static void panel_detach(struct parport *port) static struct parport_driver panel_driver = { .name = "panel", - .attach = panel_attach, + .match_port = panel_attach, .detach = panel_detach, + .devmodel = true, }; /* init function */ diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index feb5961..0ae2180 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -379,7 +379,7 @@ void rtw_cfg80211_indicate_disconnect(struct rtw_adapter *padapter) GFP_ATOMIC); } else { cfg80211_disconnected(padapter->pnetdev, 0, NULL, - 0, GFP_ATOMIC); + 0, false, GFP_ATOMIC); } } } diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index 1bcadba..b4e4543 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -230,7 +230,6 @@ static struct scsi_host_template rtsx_host_template = { /* queue commands only, only one command per LUN */ .can_queue = 1, - .cmd_per_lun = 1, /* unknown initiator id */ .this_id = -1, diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 0bfc939..ed040fb 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1525,21 +1525,12 @@ static void vnt_configure(struct ieee80211_hw *hw, struct vnt_private *priv = hw->priv; u8 rx_mode = 0; - *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_PROMISC_IN_BSS | - FIF_BCN_PRBRESP_PROMISC; + *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC; VNSvInPortB(priv->PortOffset + MAC_REG_RCR, &rx_mode); dev_dbg(&priv->pcid->dev, "rx mode in = %x\n", rx_mode); - if (changed_flags & FIF_PROMISC_IN_BSS) { - /* unconditionally log net taps */ - if (*total_flags & FIF_PROMISC_IN_BSS) - rx_mode |= RCR_UNICAST; - else - rx_mode &= ~RCR_UNICAST; - } - if (changed_flags & FIF_ALLMULTI) { if (*total_flags & FIF_ALLMULTI) { unsigned long flags; @@ -1816,10 +1807,10 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); - priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_TIMING_BEACON_ONLY; + ieee80211_hw_set(priv->hw, TIMING_BEACON_ONLY); + ieee80211_hw_set(priv->hw, SIGNAL_DBM); + ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS); + ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS); priv->hw->max_signal = 100; diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index cb8c2db..f97323f 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -785,8 +785,7 @@ static void vnt_configure(struct ieee80211_hw *hw, u8 rx_mode = 0; int rc; - *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_PROMISC_IN_BSS | - FIF_BCN_PRBRESP_PROMISC; + *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC; rc = vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); @@ -796,14 +795,6 @@ static void vnt_configure(struct ieee80211_hw *hw, dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode); - if (changed_flags & FIF_PROMISC_IN_BSS) { - /* unconditionally log net taps */ - if (*total_flags & FIF_PROMISC_IN_BSS) - rx_mode |= RCR_UNICAST; - else - rx_mode &= ~RCR_UNICAST; - } - if (changed_flags & FIF_ALLMULTI) { if (*total_flags & FIF_ALLMULTI) { if (priv->mc_list_count > 2) @@ -987,10 +978,10 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); - priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_TIMING_BEACON_ONLY; + ieee80211_hw_set(priv->hw, TIMING_BEACON_ONLY); + ieee80211_hw_set(priv->hw, SIGNAL_DBM); + ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS); + ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS); priv->hw->max_signal = 100; diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c index 7c87aec..342e2b3 100644 --- a/drivers/staging/wlan-ng/cfg80211.c +++ b/drivers/staging/wlan-ng/cfg80211.c @@ -722,7 +722,7 @@ void prism2_connect_result(wlandevice_t *wlandev, u8 failed) void prism2_disconnected(wlandevice_t *wlandev) { cfg80211_disconnected(wlandev->netdev, 0, NULL, - 0, GFP_KERNEL); + 0, false, GFP_KERNEL); } void prism2_roamed(wlandevice_t *wlandev) |