From patchwork Wed Jan 9 09:11:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 155059 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp478964jaa; Wed, 9 Jan 2019 01:11:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN6y9ejgvnQVjgcqv4Nw4HzqgyqFmQR3j7eChfkzU3+K0UfIgyk5XucizqWPZk7Lhj2MItcE X-Received: by 2002:a63:b649:: with SMTP id v9mr4673163pgt.436.1547025093494; Wed, 09 Jan 2019 01:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547025093; cv=none; d=google.com; s=arc-20160816; b=SBlaNds3cdpcaNtNY2raPKRb9/MNXa+VVKymDuYI1maWssSV4kch6+UTfQO0ueL/RV sAYjcy9TykAnvjZXxYQmmafNUoyNWHCVxDPcWWxfnq6iIu1HM64aGf2nOfKQ9FJQL1lD I/6fD+46fG75aRmpqqaGw5GJjC3gGxzJWYlmQnS+a08Jp3EVF5wSy7c968S52Ewt/nA6 HSL1Jg57BLVGMs/bbMQVZ4JelfxL0En7ILs05nO1fIiHAhgcbih2SOFw/0OXCX7+X5uD /ooHJkTTVpmBRejBmCJvEbLH4+56gCo+5V1NQY4bpfLJLq2Ve5pnbCX/JGlsO0yB/8Zr xMEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=gczjm2ittIUq2444ZRz+TaQB+QGZRcSnI28sIaUrf9I=; b=IWJeBSF3D7dhrFKX1+aL8qdwfxBkrX0HqeCQozatwtVftfQZtBvsOW1rhjXzSpQMlg YGbJ/dn3Qe7HfR/e2BxZfbUmwPNYQJHe2zO887EE1pVIOGmBH+PzecuFu4tSkKRZ1Tsq CvXxctbxkrwbZSK1oNMpbC+oOipWn52Z1fcioBYPUnvAj/0670G0hRjM0dUjJqsd6/ji HeRCvHcG5E3XhhAsqLKhQWZ4UkJDLmsVS5kRg522ul/2vBzkowG5uWDT4j1Stf+DQlBK djcxSCD5Bedg0MKGWNgiULwY27CBUBCgNhCjzflHVIn5FQlEu5Mts7DmFF2ka3A15OFu q60g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Bt6Arl5x; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay7si45590506plb.410.2019.01.09.01.11.33; Wed, 09 Jan 2019 01:11:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@ti.com header.s=ti-com-17Q1 header.b=Bt6Arl5x; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730168AbfAIJLc (ORCPT + 15 others); Wed, 9 Jan 2019 04:11:32 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:58008 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730150AbfAIJLb (ORCPT ); Wed, 9 Jan 2019 04:11:31 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x099BTpi041974; Wed, 9 Jan 2019 03:11:29 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547025089; bh=gczjm2ittIUq2444ZRz+TaQB+QGZRcSnI28sIaUrf9I=; h=From:To:CC:Subject:Date; b=Bt6Arl5xKiNbT46xsV0ICt+Z5ve+VLLlxfnSFDBBuB0/4bQQMqgI67vJkIyvakdV0 XPWqE8vXPu8keT5qNzz0UPzVtEta8JXh+uwutaPp/DFg+h9M+skQ+T3xe7ab1tYqGW 6+conGdxtvvcWuz4G0Bv5UkTFOI69S3BARM7KalI= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x099BTCG100014 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 9 Jan 2019 03:11:29 -0600 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 9 Jan 2019 03:11:28 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 9 Jan 2019 03:11:28 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x099BQxC019583; Wed, 9 Jan 2019 03:11:26 -0600 From: Roger Quadros To: , CC: , , Roger Quadros , "Stable # 4 . 20+" Subject: [PATCH] gpio: pcf857x: Fix interrupts on multiple instances Date: Wed, 9 Jan 2019 11:11:24 +0200 Message-ID: <1547025084-16999-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 # 4.20+ Signed-off-by: Roger Quadros --- drivers/gpio/gpio-pcf857x.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index adf72dd..68a35b6 100644 --- 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(struct irq_data *data) 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_client *client, /* 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_client *client, 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; }