mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mchehab@infradead.org
To: linux-kernel@vger.kernel.org
Cc: linux-dvb-maintainer@linuxtv.org,
	Markus Rechberger <mrechberger@gmail.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: [PATCH 07/16] Fixed i2c return value, conversion mdelay to msleep
Date: Tue, 07 Feb 2006 13:33:31 -0200	[thread overview]
Message-ID: <20060207153331.PS65523100007@infradead.org> (raw)
In-Reply-To: <20060207153248.PS50860900000@infradead.org>

From: Markus Rechberger <mrechberger@gmail.com>

fixed i2c return value, conversion mdelay to msleep

Signed-off-by: Markus Rechberger <mrechberger@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---

 drivers/media/video/em28xx/em28xx-core.c |   15 +++++++++++++--
 drivers/media/video/em28xx/em28xx-i2c.c  |    8 ++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 82f0c5f..e5ee8bc 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -139,6 +139,9 @@ int em28xx_read_reg_req_len(struct em28x
 {
 	int ret, byte;
 
+	if (dev->state & DEV_DISCONNECTED)
+		return(-ENODEV);
+
 	em28xx_regdbg("req=%02x, reg=%02x ", req, reg);
 
 	ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
@@ -165,6 +168,9 @@ int em28xx_read_reg_req(struct em28xx *d
 	u8 val;
 	int ret;
 
+	if (dev->state & DEV_DISCONNECTED)
+		return(-ENODEV);
+
 	em28xx_regdbg("req=%02x, reg=%02x:", req, reg);
 
 	ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
@@ -195,7 +201,12 @@ int em28xx_write_regs_req(struct em28xx 
 	int ret;
 
 	/*usb_control_msg seems to expect a kmalloced buffer */
-	unsigned char *bufs = kmalloc(len, GFP_KERNEL);
+	unsigned char *bufs;
+
+	if (dev->state & DEV_DISCONNECTED)
+		return(-ENODEV);
+
+	bufs = kmalloc(len, GFP_KERNEL);
 
 	em28xx_regdbg("req=%02x reg=%02x:", req, reg);
 
@@ -212,7 +223,7 @@ int em28xx_write_regs_req(struct em28xx 
 	ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req,
 			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			      0x0000, reg, bufs, len, HZ);
-	mdelay(5);		/* FIXME: magic number */
+	msleep(5);		/* FIXME: magic number */
 	kfree(bufs);
 	return ret;
 }
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 0591a70..6ca8631 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -78,7 +78,7 @@ static int em2800_i2c_send_max4(struct e
 		ret = dev->em28xx_read_reg(dev, 0x05);
 		if (ret == 0x80 + len - 1)
 			return len;
-		mdelay(5);
+		msleep(5);
 	}
 	em28xx_warn("i2c write timed out\n");
 	return -EIO;
@@ -138,7 +138,7 @@ static int em2800_i2c_check_for_device(s
 			return -ENODEV;
 		else if (msg == 0x84)
 			return 0;
-		mdelay(5);
+		msleep(5);
 	}
 	return -ENODEV;
 }
@@ -278,9 +278,9 @@ static int em28xx_i2c_xfer(struct i2c_ad
 							   msgs[i].buf,
 							   msgs[i].len,
 							   i == num - 1);
-			if (rc < 0)
-				goto err;
 		}
+		if (rc < 0)
+			goto err;
 		if (i2c_debug>=2)
 			printk("\n");
 	}


  parent reply	other threads:[~2006-02-07 15:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07 15:32 [PATCH 00/16] V4L/DVB updates mchehab
2006-02-07 15:33 ` [PATCH 01/16] Kconfig: DVB_USB_CXUSB depends on DVB_LGDT330X and DVB_MT352 mchehab
2006-02-07 15:33 ` [PATCH 02/16] Fix NICAM buzz on analog sound mchehab
2006-02-07 15:33 ` [PATCH 04/16] Fix [Bug 5895] to correct snd_87x autodetect mchehab
2006-02-08  0:24   ` Edgar Toernig
2006-02-08  1:08     ` Manu Abraham
2006-02-07 15:33 ` [PATCH 05/16] Add IR support to KWorld DVB-T (cx22702-based) mchehab
2006-02-07 15:33 ` [PATCH 03/16] Added signal detection support to tvp5150 mchehab
2006-02-07 15:33 ` mchehab [this message]
2006-02-07 20:52   ` [v4l-dvb-maintainer] [PATCH 07/16] Fixed i2c return value, conversion mdelay to msleep Andreas Oberritter
2006-02-07 21:49     ` Markus Rechberger
2006-02-07 15:33 ` [PATCH 06/16] Add standard for South Korean NTSC-M using A2 audio mchehab
2006-02-07 15:33 ` [PATCH 10/16] Use MT352 parallel transport function for all Bluebird FusionHDTV DVB-T boxes mchehab
2006-02-07 15:33 ` [PATCH 08/16] Support for Galaxis DVB-S rev1.3 mchehab
2006-02-07 15:33 ` [PATCH 09/16] Use parallel transport for FusionHDTV Dual Digital USB mchehab
2006-02-07 15:33 ` [PATCH 12/16] FIX: Check if FW was downloaded or not + new firmware file mchehab
2006-02-07 15:33 ` [PATCH 11/16] FIX: Multiple usage of VP7045-based devices mchehab
2006-02-07 15:33 ` [PATCH 15/16] DVB: remove the at76c651/tda80xx frontends mchehab
2006-02-07 15:33 ` [PATCH 13/16] Makes Some symbols static mchehab
2006-02-07 15:33 ` [PATCH 14/16] fix saa7146 kobject register failure mchehab
2006-02-07 15:33 ` [PATCH 16/16] Disabled debug on by default in tvp5150 mchehab

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=20060207153331.PS65523100007@infradead.org \
    --to=mchehab@infradead.org \
    --cc=linux-dvb-maintainer@linuxtv.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrechberger@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome