linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
@ 2017-12-01 14:31 Sakari Ailus
  2017-12-08 14:59 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Sakari Ailus @ 2017-12-01 14:31 UTC (permalink / raw)
  To: linux-media; +Cc: rajmohan.mani, yong.zhi

Hi Mauro,

Here's the Intel IPU3 CIO2 CSI-2 receiver driver, with the accompanying
format definitions.

Please pull.


The following changes since commit be9b53c83792e3898755dce90f8c632d40e7c83e:

  media: dvb-frontends: complete kernel-doc markups (2017-11-30 04:19:05 -0500)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git ipu3

for you to fetch changes up to f178207daa68e817ab6fd702d81ed7c8637ab72c:

  intel-ipu3: cio2: add new MIPI-CSI2 driver (2017-11-30 14:19:47 +0200)

----------------------------------------------------------------
Yong Zhi (3):
      videodev2.h, v4l2-ioctl: add IPU3 raw10 color format
      doc-rst: add IPU3 raw10 bayer pixel format definitions
      intel-ipu3: cio2: add new MIPI-CSI2 driver

 Documentation/media/uapi/v4l/pixfmt-rgb.rst        |    1 +
 .../media/uapi/v4l/pixfmt-srggb10-ipu3.rst         |  335 ++++
 MAINTAINERS                                        |    8 +
 drivers/media/pci/Kconfig                          |    2 +
 drivers/media/pci/Makefile                         |    3 +-
 drivers/media/pci/intel/Makefile                   |    5 +
 drivers/media/pci/intel/ipu3/Kconfig               |   19 +
 drivers/media/pci/intel/ipu3/Makefile              |    1 +
 drivers/media/pci/intel/ipu3/ipu3-cio2.c           | 2052 ++++++++++++++++++++
 drivers/media/pci/intel/ipu3/ipu3-cio2.h           |  449 +++++
 drivers/media/v4l2-core/v4l2-ioctl.c               |    4 +
 include/uapi/linux/videodev2.h                     |    6 +
 12 files changed, 2884 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/media/uapi/v4l/pixfmt-srggb10-ipu3.rst
 create mode 100644 drivers/media/pci/intel/Makefile
 create mode 100644 drivers/media/pci/intel/ipu3/Kconfig
 create mode 100644 drivers/media/pci/intel/ipu3/Makefile
 create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.c
 create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.h

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
  2017-12-01 14:31 [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver Sakari Ailus
@ 2017-12-08 14:59 ` Mauro Carvalho Chehab
  2017-12-08 23:32   ` Zhi, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2017-12-08 14:59 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, rajmohan.mani, yong.zhi

Em Fri, 1 Dec 2017 16:31:36 +0200
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> Hi Mauro,
> 
> Here's the Intel IPU3 CIO2 CSI-2 receiver driver, with the accompanying
> format definitions.

This patch generates two warnings:

drivers/media/pci/intel/ipu3/ipu3-cio2.c:1899:16: warning: Variable length array is used.
drivers/media/pci/intel/ipu3/ipu3-cio2.c: In function 'cio2_pci_probe':
drivers/media/pci/intel/ipu3/ipu3-cio2.c:1726:14: warning: variable 'phys' set but not used [-Wunused-but-set-variable]
  phys_addr_t phys;
              ^~~~

We should never use variable-length array on Kernel, as Linux stack
is very limited, and we have static analyzers to check for it at
compilation time.

Also, the logic should check if pci_resource_start() succeeded, instead
of just ignoring it.

Please fix.


> 
> Please pull.
> 
> 
> The following changes since commit be9b53c83792e3898755dce90f8c632d40e7c83e:
> 
>   media: dvb-frontends: complete kernel-doc markups (2017-11-30 04:19:05 -0500)
> 
> are available in the git repository at:
> 
>   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> 
> for you to fetch changes up to f178207daa68e817ab6fd702d81ed7c8637ab72c:
> 
>   intel-ipu3: cio2: add new MIPI-CSI2 driver (2017-11-30 14:19:47 +0200)
> 
> ----------------------------------------------------------------
> Yong Zhi (3):
>       videodev2.h, v4l2-ioctl: add IPU3 raw10 color format
>       doc-rst: add IPU3 raw10 bayer pixel format definitions
>       intel-ipu3: cio2: add new MIPI-CSI2 driver
> 
>  Documentation/media/uapi/v4l/pixfmt-rgb.rst        |    1 +
>  .../media/uapi/v4l/pixfmt-srggb10-ipu3.rst         |  335 ++++
>  MAINTAINERS                                        |    8 +
>  drivers/media/pci/Kconfig                          |    2 +
>  drivers/media/pci/Makefile                         |    3 +-
>  drivers/media/pci/intel/Makefile                   |    5 +
>  drivers/media/pci/intel/ipu3/Kconfig               |   19 +
>  drivers/media/pci/intel/ipu3/Makefile              |    1 +
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c           | 2052 ++++++++++++++++++++
>  drivers/media/pci/intel/ipu3/ipu3-cio2.h           |  449 +++++
>  drivers/media/v4l2-core/v4l2-ioctl.c               |    4 +
>  include/uapi/linux/videodev2.h                     |    6 +
>  12 files changed, 2884 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/media/uapi/v4l/pixfmt-srggb10-ipu3.rst
>  create mode 100644 drivers/media/pci/intel/Makefile
>  create mode 100644 drivers/media/pci/intel/ipu3/Kconfig
>  create mode 100644 drivers/media/pci/intel/ipu3/Makefile
>  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.c
>  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.h
> 



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
  2017-12-08 14:59 ` Mauro Carvalho Chehab
@ 2017-12-08 23:32   ` Zhi, Yong
  2017-12-15 15:18     ` Zhi, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Zhi, Yong @ 2017-12-08 23:32 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus; +Cc: linux-media, Mani, Rajmohan

Hi, Mauro,

> -----Original Message-----
> From: Mauro Carvalho Chehab [mailto:mchehab@s-opensource.com]
> Sent: Friday, December 8, 2017 7:00 AM
> To: Sakari Ailus <sakari.ailus@iki.fi>
> Cc: linux-media@vger.kernel.org; Mani, Rajmohan
> <rajmohan.mani@intel.com>; Zhi, Yong <yong.zhi@intel.com>
> Subject: Re: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
> 
> Em Fri, 1 Dec 2017 16:31:36 +0200
> Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> 
> > Hi Mauro,
> >
> > Here's the Intel IPU3 CIO2 CSI-2 receiver driver, with the
> > accompanying format definitions.
> 
> This patch generates two warnings:
> 
> drivers/media/pci/intel/ipu3/ipu3-cio2.c:1899:16: warning: Variable length
> array is used.
> drivers/media/pci/intel/ipu3/ipu3-cio2.c: In function 'cio2_pci_probe':
> drivers/media/pci/intel/ipu3/ipu3-cio2.c:1726:14: warning: variable 'phys'
> set but not used [-Wunused-but-set-variable]
>   phys_addr_t phys;
>               ^~~~
> 
> We should never use variable-length array on Kernel, as Linux stack is very
> limited, and we have static analyzers to check for it at compilation time.
> 
> Also, the logic should check if pci_resource_start() succeeded, instead of
> just ignoring it.
> 
> Please fix.
> 

Thanks for catching the warnings, for the variable size array, from the code context, 
the size is limited to 128 bytes, maybe this language feature itself is not recommended, 
we will send a patch to address above soon.

> 
> >
> > Please pull.
> >
> >
> > The following changes since commit
> be9b53c83792e3898755dce90f8c632d40e7c83e:
> >
> >   media: dvb-frontends: complete kernel-doc markups (2017-11-30
> > 04:19:05 -0500)
> >
> > are available in the git repository at:
> >
> >   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> >
> > for you to fetch changes up to
> f178207daa68e817ab6fd702d81ed7c8637ab72c:
> >
> >   intel-ipu3: cio2: add new MIPI-CSI2 driver (2017-11-30 14:19:47
> > +0200)
> >
> > ----------------------------------------------------------------
> > Yong Zhi (3):
> >       videodev2.h, v4l2-ioctl: add IPU3 raw10 color format
> >       doc-rst: add IPU3 raw10 bayer pixel format definitions
> >       intel-ipu3: cio2: add new MIPI-CSI2 driver
> >
> >  Documentation/media/uapi/v4l/pixfmt-rgb.rst        |    1 +
> >  .../media/uapi/v4l/pixfmt-srggb10-ipu3.rst         |  335 ++++
> >  MAINTAINERS                                        |    8 +
> >  drivers/media/pci/Kconfig                          |    2 +
> >  drivers/media/pci/Makefile                         |    3 +-
> >  drivers/media/pci/intel/Makefile                   |    5 +
> >  drivers/media/pci/intel/ipu3/Kconfig               |   19 +
> >  drivers/media/pci/intel/ipu3/Makefile              |    1 +
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c           | 2052
> ++++++++++++++++++++
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.h           |  449 +++++
> >  drivers/media/v4l2-core/v4l2-ioctl.c               |    4 +
> >  include/uapi/linux/videodev2.h                     |    6 +
> >  12 files changed, 2884 insertions(+), 1 deletion(-)  create mode
> > 100644 Documentation/media/uapi/v4l/pixfmt-srggb10-ipu3.rst
> >  create mode 100644 drivers/media/pci/intel/Makefile  create mode
> > 100644 drivers/media/pci/intel/ipu3/Kconfig
> >  create mode 100644 drivers/media/pci/intel/ipu3/Makefile
> >  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.c
> >  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.h
> >
> 
> 
> 
> Thanks,
> Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
  2017-12-08 23:32   ` Zhi, Yong
@ 2017-12-15 15:18     ` Zhi, Yong
  0 siblings, 0 replies; 4+ messages in thread
From: Zhi, Yong @ 2017-12-15 15:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus; +Cc: linux-media, Mani, Rajmohan

[-- Attachment #1: Type: text/plain, Size: 3975 bytes --]

Hi, Mauro and Sakari,

Sorry for the late response, the fix of the 2 warnings is attached.

Best regards,

Yong
________________________________________
From: Zhi, Yong
Sent: Friday, December 08, 2017 3:32 PM
To: Mauro Carvalho Chehab; Sakari Ailus
Cc: linux-media@vger.kernel.org; Mani, Rajmohan
Subject: RE: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver

Hi, Mauro,

> -----Original Message-----
> From: Mauro Carvalho Chehab [mailto:mchehab@s-opensource.com]
> Sent: Friday, December 8, 2017 7:00 AM
> To: Sakari Ailus <sakari.ailus@iki.fi>
> Cc: linux-media@vger.kernel.org; Mani, Rajmohan
> <rajmohan.mani@intel.com>; Zhi, Yong <yong.zhi@intel.com>
> Subject: Re: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
>
> Em Fri, 1 Dec 2017 16:31:36 +0200
> Sakari Ailus <sakari.ailus@iki.fi> escreveu:
>
> > Hi Mauro,
> >
> > Here's the Intel IPU3 CIO2 CSI-2 receiver driver, with the
> > accompanying format definitions.
>
> This patch generates two warnings:
>
> drivers/media/pci/intel/ipu3/ipu3-cio2.c:1899:16: warning: Variable length
> array is used.
> drivers/media/pci/intel/ipu3/ipu3-cio2.c: In function 'cio2_pci_probe':
> drivers/media/pci/intel/ipu3/ipu3-cio2.c:1726:14: warning: variable 'phys'
> set but not used [-Wunused-but-set-variable]
>   phys_addr_t phys;
>               ^~~~
>
> We should never use variable-length array on Kernel, as Linux stack is very
> limited, and we have static analyzers to check for it at compilation time.
>
> Also, the logic should check if pci_resource_start() succeeded, instead of
> just ignoring it.
>
> Please fix.
>

Thanks for catching the warnings, for the variable size array, from the code context,
the size is limited to 128 bytes, maybe this language feature itself is not recommended,
we will send a patch to address above soon.

>
> >
> > Please pull.
> >
> >
> > The following changes since commit
> be9b53c83792e3898755dce90f8c632d40e7c83e:
> >
> >   media: dvb-frontends: complete kernel-doc markups (2017-11-30
> > 04:19:05 -0500)
> >
> > are available in the git repository at:
> >
> >   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> >
> > for you to fetch changes up to
> f178207daa68e817ab6fd702d81ed7c8637ab72c:
> >
> >   intel-ipu3: cio2: add new MIPI-CSI2 driver (2017-11-30 14:19:47
> > +0200)
> >
> > ----------------------------------------------------------------
> > Yong Zhi (3):
> >       videodev2.h, v4l2-ioctl: add IPU3 raw10 color format
> >       doc-rst: add IPU3 raw10 bayer pixel format definitions
> >       intel-ipu3: cio2: add new MIPI-CSI2 driver
> >
> >  Documentation/media/uapi/v4l/pixfmt-rgb.rst        |    1 +
> >  .../media/uapi/v4l/pixfmt-srggb10-ipu3.rst         |  335 ++++
> >  MAINTAINERS                                        |    8 +
> >  drivers/media/pci/Kconfig                          |    2 +
> >  drivers/media/pci/Makefile                         |    3 +-
> >  drivers/media/pci/intel/Makefile                   |    5 +
> >  drivers/media/pci/intel/ipu3/Kconfig               |   19 +
> >  drivers/media/pci/intel/ipu3/Makefile              |    1 +
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c           | 2052
> ++++++++++++++++++++
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.h           |  449 +++++
> >  drivers/media/v4l2-core/v4l2-ioctl.c               |    4 +
> >  include/uapi/linux/videodev2.h                     |    6 +
> >  12 files changed, 2884 insertions(+), 1 deletion(-)  create mode
> > 100644 Documentation/media/uapi/v4l/pixfmt-srggb10-ipu3.rst
> >  create mode 100644 drivers/media/pci/intel/Makefile  create mode
> > 100644 drivers/media/pci/intel/ipu3/Kconfig
> >  create mode 100644 drivers/media/pci/intel/ipu3/Makefile
> >  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.c
> >  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.h
> >
>
>
>
> Thanks,
> Mauro

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-PATCH-v8-intel-ipu3-cio2-fix-two-warnings-in-the-cod.patch --]
[-- Type: text/x-patch; name="0001-PATCH-v8-intel-ipu3-cio2-fix-two-warnings-in-the-cod.patch", Size: 2402 bytes --]

From d7e9baf13b1a8c8308906a7ed213f75d12756c24 Mon Sep 17 00:00:00 2001
From: Yong Zhi <yong.zhi@intel.com>
Date: Tue, 12 Dec 2017 10:16:31 -0600
Subject: [PATCH] [PATCH v8] intel-ipu3: cio2: fix two warnings in the code

Fix two warnings reported by Mauro Carvalho Chehab:

ipu3-cio2.c:1899:16: warning: Variable length array is used.

In function 'cio2_pci_probe':
ipu3-cio2.c:1726:14: warning: variable 'phys' set
but not used [-Wunused-but-set-variable]

Hi, Sakari, can you squash the patch to your tree?

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 4295bdb8b192..941caa987dab 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1723,7 +1723,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
 			  const struct pci_device_id *id)
 {
 	struct cio2_device *cio2;
-	phys_addr_t phys;
 	void __iomem *const *iomap;
 	int r;
 
@@ -1741,8 +1740,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
 	dev_info(&pci_dev->dev, "device 0x%x (rev: 0x%x)\n",
 		 pci_dev->device, pci_dev->revision);
 
-	phys = pci_resource_start(pci_dev, CIO2_PCI_BAR);
-
 	r = pcim_iomap_regions(pci_dev, 1 << CIO2_PCI_BAR, pci_name(pci_dev));
 	if (r) {
 		dev_err(&pci_dev->dev, "failed to remap I/O memory (%d)\n", r);
@@ -1896,7 +1893,6 @@ static void arrange(void *ptr, size_t elem_size, size_t elems, size_t start)
 		{ 0, start - 1 },
 		{ start, elems - 1 },
 	};
-	u8 tmp[elem_size];
 
 #define arr_size(a) ((a)->end - (a)->begin + 1)
 
@@ -1915,12 +1911,12 @@ static void arrange(void *ptr, size_t elem_size, size_t elems, size_t start)
 
 		/* Swap the entries in two parts of the array. */
 		for (i = 0; i < size0; i++) {
-			memcpy(tmp, ptr + elem_size * (arr[1].begin + i),
-			       elem_size);
-			memcpy(ptr + elem_size * (arr[1].begin + i),
-			       ptr + elem_size * (arr[0].begin + i), elem_size);
-			memcpy(ptr + elem_size * (arr[0].begin + i), tmp,
-			       elem_size);
+			u8 *d = ptr + elem_size * (arr[1].begin + i);
+			u8 *s = ptr + elem_size * (arr[0].begin + i);
+			size_t j;
+
+			for (j = 0; j < elem_size; j++)
+				swap(d[j], s[j]);
 		}
 
 		if (arr_size(&arr[0]) > arr_size(&arr[1])) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-15 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 14:31 [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver Sakari Ailus
2017-12-08 14:59 ` Mauro Carvalho Chehab
2017-12-08 23:32   ` Zhi, Yong
2017-12-15 15:18     ` Zhi, Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).