Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp974489imp; Thu, 21 Feb 2019 15:28:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ+t8zqy0KqrwjrUjL2KOAHid337m4GQfVLGYgxkrstR2wyOl+ymi6PT9vf2PUWJc4t/Qg8 X-Received: by 2002:a62:55c4:: with SMTP id j187mr1030284pfb.129.1550791695416; Thu, 21 Feb 2019 15:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550791695; cv=none; d=google.com; s=arc-20160816; b=0RYdmdqM5BFoJPitaOmKs0Wr4gIsaGUPUj4YDCZ1/lyTy7CdU153LGM2VggFUeNAx2 UR8yatKZ+PjzDgAd+Q1YKtYs8F49cCkaNNF9OhDFY3wArpgcLOuX2UWuwihdv3/FnIIt mdt0ZEwYH7UnuwT9UhI+OTEMDSNIS3fIR+Pbdh6wcHwdoYfiUZgL43ACRYHzw5tPyJic uZAqM89RjUDH1tjjO56bGofaxWs05BLmeOlMESDM7coKn3CRm9NDG4UImmgIrzwONxc8 iN3GNJ6TYjlxE+ugpb1mK9LdI7ANE9UN60k/dXaIgmMmmcKuWNuEZ6ux1zwHxGLUihDx d7oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zwuVLz2smtSflwPRGi7y6FZjj1/pEUlPr3NQjBcYqkA=; b=Gtr2jFkjlQn52eWcTV8Z+Ekx0c2Oeo3aUbVx0uWBVKTjieHinby8X6vAapgTb1FPiA /mOLwsWi47U5TQv1FpHgdSp9kTGO/hCMB67g/Nn87zkSJ10yHPsqoVPjRbf94OzCNBk7 44anPBuXOvaRmfZXtjivBnTIZjESXlRD8IRw7ZreW4tDfCYpXV+tzHFej6Vfhlo2wQ3u TrQWwenRqGmiRPou528P08Ur8/DkSak0P8xrF38xHi++7jvFPPdR/41ObDKXqHJTSt3N 8BcT8iKVhDhZIpt36Vf4eqoVnweO/v61Qy5yQl2ZXK7kY+T8aDCwos2J2sYt02PdfA4q QkdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 x8si155870plv.137.2019.02.21.15.27.58; Thu, 21 Feb 2019 15:28:15 -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; 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 S1726871AbfBUX0N (ORCPT + 99 others); Thu, 21 Feb 2019 18:26:13 -0500 Received: from sauhun.de ([88.99.104.3]:40306 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbfBUX0N (ORCPT ); Thu, 21 Feb 2019 18:26:13 -0500 Received: from localhost (p54B336C3.dip0.t-ipconnect.de [84.179.54.195]) by pokefinder.org (Postfix) with ESMTPSA id 86DFA2C088A; Fri, 22 Feb 2019 00:26:10 +0100 (CET) Date: Fri, 22 Feb 2019 00:26:10 +0100 From: Wolfram Sang To: Jim Broadus , Benjamin Tissoires Cc: ckeepax@opensource.cirrus.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: Allow recovery of the initial IRQ by an I2C client device. Message-ID: <20190221232609.d4vxl3osj6mwooey@katana> References: <20190219193027.13882-1-jbroadus@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yzjpahq6uzzczh6h" Content-Disposition: inline In-Reply-To: <20190219193027.13882-1-jbroadus@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yzjpahq6uzzczh6h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 19, 2019 at 11:30:27AM -0800, Jim Broadus wrote: > 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. >=20 > For example, the touchscreen and trackpad devices on a Dell Inspiron lapt= op > 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. >=20 > 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. >=20 > Fixes: 6f108dd70d30 ("i2c: Clear client->irq in i2c_device_remove") > Signed-off-by: Jim Broadus Adding Benjamin to CC > --- > drivers/i2c/i2c-core-base.c | 9 +++++---- > include/linux/i2c.h | 1 + > 2 files changed, 6 insertions(+), 4 deletions(-) >=20 > 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); > =20 > - client->irq =3D 0; > + client->irq =3D client->init_irq; > =20 > return status; > } > @@ -741,10 +741,11 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c= _board_info const *info) > client->flags =3D info->flags; > client->addr =3D info->addr; > =20 > - client->irq =3D info->irq; > - if (!client->irq) > - client->irq =3D i2c_dev_irq_from_resources(info->resources, > + client->init_irq =3D info->irq; > + if (!client->init_irq) > + client->init_irq =3D i2c_dev_irq_from_resources(info->resources, > info->num_resources); > + client->irq =3D client->init_irq; > =20 > strlcpy(client->name, info->type, sizeof(client->name)); > =20 > 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) > --=20 > 2.20.1 >=20 --yzjpahq6uzzczh6h Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlxvM4wACgkQFA3kzBSg KbZimBAAqUthoS36WAVsPLDvTUfDY3C3XsaX9SAWeX0d8PyDrz6Ba3aUfyt77JwW WQNn4rceHgav8xpg+1nogCBm6d1RY74tvtTD46SYm8QK1bLyMQAVORGQBb6rSHNK I+oJalVk1EdHMkeVaPV/4Meof4bVZtkIyga5A1xxWsIvUmmYsmBJHKqqDURxNCKX O9mKshKQtZRcFMeF7RW93C8om+Edj+X3yaPMjJCumJTEcNroZGTqSEO18CkGznv6 LcE/G/6e6K6fFcrq3gVfZImsu/rnXprspoN1hj49GJ1gTMknoberiGBQ5Ga7juDW jTTRRiS/XsY36Xqkxv6RkT0BiTwJDmecjygVEr8ANXuuTP8tAyIPrHDVUS1Za++J GoEZJOYAqsiBnN6Uuev8ibMfA9ICubo18GxYsfM1h2/iOW8ZOTnxmx0MYznpoNY/ Z4wFdxqRs6bufx/UZJ+hVoLhZAPkT+1V2xNY4V74qE8UXEnHxuJoEzGK1tdjw8Jh H5xhWxDqdQqwkF9pY8ymM7gDYncPkZLnQYc3gVr3d8pMjtWKBKGLTiX+mrqR5TRq 0wfTfvGe/AMOJbiHiKLergJkVY4d1s1aDgQBaAMR6/Hvz5flLwDeN5f/EOm1zvLB eEX9wurXkd4uq6ijcUJCh/fcaGXqy6Hc04AFMmCitrKJUzvR2zo= =Ijv+ -----END PGP SIGNATURE----- --yzjpahq6uzzczh6h--