public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 3/4] i2c-i801: Check if interrupts are disabled
Date: Tue, 11 Nov 2014 11:58:54 +0100	[thread overview]
Message-ID: <20141111105853.GB3794@katana> (raw)
In-Reply-To: <20141110223139.02aafde4-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]

On Mon, Nov 10, 2014 at 10:31:39PM +0100, Jean Delvare wrote:
> There is a control bit in the PCI configuration space which disables
> interrupts. If this bit is set, the driver should not try to make use
> of interrupts, it won't receive any.
> 
> Signed-off-by: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
> Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-i801.c |   21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> --- linux-3.18-rc4.orig/drivers/i2c/busses/i2c-i801.c	2014-11-10 22:29:44.416991298 +0100
> +++ linux-3.18-rc4/drivers/i2c/busses/i2c-i801.c	2014-11-10 22:29:46.915045662 +0100
> @@ -110,12 +110,16 @@
>  
>  /* PCI Address Constants */
>  #define SMBBAR		4
> +#define SMBPCICTL	0x004
>  #define SMBPCISTS	0x006
>  #define SMBHSTCFG	0x040
>  
>  /* Host status bits for SMBPCISTS */
>  #define SMBPCISTS_INTS		0x08
>  
> +/* Control bits for SMBPCICTL */
> +#define SMBPCICTL_INTDIS	0x0400
> +
>  /* Host configuration bits for SMBHSTCFG */
>  #define SMBHSTCFG_HST_EN	1
>  #define SMBHSTCFG_SMB_SMI_EN	2
> @@ -1235,6 +1239,23 @@ static int i801_probe(struct pci_dev *de
>  	priv->adapter.timeout = HZ / 5;
>  
>  	if (priv->features & FEATURE_IRQ) {
> +		u16 pcictl, pcists;
> +
> +		/* Complain if an interrupt is already pending */
> +		pci_read_config_word(priv->pci_dev, SMBPCISTS, &pcists);
> +		if (pcists & SMBPCISTS_INTS)
> +			dev_warn(&dev->dev, "An interrupt is pending!\n");

You think it is better to not clear it?

> +
> +		/* Check if interrupts have been disabled */
> +		pci_read_config_word(priv->pci_dev, SMBPCICTL, &pcictl);
> +		if (pcictl & SMBPCICTL_INTDIS) {
> +			dev_warn(&dev->dev,
> +				 "Interrupts are disabled, will use polling\n");

I'd say it is more info than warning?

> +			priv->features &= ~FEATURE_IRQ;
> +		}
> +	}
> +
> +	if (priv->features & FEATURE_IRQ) {
>  		init_waitqueue_head(&priv->waitq);
>  
>  		err = request_irq(dev->irq, i801_isr, IRQF_SHARED,
> 
> -- 
> Jean Delvare
> SUSE L3 Support

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-11-11 10:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 21:26 [PATCH 0/4] i2c-i801: Make interrupt mode more robust Jean Delvare
     [not found] ` <20141110222655.13660613-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-11-10 21:30   ` [PATCH 1/4] i2c-i801: Use wait_event_timeout to wait for interrupts Jean Delvare
2014-11-10 21:31   ` [PATCH 2/4] i2c-i801: Fallback to polling if request_irq() fails Jean Delvare
     [not found]     ` <20141110223104.6419229d-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-11-11 10:57       ` Wolfram Sang
2014-11-11 13:55         ` Jean Delvare
2014-11-10 21:31   ` [PATCH 3/4] i2c-i801: Check if interrupts are disabled Jean Delvare
     [not found]     ` <20141110223139.02aafde4-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-11-11 10:58       ` Wolfram Sang [this message]
2014-11-11 14:32         ` Jean Delvare
     [not found]           ` <20141111153214.39dfaeb8-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-11-11 14:41             ` Wolfram Sang
2014-11-11 20:06               ` Jean Delvare
     [not found]                 ` <20141111210646.02b77c68-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-11-11 20:13                   ` Wolfram Sang
2014-11-10 21:32   ` [PATCH 4/4] i2c-i801: Drop useless debug message Jean Delvare

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=20141111105853.GB3794@katana \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=jdelvare-l3A5Bk7waGM@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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