media: vb2-dma-contig: fix sizeof(pointer) allocation

2016-07-27 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan <adobri...@gmail.com>
---

 drivers/media/v4l2-core/videobuf2-dma-contig.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -749,7 +749,7 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
 int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size)
 {
if (!dev->dma_parms) {
-   dev->dma_parms = kzalloc(sizeof(dev->dma_parms), GFP_KERNEL);
+   dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
if (!dev->dma_parms)
return -ENOMEM;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] headers: fix circular dependency between linux/sched.h and linux/wait.h

2011-02-21 Thread Alexey Dobriyan
On Mon, Feb 21, 2011 at 12:20 PM, David Cohen daco...@gmail.com wrote:
 Currently sched.h and wait.h have circular dependency between both.
 wait.h defines macros wake_up*() which use macros TASK_* defined by
 sched.h. But as sched.h indirectly includes wait.h, such wait.h header
 file can't include sched.h too. The side effect is when some file
 includes wait.h and tries to use its wake_up*() macros, it's necessary
 to include sched.h also.
 This patch moves all TASK_* macros from linux/sched.h to a new header
 file linux/task_sched.h. This way, both sched.h and wait.h can include
 task_sched.h and fix the circular dependency. No need to include sched.h
 anymore when wake_up*() macros are used.

Just include linux/sched.h in your driver.
This include splitting in small pieces is troublesome as well.

Why are you moving TASK_COMM_LEN?

  include/linux/sched.h      |   61 +-
  include/linux/task_sched.h |   64 
 
  include/linux/wait.h       |    1 +
  3 files changed, 66 insertions(+), 60 deletions(-)
  create mode 100644 include/linux/task_sched.h

 --- a/include/linux/sched.h
 +++ b/include/linux/sched.h
 +#include linux/task_sched.h
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] headers: fix circular dependency between linux/sched.h and linux/wait.h

2011-02-21 Thread Alexey Dobriyan
On Mon, Feb 21, 2011 at 2:30 PM, Felipe Balbi ba...@ti.com wrote:
 On Mon, Feb 21, 2011 at 01:05:51PM +0200, Alexey Dobriyan wrote:

 Just include linux/sched.h in your driver.
 This include splitting in small pieces is troublesome as well.

 so, simply to call wake_up*() we need to know everything there is to
 know about the scheduler ?

know everything is exaggeration.
You add sched.h, if someone else haven't added it already via other headers.

File is misnamed, BTW. It should be called task-state.h or something.
And, again, TASK_COMM_LEN should be left alone.

 I rather have the split done and kill the circular dependency.

It's not circular for starters.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] headers: fix circular dependency between linux/sched.h and linux/wait.h

2011-02-21 Thread Alexey Dobriyan
On Mon, Feb 21, 2011 at 06:06:02PM +0100, Peter Zijlstra wrote:
 1) remove the inclusion of completion.h -- easy we can live with an
 incomplete type.

ACK

 2) move the other wait_queue_head_t users (signal_struct sighand_struct)
 out of sched.h
 
 3) ...

Compile test! :^)

 4) profit!
 
 Just isolating the TASK_state bits isn't going to be enough, wait.h also
 wants wake_up goo and schedule*(), therefore either include sched.h from
 whatever .c file you're using wait.h bits or do the above cleanup.

Speaking of junk in sched.h, I'll send mm_types.h removal next merge window
and maybe cred.h.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -next] media: fix em28xx build, needs interrupt.h

2010-12-07 Thread Alexey Dobriyan
On Tue, Dec 07, 2010 at 10:38:15AM -0800, Randy Dunlap wrote:
 From: Randy Dunlap randy.dun...@oracle.com
 
 drivers/media/video/em28xx/em28xx-vbi.c:49: error: implicit declaration of 
 function 'in_interrupt'

 +#include linux/interrupt.h

It's defined in hardirq.h.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bug #15589] 2.6.34-rc1: Badness at fs/proc/generic.c:316

2010-06-14 Thread Alexey Dobriyan
On Sun, Jun 13, 2010 at 01:57:40PM -0600, Grant Likely wrote:
 On brief review, they look like completely different issues.  I doubt
 the second patch will fix the flexcop-pci issue.

It will, see how name wht slashes propagated by request_irq()
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git:v4l-dvb/master] af_key: fix netns ops ordering on module load/unload

2010-03-06 Thread Alexey Dobriyan
On Sat, Mar 06, 2010 at 03:27:06PM +0100, Patch from Alexey Dobriyan wrote:
 From: Alexey Dobriyan adobri...@gmail.com
 
 1. After sock_register() returns, it's possible to create sockets,
even if module still not initialized fully (blame generic module code
for that!)
 2. Consequently, pfkey_create() can be called with pfkey_net_id still not
initialized which will BUG_ON in net_generic():
   kernel BUG at include/net/netns/generic.h:43!
 3. During netns shutdown, netns ops should be unregistered after
key manager unregistered because key manager calls can be triggered
from xfrm_user module:
 
   general protection fault:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
   pfkey_broadcast+0x111/0x210 [af_key]
   pfkey_send_notify+0x16a/0x300 [af_key]
   km_state_notify+0x41/0x70
   xfrm_flush_sa+0x75/0x90 [xfrm_user]
 4. Unregister netns ops after socket ops just in case and for symmetry.
 
 Reported by Luca Tettamanti.
 
 Signed-off-by: Alexey Dobriyan adobri...@gmail.com
 Tested-by: Luca Tettamanti kronos...@gmail.com
 Signed-off-by: Eric Dumazet eric.duma...@gmail.com
 Signed-off-by: David S. Miller da...@davemloft.net

What this has to do with DVB?
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] proc_fops: convert cpia

2009-11-22 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan adobri...@gmail.com
---

 drivers/media/video/cpia.c |  211 ++---
 1 file changed, 104 insertions(+), 107 deletions(-)

--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -32,6 +32,7 @@
 #include linux/fs.h
 #include linux/vmalloc.h
 #include linux/sched.h
+#include linux/seq_file.h
 #include linux/slab.h
 #include linux/proc_fs.h
 #include linux/ctype.h
@@ -244,72 +245,67 @@ static void rvfree(void *mem, unsigned long size)
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry *cpia_proc_root=NULL;
 
-static int cpia_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int cpia_proc_show(struct seq_file *m, void *v)
 {
-   char *out = page;
-   int len, tmp;
-   struct cam_data *cam = data;
+   struct cam_data *cam = m-private;
+   int tmp;
char tmpstr[29];
 
-   /* IMPORTANT: This output MUST be kept under PAGE_SIZE
-*or we need to get more sophisticated. */
-
-   out += sprintf(out, read-only\n---\n);
-   out += sprintf(out, V4L Driver version:   %d.%d.%d\n,
+   seq_printf(m, read-only\n---\n);
+   seq_printf(m, V4L Driver version:   %d.%d.%d\n,
   CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER);
-   out += sprintf(out, CPIA Version: %d.%02d (%d.%d)\n,
+   seq_printf(m, CPIA Version: %d.%02d (%d.%d)\n,
   cam-params.version.firmwareVersion,
   cam-params.version.firmwareRevision,
   cam-params.version.vcVersion,
   cam-params.version.vcRevision);
-   out += sprintf(out, CPIA PnP-ID:  %04x:%04x:%04x\n,
+   seq_printf(m, CPIA PnP-ID:  %04x:%04x:%04x\n,
   cam-params.pnpID.vendor, cam-params.pnpID.product,
   cam-params.pnpID.deviceRevision);
-   out += sprintf(out, VP-Version:   %d.%d %04x\n,
+   seq_printf(m, VP-Version:   %d.%d %04x\n,
   cam-params.vpVersion.vpVersion,
   cam-params.vpVersion.vpRevision,
   cam-params.vpVersion.cameraHeadID);
 
-   out += sprintf(out, system_state: %#04x\n,
+   seq_printf(m, system_state: %#04x\n,
   cam-params.status.systemState);
-   out += sprintf(out, grab_state:   %#04x\n,
+   seq_printf(m, grab_state:   %#04x\n,
   cam-params.status.grabState);
-   out += sprintf(out, stream_state: %#04x\n,
+   seq_printf(m, stream_state: %#04x\n,
   cam-params.status.streamState);
-   out += sprintf(out, fatal_error:  %#04x\n,
+   seq_printf(m, fatal_error:  %#04x\n,
   cam-params.status.fatalError);
-   out += sprintf(out, cmd_error:%#04x\n,
+   seq_printf(m, cmd_error:%#04x\n,
   cam-params.status.cmdError);
-   out += sprintf(out, debug_flags:  %#04x\n,
+   seq_printf(m, debug_flags:  %#04x\n,
   cam-params.status.debugFlags);
-   out += sprintf(out, vp_status:%#04x\n,
+   seq_printf(m, vp_status:%#04x\n,
   cam-params.status.vpStatus);
-   out += sprintf(out, error_code:   %#04x\n,
+   seq_printf(m, error_code:   %#04x\n,
   cam-params.status.errorCode);
/* QX3 specific entries */
if (cam-params.qx3.qx3_detected) {
-   out += sprintf(out, button:   %4d\n,
+   seq_printf(m, button:   %4d\n,
   cam-params.qx3.button);
-   out += sprintf(out, cradled:  %4d\n,
+   seq_printf(m, cradled:  %4d\n,
   cam-params.qx3.cradled);
}
-   out += sprintf(out, video_size:   %s\n,
+   seq_printf(m, video_size:   %s\n,
   cam-params.format.videoSize == VIDEOSIZE_CIF ?
   CIF  : QCIF);
-   out += sprintf(out, roi:  (%3d, %3d) to (%3d, 
%3d)\n,
+   seq_printf(m, roi:  (%3d, %3d) to (%3d, %3d)\n,
   cam-params.roi.colStart*8,
   cam-params.roi.rowStart*4,
   cam-params.roi.colEnd*8,
   cam-params.roi.rowEnd*4);
-   out += sprintf(out, actual_fps:   %3d\n, cam-fps);
-   out += sprintf(out, transfer_rate:%4dkB/s\n,
+   seq_printf(m, actual_fps:   %3d\n, cam-fps);
+   seq_printf(m