Skip to contentSkip to conversation

media: don't print error when adding adapter fails

PATCH In review Wolfram Sang 3 participants 9 messages Aug 9, 2016 – Aug 10, 2016 1 message not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover media: don't print error when adding adapter fails

Since v4.8-rc1, the I2C core will print detailed information when adding an I2C adapter fails. So, drivers can skip this now.

Should go via subsystem tree, I'd think.

Wolfram Sang (4):
media: pci: netup_unidvb: don't print error when adding adapter fails
media: pci: pt3: don't print error when adding adapter fails
media: platform: exynos4-is: fimc-is-i2c: don't print error when
adding adapter fails
media: usb: dvb-usb-v2: dvb_usb_core: don't print error when adding
adapter fails

 drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 5 +----
 drivers/media/pci/pt3/pt3.c                       | 4 +---
 drivers/media/platform/exynos4-is/fimc-is-i2c.c   | 5 +----
 drivers/media/usb/dvb-usb-v2/dvb_usb_core.c       | 2 --
 4 files changed, 3 insertions(+), 13 deletions(-)
Signature · 1 line
2.8.1
#7 lore raw

PATCH 2/4 media: pci: pt3: don't print error when adding adapter fails

The core will do this for us now.

---
 drivers/media/pci/pt3/pt3.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/pci/pt3/pt3.c +1 -3
index eff5e9f51ace3d..7fb649e523f46e 100644
@@ -798,10 +798,8 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	strlcpy(i2c->name, DRV_NAME, sizeof(i2c->name));
 	i2c_set_adapdata(i2c, pt3);
 	ret = i2c_add_adapter(i2c);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "Failed to add i2c adapter\n");
+	if (ret < 0)
 		goto err_i2cbuf;
-	}
 
 	for (i = 0; i < PT3_NUM_FE; i++) {
 		ret = pt3_alloc_adapter(pt3, i);
Signature · 1 line
2.8.1
#8 lore raw

PATCH 3/4 media: platform: exynos4-is: fimc-is-i2c: don't print error when adding adapter fails

In reply to Wolfram Sang

The core will do this for us now.

---
 drivers/media/platform/exynos4-is/fimc-is-i2c.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/platform/exynos4-is/fimc-is-i2c.c +1 -4
index 7521aa59b0649c..fd888ef447a903 100644
@@ -56,11 +56,8 @@ static int fimc_is_i2c_probe(struct platform_device *pdev)
 	i2c_adap->class = I2C_CLASS_SPD;
 
 	ret = i2c_add_adapter(i2c_adap);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to add I2C bus %s\n",
-						node->full_name);
+	if (ret < 0)
 		return ret;
-	}
 
 	platform_set_drvdata(pdev, isp_i2c);
 
Signature · 1 line
2.8.1
#9 lore raw

PATCH 4/4 media: usb: dvb-usb-v2: dvb_usb_core: don't print error when adding adapter fails

In reply to Wolfram Sang

The core will do this for us now.

---
 drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +0 -2
index 3fbb2cd19f5e2a..a8e6624fbe8347 100644
@@ -82,8 +82,6 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
 	ret = i2c_add_adapter(&d->i2c_adap);
 	if (ret < 0) {
 		d->i2c_adap.algo = NULL;
-		dev_err(&d->udev->dev, "%s: i2c_add_adapter() failed=%d\n",
-				KBUILD_MODNAME, ret);
 		goto err;
 	}
 
Signature · 1 line
2.8.1
#1 lore raw

PATCH 1/4 media: pci: netup_unidvb: don't print error when adding adapter fails

In reply to Wolfram Sang

The core will do this for us now.

---
 drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c +1 -4
index c09c52bc6eabef..b49e4f9788e869 100644
@@ -327,11 +327,8 @@ static int netup_i2c_init(struct netup_unidvb_dev *ndev, int bus_num)
 	i2c->adap.dev.parent = &ndev->pci_dev->dev;
 	i2c_set_adapdata(&i2c->adap, i2c);
 	ret = i2c_add_adapter(&i2c->adap);
-	if (ret) {
-		dev_err(&ndev->pci_dev->dev,
-			"%s(): failed to add I2C adapter\n", __func__);
+	if (ret)
 		return ret;
-	}
 	dev_info(&ndev->pci_dev->dev,
 		"%s(): registered I2C bus %d at 0x%x\n",
 		__func__,
Signature · 1 line
2.8.1
#3 lore raw

Re: [PATCH 1/4] media: pci: netup_unidvb: don't print error when adding adapter fails

In reply to a message not in the archive
Quoted 2 lines

Sometimes it better to show more message - especially in error conditions :)

Sure, if they contain additional information.

Quoted 1 line

btw, do you make sanity check for "duplicate" log messages ?

I checked all error messages if they contain additional information.

Quoted 7 lines
            ret = i2c_add_adapter(&i2c->adap);
    -       if (ret) {
    -               dev_err(&ndev->pci_dev->dev,
    -                       "%s(): failed to add I2C adapter\n", __func__);
    +       if (ret)
                    return ret;
    -       }

IMHO, this one doesn't. __func__ is not helpful to users. And the error messages in the core will make sure that a developer knows where to start looking.

Acked-by
#4 lore raw

Re: [PATCH 1/4] media: pci: netup_unidvb: don't print error when adding adapter fails

yes, you right. If we remove this message there is no big problem. But if we do not remove this it's also ok, right ? What the big deal to remove this type of messages (i'm just interested) ?

For me it's ok to remove:

2016-08-09 10:58 GMT-04:00 Wolfram Sang <[email protected]>:

Quoted 21 lines
Quoted 2 lines

Sometimes it better to show more message - especially in error conditions :)

Sure, if they contain additional information.

Quoted 1 line

btw, do you make sanity check for "duplicate" log messages ?

I checked all error messages if they contain additional information.

Quoted 7 lines

ret = i2c_add_adapter(&i2c->adap);
- if (ret) {
- dev_err(&ndev->pci_dev->dev,
- "%s(): failed to add I2C adapter\n", __func__);
+ if (ret)
return ret;
- }

IMHO, this one doesn't. __func__ is not helpful to users. And the error messages in the core will make sure that a developer knows where to start looking.

Signature · 3 lines
Abylay Ospan,
NetUP Inc.
http://www.netup.tv
#5 lore raw

Re: [PATCH 1/4] media: pci: netup_unidvb: don't print error when adding adapter fails

Quoted 3 lines

if we do not remove this it's also ok, right ? What the big deal to remove this type of messages (i'm just interested) ?

* Saving memory, especially at runtime.
* Giving consistent and precise error messages

This series is a first step of trying to move generic error messages from drivers to subsystem cores.

#6 lore raw

Re: [PATCH 1/4] media: pci: netup_unidvb: don't print error when adding adapter fails

make sense. thanks for explaining and for patch !

2016-08-10 10:56 GMT-04:00 Wolfram Sang <[email protected]>:

Quoted 10 lines
Quoted 3 lines

if we do not remove this it's also ok, right ? What the big deal to remove this type of messages (i'm just interested) ?

* Saving memory, especially at runtime.
* Giving consistent and precise error messages

This series is a first step of trying to move generic error messages from drivers to subsystem cores.

Signature · 3 lines
Abylay Ospan,
NetUP Inc.
http://www.netup.tv