summaryrefslogtreecommitdiff
path: root/drivers/hwmon/npcm750-pwm-fan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/npcm750-pwm-fan.c')
-rw-r--r--drivers/hwmon/npcm750-pwm-fan.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c
index bc8db1dc595d..c8f5e695fb6d 100644
--- a/drivers/hwmon/npcm750-pwm-fan.c
+++ b/drivers/hwmon/npcm750-pwm-fan.c
@@ -4,7 +4,6 @@
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/hwmon.h>
-#include <linux/hwmon-sysfs.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -198,7 +197,6 @@ struct npcm7xx_pwm_fan_data {
int pwm_modules;
struct clk *pwm_clk;
struct clk *fan_clk;
- struct mutex pwm_lock[NPCM7XX_PWM_MAX_MODULES];
spinlock_t fan_lock[NPCM7XX_FAN_MAX_MODULE];
int fan_irq[NPCM7XX_FAN_MAX_MODULE];
bool pwm_present[NPCM7XX_PWM_MAX_CHN_NUM];
@@ -221,7 +219,6 @@ static int npcm7xx_pwm_config_set(struct npcm7xx_pwm_fan_data *data,
/*
* Config PWM Comparator register for setting duty cycle
*/
- mutex_lock(&data->pwm_lock[module]);
/* write new CMR value */
iowrite32(val, NPCM7XX_PWM_REG_CMRx(data->pwm_base, module, pwm_ch));
@@ -245,7 +242,6 @@ static int npcm7xx_pwm_config_set(struct npcm7xx_pwm_fan_data *data,
env_bit = NPCM7XX_PWM_CTRL_CH3_INV_BIT;
break;
default:
- mutex_unlock(&data->pwm_lock[module]);
return -ENODEV;
}
@@ -260,8 +256,6 @@ static int npcm7xx_pwm_config_set(struct npcm7xx_pwm_fan_data *data,
}
iowrite32(tmp_buf, NPCM7XX_PWM_REG_CR(data->pwm_base, module));
- mutex_unlock(&data->pwm_lock[module]);
-
return 0;
}
@@ -331,7 +325,7 @@ static void npcm7xx_fan_polling(struct timer_list *t)
struct npcm7xx_pwm_fan_data *data;
int i;
- data = from_timer(data, t, fan_timer);
+ data = timer_container_of(data, t, fan_timer);
/*
* Polling two module per one round,
@@ -927,13 +921,13 @@ static int npcm7xx_en_pwm_fan(struct device *dev,
static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct device_node *np, *child;
+ struct device_node *np;
struct npcm7xx_pwm_fan_data *data;
struct resource *res;
struct device *hwmon;
char name[20];
- int ret, cnt;
u32 output_freq;
+ int ret;
u32 i;
np = dev->of_node;
@@ -985,9 +979,6 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
output_freq = npcm7xx_pwm_init(data);
npcm7xx_fan_init(data);
- for (cnt = 0; cnt < data->pwm_modules; cnt++)
- mutex_init(&data->pwm_lock[cnt]);
-
for (i = 0; i < NPCM7XX_FAN_MAX_MODULE; i++) {
spin_lock_init(&data->fan_lock[i]);
@@ -1004,11 +995,10 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
}
}
- for_each_child_of_node(np, child) {
+ for_each_child_of_node_scoped(np, child) {
ret = npcm7xx_en_pwm_fan(dev, child, data);
if (ret) {
dev_err(dev, "enable pwm and fan failed\n");
- of_node_put(child);
return ret;
}
}