Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3665297ima; Mon, 4 Feb 2019 03:05:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN7ZxWuhvW2vEg2GB9yV6YPkGhN+p4dNlN2ZCRFfZkDKV7e2z5SV8tk9s6H2FhlY4ZIOREWK X-Received: by 2002:a17:902:2468:: with SMTP id m37mr51089394plg.314.1549278337513; Mon, 04 Feb 2019 03:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549278337; cv=none; d=google.com; s=arc-20160816; b=TWaK4Mz0UesQsV/YYEDTb9faS4Ckpn3U7txjPd5NONpf5iujFQgcaBANUZrJoTQ6+E dBkadbRsDtKEbeVDLBtUoqsK8MEtfawikSh9UFaFKQSaQVTGueDHpaxrb7zJZyTpfJ5P /Vz8an0GgQ/pGtVOkATJtKtwXkDXHTBMr5Yxt4VYgj9b2RQRO1L2DDrQO+5CWku78Amc KhPSI9WLcQu+U4OgLZyN01pLPckrLAfe3r3IlJecvlB9Yatz3ZDYIYdfOYxYb/2O0iMh JuFpU+TF5XXhgXdrfd3JwkRPSKMlYAtRqBM2G/Eb/H/QOi6cltYlECfXGGKiCsnihwBO Q3EQ== 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=fwk22rfTfq/XX6TboJt39GFottEdpQF4uczQp7WcJ8w=; b=eZGRgTCcmyOH6Rf/G1aAI1eM1yiyOxWGUbnDeBOK4KQvPaCyVPU16kKvOOANQE+kDI anzdoxMqshuYAqy825ZX4Jl7UKwMiZZHC9XUMiTFuYNyvey6opLWW5BA5VHThCtR6lY8 gBMuPaV7PTTGAoGllwoes1mCmIOaQ1z1+zAQpz10ytiOIil5R17VbDAxGQaGtPi5eRPc xAto7nfdm4G7gFDP2lyGGw1KrXBpx0efnU5S0+trb7SgHwxltnRodTqd/fBrkBV5kDw1 l5TxZFCEaM9o6fIstgdwfjbJVLNcLaywpcsnjHqQFlf2EHlYVVedGV77jcBqz+POkBbX atRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d+VypRr2; 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 g19si8587853pgj.358.2019.02.04.03.05.21; Mon, 04 Feb 2019 03:05:37 -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=d+VypRr2; 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 S1731200AbfBDKp1 (ORCPT + 99 others); Mon, 4 Feb 2019 05:45:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:43506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729980AbfBDKpZ (ORCPT ); Mon, 4 Feb 2019 05:45:25 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 BE9FC2075B; Mon, 4 Feb 2019 10:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549277124; bh=i21flE++DfmfHsg85aCB/xkd+G8Nnleh+Y1EAH8umaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+VypRr2m9C+s89kP3iBBnDg8T0zvHvobDlehQzmXi3YeBZK76UPgJaHkDkpjlFIJ 2Uj+SzpOPnMWafPdowT6bZXEoeIRwIwiNL9HuZJ300KWOFsY5ZVkEXWFzQkCpzyXr6 u3403FM7SzFnelBG3sZqUA5xUndkqLaDNSfNsNVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roger Quadros , Bartosz Golaszewski Subject: [PATCH 4.14 30/46] gpio: pcf857x: Fix interrupts on multiple instances Date: Mon, 4 Feb 2019 11:37:01 +0100 Message-Id: <20190204103613.928121972@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103608.651205056@linuxfoundation.org> References: <20190204103608.651205056@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Roger Quadros commit 2486e67374aa8b7854c2de32869642c2873b3d53 upstream. When multiple instances of pcf857x chips are present, a fix up message [1] is printed during the probe of the 2nd and later instances. The issue is that the driver is using the same irq_chip data structure between multiple instances. Fix this by allocating the irq_chip data structure per instance. [1] fix up message addressed by this patch [ 1.212100] gpio gpiochip9: (pcf8575): detected irqchip that is shared with multiple gpiochips: please fix the driver. Cc: Stable Signed-off-by: Roger Quadros Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-pcf857x.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -84,6 +84,7 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table */ struct pcf857x { struct gpio_chip chip; + struct irq_chip irqchip; struct i2c_client *client; struct mutex lock; /* protect 'out' */ unsigned out; /* software latch */ @@ -252,18 +253,6 @@ static void pcf857x_irq_bus_sync_unlock( mutex_unlock(&gpio->lock); } -static struct irq_chip pcf857x_irq_chip = { - .name = "pcf857x", - .irq_enable = pcf857x_irq_enable, - .irq_disable = pcf857x_irq_disable, - .irq_ack = noop, - .irq_mask = noop, - .irq_unmask = noop, - .irq_set_wake = pcf857x_irq_set_wake, - .irq_bus_lock = pcf857x_irq_bus_lock, - .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, -}; - /*-------------------------------------------------------------------------*/ static int pcf857x_probe(struct i2c_client *client, @@ -376,8 +365,17 @@ static int pcf857x_probe(struct i2c_clie /* Enable irqchip if we have an interrupt */ if (client->irq) { + gpio->irqchip.name = "pcf857x", + gpio->irqchip.irq_enable = pcf857x_irq_enable, + gpio->irqchip.irq_disable = pcf857x_irq_disable, + gpio->irqchip.irq_ack = noop, + gpio->irqchip.irq_mask = noop, + gpio->irqchip.irq_unmask = noop, + gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, + gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, + gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, status = gpiochip_irqchip_add_nested(&gpio->chip, - &pcf857x_irq_chip, + &gpio->irqchip, 0, handle_level_irq, IRQ_TYPE_NONE); if (status) { @@ -392,7 +390,7 @@ static int pcf857x_probe(struct i2c_clie if (status) goto fail; - gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, + gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, client->irq); gpio->irq_parent = client->irq; }