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

Commit 6ea54d93 authored by Douglas Schilling Landgraf's avatar Douglas Schilling Landgraf Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (7607): CodingStyle fixes

parent e6a353b0
Loading
Loading
Loading
Loading
+39 −24
Original line number Diff line number Diff line
@@ -79,10 +79,10 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,

	if (reg_debug) {
		printk(ret < 0 ? " failed!\n" : "%02x values: ", ret);
		for (byte = 0; byte < len; byte++) {
			printk(" %02x", (unsigned char)buf[byte]);
		}
		printk("\n");
		for (byte = 0; byte < len; byte++)
			printk(KERN_INFO " %02x", (unsigned char)buf[byte]);

		printk(KERN_INFO "\n");
	}

	return ret;
@@ -143,8 +143,8 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
	if (reg_debug) {
		int i;
		for (i = 0; i < len; ++i)
			printk (" %02x", (unsigned char)buf[i]);
		printk ("\n");
			printk(KERN_INFO " %02x", (unsigned char)buf[i]);
		printk(KERN_INFO "\n");
	}

	if (!bufs)
@@ -173,8 +173,12 @@ static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
{
	int oldval;
	u8 newval;
	if ((oldval = em28xx_read_reg(dev, reg)) < 0)

	oldval = em28xx_read_reg(dev, reg);

	if (oldval < 0)
		return oldval;

	newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
	return em28xx_write_regs(dev, reg, &newval, 1);
}
@@ -187,15 +191,21 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
{
	int ret, i;
	u8 addr = reg & 0x7f;
	if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0)

	ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2);
	if (ret < 0)
		return ret;
	if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0)

	ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1);
	if (ret < 0)
		return ret;

	/* Wait up to 50 ms for AC97 command to complete */
	for (i = 0; i < 10; i++) {
		if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
		ret = em28xx_read_reg(dev, AC97BUSY_REG);
		if (ret < 0)
			return ret;

		if (!(ret & 0x01))
			return 0;
		msleep(5);
@@ -357,7 +367,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev)
static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
				  u8 ymin, u8 ymax)
{
	em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax);
	em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n",
			xmin, ymin, xmax, ymax);

	em28xx_write_regs(dev, XMIN_REG, &xmin, 1);
	em28xx_write_regs(dev, XMAX_REG, &xmax, 1);
@@ -372,7 +383,8 @@ static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
	u8 cheight = height;
	u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01);

	em28xx_coredbg("em28xx Area Set: (%d,%d)\n", (width | (overflow & 2) << 7),
	em28xx_coredbg("em28xx Area Set: (%d,%d)\n",
			(width | (overflow & 2) << 7),
			(height | (overflow & 1) << 8));

	em28xx_write_regs(dev, HSTART_REG, &hstart, 1);
@@ -396,7 +408,8 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
		buf[0] = v;
		buf[1] = v >> 8;
		em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
		/* it seems that both H and V scalers must be active to work correctly */
		/* it seems that both H and V scalers must be active
		   to work correctly */
		mode = (h || v)? 0x30: 0x00;
	}
	return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30);
@@ -596,7 +609,9 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets,
			'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK'
			should also be using 'desc.bInterval'
		 */
		pipe = usb_rcvisocpipe(dev->udev, cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);
		pipe = usb_rcvisocpipe(dev->udev,
			cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);

		usb_fill_int_urb(urb, dev->udev, pipe,
				 dev->isoc_ctl.transfer_buffer[i], sb_size,
				 em28xx_irq_callback, dma_q, 1);
+17 −12
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ static inline void print_err_status(struct em28xx *dev,
	if (packet < 0) {
		dprintk(1, "URB status %d [%s].\n", status, errmsg);
	} else {
		dprintk(1, "URB packet %d, status %d [%s].\n", packet, status, errmsg);
		dprintk(1, "URB packet %d, status %d [%s].\n",
			packet, status, errmsg);
	}
}

@@ -134,7 +135,8 @@ static inline int dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
	return 0;
}

static int start_streaming(struct em28xx_dvb* dvb) {
static int start_streaming(struct em28xx_dvb *dvb)
{
	struct em28xx *dev = dvb->adapter.priv;

	usb_set_interface(dev->udev, 0, 1);
@@ -145,7 +147,8 @@ static int start_streaming(struct em28xx_dvb* dvb) {
				dvb_isoc_copy, EM28XX_DIGITAL_CAPTURE);
}

static int stop_streaming(struct em28xx_dvb* dvb) {
static int stop_streaming(struct em28xx_dvb *dvb)
{
	struct em28xx *dev = dvb->adapter.priv;

	em28xx_uninit_isoc(dev);
@@ -167,7 +170,8 @@ static int start_feed(struct dvb_demux_feed *feed)

	if (dvb->nfeeds == 1) {
		ret = start_streaming(dvb);
		if(ret < 0) rc = ret;
		if (ret < 0)
			rc = ret;
	}

	mutex_unlock(&dvb->lock);
@@ -182,9 +186,10 @@ static int stop_feed(struct dvb_demux_feed *feed)

	mutex_lock(&dvb->lock);
	dvb->nfeeds--;
	if (0 == dvb->nfeeds) {

	if (0 == dvb->nfeeds)
		err = stop_streaming(dvb);
	}

	mutex_unlock(&dvb->lock);
	return err;
}
@@ -360,8 +365,9 @@ static int dvb_init(struct em28xx *dev)
	struct em28xx_dvb *dvb;

	dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);

	if (dvb == NULL) {
		printk("em28xx_dvb: memory allocation failed\n");
		printk(KERN_INFO "em28xx_dvb: memory allocation failed\n");
		return -ENOMEM;
	}
	dev->dvb = dvb;
@@ -410,9 +416,8 @@ static int dvb_init(struct em28xx *dev)
	/* register everything */
	result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);

	if (result < 0) {
	if (result < 0)
		goto out_free;
	}

	printk(KERN_INFO "Successfully loaded em28xx-dvb\n");
	return 0;
+86 −70
Original line number Diff line number Diff line
@@ -41,11 +41,21 @@ static unsigned int i2c_debug;
module_param(i2c_debug, int, 0644);
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");

#define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\
			printk(fmt, ##args); } while (0)
#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \

#define dprintk1(lvl, fmt, args...)			\
do {							\
	if (i2c_debug >= lvl) {				\
	printk(fmt, ##args);				\
      }							\
} while (0)

#define dprintk2(lvl, fmt, args...)			\
do {							\
	if (i2c_debug >= lvl) {				\
		printk(KERN_DEBUG "%s at %s: " fmt,	\
			dev->name, __func__ , ##args); } while (0)
		       dev->name, __func__ , ##args);	\
      } 						\
} while (0)

/*
 * em2800_i2c_send_max4()
@@ -259,10 +269,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
							   msgs[i].buf,
							   msgs[i].len);
			if (i2c_debug >= 2) {
				for (byte = 0; byte < msgs[i].len; byte++) {
				for (byte = 0; byte < msgs[i].len; byte++)
					printk(" %02x", msgs[i].buf[byte]);
			}
			}
		} else {
			/* write bytes */
			if (i2c_debug >= 2) {
@@ -330,7 +339,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
		return -1;

	buf = 0;
	if (1 != (err = i2c_master_send(&dev->i2c_client, &buf, 1))) {

	err = i2c_master_send(&dev->i2c_client, &buf, 1);
	if (err != 1) {
		printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n",
		       dev->name, err);
		return -1;
@@ -403,8 +414,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
		break;
	}
	printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n",
				em_eeprom->string_idx_table,em_eeprom->string1,
				em_eeprom->string2,em_eeprom->string3);
				em_eeprom->string_idx_table,
				em_eeprom->string1,
				em_eeprom->string2,
				em_eeprom->string3);

	return 0;
}
@@ -443,7 +456,8 @@ static int attach_inform(struct i2c_client *client)
		tun_setup.type = TUNER_TDA9887;
		tun_setup.addr = client->addr;

			em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
		em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR,
			&tun_setup);

		tda9887_cfg.tuner = TUNER_TDA9887;
		tda9887_cfg.priv = &dev->tda9887_conf;
@@ -464,7 +478,8 @@ static int attach_inform(struct i2c_client *client)
	case 0x8e:
	{
		struct IR_i2c *ir = i2c_get_clientdata(client);
			dprintk1(1,"attach_inform: IR detected (%s).\n",ir->phys);
		dprintk1(1, "attach_inform: IR detected (%s).\n",
			ir->phys);
		em28xx_set_ir(dev, ir);
		break;
	}
@@ -481,7 +496,8 @@ static int attach_inform(struct i2c_client *client)
		if (!dev->tuner_addr)
			dev->tuner_addr = client->addr;

			dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1);
		dprintk1(1, "attach inform: detected I2C address %x\n",
				client->addr << 1);

	}

+14 −12
Original line number Diff line number Diff line
@@ -34,8 +34,10 @@ static unsigned int ir_debug;
module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");

#define dprintk(fmt, arg...)	if (ir_debug) \
	printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg)
#define dprintk(fmt, arg...) \
	if (ir_debug) { \
		printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg); \
	}

/* ----------------------------------------------------------------------- */

@@ -91,7 +93,8 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
		 ((buf[0]&0x10)>>3) | /* 0000 0010 */
		 ((buf[0]&0x20)>>5);  /* 0000 0001 */

	dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",code,buf[0]);
	dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",
			code, buf[0]);

	/* return key */
	*ir_key = code;
@@ -112,9 +115,8 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
	}

	dprintk("key %02x\n", buf[2]&0x3f);
	if (buf[0]!=0x00){
	if (buf[0] != 0x00)
		return 0;
	}

	*ir_key = buf[2]&0x3f;
	*ir_raw = buf[2]&0x3f;
+58 −45
Original line number Diff line number Diff line
/*
   em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices
   em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB
		    video capture devices

   Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
		      Markus Rechberger <mrechberger@gmail.com>
@@ -58,10 +59,13 @@ static unsigned int isoc_debug;
module_param(isoc_debug, int, 0644);
MODULE_PARM_DESC(isoc_debug, "enable debug messages [isoc transfers]");

#define em28xx_isocdbg(fmt, arg...) do {\
	if (isoc_debug) \
#define em28xx_isocdbg(fmt, arg...) \
do {\
	if (isoc_debug) { \
		printk(KERN_INFO "%s %s :"fmt, \
			 dev->name, __func__ , ##arg); } while (0)
			 dev->name, __func__ , ##arg); \
	} \
  } while (0)

MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
@@ -483,7 +487,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)

}

static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb)
static void buffer_release(struct videobuf_queue *vq,
				struct videobuf_buffer *vb)
{
	struct em28xx_buffer   *buf  = container_of(vb, struct em28xx_buffer, vb);
	struct em28xx_fh       *fh   = vq->priv_data;
@@ -501,7 +506,7 @@ static struct videobuf_queue_ops em28xx_video_qops = {
	.buf_release    = buffer_release,
};

/*********************  v4l2 interface  ******************************************/
/*********************  v4l2 interface  **************************************/

/*
 * em28xx_config()
@@ -557,12 +562,15 @@ static void video_mux(struct em28xx *dev, int index)
	em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);

	if (dev->has_msp34xx) {
		if (dev->i2s_speed)
			em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed);
		if (dev->i2s_speed) {
			em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ,
				&dev->i2s_speed);
		}
		route.input = dev->ctl_ainput;
		route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
		/* Note: this is msp3400 specific */
		em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route);
		em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
			&route);
	}

	em28xx_audio_analog_set(dev);
@@ -919,11 +927,11 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)

	index = dev->ctl_ainput;

	if (index == 0) {
	if (index == 0)
		strcpy(a->name, "Television");
	} else {
	else
		strcpy(a->name, "Line In");
	}

	a->capability = V4L2_AUDCAP_STEREO;
	a->index = index;

@@ -1607,7 +1615,8 @@ static void em28xx_release_resources(struct em28xx *dev)

/*
 * em28xx_v4l2_close()
 * stops streaming and deallocates all resources allocated by the v4l2 calls and ioctls
 * stops streaming and deallocates all resources allocated by the v4l2
 * calls and ioctls
 */
static int em28xx_v4l2_close(struct inode *inode, struct file *filp)
{
@@ -1825,7 +1834,7 @@ static struct video_device em28xx_radio_template = {
#endif
};

/******************************** usb interface *****************************************/
/******************************** usb interface ******************************/


static LIST_HEAD(em28xx_extension_devlist);
@@ -2094,7 +2103,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
	/* Don't register audio interfaces */
	if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
		em28xx_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n",
				udev->descriptor.idVendor,udev->descriptor.idProduct,
				udev->descriptor.idVendor,
				udev->descriptor.idProduct,
				ifnum,
				interface->altsetting[0].desc.bInterfaceClass);

@@ -2103,7 +2113,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
	}

	em28xx_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n",
			udev->descriptor.idVendor,udev->descriptor.idProduct,
			udev->descriptor.idVendor,
			udev->descriptor.idProduct,
			ifnum,
			interface->altsetting[0].desc.bInterfaceClass);

@@ -2123,7 +2134,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
	}

	if (nr >= EM28XX_MAXBOARDS) {
		printk (DRIVER_NAME ": Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS);
		printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
				EM28XX_MAXBOARDS);
		em28xx_devused &= ~(1<<nr);
		return -ENOMEM;
	}
@@ -2158,9 +2170,9 @@ static int em28xx_usb_probe(struct usb_interface *interface,

	dev->num_alt = uif->num_altsetting;
	em28xx_info("Alternate settings: %i\n", dev->num_alt);
//	dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)*
	dev->alt_max_pkt_size = kmalloc(32*
						dev->num_alt,GFP_KERNEL);
/*	dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)* */
	dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);

	if (dev->alt_max_pkt_size == NULL) {
		em28xx_errdev("out of memory!\n");
		em28xx_devused &= ~(1<<nr);
@@ -2213,7 +2225,8 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)

	em28xx_info("disconnecting %s\n", dev->vdev->name);

	/* wait until all current v4l2 io is finished then deallocate resources */
	/* wait until all current v4l2 io is finished then deallocate
	   resources */
	mutex_lock(&dev->lock);

	wake_up_interruptible_all(&dev->open);
Loading