From: Jean Delvare <jdelvare@suse.de>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: linux-i2c@vger.kernel.org
Subject: Re: [PATCH 06/10] i2c: i801: Remove not needed check for PCI_COMMAND_INTX_DISABLE
Date: Fri, 6 Aug 2021 10:46:28 +0200 [thread overview]
Message-ID: <20210806104628.2975ae37@endymion> (raw)
In-Reply-To: <cfe089f3-fe26-5373-63f2-c47b8d13f491@gmail.com>
On Thu, 5 Aug 2021 22:04:18 +0200, Heiner Kallweit wrote:
> On 05.08.2021 12:41, Jean Delvare wrote:
> > On Sun, 01 Aug 2021 16:21:08 +0200, Heiner Kallweit wrote:
> >> do_pci_enable_device() takes care that PCI_COMMAND_INTX_DISABLE
> >> is cleared if a legacy interrupt is used.
> >
> > Only if pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) returned a
> > non-zero pin, if I read the code correctly. While I can't remember the
> > context in which I wrote this piece of code, I suppose that pin == 0
> > was the situation where this test was needed. I mean, the board
> > designer can legitimately not wire the interrupt pin, and require that
> > polling is being used, right?
>
> I think we have such a use case, but it's handled in ACPI and results
> in dev->irq == IRQ_NOTCONNECTED.
But not all systems use ACPI. The i2c-i801 driver could be used on
non-ACPI systems. I don't know if this is actually the case though. But
we definitely allow building kernels with ACPI disabled and I2C_I801
enabled.
> In case of pin == 0 pci_dev->irq is 0, and I'd expect that irq_to_desc(0)
> returns NULL and request_threaded_irq() returns -EINVAL. This would
> result in switching to polling.
Reading the !CONFIG_SPARSE_IRQ version of that function, it doesn't
seem so. irq_to_desc(0) would return &irq_desc[0]. IRQ 0 is not
invalid, it was the system clock on legacy PC systems, and probably
still is for compatibility reasons. I suppose the CONFIG_SPARSE_IRQ
version of irq_to_desc() is compatible with that too.
That being said, I suppose IRQ 0 is requested early at boot, so the
i2c-i801 driver would get -EBUSY or similar when trying to request it,
which in turn would result in falling back to polling mode, which is
what we want.
> Having said that I see no scenario where the check would be needed.
>
> > In your favor, I can't find any online kernel log with this message.
> > However that doesn't mean I'm comfortable removing the safety check.
I'm still uncertain about what to do here. On the one hand, the check
can't hurt, and if we hit a corner case, could provide useful debugging
information. On the other hand, it may be dead code if you are correct,
and I don't like dead code.
I suppose we could remove the code for now, and see if anyone reports a
regression.
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2021-08-06 8:46 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-01 14:15 [PATCH 00/10] i2c: i801: Series with improvements Heiner Kallweit
2021-08-01 14:16 ` [PATCH 01/10] i2c: i801: Don't call pm_runtime_allow Heiner Kallweit
2021-08-02 12:53 ` Jean Delvare
2021-08-02 16:31 ` Heiner Kallweit
2021-08-04 13:36 ` Jarkko Nikula
2021-08-04 14:06 ` Rafael J. Wysocki
2021-08-04 19:02 ` Heiner Kallweit
2021-08-05 8:31 ` Jean Delvare
2021-08-06 14:11 ` Rafael J. Wysocki
2021-08-06 13:52 ` Rafael J. Wysocki
2021-08-06 18:34 ` Heiner Kallweit
2021-08-01 14:17 ` [PATCH 02/10] i2c: i801: Improve disabling runtime pm Heiner Kallweit
2021-08-05 8:39 ` Jean Delvare
2021-08-01 14:18 ` [PATCH 03/10] i2c: i801: Make p2sb_spinlock a mutex Heiner Kallweit
2021-08-05 8:49 ` Jean Delvare
2021-08-05 12:19 ` Mika Westerberg
2021-08-01 14:19 ` [PATCH 04/10] i2c: i801: Remove not needed debug message Heiner Kallweit
2021-08-05 8:53 ` Jean Delvare
2021-08-01 14:20 ` [PATCH 05/10] i2c: i801: Improve is_dell_system_with_lis3lv02d Heiner Kallweit
2021-08-05 9:51 ` Jean Delvare
2021-08-05 19:11 ` Pali Rohár
2021-08-05 19:42 ` Heiner Kallweit
2021-08-05 23:08 ` Pali Rohár
2021-08-06 9:55 ` Jean Delvare
2021-08-06 10:47 ` Pali Rohár
2021-08-06 11:26 ` Jean Delvare
2021-08-01 14:21 ` [PATCH 06/10] i2c: i801: Remove not needed check for PCI_COMMAND_INTX_DISABLE Heiner Kallweit
2021-08-05 10:41 ` Jean Delvare
2021-08-05 20:04 ` Heiner Kallweit
2021-08-06 8:46 ` Jean Delvare [this message]
2021-08-01 14:21 ` [PATCH 07/10] i2c: i801: Improve i801_acpi_probe/remove functions Heiner Kallweit
2021-08-05 13:38 ` Jean Delvare
2021-08-05 14:24 ` Mika Westerberg
2021-08-01 14:22 ` [PATCH 08/10] i2c: i801: Improve i801_add_mux Heiner Kallweit
2021-08-05 13:43 ` Jean Delvare
2021-08-01 14:23 ` [PATCH 09/10] i2c: i801: Improve register_dell_lis3lv02d_i2c_device Heiner Kallweit
2021-08-05 14:23 ` Jean Delvare
2021-08-06 20:49 ` Heiner Kallweit
2021-08-09 13:33 ` Jean Delvare
2021-08-09 19:11 ` Heiner Kallweit
2021-08-01 14:24 ` [PATCH 10/10] i2c: i801: Improve handling platform data for tco device Heiner Kallweit
2021-08-05 18:32 ` Jean Delvare
2021-08-05 19:44 ` Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210806104628.2975ae37@endymion \
--to=jdelvare@suse.de \
--cc=hkallweit1@gmail.com \
--cc=linux-i2c@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox