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

media: zoran: convert all error dprintk to pci_err/pr_err



This patch converts all errors dprintk to pci_err/pr_err.

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 c6389136
Loading
Loading
Loading
Loading
+13 −26
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
	int res;

	if (!master) {
		dprintk(1, KERN_ERR "videocodec_attach: no data\n");
		pr_err("%s: no data\n", __func__);
		return NULL;
	}

@@ -70,9 +70,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
		master->name, master->flags, master->magic);

	if (!h) {
		dprintk(1,
			KERN_ERR
			"videocodec_attach: no device available\n");
		pr_err("%s: no device available\n", __func__);
		return NULL;
	}

@@ -120,7 +118,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
		h = h->next;
	}

	dprintk(1, KERN_ERR "videocodec_attach: no codec found!\n");
	pr_err("%s: no codec found!\n", __func__);
	return NULL;

 out_module_put:
@@ -138,7 +136,7 @@ int videocodec_detach(struct videocodec *codec)
	int res;

	if (!codec) {
		dprintk(1, KERN_ERR "videocodec_detach: no data\n");
		pr_err("%s: no data\n", __func__);
		return -EINVAL;
	}

@@ -146,8 +144,7 @@ int videocodec_detach(struct videocodec *codec)
		codec->name, codec->type, codec->flags, codec->magic);

	if (!h) {
		dprintk(1,
			KERN_ERR "videocodec_detach: no device left...\n");
		pr_err("%s: no device left...\n", __func__);
		return -ENXIO;
	}

@@ -161,10 +158,7 @@ int videocodec_detach(struct videocodec *codec)
					dprintk(3, "%s: '%s'\n", __func__, a->codec->name);
					a->codec->master_data = NULL;
				} else {
					dprintk(1,
						KERN_ERR
						"videocodec_detach: '%s'\n",
						a->codec->name);
					pr_err("%s: '%s'\n", __func__, a->codec->name);
					a->codec->master_data = NULL;
				}
				if (!prev) {
@@ -186,7 +180,7 @@ int videocodec_detach(struct videocodec *codec)
		h = h->next;
	}

	dprintk(1, KERN_ERR "videocodec_detach: given codec not found!\n");
	pr_err("%s: given codec not found!\n", __func__);
	return -EINVAL;
}
EXPORT_SYMBOL(videocodec_detach);
@@ -196,7 +190,7 @@ int videocodec_register(const struct videocodec *codec)
	struct codec_list *ptr, *h = codeclist_top;

	if (!codec) {
		dprintk(1, KERN_ERR "videocodec_register: no data!\n");
		pr_err("%s: no data!\n", __func__);
		return -EINVAL;
	}

@@ -229,7 +223,7 @@ int videocodec_unregister(const struct videocodec *codec)
	struct codec_list *prev = NULL, *h = codeclist_top;

	if (!codec) {
		dprintk(1, KERN_ERR "videocodec_unregister: no data!\n");
		pr_err("%s: no data!\n", __func__);
		return -EINVAL;
	}

@@ -238,19 +232,14 @@ int videocodec_unregister(const struct videocodec *codec)
		codec->name, codec->type, codec->flags, codec->magic);

	if (!h) {
		dprintk(1,
			KERN_ERR
			"videocodec_unregister: no device left...\n");
		pr_err("%s: no device left...\n", __func__);
		return -ENXIO;
	}

	while (h) {
		if (codec == h->codec) {
			if (h->attached) {
				dprintk(1,
					KERN_ERR
					"videocodec: '%s' is used\n",
					h->codec->name);
				pr_err("videocodec: '%s' is used\n", h->codec->name);
				return -EBUSY;
			}
			dprintk(3, "videocodec: unregister '%s' is ok.\n",
@@ -271,9 +260,7 @@ int videocodec_unregister(const struct videocodec *codec)
		h = h->next;
	}

	dprintk(1,
		KERN_ERR
		"videocodec_unregister: given codec not found!\n");
	pr_err("%s: given codec not found!\n", __func__);
	return -EINVAL;
}
EXPORT_SYMBOL(videocodec_unregister);
@@ -322,7 +309,7 @@ static int __init videocodec_init(void)
#ifdef CONFIG_PROC_FS
	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");
		pr_err("videocodec: can't init procfs.\n");
#endif
	return 0;
}
+25 −71
Original line number Diff line number Diff line
@@ -787,18 +787,13 @@ int zoran_check_jpg_settings(struct zoran *zr,
		}

		if (!try && err0) {
			dprintk(1,
				KERN_ERR
				"%s: %s - error in params for decimation = 0\n",
				ZR_DEVNAME(zr), __func__);
			pci_err(zr->pci_dev, "%s - error in params for decimation = 0\n", __func__);
			err++;
		}
		break;
	default:
		dprintk(1,
			KERN_ERR
			"%s: %s - decimation = %d, must be 0, 1, 2 or 4\n",
			ZR_DEVNAME(zr), __func__, settings->decimation);
		pci_err(zr->pci_dev, "%s - decimation = %d, must be 0, 1, 2 or 4\n",
			__func__, settings->decimation);
		err++;
		break;
	}
@@ -875,8 +870,7 @@ void zoran_open_init_params(struct zoran *zr)
	    V4L2_JPEG_MARKER_DHT | V4L2_JPEG_MARKER_DQT;
	i = zoran_check_jpg_settings(zr, &zr->jpg_settings, 0);
	if (i)
		dprintk(1, KERN_ERR "%s: %s internal error\n",
			ZR_DEVNAME(zr), __func__);
		pci_err(zr->pci_dev, "%s internal error\n", __func__);

	clear_interrupt_counters(zr);
	zr->testing = 0;
@@ -968,10 +962,6 @@ static int zr36057_init(struct zoran *zr)
	zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL);
	zr->video_dev = video_device_alloc();
	if (!zr->stat_com || !zr->video_dev) {
		dprintk(1,
			KERN_ERR
			"%s: %s - kmalloc (STAT_COM) failed\n",
			ZR_DEVNAME(zr), __func__);
		err = -ENOMEM;
		goto exit_free;
	}
@@ -1132,8 +1122,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

	nr = zoran_num++;
	if (nr >= BUZ_MAX) {
		dprintk(1, KERN_ERR "%s: driver limited to %d card(s) maximum\n",
			ZORAN_NAME, BUZ_MAX);
		pci_err(pdev, "driver limited to %d card(s) maximum\n", BUZ_MAX);
		return -ENOENT;
	}

@@ -1172,23 +1161,14 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	/* Use auto-detected card type? */
	if (card[nr] == -1) {
		if (zr->revision < 2) {
			dprintk(1,
				KERN_ERR
				"%s: No card type specified, please use the card=X module parameter\n",
				ZR_DEVNAME(zr));
			dprintk(1,
				KERN_ERR
				"%s: It is not possible to auto-detect ZR36057 based cards\n",
				ZR_DEVNAME(zr));
			pci_err(pdev, "No card type specified, please use the card=X module parameter\n");
			pci_err(pdev, "It is not possible to auto-detect ZR36057 based cards\n");
			goto zr_unreg;
		}

		card_num = ent->driver_data;
		if (card_num >= NUM_CARDS) {
			dprintk(1,
				KERN_ERR
				"%s: Unknown card, try specifying card=X module parameter\n",
				ZR_DEVNAME(zr));
			pci_err(pdev, "Unknown card, try specifying card=X module parameter\n");
			goto zr_unreg;
		}
		dprintk(3,
@@ -1198,10 +1178,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	} else {
		card_num = card[nr];
		if (card_num >= NUM_CARDS || card_num < 0) {
			dprintk(1,
				KERN_ERR
				"%s: User specified card type %d out of range (0 .. %d)\n",
				ZR_DEVNAME(zr), card_num, NUM_CARDS - 1);
			pci_err(pdev, "User specified card type %d out of range (0 .. %d)\n",
				card_num, NUM_CARDS - 1);
			goto zr_unreg;
		}
	}
@@ -1219,8 +1197,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

	zr->zr36057_mem = pci_ioremap_bar(zr->pci_dev, 0);
	if (!zr->zr36057_mem) {
		dprintk(1, KERN_ERR "%s: %s() - ioremap failed\n",
			ZR_DEVNAME(zr), __func__);
		pci_err(pdev, "%s() - ioremap failed\n", __func__);
		goto zr_unreg;
	}

@@ -1228,20 +1205,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
			     IRQF_SHARED, ZR_DEVNAME(zr), zr);
	if (result < 0) {
		if (result == -EINVAL) {
			dprintk(1,
				KERN_ERR
				"%s: %s - bad irq number or handler\n",
				ZR_DEVNAME(zr), __func__);
			pci_err(pdev, "%s - bad IRQ number or handler\n", __func__);
		} else if (result == -EBUSY) {
			dprintk(1,
				KERN_ERR
				"%s: %s - IRQ %d busy, change your PnP config in BIOS\n",
				ZR_DEVNAME(zr), __func__, zr->pci_dev->irq);
			pci_err(pdev, "%s - IRQ %d busy, change your PnP config in BIOS\n",
				__func__, zr->pci_dev->irq);
		} else {
			dprintk(1,
				KERN_ERR
				"%s: %s - can't assign irq, error code %d\n",
				ZR_DEVNAME(zr), __func__, result);
			pci_err(pdev, "%s - cannot assign IRQ, error code %d\n", __func__, result);
		}
		goto zr_unmap;
	}
@@ -1261,8 +1230,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	dprintk(2, KERN_INFO "%s: Initializing i2c bus...\n", ZR_DEVNAME(zr));

	if (zoran_register_i2c(zr) < 0) {
		dprintk(1, KERN_ERR "%s: %s - can't initialize i2c bus\n",
			ZR_DEVNAME(zr), __func__);
		pci_err(pdev, "%s - can't initialize i2c bus\n", __func__);
		goto zr_free_irq;
	}

@@ -1281,24 +1249,16 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
		codec_name = codecid_to_modulename(zr->card.video_codec);
		if (codec_name) {
			result = request_module(codec_name);
			if (result) {
				dprintk(1,
					KERN_ERR
					"%s: failed to load modules %s: %d\n",
					ZR_DEVNAME(zr), codec_name, result);
			}
			if (result)
				pci_err(pdev, "failed to load modules %s: %d\n", codec_name, result);
		}
	}
	if (zr->card.video_vfe) {
		vfe_name = codecid_to_modulename(zr->card.video_vfe);
		if (vfe_name) {
			result = request_module(vfe_name);
			if (result < 0) {
				dprintk(1,
					KERN_ERR
					"%s: failed to load modules %s: %d\n",
					ZR_DEVNAME(zr), vfe_name, result);
			}
			if (result < 0)
				pci_err(pdev, "failed to load modules %s: %d\n", vfe_name, result);
		}
	}

@@ -1313,13 +1273,11 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
			goto zr_unreg_i2c;
		zr->codec = videocodec_attach(master_codec);
		if (!zr->codec) {
			dprintk(1, KERN_ERR "%s: %s - no codec found\n",
				ZR_DEVNAME(zr), __func__);
			pci_err(pdev, "%s - no codec found\n", __func__);
			goto zr_free_codec;
		}
		if (zr->codec->type != zr->card.video_codec) {
			dprintk(1, KERN_ERR "%s: %s - wrong codec\n",
				ZR_DEVNAME(zr), __func__);
			pci_err(pdev, "%s - wrong codec\n", __func__);
			goto zr_detach_codec;
		}
	}
@@ -1329,13 +1287,11 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
			goto zr_detach_codec;
		zr->vfe = videocodec_attach(master_vfe);
		if (!zr->vfe) {
			dprintk(1, KERN_ERR "%s: %s - no VFE found\n",
				ZR_DEVNAME(zr), __func__);
			pci_err(pdev, "%s - no VFE found\n", __func__);
			goto zr_free_vfe;
		}
		if (zr->vfe->type != zr->card.video_vfe) {
			dprintk(1, KERN_ERR "%s: %s = wrong VFE\n",
				ZR_DEVNAME(zr), __func__);
			pci_err(pdev, "%s = wrong VFE\n", __func__);
			goto zr_detach_vfe;
		}
	}
@@ -1430,9 +1386,7 @@ static int __init zoran_init(void)

	res = pci_register_driver(&zoran_driver);
	if (res) {
		dprintk(1,
			KERN_ERR
			"%s: Unable to register ZR36057 driver\n", ZORAN_NAME);
		pr_err("Unable to register ZR36057 driver\n");
		return res;
	}

+8 −20
Original line number Diff line number Diff line
@@ -315,8 +315,7 @@ static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height,
	if (video_width < BUZ_MIN_WIDTH ||
	    video_height < BUZ_MIN_HEIGHT ||
	    video_width > Wa || video_height > Ha) {
		dprintk(1, KERN_ERR "%s: set_vfe: w=%d h=%d not valid\n",
			ZR_DEVNAME(zr), video_width, video_height);
		pci_err(zr->pci_dev, "set_vfe: w=%d h=%d not valid\n", video_width, video_height);
		return;
	}

@@ -451,10 +450,7 @@ void zr36057_overlay(struct zoran *zr, int on)
		    zr->vbuf_bytesperline;
		btwrite(reg, ZR36057_VDTR);
		if (reg & 3)
			dprintk(1,
				KERN_ERR
				"%s: zr36057_overlay() - video_address not aligned\n",
				ZR_DEVNAME(zr));
			pci_err(zr->pci_dev, "zr36057_overlay() - video_address not aligned\n");
		if (zr->overlay_settings.height > BUZ_MAX_HEIGHT / 2)
			reg += zr->vbuf_bytesperline;
		btwrite(reg, ZR36057_VDBR);
@@ -466,10 +462,7 @@ void zr36057_overlay(struct zoran *zr, int on)
		if (zr->overlay_settings.height > BUZ_MAX_HEIGHT / 2)
			reg += zr->vbuf_bytesperline;
		if (reg & 3)
			dprintk(1,
				KERN_ERR
				"%s: zr36057_overlay() - video_stride not aligned\n",
				ZR_DEVNAME(zr));
			pci_err(zr->pci_dev, "zr36057_overlay() - video_stride not aligned\n");
		reg = (reg << ZR36057_VSSFGR_DispStride);
		reg |= ZR36057_VSSFGR_VidOvf;	/* clear overflow status */
		btwrite(reg, ZR36057_VSSFGR);
@@ -1203,8 +1196,8 @@ static void error_handler(struct zoran *zr, u32 astat, u32 stat)
		int j;

		frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
		pr_err("%s: JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ",
			ZR_DEVNAME(zr), stat, zr->last_isr,
		pci_err(zr->pci_dev, "JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ",
			stat, zr->last_isr,
			zr->jpg_que_tail, zr->jpg_dma_tail,
			zr->jpg_dma_head, zr->jpg_que_head,
			zr->jpg_seq_num, frame);
@@ -1272,10 +1265,8 @@ irqreturn_t zoran_irq(int irq, void *dev_id)
		while ((stat = count_reset_interrupt(zr))) {
			if (count++ > 100) {
				btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR);
				dprintk(1,
					KERN_ERR
					"%s: IRQ lockup while testing, isr=0x%08x, cleared int mask\n",
					ZR_DEVNAME(zr), stat);
				pci_err(zr->pci_dev, "IRQ lockup while testing, isr=0x%08x, cleared int mask\n",
					stat);
				wake_up_interruptible(&zr->test_q);
			}
		}
@@ -1435,10 +1426,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id)
				ZR_DEVNAME(zr), count);
			if (count > 20) {
				btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR);
				dprintk(2,
					KERN_ERR
					"%s: IRQ lockup, cleared int mask\n",
					ZR_DEVNAME(zr));
				pci_err(zr->pci_dev, "IRQ lockup, cleared int mask\n");
				break;
			}
		}
+78 −256

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/printk.h>
#include <linux/vmalloc.h>

#include <linux/proc_fs.h>
@@ -192,8 +193,7 @@ int zoran_proc_init(struct zoran *zr)
			"%s: procfs entry /proc/%s allocated. data=%p\n",
			ZR_DEVNAME(zr), name, zr);
	} else {
		dprintk(1, KERN_ERR "%s: Unable to initialise /proc/%s\n",
			ZR_DEVNAME(zr), name);
		pr_err("%s: Unable to initialise /proc/%s\n", ZR_DEVNAME(zr), name);
		return 1;
	}
#endif
Loading