* [PATCH] i2c: i801: Use standard PCI constants instead of own ones
@ 2021-05-22 21:46 Heiner Kallweit
2021-05-25 9:42 ` Jean Delvare
2021-05-27 20:10 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2021-05-22 21:46 UTC (permalink / raw)
To: Jean Delvare; +Cc: linux-i2c@vger.kernel.org
Layout of these registers is part of the PCI standard. Therefore use
the constants defined by the PCI subsystem.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/busses/i2c-i801.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 738204d77..f6d7866f1 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -131,8 +131,6 @@
/* PCI Address Constants */
#define SMBBAR 4
-#define SMBPCICTL 0x004
-#define SMBPCISTS 0x006
#define SMBHSTCFG 0x040
#define TCOBASE 0x050
#define TCOCTL 0x054
@@ -141,12 +139,6 @@
#define SBREG_SMBCTRL 0xc6000c
#define SBREG_SMBCTRL_DNV 0xcf000c
-/* Host status bits for SMBPCISTS */
-#define SMBPCISTS_INTS BIT(3)
-
-/* Control bits for SMBPCICTL */
-#define SMBPCICTL_INTDIS BIT(10)
-
/* Host configuration bits for SMBHSTCFG */
#define SMBHSTCFG_HST_EN BIT(0)
#define SMBHSTCFG_SMB_SMI_EN BIT(1)
@@ -648,8 +640,8 @@ static irqreturn_t i801_isr(int irq, void *dev_id)
u8 status;
/* Confirm this is our interrupt */
- pci_read_config_word(priv->pci_dev, SMBPCISTS, &pcists);
- if (!(pcists & SMBPCISTS_INTS))
+ pci_read_config_word(priv->pci_dev, PCI_STATUS, &pcists);
+ if (!(pcists & PCI_STATUS_INTERRUPT))
return IRQ_NONE;
if (priv->features & FEATURE_HOST_NOTIFY) {
@@ -1866,13 +1858,13 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
u16 pcictl, pcists;
/* Complain if an interrupt is already pending */
- pci_read_config_word(priv->pci_dev, SMBPCISTS, &pcists);
- if (pcists & SMBPCISTS_INTS)
+ pci_read_config_word(priv->pci_dev, PCI_STATUS, &pcists);
+ if (pcists & PCI_STATUS_INTERRUPT)
dev_warn(&dev->dev, "An interrupt is pending!\n");
/* Check if interrupts have been disabled */
- pci_read_config_word(priv->pci_dev, SMBPCICTL, &pcictl);
- if (pcictl & SMBPCICTL_INTDIS) {
+ pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pcictl);
+ if (pcictl & PCI_COMMAND_INTX_DISABLE) {
dev_info(&dev->dev, "Interrupts are disabled\n");
priv->features &= ~FEATURE_IRQ;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: i801: Use standard PCI constants instead of own ones
2021-05-22 21:46 [PATCH] i2c: i801: Use standard PCI constants instead of own ones Heiner Kallweit
@ 2021-05-25 9:42 ` Jean Delvare
2021-05-27 20:10 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2021-05-25 9:42 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-i2c
On Sat, 22 May 2021 23:46:20 +0200, Heiner Kallweit wrote:
> Layout of these registers is part of the PCI standard. Therefore use
> the constants defined by the PCI subsystem.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/i2c/busses/i2c-i801.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 738204d77..f6d7866f1 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -131,8 +131,6 @@
>
> /* PCI Address Constants */
> #define SMBBAR 4
> -#define SMBPCICTL 0x004
> -#define SMBPCISTS 0x006
> #define SMBHSTCFG 0x040
> #define TCOBASE 0x050
> #define TCOCTL 0x054
> @@ -141,12 +139,6 @@
> #define SBREG_SMBCTRL 0xc6000c
> #define SBREG_SMBCTRL_DNV 0xcf000c
>
> -/* Host status bits for SMBPCISTS */
> -#define SMBPCISTS_INTS BIT(3)
> -
> -/* Control bits for SMBPCICTL */
> -#define SMBPCICTL_INTDIS BIT(10)
> -
> /* Host configuration bits for SMBHSTCFG */
> #define SMBHSTCFG_HST_EN BIT(0)
> #define SMBHSTCFG_SMB_SMI_EN BIT(1)
> @@ -648,8 +640,8 @@ static irqreturn_t i801_isr(int irq, void *dev_id)
> u8 status;
>
> /* Confirm this is our interrupt */
> - pci_read_config_word(priv->pci_dev, SMBPCISTS, &pcists);
> - if (!(pcists & SMBPCISTS_INTS))
> + pci_read_config_word(priv->pci_dev, PCI_STATUS, &pcists);
> + if (!(pcists & PCI_STATUS_INTERRUPT))
> return IRQ_NONE;
>
> if (priv->features & FEATURE_HOST_NOTIFY) {
> @@ -1866,13 +1858,13 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
> u16 pcictl, pcists;
>
> /* Complain if an interrupt is already pending */
> - pci_read_config_word(priv->pci_dev, SMBPCISTS, &pcists);
> - if (pcists & SMBPCISTS_INTS)
> + pci_read_config_word(priv->pci_dev, PCI_STATUS, &pcists);
> + if (pcists & PCI_STATUS_INTERRUPT)
> dev_warn(&dev->dev, "An interrupt is pending!\n");
>
> /* Check if interrupts have been disabled */
> - pci_read_config_word(priv->pci_dev, SMBPCICTL, &pcictl);
> - if (pcictl & SMBPCICTL_INTDIS) {
> + pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pcictl);
> + if (pcictl & PCI_COMMAND_INTX_DISABLE) {
> dev_info(&dev->dev, "Interrupts are disabled\n");
> priv->features &= ~FEATURE_IRQ;
> }
Nice, thanks for the clean-up.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: i801: Use standard PCI constants instead of own ones
2021-05-22 21:46 [PATCH] i2c: i801: Use standard PCI constants instead of own ones Heiner Kallweit
2021-05-25 9:42 ` Jean Delvare
@ 2021-05-27 20:10 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-05-27 20:10 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Jean Delvare, linux-i2c@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
On Sat, May 22, 2021 at 11:46:20PM +0200, Heiner Kallweit wrote:
> Layout of these registers is part of the PCI standard. Therefore use
> the constants defined by the PCI subsystem.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-27 20:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-22 21:46 [PATCH] i2c: i801: Use standard PCI constants instead of own ones Heiner Kallweit
2021-05-25 9:42 ` Jean Delvare
2021-05-27 20:10 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox