Commit 93481c90 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/scm_drv: extend notify callback

Extend the notify callback of scm_driver by an event parameter
to allow to distinguish between different notifications.
Reviewed-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 8360cb5f
...@@ -96,11 +96,13 @@ struct scm_device { ...@@ -96,11 +96,13 @@ struct scm_device {
#define OP_STATE_TEMP_ERR 2 #define OP_STATE_TEMP_ERR 2
#define OP_STATE_PERM_ERR 3 #define OP_STATE_PERM_ERR 3
enum scm_event {SCM_CHANGE};
struct scm_driver { struct scm_driver {
struct device_driver drv; struct device_driver drv;
int (*probe) (struct scm_device *scmdev); int (*probe) (struct scm_device *scmdev);
int (*remove) (struct scm_device *scmdev); int (*remove) (struct scm_device *scmdev);
void (*notify) (struct scm_device *scmdev); void (*notify) (struct scm_device *scmdev, enum scm_event event);
void (*handler) (struct scm_device *scmdev, void *data, int error); void (*handler) (struct scm_device *scmdev, void *data, int error);
}; };
......
...@@ -13,12 +13,16 @@ ...@@ -13,12 +13,16 @@
#include <asm/eadm.h> #include <asm/eadm.h>
#include "scm_blk.h" #include "scm_blk.h"
static void notify(struct scm_device *scmdev) static void scm_notify(struct scm_device *scmdev, enum scm_event event)
{ {
pr_info("%lu: The capabilities of the SCM increment changed\n", switch (event) {
(unsigned long) scmdev->address); case SCM_CHANGE:
SCM_LOG(2, "State changed"); pr_info("%lu: The capabilities of the SCM increment changed\n",
SCM_LOG_STATE(2, scmdev); (unsigned long) scmdev->address);
SCM_LOG(2, "State changed");
SCM_LOG_STATE(2, scmdev);
break;
}
} }
static int scm_probe(struct scm_device *scmdev) static int scm_probe(struct scm_device *scmdev)
...@@ -64,7 +68,7 @@ static struct scm_driver scm_drv = { ...@@ -64,7 +68,7 @@ static struct scm_driver scm_drv = {
.name = "scm_block", .name = "scm_block",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.notify = notify, .notify = scm_notify,
.probe = scm_probe, .probe = scm_probe,
.remove = scm_remove, .remove = scm_remove,
.handler = scm_blk_irq, .handler = scm_blk_irq,
......
...@@ -211,7 +211,7 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale) ...@@ -211,7 +211,7 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale)
goto out; goto out;
scmdrv = to_scm_drv(scmdev->dev.driver); scmdrv = to_scm_drv(scmdev->dev.driver);
if (changed && scmdrv->notify) if (changed && scmdrv->notify)
scmdrv->notify(scmdev); scmdrv->notify(scmdev, SCM_CHANGE);
out: out:
device_unlock(&scmdev->dev); device_unlock(&scmdev->dev);
if (changed) if (changed)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment