diff mbox series

[v1,2/4] hwmon (it87): Do not enter configuration mode for some chip types

Message ID 20240401025620.205068-3-frank@crawford.emu.id.au (mailing list archive)
State Rejected
Headers show
Series hwmon (it87): Correct handling for configuration mode | expand

Commit Message

Frank Crawford April 1, 2024, 2:56 a.m. UTC
Update the configuration mode entry code to allow conditional entry, and
apply to all calls.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
---
 drivers/hwmon/it87.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Guenter Roeck April 10, 2024, 3:12 p.m. UTC | #1
On Mon, Apr 01, 2024 at 01:56:04PM +1100, Frank Crawford wrote:
> Update the configuration mode entry code to allow conditional entry, and
> apply to all calls.
> 

This is just as wrong as the previous patch. Any such option
would have to be board specific, not chip specific.

Guenter

> Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
> ---
>  drivers/hwmon/it87.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 6eeba3a01e3c..396c2d3afbf7 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -117,7 +117,7 @@ static inline void superio_select(int ioreg, int ldn)
>  	outb(ldn, ioreg + 1);
>  }
>  
> -static inline int superio_enter(int ioreg)
> +static inline int superio_enter(int ioreg, bool noentry)
>  {
>  	/*
>  	 * Try to reserve ioreg and ioreg + 1 for exclusive access.
> @@ -125,7 +125,8 @@ static inline int superio_enter(int ioreg)
>  	if (!request_muxed_region(ioreg, 2, DRVNAME))
>  		return -EBUSY;
>  
> -	__superio_enter(ioreg);
> +	if (!noentry)
> +		__superio_enter(ioreg);
>  	return 0;
>  }
>  
> @@ -742,7 +743,7 @@ static int smbus_disable(struct it87_data *data)
>  	int err;
>  
>  	if (data->smbus_bitmap) {
> -		err = superio_enter(data->sioaddr);
> +		err = superio_enter(data->sioaddr, has_conf_biosopen(data));
>  		if (err)
>  			return err;
>  		superio_select(data->sioaddr, PME);
> @@ -758,7 +759,7 @@ static int smbus_enable(struct it87_data *data)
>  	int err;
>  
>  	if (data->smbus_bitmap) {
> -		err = superio_enter(data->sioaddr);
> +		err = superio_enter(data->sioaddr, has_conf_biosopen(data));
>  		if (err)
>  			return err;
>  
> @@ -2674,7 +2675,7 @@ static int __init it87_find(int sioaddr, unsigned short *address,
>  	u16 chip_type;
>  	const struct it87_devices *config = NULL;
>  
> -	err = superio_enter(sioaddr);
> +	err = superio_enter(sioaddr, false);
>  	if (err)
>  		return err;
>  
> @@ -3520,7 +3521,7 @@ static void it87_resume_sio(struct platform_device *pdev)
>  	if (!data->need_in7_reroute)
>  		return;
>  
> -	err = superio_enter(data->sioaddr);
> +	err = superio_enter(data->sioaddr, has_conf_biosopen(data));
>  	if (err) {
>  		dev_warn(&pdev->dev,
>  			 "Unable to enter Super I/O to reroute in7 (%d)",
diff mbox series

Patch

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 6eeba3a01e3c..396c2d3afbf7 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -117,7 +117,7 @@  static inline void superio_select(int ioreg, int ldn)
 	outb(ldn, ioreg + 1);
 }
 
-static inline int superio_enter(int ioreg)
+static inline int superio_enter(int ioreg, bool noentry)
 {
 	/*
 	 * Try to reserve ioreg and ioreg + 1 for exclusive access.
@@ -125,7 +125,8 @@  static inline int superio_enter(int ioreg)
 	if (!request_muxed_region(ioreg, 2, DRVNAME))
 		return -EBUSY;
 
-	__superio_enter(ioreg);
+	if (!noentry)
+		__superio_enter(ioreg);
 	return 0;
 }
 
@@ -742,7 +743,7 @@  static int smbus_disable(struct it87_data *data)
 	int err;
 
 	if (data->smbus_bitmap) {
-		err = superio_enter(data->sioaddr);
+		err = superio_enter(data->sioaddr, has_conf_biosopen(data));
 		if (err)
 			return err;
 		superio_select(data->sioaddr, PME);
@@ -758,7 +759,7 @@  static int smbus_enable(struct it87_data *data)
 	int err;
 
 	if (data->smbus_bitmap) {
-		err = superio_enter(data->sioaddr);
+		err = superio_enter(data->sioaddr, has_conf_biosopen(data));
 		if (err)
 			return err;
 
@@ -2674,7 +2675,7 @@  static int __init it87_find(int sioaddr, unsigned short *address,
 	u16 chip_type;
 	const struct it87_devices *config = NULL;
 
-	err = superio_enter(sioaddr);
+	err = superio_enter(sioaddr, false);
 	if (err)
 		return err;
 
@@ -3520,7 +3521,7 @@  static void it87_resume_sio(struct platform_device *pdev)
 	if (!data->need_in7_reroute)
 		return;
 
-	err = superio_enter(data->sioaddr);
+	err = superio_enter(data->sioaddr, has_conf_biosopen(data));
 	if (err) {
 		dev_warn(&pdev->dev,
 			 "Unable to enter Super I/O to reroute in7 (%d)",