aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2011-12-22 11:50:50 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-22 16:46:16 -0500
commit70cd533763aa9804bc99a9e6cb79720fa1717770 (patch)
tree9e64f34b0cb65340036e643456d58c7cffa61e23 /drivers
parentf3bc9d24cb4a221bd3530c445fa08e33775e7707 (diff)
staging/mei: add watchdog device registration wrappers
add mei_watchdog_register/unregister wrappers for cleaner encapsulation Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/mei/interface.h11
-rw-r--r--drivers/staging/mei/interrupt.c18
-rw-r--r--drivers/staging/mei/main.c3
-rw-r--r--drivers/staging/mei/mei_dev.h5
-rw-r--r--drivers/staging/mei/wd.c28
5 files changed, 41 insertions, 24 deletions
diff --git a/drivers/staging/mei/interface.h b/drivers/staging/mei/interface.h
index 7bd38ae2c233..aeae511419c7 100644
--- a/drivers/staging/mei/interface.h
+++ b/drivers/staging/mei/interface.h
@@ -52,6 +52,17 @@ int mei_wd_send(struct mei_device *dev);
52int mei_wd_stop(struct mei_device *dev, bool preserve); 52int mei_wd_stop(struct mei_device *dev, bool preserve);
53bool mei_wd_host_init(struct mei_device *dev); 53bool mei_wd_host_init(struct mei_device *dev);
54void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout); 54void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout);
55/*
56 * mei_watchdog_register - Registering watchdog interface
57 * once we got connection to the WD Client
58 * @dev - mei device
59 */
60void mei_watchdog_register(struct mei_device *dev);
61/*
62 * mei_watchdog_unregister - Uegistering watchdog interface
63 * @dev - mei device
64 */
65void mei_watchdog_unregister(struct mei_device *dev);
55 66
56int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl); 67int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
57 68
diff --git a/drivers/staging/mei/interrupt.c b/drivers/staging/mei/interrupt.c
index c7822c9d2676..3544fee34e48 100644
--- a/drivers/staging/mei/interrupt.c
+++ b/drivers/staging/mei/interrupt.c
@@ -386,24 +386,10 @@ static void mei_client_connect_response(struct mei_device *dev,
386 /* if WD or iamthif client treat specially */ 386 /* if WD or iamthif client treat specially */
387 387
388 if (is_treat_specially_client(&(dev->wd_cl), rs)) { 388 if (is_treat_specially_client(&(dev->wd_cl), rs)) {
389 dev_dbg(&dev->pdev->dev, "dev->wd_timeout =%d.\n",
390 dev->wd_timeout);
391
392 dev->wd_due_counter = (dev->wd_timeout) ? 1 : 0;
393
394 dev_dbg(&dev->pdev->dev, "successfully connected to WD client.\n"); 389 dev_dbg(&dev->pdev->dev, "successfully connected to WD client.\n");
390 mei_watchdog_register(dev);
395 391
396 /* Registering watchdog interface device once we got connection 392 /* next step in the state maching */
397 to the WD Client
398 */
399 if (watchdog_register_device(&amt_wd_dev)) {
400 printk(KERN_ERR "mei: unable to register watchdog device.\n");
401 dev->wd_interface_reg = false;
402 } else {
403 dev_dbg(&dev->pdev->dev, "successfully register watchdog interface.\n");
404 dev->wd_interface_reg = true;
405 }
406
407 mei_host_init_iamthif(dev); 393 mei_host_init_iamthif(dev);
408 return; 394 return;
409 } 395 }
diff --git a/drivers/staging/mei/main.c b/drivers/staging/mei/main.c
index 5d84d6c530a9..1e1a9f996e7c 100644
--- a/drivers/staging/mei/main.c
+++ b/drivers/staging/mei/main.c
@@ -1082,8 +1082,7 @@ static void __devexit mei_remove(struct pci_dev *pdev)
1082 } 1082 }
1083 1083
1084 /* Unregistering watchdog device */ 1084 /* Unregistering watchdog device */
1085 if (dev->wd_interface_reg) 1085 mei_watchdog_unregister(dev);
1086 watchdog_unregister_device(&amt_wd_dev);
1087 1086
1088 /* remove entry if already in list */ 1087 /* remove entry if already in list */
1089 dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); 1088 dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n");
diff --git a/drivers/staging/mei/mei_dev.h b/drivers/staging/mei/mei_dev.h
index 5e8b64ee61ff..82bacfc624c5 100644
--- a/drivers/staging/mei/mei_dev.h
+++ b/drivers/staging/mei/mei_dev.h
@@ -35,11 +35,6 @@
35 */ 35 */
36extern struct pci_dev *mei_device; 36extern struct pci_dev *mei_device;
37 37
38/*
39 * AMT Watchdog Device
40 */
41#define INTEL_AMT_WATCHDOG_ID "INTCAMT"
42extern struct watchdog_device amt_wd_dev;
43 38
44/* 39/*
45 * AMTHI Client UUID 40 * AMTHI Client UUID
diff --git a/drivers/staging/mei/wd.c b/drivers/staging/mei/wd.c
index cb3f92d221a7..8094941a98f1 100644
--- a/drivers/staging/mei/wd.c
+++ b/drivers/staging/mei/wd.c
@@ -35,12 +35,16 @@ const u8 mei_wd_state_independence_msg[3][4] = {
35 {0x07, 0x02, 0x01, 0x10} 35 {0x07, 0x02, 0x01, 0x10}
36}; 36};
37 37
38/*
39 * AMT Watchdog Device
40 */
41#define INTEL_AMT_WATCHDOG_ID "INTCAMT"
42
38/* UUIDs for AMT F/W clients */ 43/* UUIDs for AMT F/W clients */
39const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89, 44const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89,
40 0x9D, 0xA9, 0x15, 0x14, 0xCB, 45 0x9D, 0xA9, 0x15, 0x14, 0xCB,
41 0x32, 0xAB); 46 0x32, 0xAB);
42 47
43
44void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) 48void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout)
45{ 49{
46 dev_dbg(&dev->pdev->dev, "timeout=%d.\n", timeout); 50 dev_dbg(&dev->pdev->dev, "timeout=%d.\n", timeout);
@@ -352,3 +356,25 @@ struct watchdog_device amt_wd_dev = {
352}; 356};
353 357
354 358
359void mei_watchdog_register(struct mei_device *dev)
360{
361 dev_dbg(&dev->pdev->dev, "dev->wd_timeout =%d.\n", dev->wd_timeout);
362
363 dev->wd_due_counter = !!dev->wd_timeout;
364
365 if (watchdog_register_device(&amt_wd_dev)) {
366 dev_err(&dev->pdev->dev, "unable to register watchdog device.\n");
367 dev->wd_interface_reg = false;
368 } else {
369 dev_dbg(&dev->pdev->dev, "successfully register watchdog interface.\n");
370 dev->wd_interface_reg = true;
371 }
372}
373
374void mei_watchdog_unregister(struct mei_device *dev)
375{
376 if (dev->wd_interface_reg)
377 watchdog_unregister_device(&amt_wd_dev);
378 dev->wd_interface_reg = false;
379}
380