diff mbox series

[v2,2/3] hwmon: (it87) Improve temperature reporting support

Message ID 20230707123005.956415-3-frank@crawford.emu.id.au (mailing list archive)
State Accepted
Headers show
Series hwmon: (it87) Separate temperature type to separate funtion and detect AMDTSI | expand

Commit Message

Frank Crawford July 7, 2023, 12:29 p.m. UTC
Add test if thermistor sensor type attribute should be visible, i.e.
test if the attribute is defined.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
---

v2:
 * Split single patch into multi-patch set following review.

---
 drivers/hwmon/it87.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Guenter Roeck July 19, 2023, 2:56 a.m. UTC | #1
On Fri, Jul 07, 2023 at 10:29:51PM +1000, Frank Crawford wrote:
> Add test if thermistor sensor type attribute should be visible, i.e.
> test if the attribute is defined.
> 
> Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
> ---
> 
> v2:
>  * Split single patch into multi-patch set following review.
> 
> ---
>  drivers/hwmon/it87.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 7a1224ddc8b1..fb62f2a7017a 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -2330,6 +2330,14 @@ static umode_t it87_temp_is_visible(struct kobject *kobj,
>  	if (!(data->has_temp & BIT(i)))
>  		return 0;
>  
> +	if (a == 3) {
> +		int type = get_temp_type(data, i);
> +
> +		if (type == 0)
> +			return 0;

Applied. Again, I dropped the unnecessary 'type' variable.

Thanks,
Guenter

> +		return attr->mode;
> +	}
> +
>  	if (a == 5 && !has_temp_offset(data))
>  		return 0;
>
diff mbox series

Patch

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 7a1224ddc8b1..fb62f2a7017a 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -2330,6 +2330,14 @@  static umode_t it87_temp_is_visible(struct kobject *kobj,
 	if (!(data->has_temp & BIT(i)))
 		return 0;
 
+	if (a == 3) {
+		int type = get_temp_type(data, i);
+
+		if (type == 0)
+			return 0;
+		return attr->mode;
+	}
+
 	if (a == 5 && !has_temp_offset(data))
 		return 0;