aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-08-16 12:39:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-16 12:51:02 -0400
commit09649a85adfedde99b47b6ccef3fea696fad72be (patch)
tree5faa03756a45e37b775721f63d3555b921d13623 /drivers/misc
parentc216fdeb2e7371554c56ba457c374cce9c77f91a (diff)
mei: wd: use watchdog_set/get_drvdata for passing mei_device
use watchdog_set/get_drvdata for passing mei_device to watchdog_ops handlers instead of using global mei_device Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/wd.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c
index 0824166a7303..d96c537f046f 100644
--- a/drivers/misc/mei/wd.c
+++ b/drivers/misc/mei/wd.c
@@ -194,7 +194,7 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev)
194 int err = -ENODEV; 194 int err = -ENODEV;
195 struct mei_device *dev; 195 struct mei_device *dev;
196 196
197 dev = pci_get_drvdata(mei_device); 197 dev = watchdog_get_drvdata(wd_dev);
198 if (!dev) 198 if (!dev)
199 return -ENODEV; 199 return -ENODEV;
200 200
@@ -231,8 +231,8 @@ end_unlock:
231static int mei_wd_ops_stop(struct watchdog_device *wd_dev) 231static int mei_wd_ops_stop(struct watchdog_device *wd_dev)
232{ 232{
233 struct mei_device *dev; 233 struct mei_device *dev;
234 dev = pci_get_drvdata(mei_device);
235 234
235 dev = watchdog_get_drvdata(wd_dev);
236 if (!dev) 236 if (!dev)
237 return -ENODEV; 237 return -ENODEV;
238 238
@@ -254,8 +254,8 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
254{ 254{
255 int ret = 0; 255 int ret = 0;
256 struct mei_device *dev; 256 struct mei_device *dev;
257 dev = pci_get_drvdata(mei_device);
258 257
258 dev = watchdog_get_drvdata(wd_dev);
259 if (!dev) 259 if (!dev)
260 return -ENODEV; 260 return -ENODEV;
261 261
@@ -309,8 +309,8 @@ end:
309static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout) 309static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout)
310{ 310{
311 struct mei_device *dev; 311 struct mei_device *dev;
312 dev = pci_get_drvdata(mei_device);
313 312
313 dev = watchdog_get_drvdata(wd_dev);
314 if (!dev) 314 if (!dev)
315 return -ENODEV; 315 return -ENODEV;
316 316
@@ -355,25 +355,28 @@ static struct watchdog_device amt_wd_dev = {
355}; 355};
356 356
357 357
358void mei_watchdog_register(struct mei_device *dev) 358void mei_watchdog_register(struct mei_device *dev)
359{ 359{
360 dev_dbg(&dev->pdev->dev, "dev->wd_timeout =%d.\n", dev->wd_timeout);
361
362 if (watchdog_register_device(&amt_wd_dev)) { 360 if (watchdog_register_device(&amt_wd_dev)) {
363 dev_err(&dev->pdev->dev, 361 dev_err(&dev->pdev->dev,
364 "wd: unable to register watchdog device.\n"); 362 "wd: unable to register watchdog device.\n");
365 dev->wd_interface_reg = false; 363 dev->wd_interface_reg = false;
366 } else { 364 return;
367 dev_dbg(&dev->pdev->dev,
368 "wd: successfully register watchdog interface.\n");
369 dev->wd_interface_reg = true;
370 } 365 }
366
367 dev_dbg(&dev->pdev->dev,
368 "wd: successfully register watchdog interface.\n");
369 dev->wd_interface_reg = true;
370 watchdog_set_drvdata(&amt_wd_dev, dev);
371} 371}
372 372
373void mei_watchdog_unregister(struct mei_device *dev) 373void mei_watchdog_unregister(struct mei_device *dev)
374{ 374{
375 if (dev->wd_interface_reg) 375 if (!dev->wd_interface_reg)
376 watchdog_unregister_device(&amt_wd_dev); 376 return;
377
378 watchdog_set_drvdata(&amt_wd_dev, NULL);
379 watchdog_unregister_device(&amt_wd_dev);
377 dev->wd_interface_reg = false; 380 dev->wd_interface_reg = false;
378} 381}
379 382