All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@linuxtv.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [DVB patch 03/48] dibusb: misc. fixes
Date: Tue, 22 Mar 2005 02:23:36 +0100	[thread overview]
Message-ID: <20050322013454.699542000@abc> (raw)
In-Reply-To: 20050322013427.919515000@abc

[-- Attachment #1: dvb-dibusb.patch --]
[-- Type: text/plain, Size: 7484 bytes --]

o worked around hw_sleep handling for usb1.1 devices
o fixed oops when no frontend was attached (because of usb1.1 timeouts in my
  debugging sessions)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-fe-i2c.c |    4 ++
 dvb-dibusb-usb.c    |   70 ++++++++++++++++++++++++++--------------------------
 2 files changed, 39 insertions(+), 35 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:14:35.000000000 +0100
@@ -178,6 +178,8 @@ int dibusb_fe_init(struct usb_dibusb* di
 				break;
 			}
 		}
+		/* if a frontend was found */
+		if (dib->fe != NULL) {
 			if (dib->fe->ops->sleep != NULL)
 				dib->fe_sleep = dib->fe->ops->sleep;
 			dib->fe->ops->sleep = dibusb_hw_sleep;
@@ -192,6 +194,7 @@ int dibusb_fe_init(struct usb_dibusb* di
 			/* check which tuner is mounted on this device, in case this is unsure */
 			dibusb_tuner_quirk(dib);
 		}
+	}
 	if (dib->fe == NULL) {
 		err("A frontend driver was not found for device '%s'.",
 		       dib->dibdev->name);
@@ -205,6 +208,7 @@ int dibusb_fe_init(struct usb_dibusb* di
 			return -ENODEV;
 		}
 	}
+
 	return 0;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:14:35.000000000 +0100
@@ -1,12 +1,12 @@
 /*
- * dvb-dibusb-usb.c is part of the driver for mobile USB Budget DVB-T devices 
+ * dvb-dibusb-usb.c is part of the driver for mobile USB Budget DVB-T devices
  * based on reference design made by DiBcom (http://www.dibcom.fr/)
  *
  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
  *
  * see dvb-dibusb-core.c for more copyright details.
  *
- * This file contains functions for initializing and handling the 
+ * This file contains functions for initializing and handling the
  * usb specific stuff.
  */
 #include "dvb-dibusb.h"
@@ -25,18 +25,18 @@ int dibusb_readwrite_usb(struct usb_dibu
 	if ((ret = down_interruptible(&dib->usb_sem)))
 		return ret;
 
-	if (dib->feedcount && 
-		wbuf[0] == DIBUSB_REQ_I2C_WRITE && 
+	if (dib->feedcount &&
+		wbuf[0] == DIBUSB_REQ_I2C_WRITE &&
 		dib->dibdev->dev_cl->id == DIBUSB1_1)
 		deb_err("BUG: writing to i2c, while TS-streaming destroys the stream."
 				"(%x reg: %x %x)\n", wbuf[0],wbuf[2],wbuf[3]);
-			
+
 	debug_dump(wbuf,wlen);
 
 	ret = usb_bulk_msg(dib->udev,usb_sndbulkpipe(dib->udev,
 			dib->dibdev->dev_cl->pipe_cmd), wbuf,wlen,&actlen,
 			DIBUSB_I2C_TIMEOUT);
-		
+
 	if (ret)
 		err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
 	else
@@ -55,7 +55,7 @@ int dibusb_readwrite_usb(struct usb_dibu
 			debug_dump(rbuf,actlen);
 		}
 	}
-	
+
 	up(&dib->usb_sem);
 	return ret;
 }
@@ -63,15 +63,18 @@ int dibusb_readwrite_usb(struct usb_dibu
 /*
  * Cypress controls
  */
+static int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len)
+{
+	return dibusb_readwrite_usb(dib,buf,len,NULL,0);
+}
 
 #if 0
-/* 
- * #if 0'ing the following functions as they are not in use _now_, 
+/*
+ * #if 0'ing the following functions as they are not in use _now_,
  * but probably will be sometime.
  */
-
 /*
- * do not use this, just a workaround for a bug, 
+ * do not use this, just a workaround for a bug,
  * which will hopefully never occur :).
  */
 int dibusb_interrupt_read_loop(struct usb_dibusb *dib)
@@ -79,15 +82,10 @@ int dibusb_interrupt_read_loop(struct us
 	u8 b[1] = { DIBUSB_REQ_INTR_READ };
 	return dibusb_write_usb(dib,b,1);
 }
-
-#endif 
-static int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len)
-{
-	return dibusb_readwrite_usb(dib,buf,len,NULL,0);
-}
+#endif
 
 /*
- * ioctl for the firmware 
+ * ioctl for the firmware
  */
 static int dibusb_ioctl_cmd(struct usb_dibusb *dib, u8 cmd, u8 *param, int plen)
 {
@@ -112,10 +110,10 @@ int dibusb_hw_wakeup(struct dvb_frontend
 	u8 b[1] = { DIBUSB_IOCTL_POWER_WAKEUP };
 	deb_info("dibusb-device is getting up.\n");
 	dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
-	
+
 	if (dib->fe_init)
 		return dib->fe_init(fe);
-	
+
 	return 0;
 }
 
@@ -124,11 +122,13 @@ int dibusb_hw_sleep(struct dvb_frontend 
 	struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv;
 	u8 b[1] = { DIBUSB_IOCTL_POWER_SLEEP };
 	deb_info("dibusb-device is going to bed.\n");
-	dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
+	/* workaround, something is wrong, when dibusb 1.1 device are going to bed too late */
+	if (dib->dibdev->dev_cl->id != DIBUSB1_1)
+		dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
 
 	if (dib->fe_sleep)
 		return dib->fe_sleep(fe);
-	
+
 	return 0;
 }
 
@@ -147,7 +147,7 @@ int dibusb_streaming(struct usb_dibusb *
 			else
 				return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_DISABLE_STREAM,NULL,0);
 			break;
-		case UMT2_0: 
+		case UMT2_0:
 			return dibusb_set_streaming_mode(dib,onoff);
 			break;
 		default:
@@ -159,9 +159,9 @@ int dibusb_streaming(struct usb_dibusb *
 int dibusb_urb_init(struct usb_dibusb *dib)
 {
 	int ret,i,bufsize,def_pid_parse = 1;
-	
+
 	/*
-	 * when reloading the driver w/o replugging the device 
+	 * when reloading the driver w/o replugging the device
 	 * a timeout occures, this helps
 	 */
 	usb_clear_halt(dib->udev,usb_sndbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd));
@@ -175,7 +175,7 @@ int dibusb_urb_init(struct usb_dibusb *d
 	memset(dib->urb_list,0,dib->dibdev->dev_cl->urb_count*sizeof(struct urb *));
 
 	dib->init_state |= DIBUSB_STATE_URB_LIST;
-	
+
 	bufsize = dib->dibdev->dev_cl->urb_count*dib->dibdev->dev_cl->urb_buffer_size;
 	deb_info("allocate %d bytes as buffersize for all URBs\n",bufsize);
 	/* allocate the actual buffer for the URBs */
@@ -185,7 +185,7 @@ int dibusb_urb_init(struct usb_dibusb *d
 	}
 	deb_info("allocation complete\n");
 	memset(dib->buffer,0,bufsize);
-	
+
 	dib->init_state |= DIBUSB_STATE_URB_BUF;
 
 	/* allocate and submit the URBs */
@@ -194,13 +194,13 @@ int dibusb_urb_init(struct usb_dibusb *d
 			return -ENOMEM;
 		}
 		deb_info("submitting URB no. %d\n",i);
-		
-		usb_fill_bulk_urb( dib->urb_list[i], dib->udev, 
+
+		usb_fill_bulk_urb( dib->urb_list[i], dib->udev,
 				usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data),
-				&dib->buffer[i*dib->dibdev->dev_cl->urb_buffer_size], 
-				dib->dibdev->dev_cl->urb_buffer_size, 
+				&dib->buffer[i*dib->dibdev->dev_cl->urb_buffer_size],
+				dib->dibdev->dev_cl->urb_buffer_size,
 				dibusb_urb_complete, dib);
-		
+
 		dib->urb_list[i]->transfer_flags = 0;
 
 		if ((ret = usb_submit_urb(dib->urb_list[i],GFP_ATOMIC))) {
@@ -222,12 +222,12 @@ int dibusb_urb_init(struct usb_dibusb *d
 			} else
 				info("will use pid_parsing.");
 			break;
-		default: 
+		default:
 			break;
 	}
 	/* from here on it contains the device and user decision */
 	dib->pid_parse = def_pid_parse;
-	
+
 	return 0;
 }
 
@@ -241,7 +241,7 @@ int dibusb_urb_exit(struct usb_dibusb *d
 
 				/* stop the URBs */
 				usb_kill_urb(dib->urb_list[i]);
-				
+
 				deb_info("freeing URB no. %d.\n",i);
 				/* free the URBs */
 				usb_free_urb(dib->urb_list[i]);

--


  parent reply	other threads:[~2005-03-22  4:11 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 01/48] clarify firmware upload messages Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 02/48] dibcom: frontend fixes Johannes Stezenbach
2005-03-22  1:23 ` Johannes Stezenbach [this message]
2005-03-22  1:23 ` [DVB patch 04/48] skystar2: remove duplicate pci_release_region() Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 05/48] mt352: Pinnacle 300i comments Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 06/48] support Activy Budget card Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 07/48] skystar2: update email address Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 08/48] ves1x93: invert_pwm fix Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 09/48] dibusb readme update Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 10/48] dibusb: support Hauppauge WinTV NOVA-T USB2 Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 11/48] nxt2002: QAM64/256 support Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 12/48] get_dvb_firmware: new unshield version Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 13/48] dib3000: corrected device naming Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 14/48] dibusb: debug changes Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 15/48] dibusb: increased the number of urbs for usb1.1 devices Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 16/48] ttusb_dec: use alternative interface to save bandwidth Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 17/48] l64781: email address fix Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 18/48] skystar2: fix MAC address reading Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 19/48] support KWorld/ADSTech Instant DVB-T USB2.0 Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 20/48] cleanups, make stuff static Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 21/48] refactor sw pid filter to drop redundant code Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 22/48] nxt2002: fix max frequency Johannes Stezenbach
2005-03-22  2:43   ` Gene Heskett
2005-03-22  1:23 ` [DVB patch 23/48] ttusb-budget: s/usb_unlink_urb/usb_kill_urb/ Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 24/48] av7110: fix Oops when av7110_ir_init() failed Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 25/48] saa7146: static initialization Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 26/48] av7110: error handling during attach Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 27/48] corrected links to firmware files Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 28/48] support pcHDTV HD2000 Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 29/48] dibusb: support nova-t usb ir Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 30/48] OREN or51211, or51132_qam and or51132_vsb firmware download info Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 31/48] ttusb_dec: IR support Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 32/48] dibusb: pll fix Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 33/48] tda10021: fix continuity errors Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 34/48] saa7146: remove duplicate setgpio Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 35/48] fix CAMs on Typhoon DVB-S Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 36/48] frontends: kfree() cleanup Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 37/48] clear up confusion between ids and adapters Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 38/48] dibusb: remove useless ifdef Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 39/48] support for Technotrend PCI DVB-T Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 40/48] dibusb: HanfTek UMT-010 fixes Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 41/48] vfree() checking cleanups Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 42/48] convert from pci_module_init to pci_register_driver Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 43/48] dibusb: support dtt200u (Yakumo/Typhoon/Hama) USB2.0 device Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 44/48] sparse warnings on one-bit bitfields Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 45/48] support Nova-S rev 2.2 Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 46/48] ttusb_dec: cleanup Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 47/48] gcc 2.95 compile fixes Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 48/48] mt352: cleanups Johannes Stezenbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050322013454.699542000@abc \
    --to=js@linuxtv.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.