2 * Device driver for s390 storage class memory.
4 * Copyright IBM Corp. 2012
5 * Author(s): Sebastian Ott <sebott@linux.vnet.ibm.com>
8 #define KMSG_COMPONENT "scm_block"
9 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11 #include <linux/module.h>
12 #include <linux/slab.h>
16 static void scm_notify(struct scm_device
*scmdev
, enum scm_event event
)
18 struct scm_blk_dev
*bdev
= dev_get_drvdata(&scmdev
->dev
);
22 pr_info("%lx: The capabilities of the SCM increment changed\n",
23 (unsigned long) scmdev
->address
);
24 SCM_LOG(2, "State changed");
25 SCM_LOG_STATE(2, scmdev
);
28 SCM_LOG(2, "Increment available");
29 SCM_LOG_STATE(2, scmdev
);
30 scm_blk_set_available(bdev
);
35 static int scm_probe(struct scm_device
*scmdev
)
37 struct scm_blk_dev
*bdev
;
41 SCM_LOG_STATE(2, scmdev
);
43 if (scmdev
->attrs
.oper_state
!= OP_STATE_GOOD
)
46 bdev
= kzalloc(sizeof(*bdev
), GFP_KERNEL
);
50 dev_set_drvdata(&scmdev
->dev
, bdev
);
51 ret
= scm_blk_dev_setup(bdev
, scmdev
);
53 dev_set_drvdata(&scmdev
->dev
, NULL
);
62 static int scm_remove(struct scm_device
*scmdev
)
64 struct scm_blk_dev
*bdev
= dev_get_drvdata(&scmdev
->dev
);
66 scm_blk_dev_cleanup(bdev
);
67 dev_set_drvdata(&scmdev
->dev
, NULL
);
73 static struct scm_driver scm_drv
= {
81 .handler
= scm_blk_irq
,
84 int __init
scm_drv_init(void)
86 return scm_driver_register(&scm_drv
);
89 void scm_drv_cleanup(void)
91 scm_driver_unregister(&scm_drv
);