Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11787881pjo; Thu, 2 Jan 2020 14:17:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxqxEVIfmwrI2HM0/MXnote0eBJEGjyRrmgNoyBQ8g20lbS18/2TIVO/7qUVrhsnvoDqRk4 X-Received: by 2002:aca:dc8b:: with SMTP id t133mr3200629oig.98.1578003431485; Thu, 02 Jan 2020 14:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003431; cv=none; d=google.com; s=arc-20160816; b=oVqWivlFpmROrJH3rq4mznNavqOt6prok0e6xSDqLbNLnCWutMRX97BhApVK7uURHa /8uWROTrOEfRQcJ6KOuzvLTxn7AFkDQVBygIFETvE8rc8BoLiH8msMOFF7sF7v1ea/OM 8H26zzY3BleuxuCsmMIGzq+mHKtqnAe6pH8odaIBmQDK5fAwOOklovwVQlbieRZSB7BO j9DeFRkKK320irkCYn3PwfMc2MV2R97Qe82kU5e2FZ6r9D0l45ea+IPfQIAiYEfA6nja w/oN/YnZ+cUNGljb8vooybtHuFOt0PqppEJtcE4wz7kRHBHvTwcaC8BYQUF/ud6onIaU 6iCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5Kv3+uj3ACIPs6TDG/T80lUpCWW8jhK+W6kRbhAG/oA=; b=XURHHY9U0KXHGgexYAF7F9PR/363dvPR3JNMl4P5DETPGyg2ifA+G5GKlN+8PPQ1fE UvnTo0x4+ctBZECVFCNrjy+erDEKAsq99NzMe0qdZOMU1nmtXA4h8qUHz769WVCqtlq5 NG2T7KUL9aO++ZIvwXUedRL2hehWa3a05pq1A3k8Uy21TF/Usl3iULkdGsGnGMlXRJsa ++dIUoEqMdZPTcgM+MIm9s7DaEijAm+y7R0AQqgCl7C+efohPYe4FiF5w3XErTJby+Tw GuZNS+XOCoxgwRlMvl/CSWX7Gs7Lzd7pkgxVNpMnMAUR0+MF/WO0A9aNGXFAVg7NbeW1 /Z5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UbNjmgEX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si10209734oth.104.2020.01.02.14.17.00; Thu, 02 Jan 2020 14:17:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UbNjmgEX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbgABWO5 (ORCPT + 99 others); Thu, 2 Jan 2020 17:14:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:55358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727980AbgABWOw (ORCPT ); Thu, 2 Jan 2020 17:14:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A0D4227BF; Thu, 2 Jan 2020 22:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003292; bh=1zgoFSiRV6Onojow7U/bJxM9FdsVZWpzk4N5y2Y95Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UbNjmgEX/MByeIqPLCUjjCy2HaNmqHKgVwuNiQ9e6ZmgaPbHys/igafOwYLgKqRvt UO4HEXlera/EPgv0LNg7to7yPd5A4fGG3MLODdSSO6OchF0TUUojhf0qcdvRJPR0ye rdws5GGA5p0yrS8VP0JqUIiCV+D5pIyLciaNxN4M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Michael Walle , Linus Walleij , Sasha Levin Subject: [PATCH 5.4 100/191] gpio: mpc8xxx: Dont overwrite default irq_set_type callback Date: Thu, 2 Jan 2020 23:06:22 +0100 Message-Id: <20200102215840.669478662@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean [ Upstream commit 4e50573f39229d5e9c985fa3b4923a8b29619ade ] The per-SoC devtype structures can contain their own callbacks that overwrite mpc8xxx_gpio_devtype_default. The clear intention is that mpc8xxx_irq_set_type is used in case the SoC does not specify a more specific callback. But what happens is that if the SoC doesn't specify one, its .irq_set_type is de-facto NULL, and this overwrites mpc8xxx_irq_set_type to a no-op. This means that the following SoCs are affected: - fsl,mpc8572-gpio - fsl,ls1028a-gpio - fsl,ls1088a-gpio On these boards, the irq_set_type does exactly nothing, and the GPIO controller keeps its GPICR register in the hardware-default state. On the LS1028A, that is ACTIVE_BOTH, which means 2 interrupts are raised even if the IRQ client requests LEVEL_HIGH. Another implication is that the IRQs are not checked (e.g. level-triggered interrupts are not rejected, although they are not supported). Fixes: 82e39b0d8566 ("gpio: mpc8xxx: handle differences between incarnations at a single place") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20191115125551.31061-1-olteanv@gmail.com Tested-by: Michael Walle Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mpc8xxx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index b863421ae730..a031cbcdf6ef 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -377,7 +377,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) * It's assumed that only a single type of gpio controller is available * on the current machine, so overwriting global data is fine. */ - mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; + if (devtype->irq_set_type) + mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; if (devtype->gpio_dir_out) gc->direction_output = devtype->gpio_dir_out; -- 2.20.1