Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3567815pxb; Mon, 1 Mar 2021 13:36:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzd+4ekStitvBFRiBuNXzY1VDXjL4bRWJKnskBZnQmoF1f2gGGyABPCFnQ4/lemysAiwwJU X-Received: by 2002:a05:6402:34c1:: with SMTP id w1mr18377207edc.147.1614634591465; Mon, 01 Mar 2021 13:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614634591; cv=none; d=google.com; s=arc-20160816; b=lZkIn2sNCM3iF6LsdyfXgr3ioZeF4GI+j4Tx9UZ9shMXVBzLSBbeCyOcnJVW1rjDto Sf+g74ijrDmqRUIhA/uCLZ+Hkxq6knwS9C4Pt4xd2KeiMCkFDnFXr75RfNywUpDPXl/V nKKgMMUwHhW+Z0s6MaGH/+0Nlmv0rNpRdVpD0oS1wb9luDPfKyyyIv8Cv6OIDTfxU6h9 jysnaCesi6oGTqNwrd2TQ1LZQApKH6qE9gWi3lqNNnFiP+P/cfktkrz4q7B5exZi511/ xf5jRxpU2dmNvmq028l33SJQUEYV7ZXjLiPmubZGBRsWqdIWrEbnyVpV8LIgxGzE5rkP wdNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zmQNUzAblLfj/u6MbP8oLxRI7JX0YjBTHTMzubl/J7c=; b=rk/kgKTc7A2akyTZbz1fbcmw0MXRIbwIBRDVwvdDp9Tne/Cr2QHnq8FSrk6auSQLeC zQwnm/CE/1KU7eH5A6b3K1vppjDLBl2uiFJ4yhHlO6WmE/S4cAm/whsohWLIwsCgXRGL xb15kgN7APxSidJLL+m4kN3Hkh+kW9DUjjUHGgPdewb/33d8X8XslMhXPoXwW6HcfiIp vybG0Ugh6jfLZUVMgFFOQgfg+nkHYXh59iv1Q+TUkFAc6eowz9hRLCo/0cGOg+80ZU9o XLjsZIYYefW6zqYqjhbUJryxSFUAputlUhkFe+5ziTMJYe814Z95A+vLlZZM8c/j91ot jhog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yFWDeydp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si11461055edb.267.2021.03.01.13.36.08; Mon, 01 Mar 2021 13:36:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yFWDeydp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244512AbhCAVdv (ORCPT + 99 others); Mon, 1 Mar 2021 16:33:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:37356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236098AbhCARSx (ORCPT ); Mon, 1 Mar 2021 12:18:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0A6864F4E; Mon, 1 Mar 2021 16:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617239; bh=2k/Y97RHT7hk5wZrN5m6S4YgDsSzrKa+SR+h13LXQ50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yFWDeydpbEEIgdyWjvsl9/tdw7cbcasavTADCY6ssibjChoxOMa+/Qq8tviYsr5M2 7+0d4hbFdqtj2UbbNGbDkJwGB9oDO74Rw7486m3jf8r2rbXDbkGQ8T+nitQkH1UFB1 SA2U8lH/LK97qpjPQKGlNQHZo7MMMrU74Usika4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Kiselev , Bartosz Golaszewski Subject: [PATCH 4.19 226/247] gpio: pcf857x: Fix missing first interrupt Date: Mon, 1 Mar 2021 17:14:06 +0100 Message-Id: <20210301161042.754011394@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Kiselev commit a8002a35935aaefcd6a42ad3289f62bab947f2ca upstream. If no n_latch value will be provided at driver probe then all pins will be used as an input: gpio->out = ~n_latch; In that case initial state for all pins is "one": gpio->status = gpio->out; So if pcf857x IRQ happens with change pin value from "zero" to "one" then we miss it, because of "one" from IRQ and "one" from initial state leaves corresponding pin unchanged: change = (gpio->status ^ status) & gpio->irq_enabled; The right solution will be to read actual state at driver probe. Cc: stable@vger.kernel.org Fixes: 6e20a0a429bd ("gpio: pcf857x: enable gpio_to_irq() support") Signed-off-by: Maxim Kiselev Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-pcf857x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -357,7 +357,7 @@ static int pcf857x_probe(struct i2c_clie * reset state. Otherwise it flags pins to be driven low. */ gpio->out = ~n_latch; - gpio->status = gpio->out; + gpio->status = gpio->read(gpio->client); status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio); if (status < 0)