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 Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * VIDEO MOTION CODECs internal API for video devices
 *
@@ -5,22 +6,6 @@
 * bound to a master device.
 *
 * (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"
@@ -69,8 +54,7 @@ static struct codec_list *codeclist_top;
/* function prototypes of the master/slave interface */
/* ================================================= */

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

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

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

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

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

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

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

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

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

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

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

int
videocodec_register (const struct videocodec *codec)
int videocodec_register(const struct videocodec *codec)
{
	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",
		codec->name, codec->type, codec->flags, codec->magic);

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

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

	return 0;
}
EXPORT_SYMBOL(videocodec_register);

int
videocodec_unregister (const struct videocodec *codec)
int videocodec_unregister(const struct videocodec *codec)
{
	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",
				h->codec->name);
			if (prev == NULL) {
			if (!prev) {
				codeclist_top = h->next;
				dprintk(4,
					"videocodec: delete first element\n");
@@ -315,6 +276,7 @@ videocodec_unregister (const struct videocodec *codec)
		"videocodec_unregister: given codec not found!\n");
	return -EINVAL;
}
EXPORT_SYMBOL(videocodec_unregister);

#ifdef CONFIG_PROC_FS
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 */
/* ===================== */
static int __init
videocodec_init (void)
static int __init videocodec_init(void)
{
#ifdef CONFIG_PROC_FS
	static struct proc_dir_entry *videocodec_proc_entry;
#endif

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

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

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

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

module_init(videocodec_init);
module_exit(videocodec_exit);

+17 −58
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * VIDEO MOTION CODECs internal API for video devices
 *
@@ -5,22 +6,6 @@
 * bound to a master device.
 *
 * (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. (!!!!)
   ----------------------------------------------------------------------------
*/


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

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

*/


/* =============================================== */
/* 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 */
#define CODEC_TRANSFER_KERNEL 0	/* use "memcopy" */
#define CODEC_TRANSFER_USER   1	/* use "to/from_user" */


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

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

	/* additional setup/query/processing (may be NULL pointer) */
	// interrupt setup / handling (for irq's delivered by master)
	int (*setup_interrupt) (struct videocodec * codec,
				long mode);
	int (*handle_interrupt) (struct videocodec * codec,
				 int source,
				 long flag);
	int (*setup_interrupt)(struct videocodec *codec, long mode);
	int (*handle_interrupt)(struct videocodec *codec, int source, long flag);
	// picture interface (if any)
	long (*put_image) (struct videocodec * codec,
			   int tr_type,
			   int block,
			   long *fr_num,
			   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);
	long (*put_image)(struct videocodec *codec, int tr_type, int block,
			  long *fr_num, 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 {
@@ -318,13 +281,9 @@ struct videocodec_master {

	void *data;		/* private master data */

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

/* ================================================= */
/* function prototypes of the master/slave interface */
+22 −30
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * zoran - Iomega Buz driver
 *
@@ -12,16 +13,6 @@
 * bttv - Bt848 frame grabber driver
 * Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@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_
@@ -141,11 +132,12 @@ struct zoran_format {
	__u32 flags;
	__u32 vfespfr;
};

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

/* overlay-settings */
struct zoran_overlay_settings {
+124 −195

File changed.

Preview size limit exceeded, changes collapsed.

+1 −10
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Zoran zr36057/zr36067 PCI controller driver, for the
 * Pinnacle/Miro DC10/DC10+/DC30/DC30+, Iomega Buz, Linux
@@ -6,16 +7,6 @@
 * This part handles card-specific data and detection
 *
 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
 *
 * 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 __ZORAN_CARD_H__
Loading