From patchwork Wed Sep 28 08:15:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 676046 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3skVsC5Gw7z9sC4 for ; Wed, 28 Sep 2016 18:16:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbcI1IQE (ORCPT ); Wed, 28 Sep 2016 04:16:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33870 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbcI1IQC (ORCPT ); Wed, 28 Sep 2016 04:16:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 194647EAB0; Wed, 28 Sep 2016 08:16:02 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-116-65.ams2.redhat.com [10.36.116.65]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8S8FoBn031570; Wed, 28 Sep 2016 04:16:00 -0400 From: Benjamin Tissoires To: Jean Delvare , Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 06/10] i2c: i801: do not report an error if FEATURE_HOST_NOTIFY is not set Date: Wed, 28 Sep 2016 10:15:45 +0200 Message-Id: <1475050549-25542-7-git-send-email-benjamin.tissoires@redhat.com> In-Reply-To: <1475050549-25542-1-git-send-email-benjamin.tissoires@redhat.com> References: <1475050549-25542-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 28 Sep 2016 08:16:02 +0000 (UTC) Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org we can skip one test when calling i801_enable_host_notify(). Given that we call it all the time, it's better to consider the fact that the adapter doesn't support Host Notify as not an error. Reviewed-by: Jean Delvare Signed-off-by: Benjamin Tissoires --- no changes in v3 no changes in v2 --- drivers/i2c/busses/i2c-i801.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 55fa6e1..422cce2 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -944,12 +944,13 @@ static int i801_enable_host_notify(struct i2c_adapter *adapter) struct i801_priv *priv = i2c_get_adapdata(adapter); if (!(priv->features & FEATURE_HOST_NOTIFY)) - return -ENOTSUPP; + return 0; /* not an error actually */ - if (!priv->host_notify) + if (!priv->host_notify) { priv->host_notify = i2c_setup_smbus_host_notify(adapter); - if (!priv->host_notify) - return -ENOMEM; + if (!priv->host_notify) + return -ENOMEM; + } priv->original_slvcmd = inb_p(SMBSLVCMD(priv)); @@ -1638,7 +1639,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) * is not used if i2c_add_adapter() fails. */ err = i801_enable_host_notify(&priv->adapter); - if (err && err != -ENOTSUPP) + if (err) dev_warn(&dev->dev, "Unable to enable SMBus Host Notify\n"); i801_probe_optional_slaves(priv); @@ -1693,7 +1694,7 @@ static int i801_resume(struct device *dev) int err; err = i801_enable_host_notify(&priv->adapter); - if (err && err != -ENOTSUPP) + if (err) dev_warn(dev, "Unable to enable SMBus Host Notify\n"); return 0;