From patchwork Wed Sep 28 08:15:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 676047 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 3skVtF2Jflz9s36 for ; Wed, 28 Sep 2016 18:17:09 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494AbcI1IQK (ORCPT ); Wed, 28 Sep 2016 04:16:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47810 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751907AbcI1IQH (ORCPT ); Wed, 28 Sep 2016 04:16:07 -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 DD626DCA38; Wed, 28 Sep 2016 08:16:06 +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 u8S8FoBq031570; Wed, 28 Sep 2016 04:16:05 -0400 From: Benjamin Tissoires To: Jean Delvare , Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 09/10] i2c: i801: check if Host Notify is available during interrupt Date: Wed, 28 Sep 2016 10:15:48 +0200 Message-Id: <1475050549-25542-10-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.27]); Wed, 28 Sep 2016 08:16:06 +0000 (UTC) Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org There is a chance we get called while Host Notify is not available (yet), so we need to clear the Host Notify bit in those rare case. Signed-off-by: Benjamin Tissoires --- changes in v3: - renamed from "i2c: i801: warn on i2c_handle_smbus_host_notify() errors" - removed the warnings and just kept the test - added some comments on why the errors are not treated no changes in v2 (comments addressed in the previous patches) i2c: i2c-i801: remove warnings on the handle host notify add a comment on i2c-i801 --- drivers/i2c/busses/i2c-i801.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 422cce2..38e2421 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -580,11 +580,20 @@ static irqreturn_t i801_host_notify_isr(struct i801_priv *priv) unsigned short addr; unsigned int data; + if (unlikely(!priv->host_notify)) + goto out; + addr = inb_p(SMBNTFDADD(priv)) >> 1; data = inw_p(SMBNTFDDAT(priv)); + /* + * We don't notify about missed host notify events when the adapter + * lags behind. The operation is still scheduled and will get + * eventually processed. + */ i2c_handle_smbus_host_notify(priv->host_notify, addr, data); +out: /* clear Host Notify bit and return */ outb_p(SMBSLVSTS_HST_NTFY_STS, SMBSLVSTS(priv)); return IRQ_HANDLED;