Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5639665img; Wed, 27 Mar 2019 12:14:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuyhIlNxQ4ENQ44etGl0zdb5wiwWMBa3wp1G0TUsEe4FVOlOCG2KW6orbEbMHhrUbyOnQM X-Received: by 2002:a17:902:728e:: with SMTP id d14mr37206492pll.327.1553714055564; Wed, 27 Mar 2019 12:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714055; cv=none; d=google.com; s=arc-20160816; b=Yetl4TjQwvzhsMOz4kZ24AChkLhxogj9zI/SyVqTvOax9cVU8eY0oQpGd3n35Ajtzy boJR67+s5KR6KCqBBtM8QrGQvWIrXMqW2EpkHnX8exKGXD+R6QC1whLWZKllr4LWTuAG FZn+SqObKR8bxAEGrN7f11CiWXeKNydwSWoNgA10HofmEQfNgbYsekK3uZZRpvX6V7HR 2KKeKVJ6NQMRLgAYl6jWPcH5qRxRkpSApJKC75l362Tcy5xE3Ux1gKV2JqK0dQd5EUgq 1cDOdIKa4E0btS7rzELLObnFrFfM33Bc3yuWWEhU1C/HJWUeZcn0hYbsOZ/Gm/UUp31b uWxw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MFGYMqjxuhUAG0jnLJh+3kI1XYgVGLKeOgvKSQm5SMs=; b=KHykOzw2IUoU60FPqVzVJg3OEodn9Id3NQPN1b7iXpDnY6Ikk/jIdlA0O8EWjIWw9s GUEsK9GnbUlB+YhNZ1HnpxI5sO8bbTQjwqKzNC387yLKLTj0PkVb10FEzOhGbzq5Z0zk nOeK5ACIbyCnhXcvMhORmnwNYmNavG8V4KDuOoaRticmDhxGCYJm0Co+ok9hwOlggGs+ z4kb2hK/kkL5vZml3gJui5rNpcKvRctcalRezv5Vq+VVpVszJPyewVaveMlEe5rBdTKA 4qUGzOtIjXaoahWI7FR9y1S95npyetVIqdLcAsHhv5WcHR1j8mAdZJNBYG5DFKKHIoE2 qiMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x6BAGjw0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si1098606pgv.441.2019.03.27.12.14.00; Wed, 27 Mar 2019 12:14:15 -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=x6BAGjw0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388745AbfC0SKI (ORCPT + 99 others); Wed, 27 Mar 2019 14:10:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:52072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388726AbfC0SKG (ORCPT ); Wed, 27 Mar 2019 14:10:06 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C317F217F9; Wed, 27 Mar 2019 18:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710205; bh=Qo/XY82dJ38ib4a5ddTgj7iA5hrEwWBGqg9lQEzDH5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x6BAGjw0zjtrN9/7YMay7SVtlaBWO7rqsIa0halpdcNL6gGaIY9yVXxGOuprX/Hou c0M9NrV0SnQJ0HOVvXIl/qCszQaXBR324HgVpSiQnQRDoWh+ldPaSYVEh3lxeplOm4 +HsSdWgjZ33EoknfW+dk82UgH0qOuutwdkIqw4r4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marek Vasut , Marek Vasut , Simon Horman , Sasha Levin , linux-renesas-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 250/262] ARM: shmobile: Fix R-Car Gen2 regulator quirk Date: Wed, 27 Mar 2019 14:01:45 -0400 Message-Id: <20190327180158.10245-250-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Vasut [ 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