Commit fe8d54f0 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: em28xx-dvb: do some coding style improvements



As we're touching a lot on this file, let's solve several
Coding Style issues there using checkpatch --fix-inline --strict,
and manually adjusting the results.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ad05ff09
Loading
Loading
Loading
Loading
+97 −84
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ struct em28xx_dvb {
	struct dvb_net             net;

	/* Due to DRX-K - probably need changes */
	int (*gate_ctrl)(struct dvb_frontend *, int);
	int (*gate_ctrl)(struct dvb_frontend *fe, int gate);
	struct semaphore      pll_mutex;
	bool			dont_attach_fe1;
	int			lna_gpio;
@@ -276,14 +276,13 @@ static int em28xx_stop_feed(struct dvb_demux_feed *feed)
	mutex_lock(&dvb->lock);
	dvb->nfeeds--;

	if (0 == dvb->nfeeds)
	if (!dvb->nfeeds)
		err = em28xx_stop_streaming(dvb);

	mutex_unlock(&dvb->lock);
	return err;
}


/* ------------------------------------------------------------------ */
static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
{
@@ -512,14 +511,15 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)

	em28xx_gpio_set(dev, hauppauge_hvr930c_init);
	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
	msleep(10);
	usleep_range(10000, 11000);
	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
	msleep(10);
	usleep_range(10000, 11000);

	dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
				regs[i].r, regs[i].len);
	em28xx_gpio_set(dev, hauppauge_hvr930c_end);

	msleep(100);
@@ -528,8 +528,7 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)
	msleep(30);

	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
	msleep(10);

	usleep_range(10000, 11000);
}

static void terratec_h5_init(struct em28xx *dev)
@@ -569,14 +568,15 @@ static void terratec_h5_init(struct em28xx *dev)

	em28xx_gpio_set(dev, terratec_h5_init);
	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
	msleep(10);
	usleep_range(10000, 11000);
	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
	msleep(10);
	usleep_range(10000, 11000);

	dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
				regs[i].r, regs[i].len);
	em28xx_gpio_set(dev, terratec_h5_end);
};

@@ -622,14 +622,15 @@ static void terratec_htc_stick_init(struct em28xx *dev)
	em28xx_gpio_set(dev, terratec_htc_stick_init);

	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
	msleep(10);
	usleep_range(10000, 11000);
	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
	msleep(10);
	usleep_range(10000, 11000);

	dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
				regs[i].r, regs[i].len);

	em28xx_gpio_set(dev, terratec_htc_stick_end);
};
@@ -680,14 +681,15 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev)
	em28xx_gpio_set(dev, terratec_htc_usb_xs_init);

	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
	msleep(10);
	usleep_range(10000, 11000);
	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
	msleep(10);
	usleep_range(10000, 11000);

	dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
				regs[i].r, regs[i].len);

	em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
};
@@ -716,7 +718,8 @@ static void pctv_520e_init(struct em28xx *dev)
	dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
		i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
				regs[i].r, regs[i].len);
};

static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
@@ -778,7 +781,7 @@ static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe)
	static u8 tuner_go[]       = { TUNER_GO, 0x01};

	mt352_write(fe, clock_config,   sizeof(clock_config));
	udelay(200);
	usleep_range(200, 250);
	mt352_write(fe, reset,          sizeof(reset));
	mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));
	mt352_write(fe, agc_cfg,        sizeof(agc_cfg));
@@ -838,8 +841,8 @@ static void px_bcud_init(struct em28xx *dev)
	/* sleeping ISDB-T */
	dev->dvb->i2c_client_demod->addr = 0x14;
	for (i = 0; i < ARRAY_SIZE(regs1); i++)
		i2c_master_send(dev->dvb->i2c_client_demod, regs1[i].r,
				regs1[i].len);
		i2c_master_send(dev->dvb->i2c_client_demod,
				regs1[i].r, regs1[i].len);
	/* sleeping ISDB-S */
	dev->dvb->i2c_client_demod->addr = 0x15;
	for (i = 0; i < ARRAY_SIZE(regs2); i++)
@@ -1075,7 +1078,7 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
	dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);

	/* If the analog part won't create RF connectors, DVB will do it */
	if (!dev->has_video || (dev->tuner_type == TUNER_ABSENT))
	if (!dev->has_video || dev->tuner_type == TUNER_ABSENT)
		create_rf_connector = true;

	result = dvb_create_media_graph(&dvb->adapter, create_rf_connector);
@@ -1414,12 +1417,13 @@ static int em28xx_dvb_init(struct em28xx *dev)

	dev_info(&dev->intf->dev, "Binding DVB extension\n");

	dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
	dvb = kzalloc(sizeof(*dvb), GFP_KERNEL);
	if (!dvb)
		return -ENOMEM;

	dev->dvb = dvb;
	dvb->fe[0] = dvb->fe[1] = NULL;
	dvb->fe[0] = NULL;
	dvb->fe[1] = NULL;

	/* pre-allocate DVB usb transfer buffers */
	if (dev->dvb_xfer_bulk) {
@@ -1449,7 +1453,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
	switch (dev->model) {
	case EM2874_BOARD_LEADERSHIP_ISDBT:
		dvb->fe[0] = dvb_attach(s921_attach,
				&sharp_isdbt, &dev->i2c_adap[dev->def_i2c_bus]);
					&sharp_isdbt,
					&dev->i2c_adap[dev->def_i2c_bus]);

		if (!dvb->fe[0]) {
			result = -EINVAL;
@@ -1494,16 +1499,17 @@ static int em28xx_dvb_init(struct em28xx *dev)
	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
	case EM2882_BOARD_DIKOM_DK300:
	case EM2882_BOARD_KWORLD_VS_DVBT:
		/*
		 * Those boards could have either a zl10353 or a mt352.
		 * If the chip id isn't for zl10353, try mt352.
		 */
		dvb->fe[0] = dvb_attach(zl10353_attach,
					&em28xx_zl10353_xc3028_no_i2c_gate,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0] == NULL) {
			/* This board could have either a zl10353 or a mt352.
			   If the chip id isn't for zl10353, try mt352 */
		if (!dvb->fe[0])
			dvb->fe[0] = dvb_attach(mt352_attach,
						&terratec_xs_mt352_cfg,
						&dev->i2c_adap[dev->def_i2c_bus]);
		}

		if (em28xx_attach_xc3028(0x61, dev) < 0) {
			result = -EINVAL;
@@ -1514,7 +1520,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
		dvb->fe[0] = dvb_attach(zl10353_attach,
					&em28xx_zl10353_no_i2c_gate_dev,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0] != NULL) {
		if (dvb->fe[0]) {
			dvb_attach(mt2060_attach, dvb->fe[0],
				   &dev->i2c_adap[dev->def_i2c_bus],
				   &em28xx_mt2060_config, 1220);
@@ -1524,9 +1530,10 @@ static int em28xx_dvb_init(struct em28xx *dev)
		dvb->fe[0] = dvb_attach(zl10353_attach,
					&em28xx_zl10353_no_i2c_gate_dev,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0] != NULL)
		if (dvb->fe[0])
			dvb_attach(qt1010_attach, dvb->fe[0],
				   &dev->i2c_adap[dev->def_i2c_bus], &em28xx_qt1010_config);
				   &dev->i2c_adap[dev->def_i2c_bus],
				   &em28xx_qt1010_config);
		break;
	case EM2883_BOARD_KWORLD_HYBRID_330U:
	case EM2882_BOARD_EVGA_INDTUBE:
@@ -1542,7 +1549,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
		dvb->fe[0] = dvb_attach(lgdt330x_attach,
					&em2880_lgdt3303_dev,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0] != NULL) {
		if (dvb->fe[0]) {
			if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
					&dev->i2c_adap[dev->def_i2c_bus],
					0x61, TUNER_THOMSON_DTT761X)) {
@@ -1565,7 +1572,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
		/* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */
		dvb->fe[0] = dvb_attach(tda10023_attach,
					&em28xx_tda10023_config,
			&dev->i2c_adap[dev->def_i2c_bus], 0x48);
					&dev->i2c_adap[dev->def_i2c_bus],
					0x48);
		if (dvb->fe[0]) {
			if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
					&dev->i2c_adap[dev->def_i2c_bus],
@@ -1606,7 +1614,6 @@ static int em28xx_dvb_init(struct em28xx *dev)
					0x60,
					&dev->i2c_adap[dev->def_i2c_bus],
					&em28xx_cxd2820r_tda18271_config)) {

				dvb_frontend_detach(dvb->fe[0]);
				result = -EINVAL;
				goto out_free;
@@ -1636,7 +1643,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
		hauppauge_hvr930c_init(dev);

		dvb->fe[0] = dvb_attach(drxk_attach,
					&hauppauge_930c_drxk, &dev->i2c_adap[dev->def_i2c_bus]);
					&hauppauge_930c_drxk,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (!dvb->fe[0]) {
			result = -EINVAL;
			goto out_free;
@@ -1653,8 +1661,8 @@ static int em28xx_dvb_init(struct em28xx *dev)

		if (dvb->fe[0]->ops.i2c_gate_ctrl)
			dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
		if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus],
				&cfg)) {
		if (!dvb_attach(xc5000_attach, dvb->fe[0],
				&dev->i2c_adap[dev->def_i2c_bus], &cfg)) {
			result = -EINVAL;
			goto out_free;
		}
@@ -1666,7 +1674,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
	case EM2884_BOARD_TERRATEC_H5:
		terratec_h5_init(dev);

		dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap[dev->def_i2c_bus]);
		dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (!dvb->fe[0]) {
			result = -EINVAL;
			goto out_free;
@@ -1680,7 +1689,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
		/* Attach tda18271 to DVB-C frontend */
		if (dvb->fe[0]->ops.i2c_gate_ctrl)
			dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
		if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], 0x60)) {
		if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0],
				&dev->i2c_adap[dev->def_i2c_bus], 0x60)) {
			result = -EINVAL;
			goto out_free;
		}
@@ -1692,7 +1702,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
		dvb->fe[0] = dvb_attach(mb86a20s_attach,
					&c3tech_duo_mb86a20s_config,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0] != NULL)
		if (dvb->fe[0])
			dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
				   &dev->i2c_adap[dev->def_i2c_bus],
				   &c3tech_duo_tda18271_config);
@@ -1814,8 +1824,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
		kworld_ub435q_v3_config.fe = dvb->fe[0];

		dvb->i2c_client_tuner = dvb_module_probe("tda18212", NULL,
							 adapter,
							 0x60,
							 adapter, 0x60,
							 &kworld_ub435q_v3_config);
		if (!dvb->i2c_client_tuner) {
			dvb_frontend_detach(dvb->fe[0]);
@@ -1825,9 +1834,11 @@ static int em28xx_dvb_init(struct em28xx *dev)
		break;
	}
	case EM2874_BOARD_PCTV_HD_MINI_80E:
		dvb->fe[0] = dvb_attach(drx39xxj_attach, &dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0] != NULL) {
			dvb->fe[0] = dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
		dvb->fe[0] = dvb_attach(drx39xxj_attach,
					&dev->i2c_adap[dev->def_i2c_bus]);
		if (dvb->fe[0]) {
			dvb->fe[0] = dvb_attach(tda18271_attach, dvb->fe[0],
						0x60,
						&dev->i2c_adap[dev->def_i2c_bus],
						&pinnacle_80e_dvb_config);
			if (!dvb->fe[0]) {
@@ -1871,7 +1882,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
			"The frontend of your DVB/ATSC card isn't supported yet\n");
		break;
	}
	if (NULL == dvb->fe[0]) {
	if (!dvb->fe[0]) {
		dev_err(&dev->intf->dev, "frontend initialization failed\n");
		result = -EINVAL;
		goto out_free;
@@ -1941,8 +1952,10 @@ static int em28xx_dvb_fini(struct em28xx *dev)
	em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);

	if (dev->disconnected) {
		/* We cannot tell the device to sleep
		 * once it has been unplugged. */
		/*
		 * We cannot tell the device to sleep
		 * once it has been unplugged.
		 */
		if (dvb->fe[0]) {
			prevent_sleep(&dvb->fe[0]->ops);
			dvb->fe[0]->exit = DVB_FE_DEVICE_REMOVED;