linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] staging: media: zoran: remove detect_guest_activity
@ 2021-05-18 12:41 Corentin Labbe
  2021-05-18 12:41 ` [PATCH 2/5] staging: media: zoran: multiple assignments should be avoided Corentin Labbe
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Corentin Labbe @ 2021-05-18 12:41 UTC (permalink / raw)
  To: gregkh, mchehab
  Cc: linux-kernel, linux-media, linux-staging, mjpeg-users, Corentin Labbe

The detect_guest_activity function is no longer used, so lets removed it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zoran_device.c | 46 ----------------------
 drivers/staging/media/zoran/zoran_device.h |  2 -
 2 files changed, 48 deletions(-)

diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
index cf788d9cd1df..7d2718744d18 100644
--- a/drivers/staging/media/zoran/zoran_device.c
+++ b/drivers/staging/media/zoran/zoran_device.c
@@ -166,52 +166,6 @@ static void dump_guests(struct zoran *zr)
 	}
 }
 
-void detect_guest_activity(struct zoran *zr)
-{
-	int timeout, i, j, res, guest[8], guest0[8], change[8][3];
-	ktime_t t0, t1;
-
-	/* do not print random data */
-	guest[0] = 0;
-	guest0[0] = 0;
-
-	dump_guests(zr);
-	pci_info(zr->pci_dev, "Detecting guests activity, please wait...\n");
-	for (i = 1; i < 8; i++) /* Don't read jpeg codec here */
-		guest0[i] = guest[i] = post_office_read(zr, i, 0);
-
-	timeout = 0;
-	j = 0;
-	t0 = ktime_get();
-	while (timeout < 10000) {
-		udelay(10);
-		timeout++;
-		for (i = 1; (i < 8) && (j < 8); i++) {
-			res = post_office_read(zr, i, 0);
-			if (res != guest[i]) {
-				t1 = ktime_get();
-				change[j][0] = ktime_to_us(ktime_sub(t1, t0));
-				t0 = t1;
-				change[j][1] = i;
-				change[j][2] = res;
-				j++;
-				guest[i] = res;
-			}
-		}
-		if (j >= 8)
-			break;
-	}
-
-	pci_info(zr->pci_dev, "Guests: %*ph\n", 8, guest0);
-
-	if (j == 0) {
-		pci_info(zr->pci_dev, "No activity detected.\n");
-		return;
-	}
-	for (i = 0; i < j; i++)
-		pci_info(zr->pci_dev, "%6d: %d => 0x%02x\n", change[i][0], change[i][1], change[i][2]);
-}
-
 /*
  * JPEG Codec access
  */
diff --git a/drivers/staging/media/zoran/zoran_device.h b/drivers/staging/media/zoran/zoran_device.h
index 24be19a61b6d..6c5d70238228 100644
--- a/drivers/staging/media/zoran/zoran_device.h
+++ b/drivers/staging/media/zoran/zoran_device.h
@@ -20,8 +20,6 @@ extern int post_office_wait(struct zoran *zr);
 extern int post_office_write(struct zoran *zr, unsigned int guest, unsigned int reg, unsigned int value);
 extern int post_office_read(struct zoran *zr, unsigned int guest, unsigned int reg);
 
-extern void detect_guest_activity(struct zoran *zr);
-
 extern void jpeg_codec_sleep(struct zoran *zr, int sleep);
 extern int jpeg_codec_reset(struct zoran *zr);
 
-- 
2.26.3


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

* [PATCH 2/5] staging: media: zoran: multiple assignments should be avoided
  2021-05-18 12:41 [PATCH 1/5] staging: media: zoran: remove detect_guest_activity Corentin Labbe
@ 2021-05-18 12:41 ` Corentin Labbe
  2021-05-18 12:41 ` [PATCH 3/5] staging: media: zoran: remove blank line Corentin Labbe
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Labbe @ 2021-05-18 12:41 UTC (permalink / raw)
  To: gregkh, mchehab
  Cc: linux-kernel, linux-media, linux-staging, mjpeg-users, Corentin Labbe

Remove all multiple assignments.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zoran_driver.c | 6 ++++--
 drivers/staging/media/zoran/zr36016.c      | 3 ++-
 drivers/staging/media/zoran/zr36050.c      | 3 ++-
 drivers/staging/media/zoran/zr36060.c      | 3 ++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c
index e8902f824d6c..46382e43f1bf 100644
--- a/drivers/staging/media/zoran/zoran_driver.c
+++ b/drivers/staging/media/zoran/zoran_driver.c
@@ -678,12 +678,14 @@ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selectio
 		sel->r.height = zr->jpg_settings.img_height;
 		break;
 	case V4L2_SEL_TGT_CROP_DEFAULT:
-		sel->r.top = sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.left = 0;
 		sel->r.width = BUZ_MIN_WIDTH;
 		sel->r.height = BUZ_MIN_HEIGHT;
 		break;
 	case V4L2_SEL_TGT_CROP_BOUNDS:
-		sel->r.top = sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.left = 0;
 		sel->r.width = BUZ_MAX_WIDTH;
 		sel->r.height = BUZ_MAX_HEIGHT;
 		break;
diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c
index 2d7dc7abde79..82702a13b05f 100644
--- a/drivers/staging/media/zoran/zr36016.c
+++ b/drivers/staging/media/zoran/zr36016.c
@@ -361,7 +361,8 @@ static int zr36016_setup(struct videocodec *codec)
 		return -ENOSPC;
 	}
 	//mem structure init
-	codec->data = ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL);
+	ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL);
+	codec->data = ptr;
 	if (!ptr)
 		return -ENOMEM;
 
diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
index 2826f4e5d37b..a78862852a47 100644
--- a/drivers/staging/media/zoran/zr36050.c
+++ b/drivers/staging/media/zoran/zr36050.c
@@ -754,7 +754,8 @@ static int zr36050_setup(struct videocodec *codec)
 		return -ENOSPC;
 	}
 	//mem structure init
-	codec->data = ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL);
+	ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL);
+	codec->data = ptr;
 	if (!ptr)
 		return -ENOMEM;
 
diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c
index 4f9eb9ff2c42..1c3af11b5f24 100644
--- a/drivers/staging/media/zoran/zr36060.c
+++ b/drivers/staging/media/zoran/zr36060.c
@@ -790,7 +790,8 @@ static int zr36060_setup(struct videocodec *codec)
 		return -ENOSPC;
 	}
 	//mem structure init
-	codec->data = ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
+	ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
+	codec->data = ptr;
 	if (!ptr)
 		return -ENOMEM;
 
-- 
2.26.3


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

* [PATCH 3/5] staging: media: zoran: remove blank line
  2021-05-18 12:41 [PATCH 1/5] staging: media: zoran: remove detect_guest_activity Corentin Labbe
  2021-05-18 12:41 ` [PATCH 2/5] staging: media: zoran: multiple assignments should be avoided Corentin Labbe
@ 2021-05-18 12:41 ` Corentin Labbe
  2021-05-18 12:41 ` [PATCH 4/5] staging: media: zoran: fix kzalloc style Corentin Labbe
  2021-05-18 12:41 ` [PATCH 5/5] staging: media: zoran: change asm header Corentin Labbe
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Labbe @ 2021-05-18 12:41 UTC (permalink / raw)
  To: gregkh, mchehab
  Cc: linux-kernel, linux-media, linux-staging, mjpeg-users, Corentin Labbe

Minor style fix by removing useless blank line.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zoran.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h
index e7fe8da7732c..b1ad2a2b914c 100644
--- a/drivers/staging/media/zoran/zoran.h
+++ b/drivers/staging/media/zoran/zoran.h
@@ -158,7 +158,6 @@ struct zoran_jpg_settings {
 	struct v4l2_jpegcompression jpg_comp;	/* JPEG-specific capture settings */
 };
 
-
 struct zoran;
 
 /* zoran_fh contains per-open() settings */
-- 
2.26.3


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

* [PATCH 4/5] staging: media: zoran: fix kzalloc style
  2021-05-18 12:41 [PATCH 1/5] staging: media: zoran: remove detect_guest_activity Corentin Labbe
  2021-05-18 12:41 ` [PATCH 2/5] staging: media: zoran: multiple assignments should be avoided Corentin Labbe
  2021-05-18 12:41 ` [PATCH 3/5] staging: media: zoran: remove blank line Corentin Labbe
@ 2021-05-18 12:41 ` Corentin Labbe
  2021-05-18 12:41 ` [PATCH 5/5] staging: media: zoran: change asm header Corentin Labbe
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Labbe @ 2021-05-18 12:41 UTC (permalink / raw)
  To: gregkh, mchehab
  Cc: linux-kernel, linux-media, linux-staging, mjpeg-users, Corentin Labbe

Prefer kzalloc(sizeof(*prt)...) over kzalloc(sizeof(struct.../

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zr36016.c | 2 +-
 drivers/staging/media/zoran/zr36050.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c
index 82702a13b05f..9b350a885879 100644
--- a/drivers/staging/media/zoran/zr36016.c
+++ b/drivers/staging/media/zoran/zr36016.c
@@ -361,7 +361,7 @@ static int zr36016_setup(struct videocodec *codec)
 		return -ENOSPC;
 	}
 	//mem structure init
-	ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL);
+	ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
 	codec->data = ptr;
 	if (!ptr)
 		return -ENOMEM;
diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
index a78862852a47..8bb101fa18bc 100644
--- a/drivers/staging/media/zoran/zr36050.c
+++ b/drivers/staging/media/zoran/zr36050.c
@@ -754,7 +754,7 @@ static int zr36050_setup(struct videocodec *codec)
 		return -ENOSPC;
 	}
 	//mem structure init
-	ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL);
+	ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
 	codec->data = ptr;
 	if (!ptr)
 		return -ENOMEM;
-- 
2.26.3


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

* [PATCH 5/5] staging: media: zoran: change asm header
  2021-05-18 12:41 [PATCH 1/5] staging: media: zoran: remove detect_guest_activity Corentin Labbe
                   ` (2 preceding siblings ...)
  2021-05-18 12:41 ` [PATCH 4/5] staging: media: zoran: fix kzalloc style Corentin Labbe
@ 2021-05-18 12:41 ` Corentin Labbe
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Labbe @ 2021-05-18 12:41 UTC (permalink / raw)
  To: gregkh, mchehab
  Cc: linux-kernel, linux-media, linux-staging, mjpeg-users, Corentin Labbe

As asked by checkpatch, convert a asm/xxx header to a linux one.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zr36050.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
index 8bb101fa18bc..c62af27f2683 100644
--- a/drivers/staging/media/zoran/zr36050.c
+++ b/drivers/staging/media/zoran/zr36050.c
@@ -16,7 +16,7 @@
 #include <linux/wait.h>
 
 /* I/O commands, error codes */
-#include <asm/io.h>
+#include <linux/io.h>
 
 /* headerfile of this module */
 #include "zr36050.h"
-- 
2.26.3


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

end of thread, other threads:[~2021-05-18 12:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 12:41 [PATCH 1/5] staging: media: zoran: remove detect_guest_activity Corentin Labbe
2021-05-18 12:41 ` [PATCH 2/5] staging: media: zoran: multiple assignments should be avoided Corentin Labbe
2021-05-18 12:41 ` [PATCH 3/5] staging: media: zoran: remove blank line Corentin Labbe
2021-05-18 12:41 ` [PATCH 4/5] staging: media: zoran: fix kzalloc style Corentin Labbe
2021-05-18 12:41 ` [PATCH 5/5] staging: media: zoran: change asm header Corentin Labbe

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).