Commit 5e195bbd authored by Corentin Labbe's avatar Corentin Labbe Committed by Mauro Carvalho Chehab
Browse files

media: zoran: fix checkpatch issue



Fix a lot of style issue found by checkpatch.

Signed-off-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 874edaa5
Loading
Loading
Loading
Loading
+34 −82
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-or-later
/*
/*
 * VIDEO MOTION CODECs internal API for video devices
 * VIDEO MOTION CODECs internal API for video devices
 *
 *
@@ -5,22 +6,6 @@
 * bound to a master device.
 * bound to a master device.
 *
 *
 * (c) 2002 Wolfgang Scherr <scherr@net4you.at>
 * (c) 2002 Wolfgang Scherr <scherr@net4you.at>
 *
 * $Id: videocodec.c,v 1.1.2.8 2003/03/29 07:16:04 rbultje Exp $
 *
 * ------------------------------------------------------------------------
 *
 * 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.
 *
 * ------------------------------------------------------------------------
 */
 */


#define VIDEOCODEC_VERSION "v0.2"
#define VIDEOCODEC_VERSION "v0.2"
@@ -69,8 +54,7 @@ static struct codec_list *codeclist_top;
/* function prototypes of the master/slave interface */
/* function prototypes of the master/slave interface */
/* ================================================= */
/* ================================================= */


struct videocodec *
struct videocodec *videocodec_attach(struct videocodec_master *master)
videocodec_attach (struct videocodec_master *master)
{
{
	struct codec_list *h = codeclist_top;
	struct codec_list *h = codeclist_top;
	struct attached_list *a, *ptr;
	struct attached_list *a, *ptr;
@@ -82,8 +66,7 @@ videocodec_attach (struct videocodec_master *master)
		return NULL;
		return NULL;
	}
	}


	dprintk(2,
	dprintk(2, "%s: '%s', flags %lx, magic %lx\n", __func__,
		"videocodec_attach: '%s', flags %lx, magic %lx\n",
		master->name, master->flags, master->magic);
		master->name, master->flags, master->magic);


	if (!h) {
	if (!h) {
@@ -97,50 +80,35 @@ videocodec_attach (struct videocodec_master *master)
		// attach only if the slave has at least the flags
		// attach only if the slave has at least the flags
		// expected by the master
		// expected by the master
		if ((master->flags & h->codec->flags) == master->flags) {
		if ((master->flags & h->codec->flags) == master->flags) {
			dprintk(4, "videocodec_attach: try '%s'\n",
			dprintk(4, "%s: try '%s'\n", __func__, h->codec->name);
				h->codec->name);


			if (!try_module_get(h->codec->owner))
			if (!try_module_get(h->codec->owner))
				return NULL;
				return NULL;


			codec = kmemdup(h->codec, sizeof(struct videocodec),
			codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL);
					GFP_KERNEL);
			if (!codec)
			if (!codec) {
				dprintk(1,
					KERN_ERR
					"videocodec_attach: no mem\n");
				goto out_module_put;
				goto out_module_put;
			}


			res = strlen(codec->name);
			res = strlen(codec->name);
			snprintf(codec->name + res, sizeof(codec->name) - res,
			snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached);
				 "[%d]", h->attached);
			codec->master_data = master;
			codec->master_data = master;
			res = codec->setup(codec);
			res = codec->setup(codec);
			if (res == 0) {
			if (res == 0) {
				dprintk(3, "videocodec_attach '%s'\n",
				dprintk(3, "%s: '%s'\n", __func__, codec->name);
					codec->name);
				ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
				ptr = kzalloc(sizeof(struct attached_list), GFP_KERNEL);
				if (!ptr)
				if (!ptr) {
					dprintk(1,
						KERN_ERR
						"videocodec_attach: no memory\n");
					goto out_kfree;
					goto out_kfree;
				}
				ptr->codec = codec;
				ptr->codec = codec;


				a = h->list;
				a = h->list;
				if (!a) {
				if (!a) {
					h->list = ptr;
					h->list = ptr;
					dprintk(4,
					dprintk(4, "videocodec: first element\n");
						"videocodec: first element\n");
				} else {
				} else {
					while (a->next)
					while (a->next)
						a = a->next;	// find end
						a = a->next;	// find end
					a->next = ptr;
					a->next = ptr;
					dprintk(4,
					dprintk(4, "videocodec: in after '%s'\n", h->codec->name);
						"videocodec: in after '%s'\n",
						h->codec->name);
				}
				}


				h->attached += 1;
				h->attached += 1;
@@ -161,9 +129,9 @@ videocodec_attach (struct videocodec_master *master)
	kfree(codec);
	kfree(codec);
	return NULL;
	return NULL;
}
}
EXPORT_SYMBOL(videocodec_attach);


int
int videocodec_detach(struct videocodec *codec)
videocodec_detach (struct videocodec *codec)
{
{
	struct codec_list *h = codeclist_top;
	struct codec_list *h = codeclist_top;
	struct attached_list *a, *prev;
	struct attached_list *a, *prev;
@@ -174,8 +142,7 @@ videocodec_detach (struct videocodec *codec)
		return -EINVAL;
		return -EINVAL;
	}
	}


	dprintk(2,
	dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__,
		"videocodec_detach: '%s', type: %x, flags %lx, magic %lx\n",
		codec->name, codec->type, codec->flags, codec->magic);
		codec->name, codec->type, codec->flags, codec->magic);


	if (!h) {
	if (!h) {
@@ -191,9 +158,7 @@ videocodec_detach (struct videocodec *codec)
			if (codec == a->codec) {
			if (codec == a->codec) {
				res = a->codec->unset(a->codec);
				res = a->codec->unset(a->codec);
				if (res >= 0) {
				if (res >= 0) {
					dprintk(3,
					dprintk(3, "%s: '%s'\n", __func__, a->codec->name);
						"videocodec_detach: '%s'\n",
						a->codec->name);
					a->codec->master_data = NULL;
					a->codec->master_data = NULL;
				} else {
				} else {
					dprintk(1,
					dprintk(1,
@@ -202,14 +167,12 @@ videocodec_detach (struct videocodec *codec)
						a->codec->name);
						a->codec->name);
					a->codec->master_data = NULL;
					a->codec->master_data = NULL;
				}
				}
				if (prev == NULL) {
				if (!prev) {
					h->list = a->next;
					h->list = a->next;
					dprintk(4,
					dprintk(4, "videocodec: delete first\n");
						"videocodec: delete first\n");
				} else {
				} else {
					prev->next = a->next;
					prev->next = a->next;
					dprintk(4,
					dprintk(4, "videocodec: delete middle\n");
						"videocodec: delete middle\n");
				}
				}
				module_put(a->codec->owner);
				module_put(a->codec->owner);
				kfree(a->codec);
				kfree(a->codec);
@@ -226,9 +189,9 @@ videocodec_detach (struct videocodec *codec)
	dprintk(1, KERN_ERR "videocodec_detach: given codec not found!\n");
	dprintk(1, KERN_ERR "videocodec_detach: given codec not found!\n");
	return -EINVAL;
	return -EINVAL;
}
}
EXPORT_SYMBOL(videocodec_detach);


int
int videocodec_register(const struct videocodec *codec)
videocodec_register (const struct videocodec *codec)
{
{
	struct codec_list *ptr, *h = codeclist_top;
	struct codec_list *ptr, *h = codeclist_top;


@@ -241,11 +204,9 @@ videocodec_register (const struct videocodec *codec)
		"videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
		"videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
		codec->name, codec->type, codec->flags, codec->magic);
		codec->name, codec->type, codec->flags, codec->magic);


	ptr = kzalloc(sizeof(struct codec_list), GFP_KERNEL);
	ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
	if (!ptr) {
	if (!ptr)
		dprintk(1, KERN_ERR "videocodec_register: no memory\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	ptr->codec = codec;
	ptr->codec = codec;


	if (!h) {
	if (!h) {
@@ -261,9 +222,9 @@ videocodec_register (const struct videocodec *codec)


	return 0;
	return 0;
}
}
EXPORT_SYMBOL(videocodec_register);


int
int videocodec_unregister(const struct videocodec *codec)
videocodec_unregister (const struct videocodec *codec)
{
{
	struct codec_list *prev = NULL, *h = codeclist_top;
	struct codec_list *prev = NULL, *h = codeclist_top;


@@ -294,7 +255,7 @@ videocodec_unregister (const struct videocodec *codec)
			}
			}
			dprintk(3, "videocodec: unregister '%s' is ok.\n",
			dprintk(3, "videocodec: unregister '%s' is ok.\n",
				h->codec->name);
				h->codec->name);
			if (prev == NULL) {
			if (!prev) {
				codeclist_top = h->next;
				codeclist_top = h->next;
				dprintk(4,
				dprintk(4,
					"videocodec: delete first element\n");
					"videocodec: delete first element\n");
@@ -315,6 +276,7 @@ videocodec_unregister (const struct videocodec *codec)
		"videocodec_unregister: given codec not found!\n");
		"videocodec_unregister: given codec not found!\n");
	return -EINVAL;
	return -EINVAL;
}
}
EXPORT_SYMBOL(videocodec_unregister);


#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
static int proc_videocodecs_show(struct seq_file *m, void *v)
static int proc_videocodecs_show(struct seq_file *m, void *v)
@@ -349,39 +311,29 @@ static int proc_videocodecs_show(struct seq_file *m, void *v)
/* ===================== */
/* ===================== */
/* hook in driver module */
/* hook in driver module */
/* ===================== */
/* ===================== */
static int __init
static int __init videocodec_init(void)
videocodec_init (void)
{
{
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
	static struct proc_dir_entry *videocodec_proc_entry;
	static struct proc_dir_entry *videocodec_proc_entry;
#endif
#endif


	printk(KERN_INFO "Linux video codec intermediate layer: %s\n",
	pr_info("Linux video codec intermediate layer: %s\n", VIDEOCODEC_VERSION);
	       VIDEOCODEC_VERSION);


#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
	videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL,
	videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL, proc_videocodecs_show);
			proc_videocodecs_show);
	if (!videocodec_proc_entry)
	if (!videocodec_proc_entry) {
		dprintk(1, KERN_ERR "videocodec: can't init procfs.\n");
		dprintk(1, KERN_ERR "videocodec: can't init procfs.\n");
	}
#endif
#endif
	return 0;
	return 0;
}
}


static void __exit
static void __exit videocodec_exit(void)
videocodec_exit (void)
{
{
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
	remove_proc_entry("videocodecs", NULL);
	remove_proc_entry("videocodecs", NULL);
#endif
#endif
}
}


EXPORT_SYMBOL(videocodec_attach);
EXPORT_SYMBOL(videocodec_detach);
EXPORT_SYMBOL(videocodec_register);
EXPORT_SYMBOL(videocodec_unregister);

module_init(videocodec_init);
module_init(videocodec_init);
module_exit(videocodec_exit);
module_exit(videocodec_exit);


+17 −58
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
/*
 * VIDEO MOTION CODECs internal API for video devices
 * VIDEO MOTION CODECs internal API for video devices
 *
 *
@@ -5,22 +6,6 @@
 * bound to a master device.
 * bound to a master device.
 *
 *
 * (c) 2002 Wolfgang Scherr <scherr@net4you.at>
 * (c) 2002 Wolfgang Scherr <scherr@net4you.at>
 *
 * $Id: videocodec.h,v 1.1.2.4 2003/01/14 21:15:03 rbultje Exp $
 *
 * ------------------------------------------------------------------------
 *
 * 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.
 *
 * ------------------------------------------------------------------------
 */
 */


/* =================== */
/* =================== */
@@ -64,7 +49,6 @@
   device dependent and vary between MJPEG/MPEG/WAVELET/... devices. (!!!!)
   device dependent and vary between MJPEG/MPEG/WAVELET/... devices. (!!!!)
   ----------------------------------------------------------------------------
   ----------------------------------------------------------------------------
*/
*/



/* ========================================== */
/* ========================================== */
/* description of the videocodec_io structure */
/* description of the videocodec_io structure */
@@ -111,7 +95,7 @@
		the calls include frame numbers and flags (even/odd/...)
		the calls include frame numbers and flags (even/odd/...)
		if needed and a flag which allows blocking until its ready
		if needed and a flag which allows blocking until its ready
*/
*/


/* ============== */
/* ============== */
/* user interface */
/* user interface */
/* ============== */
/* ============== */
@@ -131,7 +115,6 @@ M zr36055[0] 0001 0000c001 00000000 (zr36050[0])
M                       zr36055[1] 0001 0000c001 00000000 (zr36050[1])
M                       zr36055[1] 0001 0000c001 00000000 (zr36050[1])


*/
*/



/* =============================================== */
/* =============================================== */
/* special defines for the videocodec_io structure */
/* special defines for the videocodec_io structure */
@@ -210,7 +193,6 @@ M zr36055[1] 0001 0000c001 00000000 (zr36050[1])
/*  -> used in get_image, put_image */
/*  -> used in get_image, put_image */
#define CODEC_TRANSFER_KERNEL 0	/* use "memcopy" */
#define CODEC_TRANSFER_KERNEL 0	/* use "memcopy" */
#define CODEC_TRANSFER_USER   1	/* use "to/from_user" */
#define CODEC_TRANSFER_USER   1	/* use "to/from_user" */



/* ========================= */
/* ========================= */
/* the structures itself ... */
/* the structures itself ... */
@@ -272,41 +254,22 @@ struct videocodec {


	/* main functions, every client needs them for sure! */
	/* main functions, every client needs them for sure! */
	// set compression or decompression (or freeze, stop, standby, etc)
	// set compression or decompression (or freeze, stop, standby, etc)
	int (*set_mode) (struct videocodec * codec,
	int (*set_mode)(struct videocodec *codec, int mode);
			 int mode);
	// setup picture size and norm (for the codec's video frontend)
	// setup picture size and norm (for the codec's video frontend)
	int (*set_video) (struct videocodec * codec,
	int (*set_video)(struct videocodec *codec, struct tvnorm *norm,
			  struct tvnorm * norm,
			 struct vfe_settings *cap, struct vfe_polarity *pol);
			  struct vfe_settings * cap,
			  struct vfe_polarity * pol);
	// other control commands, also mmap setup etc.
	// other control commands, also mmap setup etc.
	int (*control) (struct videocodec * codec,
	int (*control)(struct videocodec *codec, int type, int size, void *data);
			int type,
			int size,
			void *data);


	/* additional setup/query/processing (may be NULL pointer) */
	/* additional setup/query/processing (may be NULL pointer) */
	// interrupt setup / handling (for irq's delivered by master)
	// interrupt setup / handling (for irq's delivered by master)
	int (*setup_interrupt) (struct videocodec * codec,
	int (*setup_interrupt)(struct videocodec *codec, long mode);
				long mode);
	int (*handle_interrupt)(struct videocodec *codec, int source, long flag);
	int (*handle_interrupt) (struct videocodec * codec,
				 int source,
				 long flag);
	// picture interface (if any)
	// picture interface (if any)
	long (*put_image) (struct videocodec * codec,
	long (*put_image)(struct videocodec *codec, int tr_type, int block,
			   int tr_type,
			  long *fr_num, long *flag, long size, void *buf);
			   int block,
	long (*get_image)(struct videocodec *codec, int tr_type, int block,
			   long *fr_num,
			  long *fr_num, long *flag, long size, void *buf);
			   long *flag,
			   long size,
			   void *buf);
	long (*get_image) (struct videocodec * codec,
			   int tr_type,
			   int block,
			   long *fr_num,
			   long *flag,
			   long size,
			   void *buf);
};
};


struct videocodec_master {
struct videocodec_master {
@@ -318,13 +281,9 @@ struct videocodec_master {


	void *data;		/* private master data */
	void *data;		/* private master data */


	 __u32(*readreg) (struct videocodec * codec,
	__u32 (*readreg)(struct videocodec *codec, __u16 reg);
			  __u16 reg);
	void (*writereg)(struct videocodec *codec, __u16 reg, __u32 value);
	void (*writereg) (struct videocodec * codec,
			  __u16 reg,
			  __u32 value);
};
};



/* ================================================= */
/* ================================================= */
/* function prototypes of the master/slave interface */
/* function prototypes of the master/slave interface */
+22 −30
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
/*
 * zoran - Iomega Buz driver
 * zoran - Iomega Buz driver
 *
 *
@@ -12,16 +13,6 @@
 * bttv - Bt848 frame grabber driver
 * bttv - Bt848 frame grabber driver
 * Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@thp.uni-koeln.de)
 * Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@thp.uni-koeln.de)
 *                        & Marcus Metzler (mocm@thp.uni-koeln.de)
 *                        & Marcus Metzler (mocm@thp.uni-koeln.de)
 *
 * 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.
 */
 */


#ifndef _BUZ_H_
#ifndef _BUZ_H_
@@ -141,11 +132,12 @@ struct zoran_format {
	__u32 flags;
	__u32 flags;
	__u32 vfespfr;
	__u32 vfespfr;
};
};

/* flags */
/* flags */
#define ZORAN_FORMAT_COMPRESSED 1<<0
#define ZORAN_FORMAT_COMPRESSED BIT(0)
#define ZORAN_FORMAT_OVERLAY    1<<1
#define ZORAN_FORMAT_OVERLAY BIT(1)
#define ZORAN_FORMAT_CAPTURE	1<<2
#define ZORAN_FORMAT_CAPTURE BIT(2)
#define ZORAN_FORMAT_PLAYBACK	1<<3
#define ZORAN_FORMAT_PLAYBACK BIT(3)


/* overlay-settings */
/* overlay-settings */
struct zoran_overlay_settings {
struct zoran_overlay_settings {
Loading