linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dvbsky: don't print MAC address from read_mac_address
@ 2014-10-12 10:03 Olli Salonen
  2014-10-12 10:03 ` [PATCH 2/4] dvbsky: added debug logging Olli Salonen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Olli Salonen @ 2014-10-12 10:03 UTC (permalink / raw)
  To: linux-media; +Cc: nibble.max, Olli Salonen

The dvb-usb-v2 already prints out the MAC address, no need to print it out also here.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 34688c8..502b52c 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -265,8 +265,6 @@ static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6])
 	if (i2c_transfer(&d->i2c_adap, msg, 2) == 2)
 		memcpy(mac, ibuf, 6);
 
-	dev_info(&d->udev->dev, "dvbsky_usb MAC address=%pM\n", mac);
-
 	return 0;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] dvbsky: added debug logging
  2014-10-12 10:03 [PATCH 1/4] dvbsky: don't print MAC address from read_mac_address Olli Salonen
@ 2014-10-12 10:03 ` Olli Salonen
  2014-11-03 13:04   ` Mauro Carvalho Chehab
  2014-10-12 10:03 ` [PATCH 3/4] dvbsky: clean logging Olli Salonen
  2014-10-12 10:03 ` [PATCH 4/4] dvbsky: add option to disable IR receiver Olli Salonen
  2 siblings, 1 reply; 9+ messages in thread
From: Olli Salonen @ 2014-10-12 10:03 UTC (permalink / raw)
  To: linux-media; +Cc: nibble.max, Olli Salonen

Added debug logging using dev_dgb.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 502b52c..fabe3f5 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -68,6 +68,9 @@ static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff)
 	u8 obuf_pre[3] = { 0x37, 0, 0 };
 	u8 obuf_post[3] = { 0x36, 3, 0 };
 
+	dev_dbg(&d->udev->dev, "state: %s\n", (onoff == 1)
+			? "on" : "off");
+
 	mutex_lock(&state->stream_mutex);
 	ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0);
 	if (!ret && onoff) {
@@ -91,6 +94,8 @@ static int dvbsky_gpio_ctrl(struct dvb_usb_device *d, u8 gport, u8 value)
 	int ret;
 	u8 obuf[3], ibuf[2];
 
+	dev_dbg(&d->udev->dev, "gport: %d, value: %d\n", gport, value);
+
 	obuf[0] = 0x0e;
 	obuf[1] = gport;
 	obuf[2] = value;
@@ -234,6 +239,9 @@ static int dvbsky_usb_set_voltage(struct dvb_frontend *fe,
 	struct dvbsky_state *state = d_to_priv(d);
 	u8 value;
 
+	dev_dbg(&d->udev->dev, "voltage: %s\n",
+			(voltage == SEC_VOLTAGE_OFF) ? "off" : "on");
+
 	if (voltage == SEC_VOLTAGE_OFF)
 		value = 0;
 	else
@@ -262,8 +270,10 @@ static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6])
 		}
 	};
 
-	if (i2c_transfer(&d->i2c_adap, msg, 2) == 2)
+	if (i2c_transfer(&d->i2c_adap, msg, 2) == 2) {
 		memcpy(mac, ibuf, 6);
+		dev_dbg(&d->udev->dev, "MAC: %pM\n", ibuf);
+	}
 
 	return 0;
 }
@@ -274,6 +284,8 @@ static int dvbsky_usb_read_status(struct dvb_frontend *fe, fe_status_t *status)
 	struct dvbsky_state *state = d_to_priv(d);
 	int ret;
 
+	dev_dbg(&d->udev->dev, "\n");
+
 	ret = state->fe_read_status(fe, status);
 
 	/* it need resync slave fifo when signal change from unlock to lock.*/
@@ -309,6 +321,9 @@ static int dvbsky_s960_attach(struct dvb_usb_adapter *adap)
 	struct m88ts2022_config m88ts2022_config = {
 			.clock = 27000000,
 		};
+
+	dev_dbg(&d->udev->dev, "\n");
+
 	memset(&info, 0, sizeof(struct i2c_board_info));
 
 	/* attach demod */
@@ -362,6 +377,8 @@ fail_attach:
 
 static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name)
 {
+	dev_dbg(&d->udev->dev, "\n");
+
 	dvbsky_gpio_ctrl(d, 0x04, 1);
 	msleep(20);
 	dvbsky_gpio_ctrl(d, 0x83, 0);
@@ -378,6 +395,8 @@ static int dvbsky_init(struct dvb_usb_device *d)
 {
 	struct dvbsky_state *state = d_to_priv(d);
 
+	dev_dbg(&d->udev->dev, "\n");
+
 	/* use default interface */
 	/*
 	ret = usb_set_interface(d->udev, 0, 0);
@@ -396,6 +415,8 @@ static void dvbsky_exit(struct dvb_usb_device *d)
 	struct dvbsky_state *state = d_to_priv(d);
 	struct i2c_client *client;
 
+	dev_dbg(&d->udev->dev, "\n");
+
 	client = state->i2c_client_tuner;
 	/* remove I2C tuner */
 	if (client) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] dvbsky: clean logging
  2014-10-12 10:03 [PATCH 1/4] dvbsky: don't print MAC address from read_mac_address Olli Salonen
  2014-10-12 10:03 ` [PATCH 2/4] dvbsky: added debug logging Olli Salonen
@ 2014-10-12 10:03 ` Olli Salonen
  2014-10-12 10:03 ` [PATCH 4/4] dvbsky: add option to disable IR receiver Olli Salonen
  2 siblings, 0 replies; 9+ messages in thread
From: Olli Salonen @ 2014-10-12 10:03 UTC (permalink / raw)
  To: linux-media; +Cc: nibble.max, Olli Salonen

dev_err includes the function name in the log printout, so there is no need to include it manually. While here, fix a small grammatical error in the i2c error message.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index fabe3f5..5c7387a 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -101,8 +101,7 @@ static int dvbsky_gpio_ctrl(struct dvb_usb_device *d, u8 gport, u8 value)
 	obuf[2] = value;
 	ret = dvbsky_usb_generic_rw(d, obuf, 3, ibuf, 1);
 	if (ret)
-		dev_err(&d->udev->dev, "%s: %s() failed=%d\n",
-			KBUILD_MODNAME, __func__, ret);
+		dev_err(&d->udev->dev, "failed=%d\n", ret);
 	return ret;
 }
 
@@ -119,7 +118,7 @@ static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 
 	if (num > 2) {
 		dev_err(&d->udev->dev,
-		"dvbsky_usb: too many i2c messages[%d] than 2.", num);
+		"too many i2c messages[%d], max 2.", num);
 		ret = -EOPNOTSUPP;
 		goto i2c_error;
 	}
@@ -127,7 +126,7 @@ static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 	if (num == 1) {
 		if (msg[0].len > 60) {
 			dev_err(&d->udev->dev,
-			"dvbsky_usb: too many i2c bytes[%d] than 60.",
+			"too many i2c bytes[%d], max 60.",
 			msg[0].len);
 			ret = -EOPNOTSUPP;
 			goto i2c_error;
@@ -141,8 +140,7 @@ static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 			ret = dvbsky_usb_generic_rw(d, obuf, 4,
 					ibuf, msg[0].len + 1);
 			if (ret)
-				dev_err(&d->udev->dev, "%s: %s() failed=%d\n",
-					KBUILD_MODNAME, __func__, ret);
+				dev_err(&d->udev->dev, "failed=%d\n", ret);
 			if (!ret)
 				memcpy(msg[0].buf, &ibuf[1], msg[0].len);
 		} else {
@@ -154,13 +152,12 @@ static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 			ret = dvbsky_usb_generic_rw(d, obuf,
 					msg[0].len + 3, ibuf, 1);
 			if (ret)
-				dev_err(&d->udev->dev, "%s: %s() failed=%d\n",
-					KBUILD_MODNAME, __func__, ret);
+				dev_err(&d->udev->dev, "failed=%d\n", ret);
 		}
 	} else {
 		if ((msg[0].len > 60) || (msg[1].len > 60)) {
 			dev_err(&d->udev->dev,
-			"dvbsky_usb: too many i2c bytes[w-%d][r-%d] than 60.",
+			"too many i2c bytes[w-%d][r-%d], max 60.",
 			msg[0].len, msg[1].len);
 			ret = -EOPNOTSUPP;
 			goto i2c_error;
@@ -174,8 +171,7 @@ static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 		ret = dvbsky_usb_generic_rw(d, obuf,
 			msg[0].len + 4, ibuf, msg[1].len + 1);
 		if (ret)
-			dev_err(&d->udev->dev, "%s: %s() failed=%d\n",
-				KBUILD_MODNAME, __func__, ret);
+			dev_err(&d->udev->dev, "failed=%d\n", ret);
 
 		if (!ret)
 			memcpy(msg[1].buf, &ibuf[1], msg[1].len);
@@ -206,8 +202,7 @@ static int dvbsky_rc_query(struct dvb_usb_device *d)
 	obuf[0] = 0x10;
 	ret = dvbsky_usb_generic_rw(d, obuf, 1, ibuf, 2);
 	if (ret)
-		dev_err(&d->udev->dev, "%s: %s() failed=%d\n",
-			KBUILD_MODNAME, __func__, ret);
+		dev_err(&d->udev->dev, "failed=%d\n", ret);
 	if (ret == 0)
 		code = (ibuf[0] << 8) | ibuf[1];
 	if (code != 0xffff) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] dvbsky: add option to disable IR receiver
  2014-10-12 10:03 [PATCH 1/4] dvbsky: don't print MAC address from read_mac_address Olli Salonen
  2014-10-12 10:03 ` [PATCH 2/4] dvbsky: added debug logging Olli Salonen
  2014-10-12 10:03 ` [PATCH 3/4] dvbsky: clean logging Olli Salonen
@ 2014-10-12 10:03 ` Olli Salonen
  2014-10-12 10:12   ` Antti Palosaari
  2 siblings, 1 reply; 9+ messages in thread
From: Olli Salonen @ 2014-10-12 10:03 UTC (permalink / raw)
  To: linux-media; +Cc: nibble.max, Olli Salonen

Added an option disable_rc that can be used to disable the IR receiver polling for this module.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 5c7387a..71a3324 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -25,6 +25,10 @@
 #define DVBSKY_MSG_DELAY	0/*2000*/
 #define DVBSKY_BUF_LEN	64
 
+static int dvb_usb_dvbsky_disable_rc;
+module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644);
+MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver.");
+
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 struct dvbsky_state {
@@ -218,6 +222,10 @@ static int dvbsky_rc_query(struct dvb_usb_device *d)
 
 static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 {
+	if (dvb_usb_dvbsky_disable_rc)
+		return 0;
+
+	rc->map_name       = RC_MAP_DVBSKY;
 	rc->allowed_protos = RC_BIT_RC5;
 	rc->query          = dvbsky_rc_query;
 	rc->interval       = 300;
@@ -450,7 +458,7 @@ static struct dvb_usb_device_properties dvbsky_s960_props = {
 
 static const struct usb_device_id dvbsky_id_table[] = {
 	{ DVB_USB_DEVICE(0x0572, 0x6831,
-		&dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) },
+		&dvbsky_s960_props, "DVBSky S960/S860", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, dvbsky_id_table);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] dvbsky: add option to disable IR receiver
  2014-10-12 10:03 ` [PATCH 4/4] dvbsky: add option to disable IR receiver Olli Salonen
@ 2014-10-12 10:12   ` Antti Palosaari
  2014-10-12 10:52     ` Olli Salonen
  0 siblings, 1 reply; 9+ messages in thread
From: Antti Palosaari @ 2014-10-12 10:12 UTC (permalink / raw)
  To: Olli Salonen, linux-media; +Cc: nibble.max



On 10/12/2014 01:03 PM, Olli Salonen wrote:
> Added an option disable_rc that can be used to disable the IR receiver polling for this module.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
>   drivers/media/usb/dvb-usb-v2/dvbsky.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> index 5c7387a..71a3324 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -25,6 +25,10 @@
>   #define DVBSKY_MSG_DELAY	0/*2000*/
>   #define DVBSKY_BUF_LEN	64
>
> +static int dvb_usb_dvbsky_disable_rc;
> +module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644);
> +MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver.");
> +
>   DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>
>   struct dvbsky_state {
> @@ -218,6 +222,10 @@ static int dvbsky_rc_query(struct dvb_usb_device *d)
>
>   static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
>   {
> +	if (dvb_usb_dvbsky_disable_rc)
> +		return 0;
> +
> +	rc->map_name       = RC_MAP_DVBSKY;
>   	rc->allowed_protos = RC_BIT_RC5;
>   	rc->query          = dvbsky_rc_query;
>   	rc->interval       = 300;
> @@ -450,7 +458,7 @@ static struct dvb_usb_device_properties dvbsky_s960_props = {
>
>   static const struct usb_device_id dvbsky_id_table[] = {
>   	{ DVB_USB_DEVICE(0x0572, 0x6831,
> -		&dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) },
> +		&dvbsky_s960_props, "DVBSky S960/S860", NULL) },

Why you removed default keytable too?

>   	{ }
>   };
>   MODULE_DEVICE_TABLE(usb, dvbsky_id_table);
>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] dvbsky: add option to disable IR receiver
  2014-10-12 10:12   ` Antti Palosaari
@ 2014-10-12 10:52     ` Olli Salonen
  2014-10-12 11:31       ` [PATCHv2 " Olli Salonen
  0 siblings, 1 reply; 9+ messages in thread
From: Olli Salonen @ 2014-10-12 10:52 UTC (permalink / raw)
  To: linux-media

On 12.10.2014 13:12, Antti Palosaari wrote:
>>   static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct 
>> dvb_usb_rc *rc)
>>   {
>> +    if (dvb_usb_dvbsky_disable_rc)
>> +        return 0;
>> +
>> +    rc->map_name       = RC_MAP_DVBSKY;
>>       rc->allowed_protos = RC_BIT_RC5;
>>       rc->query          = dvbsky_rc_query;
>>       rc->interval       = 300;
>> @@ -450,7 +458,7 @@ static struct dvb_usb_device_properties 
>> dvbsky_s960_props = {
>>
>>   static const struct usb_device_id dvbsky_id_table[] = {
>>       { DVB_USB_DEVICE(0x0572, 0x6831,
>> -        &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) },
>> +        &dvbsky_s960_props, "DVBSky S960/S860", NULL) },
>
> Why you removed default keytable too?
>
I initially thought that it would make sense to set all RC related 
parameters in the get_rc_config function. Of couse I could set 
RC_MAP_DVBSKY as default map and then set it to NULL only if the remote 
controller is disabled. Now that I think of it, it's probably better to 
do it this way. The next DVBSky OEM device might come with another 
remote controller, and we don't want to implement the map selection 
logic into the get_rc_config.

In general I did not see many modules with IR disable function. Is this 
the right way to implement it? I noticed that dvb-usb-v2 had an option 
to disable IR polling, but that will disable it for all dvb-usb-v2 
modules. I have 2 adapters in my HTPC setup and want to disable the IR 
only for the device that uses the dvbsky module.

-olli

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCHv2 4/4] dvbsky: add option to disable IR receiver
  2014-10-12 10:52     ` Olli Salonen
@ 2014-10-12 11:31       ` Olli Salonen
  0 siblings, 0 replies; 9+ messages in thread
From: Olli Salonen @ 2014-10-12 11:31 UTC (permalink / raw)
  To: linux-media; +Cc: crope

Add an option to disable remote controller for DVBSky devices by specifying the disable_rc option at modprobe.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>

---

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 5c7387a..f2d0eb7 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -25,6 +25,10 @@
 #define DVBSKY_MSG_DELAY	0/*2000*/
 #define DVBSKY_BUF_LEN	64
 
+static int dvb_usb_dvbsky_disable_rc;
+module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644);
+MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver.");
+
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 struct dvbsky_state {
@@ -218,6 +222,11 @@ static int dvbsky_rc_query(struct dvb_usb_device *d)
 
 static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 {
+	if (dvb_usb_dvbsky_disable_rc) {
+		rc->map_name = NULL;
+		return 0;
+	}
+
 	rc->allowed_protos = RC_BIT_RC5;
 	rc->query          = dvbsky_rc_query;
 	rc->interval       = 300;


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] dvbsky: added debug logging
  2014-10-12 10:03 ` [PATCH 2/4] dvbsky: added debug logging Olli Salonen
@ 2014-11-03 13:04   ` Mauro Carvalho Chehab
  2014-11-03 13:39     ` Antti Palosaari
  0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2014-11-03 13:04 UTC (permalink / raw)
  To: Olli Salonen; +Cc: linux-media, nibble.max

Em Sun, 12 Oct 2014 13:03:09 +0300
Olli Salonen <olli.salonen@iki.fi> escreveu:

> Added debug logging using dev_dgb.
> 
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
>  drivers/media/usb/dvb-usb-v2/dvbsky.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> index 502b52c..fabe3f5 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -68,6 +68,9 @@ static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff)
>  	u8 obuf_pre[3] = { 0x37, 0, 0 };
>  	u8 obuf_post[3] = { 0x36, 3, 0 };
>  
> +	dev_dbg(&d->udev->dev, "state: %s\n", (onoff == 1)
> +			? "on" : "off");
> +
>  	mutex_lock(&state->stream_mutex);
>  	ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0);
>  	if (!ret && onoff) {
> @@ -91,6 +94,8 @@ static int dvbsky_gpio_ctrl(struct dvb_usb_device *d, u8 gport, u8 value)
>  	int ret;
>  	u8 obuf[3], ibuf[2];
>  
> +	dev_dbg(&d->udev->dev, "gport: %d, value: %d\n", gport, value);
> +
>  	obuf[0] = 0x0e;
>  	obuf[1] = gport;
>  	obuf[2] = value;
> @@ -234,6 +239,9 @@ static int dvbsky_usb_set_voltage(struct dvb_frontend *fe,
>  	struct dvbsky_state *state = d_to_priv(d);
>  	u8 value;
>  
> +	dev_dbg(&d->udev->dev, "voltage: %s\n",
> +			(voltage == SEC_VOLTAGE_OFF) ? "off" : "on");
> +
>  	if (voltage == SEC_VOLTAGE_OFF)
>  		value = 0;
>  	else
> @@ -262,8 +270,10 @@ static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6])
>  		}
>  	};
>  
> -	if (i2c_transfer(&d->i2c_adap, msg, 2) == 2)
> +	if (i2c_transfer(&d->i2c_adap, msg, 2) == 2) {
>  		memcpy(mac, ibuf, 6);
> +		dev_dbg(&d->udev->dev, "MAC: %pM\n", ibuf);
> +	}
>  
>  	return 0;
>  }
> @@ -274,6 +284,8 @@ static int dvbsky_usb_read_status(struct dvb_frontend *fe, fe_status_t *status)
>  	struct dvbsky_state *state = d_to_priv(d);
>  	int ret;
>  
> +	dev_dbg(&d->udev->dev, "\n");
> +
>  	ret = state->fe_read_status(fe, status);
>  
>  	/* it need resync slave fifo when signal change from unlock to lock.*/
> @@ -309,6 +321,9 @@ static int dvbsky_s960_attach(struct dvb_usb_adapter *adap)
>  	struct m88ts2022_config m88ts2022_config = {
>  			.clock = 27000000,
>  		};
> +
> +	dev_dbg(&d->udev->dev, "\n");
> +
>  	memset(&info, 0, sizeof(struct i2c_board_info));
>  
>  	/* attach demod */
> @@ -362,6 +377,8 @@ fail_attach:
>  
>  static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name)
>  {
> +	dev_dbg(&d->udev->dev, "\n");
> +
>  	dvbsky_gpio_ctrl(d, 0x04, 1);
>  	msleep(20);
>  	dvbsky_gpio_ctrl(d, 0x83, 0);
> @@ -378,6 +395,8 @@ static int dvbsky_init(struct dvb_usb_device *d)
>  {
>  	struct dvbsky_state *state = d_to_priv(d);
>  
> +	dev_dbg(&d->udev->dev, "\n");
> +
>  	/* use default interface */
>  	/*
>  	ret = usb_set_interface(d->udev, 0, 0);
> @@ -396,6 +415,8 @@ static void dvbsky_exit(struct dvb_usb_device *d)
>  	struct dvbsky_state *state = d_to_priv(d);
>  	struct i2c_client *client;
>  
> +	dev_dbg(&d->udev->dev, "\n");
> +

No need to add new debug macros that only prints the called functions,
as you could get it too with Kernel tracing.

>  	client = state->i2c_client_tuner;
>  	/* remove I2C tuner */
>  	if (client) {

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] dvbsky: added debug logging
  2014-11-03 13:04   ` Mauro Carvalho Chehab
@ 2014-11-03 13:39     ` Antti Palosaari
  0 siblings, 0 replies; 9+ messages in thread
From: Antti Palosaari @ 2014-11-03 13:39 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Olli Salonen; +Cc: linux-media, nibble.max

On 11/03/2014 03:04 PM, Mauro Carvalho Chehab wrote:
> Em Sun, 12 Oct 2014 13:03:09 +0300
> Olli Salonen <olli.salonen@iki.fi> escreveu:
>
>> Added debug logging using dev_dgb.


>> @@ -396,6 +415,8 @@ static void dvbsky_exit(struct dvb_usb_device *d)
>>   	struct dvbsky_state *state = d_to_priv(d);
>>   	struct i2c_client *client;
>>
>> +	dev_dbg(&d->udev->dev, "\n");
>> +
>
> No need to add new debug macros that only prints the called functions,
> as you could get it too with Kernel tracing.

ftrace [1] is a bit heavy tool for module debugs like that. There is 
many different debugs for different use cases. When you add debugs to 
module those are usually used just to see how your module works and 
functions are called. Same is for V4L core debugs too; enable those and 
you will get tons of unneeded/useless information which makes totally 
hard to develop driver in question. When you add debugs to driver 
module, those are generally useful for cases where you want develop that 
certain driver module and not see zillion lines of unrelated debug data.

Also, I think that kind of debug log will not generate any binary code 
when debug options are not enabled by Kconfig, so it is not even reason 
for optimization.

[1] https://www.kernel.org/doc/Documentation/trace/ftrace.txt

regards
Antti

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-03 13:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-12 10:03 [PATCH 1/4] dvbsky: don't print MAC address from read_mac_address Olli Salonen
2014-10-12 10:03 ` [PATCH 2/4] dvbsky: added debug logging Olli Salonen
2014-11-03 13:04   ` Mauro Carvalho Chehab
2014-11-03 13:39     ` Antti Palosaari
2014-10-12 10:03 ` [PATCH 3/4] dvbsky: clean logging Olli Salonen
2014-10-12 10:03 ` [PATCH 4/4] dvbsky: add option to disable IR receiver Olli Salonen
2014-10-12 10:12   ` Antti Palosaari
2014-10-12 10:52     ` Olli Salonen
2014-10-12 11:31       ` [PATCHv2 " Olli Salonen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).