aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gpio-fan.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-09-25 19:09:06 -0400
committerGuenter Roeck <linux@roeck-us.net>2017-10-29 21:36:03 -0400
commit8c0eb9bc52fad2fec7a5ff40d5da85b74232f5de (patch)
tree694cce803ba37d6b425f1c97983d0110de1d0b2d /drivers/hwmon/gpio-fan.c
parentef7a612415958de1f9afd86235d38b14975d0b7c (diff)
hwmon: (gpio-fan) Send around device pointer
The driver is storing the struct platform_device *pdev pointer but what it is really using and want to pass around is a struct device *dev pointer. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
-rw-r--r--drivers/hwmon/gpio-fan.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index cfa8d9b578dd..ad7d8fdf4f81 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -58,7 +58,7 @@ struct gpio_fan_platform_data {
58}; 58};
59 59
60struct gpio_fan_data { 60struct gpio_fan_data {
61 struct platform_device *pdev; 61 struct device *dev;
62 struct device *hwmon_dev; 62 struct device *hwmon_dev;
63 /* Cooling device if any */ 63 /* Cooling device if any */
64 struct thermal_cooling_device *cdev; 64 struct thermal_cooling_device *cdev;
@@ -85,8 +85,8 @@ static void fan_alarm_notify(struct work_struct *ws)
85 struct gpio_fan_data *fan_data = 85 struct gpio_fan_data *fan_data =
86 container_of(ws, struct gpio_fan_data, alarm_work); 86 container_of(ws, struct gpio_fan_data, alarm_work);
87 87
88 sysfs_notify(&fan_data->pdev->dev.kobj, NULL, "fan1_alarm"); 88 sysfs_notify(&fan_data->dev->kobj, NULL, "fan1_alarm");
89 kobject_uevent(&fan_data->pdev->dev.kobj, KOBJ_CHANGE); 89 kobject_uevent(&fan_data->dev->kobj, KOBJ_CHANGE);
90} 90}
91 91
92static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id) 92static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id)
@@ -118,11 +118,11 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data,
118{ 118{
119 int err; 119 int err;
120 int alarm_irq; 120 int alarm_irq;
121 struct platform_device *pdev = fan_data->pdev; 121 struct device *dev = fan_data->dev;
122 122
123 fan_data->alarm = alarm; 123 fan_data->alarm = alarm;
124 124
125 err = devm_gpio_request(&pdev->dev, alarm->gpio, "GPIO fan alarm"); 125 err = devm_gpio_request(dev, alarm->gpio, "GPIO fan alarm");
126 if (err) 126 if (err)
127 return err; 127 return err;
128 128
@@ -140,7 +140,7 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data,
140 140
141 INIT_WORK(&fan_data->alarm_work, fan_alarm_notify); 141 INIT_WORK(&fan_data->alarm_work, fan_alarm_notify);
142 irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH); 142 irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH);
143 err = devm_request_irq(&pdev->dev, alarm_irq, fan_alarm_irq_handler, 143 err = devm_request_irq(dev, alarm_irq, fan_alarm_irq_handler,
144 IRQF_SHARED, "GPIO fan alarm", fan_data); 144 IRQF_SHARED, "GPIO fan alarm", fan_data);
145 return err; 145 return err;
146} 146}
@@ -191,7 +191,7 @@ static int get_fan_speed_index(struct gpio_fan_data *fan_data)
191 if (fan_data->speed[i].ctrl_val == ctrl_val) 191 if (fan_data->speed[i].ctrl_val == ctrl_val)
192 return i; 192 return i;
193 193
194 dev_warn(&fan_data->pdev->dev, 194 dev_warn(fan_data->dev,
195 "missing speed array entry for GPIO value 0x%x\n", ctrl_val); 195 "missing speed array entry for GPIO value 0x%x\n", ctrl_val);
196 196
197 return -ENODEV; 197 return -ENODEV;
@@ -382,13 +382,13 @@ static const struct attribute_group *gpio_fan_groups[] = {
382static int fan_ctrl_init(struct gpio_fan_data *fan_data, 382static int fan_ctrl_init(struct gpio_fan_data *fan_data,
383 struct gpio_fan_platform_data *pdata) 383 struct gpio_fan_platform_data *pdata)
384{ 384{
385 struct platform_device *pdev = fan_data->pdev; 385 struct device *dev = fan_data->dev;
386 int num_ctrl = pdata->num_ctrl; 386 int num_ctrl = pdata->num_ctrl;
387 unsigned *ctrl = pdata->ctrl; 387 unsigned *ctrl = pdata->ctrl;
388 int i, err; 388 int i, err;
389 389
390 for (i = 0; i < num_ctrl; i++) { 390 for (i = 0; i < num_ctrl; i++) {
391 err = devm_gpio_request(&pdev->dev, ctrl[i], 391 err = devm_gpio_request(dev, ctrl[i],
392 "GPIO fan control"); 392 "GPIO fan control");
393 if (err) 393 if (err)
394 return err; 394 return err;
@@ -588,7 +588,7 @@ static int gpio_fan_probe(struct platform_device *pdev)
588 return -EINVAL; 588 return -EINVAL;
589#endif /* CONFIG_OF_GPIO */ 589#endif /* CONFIG_OF_GPIO */
590 590
591 fan_data->pdev = pdev; 591 fan_data->dev = dev;
592 platform_set_drvdata(pdev, fan_data); 592 platform_set_drvdata(pdev, fan_data);
593 mutex_init(&fan_data->lock); 593 mutex_init(&fan_data->lock);
594 594