Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

V4L/DVB (6517): CodingStyle fixup



Used scripts/Lindent + manual check + scripts/checkpatch.pl

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 352fae1d
Loading
Loading
Loading
Loading
+168 −179
Original line number Original line Diff line number Diff line
@@ -11,7 +11,7 @@
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <asm/div64.h>
#include <asm/div64.h>
#include <linux/firmware.h>
#include <linux/firmware.h>
#include <linux/videodev.h>
#include <linux/videodev2.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <media/tuner.h>
#include <media/tuner.h>
#include <linux/mutex.h>
#include <linux/mutex.h>
@@ -65,18 +65,22 @@ struct xc2028_data {
	struct mutex lock;
	struct mutex lock;
};
};


#define i2c_send(rc, priv, buf, size)					\
#define i2c_send(rc, priv, buf, size) do {				\
if (size != (rc = tuner_i2c_xfer_send(&priv->i2c_props, buf, size)))	\
	rc = tuner_i2c_xfer_send(&priv->i2c_props, buf, size);		\
	if (size != rc)							\
		tuner_info("i2c output error: rc = %d (should be %d)\n",\
		tuner_info("i2c output error: rc = %d (should be %d)\n",\
	rc, (int)size);
			   rc, (int)size);				\
} while (0)


#define i2c_rcv(rc, priv, buf, size)					\
#define i2c_rcv(rc, priv, buf, size) do {				\
if (size != (rc = tuner_i2c_xfer_recv(&priv->i2c_props, buf, size)))	\
	rc = tuner_i2c_xfer_recv(&priv->i2c_props, buf, size);		\
	if (size != rc)							\
		tuner_info("i2c input error: rc = %d (should be %d)\n",	\
		tuner_info("i2c input error: rc = %d (should be %d)\n",	\
	rc, (int)size);
			   rc, (int)size); 				\
} while (0)


#define send_seq(priv, data...)						\
#define send_seq(priv, data...)	do {					\
{	int rc;								\
	int rc;								\
	static u8 _val[] = data;					\
	static u8 _val[] = data;					\
	if (sizeof(_val) !=						\
	if (sizeof(_val) !=						\
			(rc = tuner_i2c_xfer_send(&priv->i2c_props,	\
			(rc = tuner_i2c_xfer_send(&priv->i2c_props,	\
@@ -85,7 +89,7 @@ if (size != (rc = tuner_i2c_xfer_recv(&priv->i2c_props, buf, size))) \
		return -EINVAL;						\
		return -EINVAL;						\
	}								\
	}								\
	msleep(10);							\
	msleep(10);							\
}
} while (0)


static int xc2028_get_reg(struct xc2028_data *priv, u16 reg)
static int xc2028_get_reg(struct xc2028_data *priv, u16 reg)
{
{
@@ -114,10 +118,9 @@ static void free_firmware (struct xc2028_data *priv)
	if (!priv->firm)
	if (!priv->firm)
		return;
		return;


	for (i=0;i<priv->firm_size;i++) {
	for (i = 0; i < priv->firm_size; i++)
		if (priv->firm[i].ptr)
		kfree(priv->firm[i].ptr);
		kfree(priv->firm[i].ptr);
	}

	kfree(priv->firm);
	kfree(priv->firm);


	priv->firm = NULL;
	priv->firm = NULL;
@@ -129,7 +132,8 @@ static int load_all_firmwares (struct dvb_frontend *fe)
	struct xc2028_data    *priv = fe->tuner_priv;
	struct xc2028_data    *priv = fe->tuner_priv;
	const struct firmware *fw   = NULL;
	const struct firmware *fw   = NULL;
	unsigned char         *p, *endp;
	unsigned char         *p, *endp;
	int                   rc=0, n, n_array;
	int                   rc = 0;
	int		      n, n_array;
	char		      name[33];
	char		      name[33];


	tuner_info("%s called\n", __FUNCTION__);
	tuner_info("%s called\n", __FUNCTION__);
@@ -273,8 +277,7 @@ static int load_firmware (struct dvb_frontend *fe, unsigned int type,


	/* Seek for exact match */
	/* Seek for exact match */
	for (i = 0; i < priv->firm_size; i++) {
	for (i = 0; i < priv->firm_size; i++) {
		if ( (type == priv->firm[i].type) &&
		if ((type == priv->firm[i].type) && (*id == priv->firm[i].id))
						(*id == priv->firm[i].id))
			goto found;
			goto found;
	}
	}


@@ -292,8 +295,7 @@ static int load_firmware (struct dvb_frontend *fe, unsigned int type,


found:
found:
	*id = priv->firm[i].id;
	*id = priv->firm[i].id;
	tuner_info ("Found firmware for type=%x, id=%lx\n", type,
	tuner_info("Found firmware for type=%x, id=%lx\n", type, (long int)*id);
		    (long int)*id);


	p = priv->firm[i].ptr;
	p = priv->firm[i].ptr;


@@ -312,7 +314,6 @@ found:
			return -EINVAL;
			return -EINVAL;
		}
		}



		size = le16_to_cpu(*(__u16 *) p);
		size = le16_to_cpu(*(__u16 *) p);
		p += sizeof(size);
		p += sizeof(size);


@@ -349,7 +350,8 @@ found:


		/* Sends message chunks */
		/* Sends message chunks */
		while (size > 0) {
		while (size > 0) {
			int len = (size<priv->max_len-1)?size:priv->max_len-1;
			int len = (size < priv->max_len - 1) ?
				   size : priv->max_len - 1;


			memcpy(buf + 1, p, len);
			memcpy(buf + 1, p, len);


@@ -367,8 +369,7 @@ found:
}
}


static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
						v4l2_std_id std,
			  v4l2_std_id std, fe_bandwidth_t bandwidth)
						fe_bandwidth_t bandwidth)
{
{
	struct xc2028_data      *priv = fe->tuner_priv;
	struct xc2028_data      *priv = fe->tuner_priv;
	int			rc, version;
	int			rc, version;
@@ -427,13 +428,11 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,


		priv->need_load_generic = 0;
		priv->need_load_generic = 0;
		priv->firm_type = 0;
		priv->firm_type = 0;
		if(priv->mode == T_DIGITAL_TV) {
		if (priv->mode == T_DIGITAL_TV)
			change_digital_bandwidth = 1;
			change_digital_bandwidth = 1;
	}
	}
	}


	tuner_info("I should change bandwidth %u\n",
	tuner_info("I should change bandwidth %u\n", change_digital_bandwidth);
						   change_digital_bandwidth);


	if (change_digital_bandwidth) {
	if (change_digital_bandwidth) {


@@ -513,9 +512,8 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)


	signal = xc2028_get_reg(priv, 0x40);
	signal = xc2028_get_reg(priv, 0x40);


	if(signal<=0) {
	if (signal <= 0)
		signal = frq_lock;
		signal = frq_lock;
	}


ret:
ret:
	mutex_unlock(&priv->lock);
	mutex_unlock(&priv->lock);
@@ -529,8 +527,7 @@ ret:


static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
			       enum tuner_mode new_mode,
			       enum tuner_mode new_mode,
				v4l2_std_id std,
			       v4l2_std_id std, fe_bandwidth_t bandwidth)
				fe_bandwidth_t bandwidth)
{
{
	struct xc2028_data *priv = fe->tuner_priv;
	struct xc2028_data *priv = fe->tuner_priv;
	int		   rc = -EINVAL;
	int		   rc = -EINVAL;
@@ -609,8 +606,7 @@ static int xc2028_set_tv_freq(struct dvb_frontend *fe,
	tuner_info("%s called\n", __FUNCTION__);
	tuner_info("%s called\n", __FUNCTION__);


	return generic_set_tv_freq(fe, 62500l * p->frequency, T_ANALOG_TV,
	return generic_set_tv_freq(fe, 62500l * p->frequency, T_ANALOG_TV,
					      p->std,
				   p->std, BANDWIDTH_8_MHZ /* NOT USED */);
					      BANDWIDTH_8_MHZ /* NOT USED */);
}
}


static int xc2028_set_params(struct dvb_frontend *fe,
static int xc2028_set_params(struct dvb_frontend *fe,
@@ -627,7 +623,7 @@ static int xc2028_set_params(struct dvb_frontend *fe,
	}
	}


	return generic_set_tv_freq(fe, p->frequency, T_DIGITAL_TV,
	return generic_set_tv_freq(fe, p->frequency, T_DIGITAL_TV,
						0, /* NOT USED */
				   0 /* NOT USED */,
				   p->u.ofdm.bandwidth);
				   p->u.ofdm.bandwidth);


}
}
@@ -643,7 +639,6 @@ static int xc2028_dvb_release(struct dvb_frontend *fe)
	if (!priv->count) {
	if (!priv->count) {
		list_del(&priv->xc2028_list);
		list_del(&priv->xc2028_list);


		if (priv->ctrl.fname)
		kfree(priv->ctrl.fname);
		kfree(priv->ctrl.fname);


		free_firmware(priv);
		free_firmware(priv);
@@ -674,7 +669,6 @@ static int xc2028_set_config (struct dvb_frontend *fe, void *priv_cfg)
	priv->ctrl.type = p->type;
	priv->ctrl.type = p->type;


	if (p->fname) {
	if (p->fname) {
		if (priv->ctrl.fname)
		kfree(priv->ctrl.fname);
		kfree(priv->ctrl.fname);


		priv->ctrl.fname = kmalloc(strlen(p->fname) + 1, GFP_KERNEL);
		priv->ctrl.fname = kmalloc(strlen(p->fname) + 1, GFP_KERNEL);
@@ -708,9 +702,6 @@ static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
	.get_rf_strength   = xc2028_signal,
	.get_rf_strength   = xc2028_signal,
	.set_params        = xc2028_set_params,
	.set_params        = xc2028_set_params,


// 	int (*sleep)(struct dvb_frontend *fe);
// 	int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
// 	int (*get_status)(struct dvb_frontend *fe, u32 *status);
};
};


int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap,
int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap,
@@ -733,10 +724,9 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
	}
	}


	list_for_each_entry(priv, &xc2028_list, xc2028_list) {
	list_for_each_entry(priv, &xc2028_list, xc2028_list) {
		if (priv->dev == dev) {
		if (priv->dev == dev)
			dev = NULL;
			dev = NULL;
	}
	}
	}


	if (dev) {
	if (dev) {
		priv = kzalloc(sizeof(*priv), GFP_KERNEL);
		priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -769,7 +759,6 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,


	return 0;
	return 0;
}
}

EXPORT_SYMBOL(xc2028_attach);
EXPORT_SYMBOL(xc2028_attach);


MODULE_DESCRIPTION("Xceive xc2028/xc3028 tuner driver");
MODULE_DESCRIPTION("Xceive xc2028/xc3028 tuner driver");
+7 −5
Original line number Original line Diff line number Diff line
@@ -34,8 +34,10 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
#else
#else
static inline int xc2028_attach(struct dvb_frontend *fe,
static inline int xc2028_attach(struct dvb_frontend *fe,
				struct i2c_adapter *i2c_adap,
				struct i2c_adapter *i2c_adap,
		  u8 i2c_addr, struct device *dev, void *video_dev,
				u8 i2c_addr, struct device *dev,
		  int (*tuner_callback) (void *dev, int command,int arg))
				void *video_dev,
				int (*tuner_callback) (void *dev, int command,
						       int arg))
{
{
	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
	       __FUNCTION__);
	       __FUNCTION__);