Thread (26 messages) 26 messages, 7 authors, 2012-10-15

Re: [PATCH v1] i2c-hid: introduce HID over i2c specification implementation

flat view

From: Jean Delvare <hidden>
Date: 2012-10-06 19:54:54
Also in: linux-i2c, lkml

On Wed, 3 Oct 2012 09:43:12 -0700, Dmitry Torokhov wrote:
On Fri, Sep 14, 2012 at 03:41:43PM +0200, benjamin.tissoires wrote:
quoted
+	}
+
+	do {
+		ret = i2c_transfer(client->adapter, msg, msg_num);
+		if (ret > 0)
+			break;
+		tries--;
+		dev_dbg(&client->dev, "retrying i2chid_command:%d (%d)\n",
+			command, tries);
+	} while (tries > 0);
+
+	if (wait && ret > 0) {
+		if (debug)
+			dev_err(&client->dev, "%s: waiting....\n", __func__);
+		if (!wait_event_timeout(ihid->wait,
+				!test_bit(I2C_HID_RESET_PENDING, &ihid->flags),
+				msecs_to_jiffies(5000)))
+			ret = -ENODATA;
+		if (debug)
+			dev_err(&client->dev, "%s: finished.\n", __func__);
Why do we have error level messages with debug? I know dev_dbg is
compiled out if !DEBUG, but there must be a better way. Maybe define
i2c_hid_dbg() via dev_printk() and also check debug condition there?
dev_dbg() is compiled out if !DEBUG only if CONFIG_DYNAMIC_DEBUG isn't
set. These days I think every developer want to enable this option.

-- 
Jean Delvare
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help