Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2392306imu; Thu, 10 Jan 2019 13:23:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN67GZz3koV1SHuEPMhnsdiT7AMJNS0TPhfkg/REsFRFluiUD3Qo+5IojKxp1YHehf7b8f2V X-Received: by 2002:a62:3006:: with SMTP id w6mr11927281pfw.258.1547155426973; Thu, 10 Jan 2019 13:23:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547155426; cv=none; d=google.com; s=arc-20160816; b=tA5V+ETj67WQUmFG2KNcSTJpvEo+joXrH4ikMa5E/HyEobzAJMuEwfX8ryEpq7ogfM 9w/XACHoKaK15WJQeev6C7ovI8KPeR+REst0SK6DdD8Xv54QYWrpPhJnIjFkTwQv7ndZ MsU6vGoyOktaVIhD4xWf3w64no0nVw291mM6rUU1z8CyLWBdpqYIfSbkKA+YEqiEbQoM tnRH9O++Ea4M6xi6VlKfWgi8b1tRiYHYZRvRyu43wtJwMctdczrVUVLpbwUrzTsk5oQe CZRRqFzth+SYy0H4CFep6aFdSLkCCpGSEjSXLIKjXUItQJ1wqXrRRnc6hjBoBl9xzPwG Cd8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5uXI/gYnx6tkF/mAv6kSNlRr8gdBVN63dgNFFM+Xu1M=; b=qPokm/K/FT5figbUi8m4t2CjFoR206mXkNBu3JdYZJ6nclJK3i16RhzlbPkKTsAUhJ FZcHAixO2p6dzurCS+htrwUJXU75c8zkr8mDvvK5gcPHMtSppkWE176Bq3QmyFcrJfWj e9Ix55KQIo36fZmfriGNEbBGIU7g1tolGYOP8CjOx9Q8XDrRfNsZcv/pKyRb/sV8aRj7 Mbx5DuAjaU8G8qPLIbYl9+/deePvrpZko3Lb4RnFMcK3M0rbFirK8zHrPxSWIeW9wOIi 0bljAKpNOa6mEDNU3P76BZYLw/On8A5pPLBNzhKE4RhVjbE7y2OJUg55VDydvWowseUU 7uNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rpRcRIEs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si21844333pgm.508.2019.01.10.13.23.31; Thu, 10 Jan 2019 13:23:46 -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=@gmail.com header.s=20161025 header.b=rpRcRIEs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729596AbfAJUfk (ORCPT + 99 others); Thu, 10 Jan 2019 15:35:40 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46519 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729546AbfAJUfk (ORCPT ); Thu, 10 Jan 2019 15:35:40 -0500 Received: by mail-wr1-f68.google.com with SMTP id l9so12855181wrt.13; Thu, 10 Jan 2019 12:35:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5uXI/gYnx6tkF/mAv6kSNlRr8gdBVN63dgNFFM+Xu1M=; b=rpRcRIEszuMwYmKH+EgAkh3KG3bl1/tZ0klGiljMqkqGnrBpFt8b249VGRImTKgkwb ChcdzZzblR65egautzA5lNgVGtITiBGKD0G+dl2/p4HrLDecIrLsHjyw/avxuTdWnhT3 5J3/BFTk1vii4tRus0rtPZltW12onf++RyNRfp69F8RQMh/uPV1cCwJ93RHfDoZsBzWr L/p5GZ9JRE4dUV1GcnqNEkw1hYQ4ZTtq8I85GsD69uAQ+cJJBUJRCCcTbdzBEIIi7BUQ SFtkw/d1E8Y6OCRImcz0OCcikup1rzyeFg4f5wQeVC6R64uL+QUjyYpYD2gnQYtyKNU0 tg6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5uXI/gYnx6tkF/mAv6kSNlRr8gdBVN63dgNFFM+Xu1M=; b=a4ZRxsF6qKAsEXkd+ZZdt1kWmB1MOoRp78MPd18zggLAaTFbXUncxMiKZyF5mJHr+V cn+2Zefr4tGLhsirnAWRLkQR9XgXENqGyhREpH9lW0zgRCAS+Fb8UcZ3g/FTULoSSTvz MErKB7eDG9WkWyZ9Gan2LZZc6R1uswnJHOwPpjly69xewe3WxF0WVrHq1CnaSrb/jZFS vA6FtzNL950Nnh+R7QPnaWh6ZYOyMW5oMWIpy34tabvgelDQ8JBOW6EI2T6rMeNuc1fu 53N9TyXpAijAwAxt49tpZH3vJiC4xHGhkMwvPWtIRuufXnCrxT9pea1gmBG+jy1MMDOZ 1A0w== X-Gm-Message-State: AJcUukeffMg9WqE76Z912kGDvhDO3E+EK2KYCRFLav9f+PHv40EUTcTJ zhBYZ0WBUlhJblWwCh1/eeKPZh7v X-Received: by 2002:a05:6000:10d1:: with SMTP id b17mr10635271wrx.306.1547152537525; Thu, 10 Jan 2019 12:35:37 -0800 (PST) Received: from localhost.localdomain ([46.216.193.112]) by smtp.gmail.com with ESMTPSA id c65sm17403216wma.24.2019.01.10.12.35.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 12:35:36 -0800 (PST) Received: from [127.0.0.1] (helo=jeknote.loshitsa1.net) by localhost.localdomain with esmtp (Exim 4.91) (envelope-from ) id 1ghh38-0006u9-JH; Thu, 10 Jan 2019 23:35:34 +0300 Date: Thu, 10 Jan 2019 23:35:34 +0300 From: Yauhen Kharuzhy To: Charles Keepax Cc: wsa@the-dreams.de, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: Re: [PATCH 2/2] i2c: Clear client->irq in i2c_device_remove Message-ID: <20190110203534.GA25269@jeknote.loshitsa1.net> References: <20181019085958.32694-1-ckeepax@opensource.cirrus.com> <20181019085958.32694-2-ckeepax@opensource.cirrus.com> <20190109214756.GA18115@jeknote.loshitsa1.net> <20190110133236.GC3837@imbe.wolfsonmicro.main> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110133236.GC3837@imbe.wolfsonmicro.main> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 01:32:36PM +0000, Charles Keepax wrote: > On Thu, Jan 10, 2019 at 12:47:56AM +0300, Yauhen Kharuzhy wrote: > > On Fri, Oct 19, 2018 at 09:59:58AM +0100, Charles Keepax wrote: > > > The IRQ will be mapped in i2c_device_probe only if client->irq is zero and > > > i2c_device_remove does not clear this. When rebinding an I2C device, > > > whos IRQ provider has also been rebound this means that an IRQ mapping > > > will never be created, causing the I2C device to fail to acquire its > > > IRQ. Fix this issue by clearing client->irq in i2c_device_remove, > > > forcing i2c_device_probe to lookup the mapping again. > > > > Hi. > > > > I found driver i2c/busses/i2c-cht-wc.c which instantiates I2C device > > (battery charger) and passes IRQ to driver not using standard I2C IRQ mapping code. > > So if we reprobe I2C device (by reloading I2C device driver module or by > > manipulations with sysfs), we get invalid IRQ number for client: > > > > adap->client_irq = irq_create_mapping(adap->irq_domain, 0); > > ... > > irq_set_chip_data(adap->client_irq, adap); > > irq_set_chip_and_handler(adap->client_irq, &adap->irqchip, handle_simple_irq); > > ... > > board_info.irq = adap->client_irq; > > adap->client = i2c_new_device(&adap->adapter, &board_info); > > > > > > adap->client->irq will be reset after device removing here. > > > > > > Any advice to fix this? Maybe move initial i2c_client->irq value to new field > > like client->init_irq and copy it to client->irq at probing, for example? > > > > Could you be a little more specific here, are you saying if you > reprobe the battery charger device or if you reprobe the I2C > controller itself? If I reprobe the battery charger. > > Apologies but I am having a little difficulty working out the > path through which the IRQ is not reinitialised. As I would have > through the battery chargers probe would have reset up the IRQ > then the core would pick it up again from there. No, this I2C bus driver(i2c-cht-wc) pass the IRQ to charger not throuth ACPI of OF but by initializing of board_info.irq field, so I2C subsystem cannot reinitialize irq automatically. I am not sure if this is right path for IRQ initialization and maybe should be changed for this driver. > > Thanks, > Charles -- Yauhen Kharuzhy