All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: i801: Improve i801_setup_hstcfg
@ 2021-05-25 20:07 Heiner Kallweit
  2021-06-14 19:03 ` Jean Delvare
  2021-06-20 20:56 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2021-05-25 20:07 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-i2c

i801_setup_hstcfg() leaves the bits in priv->original_hstcfg that
we're interested in intact. Therefore we can remove the return value
from the function and use priv->original_hstcfg directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/i2c/busses/i2c-i801.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 54d84b9ef..047f73f1a 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1692,19 +1692,17 @@ static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; }
 static inline void i801_acpi_remove(struct i801_priv *priv) { }
 #endif
 
-static unsigned char i801_setup_hstcfg(struct i801_priv *priv)
+static void i801_setup_hstcfg(struct i801_priv *priv)
 {
 	unsigned char hstcfg = priv->original_hstcfg;
 
 	hstcfg &= ~SMBHSTCFG_I2C_EN;	/* SMBus timing */
 	hstcfg |= SMBHSTCFG_HST_EN;
 	pci_write_config_byte(priv->pci_dev, SMBHSTCFG, hstcfg);
-	return hstcfg;
 }
 
 static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	unsigned char temp;
 	int err, i;
 	struct i801_priv *priv;
 
@@ -1827,16 +1825,16 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	}
 
 	pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &priv->original_hstcfg);
-	temp = i801_setup_hstcfg(priv);
+	i801_setup_hstcfg(priv);
 	if (!(priv->original_hstcfg & SMBHSTCFG_HST_EN))
 		dev_info(&dev->dev, "Enabling SMBus device\n");
 
-	if (temp & SMBHSTCFG_SMB_SMI_EN) {
+	if (priv->original_hstcfg & SMBHSTCFG_SMB_SMI_EN) {
 		dev_dbg(&dev->dev, "SMBus using interrupt SMI#\n");
 		/* Disable SMBus interrupt feature if SMBus using SMI# */
 		priv->features &= ~FEATURE_IRQ;
 	}
-	if (temp & SMBHSTCFG_SPD_WD)
+	if (priv->original_hstcfg & SMBHSTCFG_SPD_WD)
 		dev_info(&dev->dev, "SPD Write Disable is set\n");
 
 	/* Clear special mode bits */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: i801: Improve i801_setup_hstcfg
  2021-05-25 20:07 [PATCH] i2c: i801: Improve i801_setup_hstcfg Heiner Kallweit
@ 2021-06-14 19:03 ` Jean Delvare
  2021-06-20 20:56 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2021-06-14 19:03 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: linux-i2c

On Tue, 25 May 2021 22:07:17 +0200, Heiner Kallweit wrote:
> i801_setup_hstcfg() leaves the bits in priv->original_hstcfg that
> we're interested in intact. Therefore we can remove the return value
> from the function and use priv->original_hstcfg directly.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/i2c/busses/i2c-i801.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> (...)

I like it.

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: Improve i801_setup_hstcfg
  2021-05-25 20:07 [PATCH] i2c: i801: Improve i801_setup_hstcfg Heiner Kallweit
  2021-06-14 19:03 ` Jean Delvare
@ 2021-06-20 20:56 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-06-20 20:56 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Jean Delvare, linux-i2c

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

On Tue, May 25, 2021 at 10:07:17PM +0200, Heiner Kallweit wrote:
> i801_setup_hstcfg() leaves the bits in priv->original_hstcfg that
> we're interested in intact. Therefore we can remove the return value
> from the function and use priv->original_hstcfg directly.
> 
> 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-06-20 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 20:07 [PATCH] i2c: i801: Improve i801_setup_hstcfg Heiner Kallweit
2021-06-14 19:03 ` Jean Delvare
2021-06-20 20:56 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.