Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1008545yba; Thu, 4 Apr 2019 02:18:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXGpCeCqQWoFHzI/hjWljEluzJDFYk5vpBWjr3w5oJMlQGfIbPcMPxn8JoRZXjkVSJ56JG X-Received: by 2002:a63:f809:: with SMTP id n9mr4755470pgh.201.1554369518897; Thu, 04 Apr 2019 02:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554369518; cv=none; d=google.com; s=arc-20160816; b=IpEDktKoflnWCJsCwySd01fIBoJgKTc/q74YmH3vabtd7hfPXJHgoJLyRS1M92Mrhl aKFBzUWWVOK1OjyypqE96LEtjoPTE3iwcRHhOgNeh70B2W9zjl0NmsjUS7+uyCdky0xI iOqx8GZGH3sNQ98hyUJ8tivTkkM5KkA/wtR1x6o5xk2+cM3DvWRqelQXCkORjz0khgbI FC6S4Dt1aCA/GKM56O/kOIeBGkZh/ccJWADaqtPjvfySinPiyPNr0C4zS+I1VxvyvNnb vtTD1TEUyw78aApX8v8cOPjPm4omzNQ1nUzq/OhcSo5+xJDl24kn4Pr5yDZuQi4bYq7F DC2w== 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=3EMJlzLQ6rAVBvD2QQaZDXJ0ycHah4fMfKrtDpXz7BU=; b=D5bSf09bile7sFNS9vIhQOOoTV/2B8DiFiM5M6UsolRIEN50VAan4d5ikPbYf9cmJJ Jzp9JFQ2ZircMRJn4cz1aLiCcAHuJ7XWC3676tEFncJ4EhsXZ7JR92qbUDVEQnA3W/xQ dIkCGtNd7wVrcVU1LtNDStOuzxqcixSgj8llULVzxNuVvRxOGIpzMp2wS18hBo6oQxvC jUK2XIHOTaHMVzrx4TwHSOJ1bQE0c+zsEoRGPfVkYo31tz/XOoXEA4x3V1ISseIJ3oRE iVl+xUUeaxtgfYdFYlrcE773hyAzprJsGNw1L3cgG3npDpG958xh2/ARuhroe5KqaaIW yQVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sEG2kE2m; 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 k131si16544130pga.267.2019.04.04.02.18.23; Thu, 04 Apr 2019 02:18:38 -0700 (PDT) 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=sEG2kE2m; 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 S2388295AbfDDJRt (ORCPT + 99 others); Thu, 4 Apr 2019 05:17:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:59616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387460AbfDDJRp (ORCPT ); Thu, 4 Apr 2019 05:17:45 -0400 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 74B1421734; Thu, 4 Apr 2019 09:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554369464; bh=/W/BJ1FRw1RBiBKdLMEJ+AWZtR455YD30xWV+T+3sHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sEG2kE2mWzuN4zrUen4kONCKeqbnvt2IXtPDe9z5NUhWigh9n3IArzmwdzQ70WgDL 7TlzL0y1Ika/PlgN366d29ec8Wvpliug5DfRSZfCYoHtY675VSXTAjYoNFanprjLq8 vROUBfTRpzys7aJqidgBqogxHOBEePqMond4X4ac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Nguyen Viet Dung , Simon Horman , Sasha Levin Subject: [PATCH 5.0 234/246] ARM: shmobile: Fix R-Car Gen2 regulator quirk Date: Thu, 4 Apr 2019 10:48:54 +0200 Message-Id: <20190404084627.476051398@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084619.236418459@linuxfoundation.org> References: <20190404084619.236418459@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 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 5347a0203709d5039a74d7c94e23519eee478094 ] The quirk code currently detects all compatible I2C chips with a shared IRQ line on all I2C busses, adds them into a list, and registers a bus notifier. For every chip for which the bus notifier triggers, the quirk code performs I2C transfer on that I2C bus for all addresses in the list. The problem is that this may generate transfers to non-existing chips on systems with multiple I2C busses. This patch adds a check to verify that the I2C bus to which the chip with shared IRQ is attached to matches the I2C bus of the chip which triggered the bus notifier and only starts the I2C transfer if they match. Signed-off-by: Marek Vasut Tested-by: Nguyen Viet Dung Signed-off-by: Simon Horman Signed-off-by: Sasha Levin --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c index 8e50daa99151..dc526ef2e9b3 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -40,6 +40,7 @@ struct regulator_quirk { struct list_head list; const struct of_device_id *id; + struct device_node *np; struct of_phandle_args irq_args; struct i2c_msg i2c_msg; bool shared; /* IRQ line is shared */ @@ -101,6 +102,9 @@ static int regulator_quirk_notify(struct notifier_block *nb, if (!pos->shared) continue; + if (pos->np->parent != client->dev.parent->of_node) + continue; + dev_info(&client->dev, "clearing %s@0x%02x interrupts\n", pos->id->compatible, pos->i2c_msg.addr); @@ -165,6 +169,7 @@ static int __init rcar_gen2_regulator_quirk(void) memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg)); quirk->id = id; + quirk->np = np; quirk->i2c_msg.addr = addr; ret = of_irq_parse_one(np, 0, argsa); -- 2.19.1