Commit c3224f41 authored by Stefan Herdler's avatar Stefan Herdler Committed by Hans Verkuil
Browse files

media: ttpci: coding style fixes: logging



This patch fixes the following checkpatch warnings:

WARNING:PRINTK_WITHOUT_KERN_LEVEL: printk() should include KERN_<LEVEL> facility level
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'ciintf_slot_ts_enable', this function's name, in a string
CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'level' may be better as '(level)' to avoid precedence issues

There was no consistent style of logging functions used so far.
Convert all logging to the appropriate pr_* macros.
Add a global pr_fmt macro for the whole driver.

Signed-off-by: default avatarStefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 58557349
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
 * the project's page is at https://linuxtv.org
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include "budget.h"
#include "stv0299.h"
@@ -206,7 +205,7 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot)
	if (slot != 0)
		return -EINVAL;

	dprintk(1, "ciintf_slot_reset\n");
	dprintk(1, "ci slot reset\n");
	budget_av->slot_status = SLOTSTATUS_RESET;

	saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */
@@ -235,7 +234,7 @@ static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
	if (slot != 0)
		return -EINVAL;

	dprintk(1, "ciintf_slot_shutdown\n");
	dprintk(1, "ci slot shutdown\n");

	ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB);
	budget_av->slot_status = SLOTSTATUS_NONE;
@@ -251,7 +250,7 @@ static int ciintf_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
	if (slot != 0)
		return -EINVAL;

	dprintk(1, "ciintf_slot_ts_enable: %d\n", budget_av->slot_status);
	dprintk(1, "ci slot status: %d\n", budget_av->slot_status);

	ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA);

@@ -1464,7 +1463,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
		if (err != 0) {
			ttpci_budget_deinit(&budget_av->budget);
			kfree(budget_av);
			ERR("cannot init vv subsystem\n");
			pr_err("cannot init vv subsystem\n");
			return err;
		}
		vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
@@ -1476,7 +1475,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
			saa7146_vv_release(dev);
			ttpci_budget_deinit(&budget_av->budget);
			kfree(budget_av);
			ERR("cannot register capture v4l2 device\n");
			pr_err("cannot register capture v4l2 device\n");
			return err;
		}

+12 −12
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ static void msp430_ir_interrupt(struct tasklet_struct *t)
	 */

	if (ir_debug)
		printk("budget_ci: received byte 0x%02x\n", command);
		pr_info("received byte 0x%02x\n", command);

	/* Remove repeat bit, we use every command */
	command = command & 0x7f;
@@ -165,7 +165,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)

	dev = rc_allocate_device(RC_DRIVER_SCANCODE);
	if (!dev) {
		printk(KERN_ERR "budget_ci: IR interface initialisation failed\n");
		pr_err("IR interface initialisation failed\n");
		return -ENOMEM;
	}

@@ -224,7 +224,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)

	error = rc_register_device(dev);
	if (error) {
		printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
		pr_err("could not init driver for IR device (code %d)\n", error);
		rc_free_device(dev);
		return error;
	}
@@ -485,7 +485,7 @@ static int ciintf_init(struct budget_ci *budget_ci)
	result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter,
				     &budget_ci->ca, ca_flags, 1);
	if (result != 0) {
		printk("budget_ci: CI interface detected, but initialisation failed.\n");
		pr_err("CI interface detected, but initialisation failed.\n");
		goto error;
	}

@@ -504,7 +504,7 @@ static int ciintf_init(struct budget_ci *budget_ci)
			       CICONTROL_RESET, 1, 0);

	// success!
	printk("budget_ci: CI interface initialised\n");
	pr_info("CI interface initialised\n");
	budget_ci->budget.ci_present = 1;

	// forge a fake CI IRQ so the CAM state is setup correctly
@@ -1358,7 +1358,7 @@ static void frontend_init(struct budget_ci *budget_ci)

			budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL;
			if (dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0) == NULL) {
				printk("%s: No LNBP21 found!\n", __func__);
				pr_err("%s(): No LNBP21 found!\n", __func__);
				dvb_frontend_detach(budget_ci->budget.dvb_frontend);
				budget_ci->budget.dvb_frontend = NULL;
			}
@@ -1369,7 +1369,7 @@ static void frontend_init(struct budget_ci *budget_ci)
		budget_ci->budget.dvb_frontend = dvb_attach(tda10023_attach, &tda10023_config, &budget_ci->budget.i2c_adap, 0x48);
		if (budget_ci->budget.dvb_frontend) {
			if (dvb_attach(tda827x_attach, budget_ci->budget.dvb_frontend, 0x61, &budget_ci->budget.i2c_adap, &tda827x_config) == NULL) {
				printk(KERN_ERR "%s: No tda827x found!\n", __func__);
				pr_err("%s(): No tda827x found!\n", __func__);
				dvb_frontend_detach(budget_ci->budget.dvb_frontend);
				budget_ci->budget.dvb_frontend = NULL;
			}
@@ -1381,12 +1381,12 @@ static void frontend_init(struct budget_ci *budget_ci)
		if (budget_ci->budget.dvb_frontend) {
			if (dvb_attach(stb6000_attach, budget_ci->budget.dvb_frontend, 0x63, &budget_ci->budget.i2c_adap)) {
				if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
					printk(KERN_ERR "%s: No LNBP21 found!\n", __func__);
					pr_err("%s(): No LNBP21 found!\n", __func__);
					dvb_frontend_detach(budget_ci->budget.dvb_frontend);
					budget_ci->budget.dvb_frontend = NULL;
				}
			} else {
				printk(KERN_ERR "%s: No STB6000 found!\n", __func__);
				pr_err("%s(): No STB6000 found!\n", __func__);
				dvb_frontend_detach(budget_ci->budget.dvb_frontend);
				budget_ci->budget.dvb_frontend = NULL;
			}
@@ -1421,7 +1421,7 @@ static void frontend_init(struct budget_ci *budget_ci)
		if (budget_ci->budget.dvb_frontend) {
			if (dvb_attach(stb6100_attach, budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) {
				if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
					printk("%s: No LNBP21 found!\n", __func__);
					pr_err("%s(): No LNBP21 found!\n", __func__);
					dvb_frontend_detach(budget_ci->budget.dvb_frontend);
					budget_ci->budget.dvb_frontend = NULL;
				}
@@ -1435,7 +1435,7 @@ static void frontend_init(struct budget_ci *budget_ci)
	}

	if (budget_ci->budget.dvb_frontend == NULL) {
		printk("budget-ci: A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
		pr_err("A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
		       budget_ci->budget.dev->pci->vendor,
		       budget_ci->budget.dev->pci->device,
		       budget_ci->budget.dev->pci->subsystem_vendor,
@@ -1443,7 +1443,7 @@ static void frontend_init(struct budget_ci *budget_ci)
	} else {
		if (dvb_register_frontend
		    (&budget_ci->budget.dvb_adapter, budget_ci->budget.dvb_frontend)) {
			printk("budget-ci: Frontend registration failed!\n");
			pr_err("Frontend registration failed!\n");
			dvb_frontend_detach(budget_ci->budget.dvb_frontend);
			budget_ci->budget.dvb_frontend = NULL;
		}
+2 −2
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ static void vpeirq(struct tasklet_struct *t)
		budget->buffer_warnings++;

	if (budget->buffer_warnings && time_after(jiffies, budget->buffer_warning_time)) {
		printk("%s %s: used %d times >80%% of buffer (%u bytes now)\n",
		pr_warn("%s %s: used %d times >80%% of buffer (%u bytes now)\n",
			budget->dev->name, __func__, budget->buffer_warnings, count);
		budget->buffer_warning_time = jiffies + BUFFER_WARNING_WAIT;
		budget->buffer_warnings = 0;
@@ -473,7 +473,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
		budget->dev->name,
		budget->buffer_size > budget->buffer_width * budget->buffer_height ? "odd/even" : "single",
		budget->buffer_width, budget->buffer_height);
	printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size);
	pr_info("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size);

	ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name,
				   owner, &budget->dev->pci->dev, adapter_nums);
+14 −15
Original line number Diff line number Diff line
@@ -537,7 +537,7 @@ static void frontend_init(struct budget *budget)
	case 0x4f52: /* Cards based on Philips Semi Sylt PCI ref. design */
		budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap);
		if (budget->dvb_frontend) {
			printk(KERN_INFO "budget: tuner ALPS BSRU6 in Philips Semi. Sylt detected\n");
			pr_info("tuner ALPS BSRU6 in Philips Semi. Sylt detected\n");
			budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
			budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
			break;
@@ -555,7 +555,7 @@ static void frontend_init(struct budget *budget)
			/* assume ALPS BSRU6 */
			budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config_activy, &budget->i2c_adap);
			if (budget->dvb_frontend) {
				printk(KERN_INFO "budget: tuner ALPS BSRU6 detected\n");
				pr_info("tuner ALPS BSRU6 detected\n");
				budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
				budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
				budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage;
@@ -571,7 +571,7 @@ static void frontend_init(struct budget *budget)
			msleep(250);
			budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsbe1_config_activy, &budget->i2c_adap);
			if (budget->dvb_frontend) {
				printk(KERN_INFO "budget: tuner ALPS BSBE1 detected\n");
				pr_info("tuner ALPS BSBE1 detected\n");
				budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params;
				budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
				budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage;
@@ -617,7 +617,7 @@ static void frontend_init(struct budget *budget)
			budget->dvb_frontend = fe;
			if (dvb_attach(lnbp21_attach, fe, &budget->i2c_adap,
				       0, 0) == NULL) {
				printk("%s: No LNBP21 found!\n", __func__);
				pr_err("%s(): No LNBP21 found!\n", __func__);
				goto error_out;
			}
			break;
@@ -639,10 +639,10 @@ static void frontend_init(struct budget *budget)
			budget->dvb_frontend = fe;
			if (dvb_attach(tda826x_attach, fe, 0x60,
				       &budget->i2c_adap, 0) == NULL)
				printk("%s: No tda826x found!\n", __func__);
				pr_err("%s(): No tda826x found!\n", __func__);
			if (dvb_attach(lnbp21_attach, fe,
				       &budget->i2c_adap, 0, 0) == NULL) {
				printk("%s: No LNBP21 found!\n", __func__);
				pr_err("%s(): No LNBP21 found!\n", __func__);
				goto error_out;
			}
			break;
@@ -695,11 +695,11 @@ static void frontend_init(struct budget *budget)
						       budget->dvb_frontend,
						       &budget->i2c_adap,
						       &tt1600_isl6423_config) == NULL) {
						printk(KERN_ERR "%s: No Intersil ISL6423 found!\n", __func__);
						pr_err("%s(): No Intersil ISL6423 found!\n", __func__);
						goto error_out;
					}
				} else {
					printk(KERN_ERR "%s: No STV6110(A) Silicon Tuner found!\n", __func__);
					pr_err("%s(): No STV6110(A) Silicon Tuner found!\n", __func__);
					goto error_out;
				}
			}
@@ -720,7 +720,7 @@ static void frontend_init(struct budget *budget)
							  STV090x_DEMODULATOR_0);

			if (budget->dvb_frontend) {
				printk(KERN_INFO "budget: Omicom S2 detected\n");
				pr_info("Omicom S2 detected\n");

				ctl = dvb_attach(stv6110x_attach,
						 budget->dvb_frontend,
@@ -753,12 +753,11 @@ static void frontend_init(struct budget *budget)
							&budget->i2c_adap,
							LNBH24_PCL | LNBH24_TTX,
							LNBH24_TEN, 0x14>>1) == NULL) {
						printk(KERN_ERR
						"No LNBH24 found!\n");
						pr_err("No LNBH24 found!\n");
						goto error_out;
					}
				} else {
					printk(KERN_ERR "%s: No STV6110(A) Silicon Tuner found!\n", __func__);
					pr_err("%s(): No STV6110(A) Silicon Tuner found!\n", __func__);
					goto error_out;
				}
			}
@@ -767,7 +766,7 @@ static void frontend_init(struct budget *budget)
	}

	if (budget->dvb_frontend == NULL) {
		printk("budget: A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
		pr_err("A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
		       budget->dev->pci->vendor,
		       budget->dev->pci->device,
		       budget->dev->pci->subsystem_vendor,
@@ -779,7 +778,7 @@ static void frontend_init(struct budget *budget)
	return;

error_out:
	printk("budget: Frontend registration failed!\n");
	pr_err("Frontend registration failed!\n");
	dvb_frontend_detach(budget->dvb_frontend);
	budget->dvb_frontend = NULL;
}
@@ -799,7 +798,7 @@ static int budget_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d

	err = ttpci_budget_init(budget, dev, info, THIS_MODULE, adapter_nr);
	if (err) {
		printk("==> failed\n");
		pr_err("==> failed\n");
		kfree(budget);
		return err;
	}
+8 −3
Original line number Diff line number Diff line
@@ -3,6 +3,12 @@
#ifndef __BUDGET_DVB__
#define __BUDGET_DVB__

#ifdef pr_fmt
#undef pr_fmt
#endif

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <media/dvb_frontend.h>
#include <media/dvbdev.h>
#include <media/demux.h>
@@ -22,9 +28,8 @@ extern int budget_debug;
#endif

#define dprintk(level, fmt, arg...) do {				\
	if (level & budget_debug)					\
		printk(KERN_DEBUG KBUILD_MODNAME ": %s(): " fmt,	\
		       __func__, ##arg);				\
	if ((level) & budget_debug)					\
		pr_info("%s(): " fmt, __func__, ##arg);			\
} while (0)

#define TS_SIZE        188