Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1004406yba; Thu, 4 Apr 2019 02:12:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjVZSzbK8k1kVwx/OpUoJMlCNwZxSTmXt7q7aGGPg2Rwuq0Dnh8FmErlLdQdA70gbG3M2w X-Received: by 2002:a17:902:aa87:: with SMTP id d7mr5262383plr.146.1554369151039; Thu, 04 Apr 2019 02:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554369151; cv=none; d=google.com; s=arc-20160816; b=uUU7JDYSw/4+Vv6NlWYLI4qAwlgP6o7QAaHDddA/ltFel5wXqrjwHD//YYf5xP7dzE Cznq4L5+y5XCrnVwKNwiRygbkvYY97cOLchcmr1NuSf/FldU7bUMxnUwFzQUgdAXd/RD 9J5HRIm7mC0KFnwQoXTwWO2nqvFryH4WSUErbHrwOUBj8tPvFIkhGVeEPRceT+AtZZlb yB2vukJvj4wwZqnsWLggETT9BQZbI+wFdEuBC8KHBbvt4KJ1VMAuKxM5wwVdOGTxO2wn EXN0tVC4I+Ut+nD/Zrg/jywFBfI+ZWtrWAE6Mzc6u2y+ggSXNCIZm9acqNWiR8XBMfff /9Jw== 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=Ch5PTLuOSn/Xm37LbUnagVdWCUm1LBV08oP5kaQw+kg=; b=DIpJ6dBZ2vIyEAxMPlOY6BYQkTgWmRqTbKYDkut/ZDecHy57gfgB2L44fzuwLucEgF wmHxvdtQPMUzQckxQgI1P7cyF1nUjzn1JaUXDm9oMOgX23v8XR0EjAbTIjk64ocSE3oX o4Lf/onPwzux4MbUEWzjsx3lvDEOap3hTii6exEQxlGKoYb8kfJcGwaiZUtkZnaXWkQ8 FFQFVIOiaFnAOvzPF58SEF+urF0FT0X1xzQPPkiaFAWPW6m75Z8b5JVLXs5G/ZAhJrxo RyUXkFTCftq9ZzrwH0qnd0HhXZwqeo11/Rbq4DKPJiGy31KX0ehWujOROwPt9QNNytnJ uEHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1FIoWsLa; 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 a1si10043088pgd.394.2019.04.04.02.12.15; Thu, 04 Apr 2019 02:12:31 -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=1FIoWsLa; 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 S1733173AbfDDJLa (ORCPT + 99 others); Thu, 4 Apr 2019 05:11:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:51324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733162AbfDDJL1 (ORCPT ); Thu, 4 Apr 2019 05:11:27 -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 3F5D520693; Thu, 4 Apr 2019 09:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554369086; bh=o9mCRSO52kTNYGasdcQaU7KNAhzHmz+0LMi4XWaspcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1FIoWsLalWrcWTibHzxy+2PXtJnxnLs3BsojnYnfp21uVD8SZU0P9v3ZO4jLxZvpp dGFZhAJ0SwczNx643opRfQvj1PgH9J2sACSDNiMgU4dlfIqT9+ElUxKOk+Bwd9CElr spxBEOP167S9S80VGcwh2UTk0eVDjQoDbPwpICsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Broadus , Benjamin Tissoires , Charles Keepax , Wolfram Sang , Sasha Levin Subject: [PATCH 5.0 092/246] i2c: Allow recovery of the initial IRQ by an I2C client device. Date: Thu, 4 Apr 2019 10:46:32 +0200 Message-Id: <20190404084622.366590957@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 93b6604c5a669d84e45fe5129294875bf82eb1ff ] A previous change allowed I2C client devices to discover new IRQs upon reprobe by clearing the IRQ in i2c_device_remove. However, if an IRQ was assigned in i2c_new_device, that information is lost. For example, the touchscreen and trackpad devices on a Dell Inspiron laptop are I2C devices whose IRQs are defined by ACPI extended IRQ types. The client device structures are initialized during an ACPI walk. After removing the i2c_hid device, modprobe fails. This change caches the initial IRQ value in i2c_new_device and then resets the client device IRQ to the initial value in i2c_device_remove. Fixes: 6f108dd70d30 ("i2c: Clear client->irq in i2c_device_remove") Signed-off-by: Jim Broadus Reviewed-by: Benjamin Tissoires Reviewed-by: Charles Keepax [wsa: this is an easy to backport fix for the regression. We will refactor the code to handle irq assignments better in general.] Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/i2c-core-base.c | 9 +++++---- include/linux/i2c.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 28460f6a60cc..af87a16ac3a5 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -430,7 +430,7 @@ static int i2c_device_remove(struct device *dev) dev_pm_clear_wake_irq(&client->dev); device_init_wakeup(&client->dev, false); - client->irq = 0; + client->irq = client->init_irq; return status; } @@ -741,10 +741,11 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) client->flags = info->flags; client->addr = info->addr; - client->irq = info->irq; - if (!client->irq) - client->irq = i2c_dev_irq_from_resources(info->resources, + client->init_irq = info->irq; + if (!client->init_irq) + client->init_irq = i2c_dev_irq_from_resources(info->resources, info->num_resources); + client->irq = client->init_irq; strlcpy(client->name, info->type, sizeof(client->name)); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 65b4eaed1d96..7e748648c7d3 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -333,6 +333,7 @@ struct i2c_client { char name[I2C_NAME_SIZE]; struct i2c_adapter *adapter; /* the adapter we sit on */ struct device dev; /* the device structure */ + int init_irq; /* irq set at initialization */ int irq; /* irq issued by device */ struct list_head detected; #if IS_ENABLED(CONFIG_I2C_SLAVE) -- 2.19.1