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 notify(struct scm_device *scmdev)
18 pr_info("%lu: The capabilities of the SCM increment changed\n",
19 (unsigned long) scmdev->address);
20 SCM_LOG(2, "State changed");
21 SCM_LOG_STATE(2, scmdev);
24 static int scm_probe(struct scm_device *scmdev)
26 struct scm_blk_dev *bdev;
30 SCM_LOG_STATE(2, scmdev);
32 if (scmdev->attrs.oper_state != OP_STATE_GOOD)
35 bdev = kzalloc(sizeof(*bdev), GFP_KERNEL);
39 dev_set_drvdata(&scmdev->dev, bdev);
40 ret = scm_blk_dev_setup(bdev, scmdev);
42 dev_set_drvdata(&scmdev->dev, NULL);
51 static int scm_remove(struct scm_device *scmdev)
53 struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev);
55 scm_blk_dev_cleanup(bdev);
56 dev_set_drvdata(&scmdev->dev, NULL);
62 static struct scm_driver scm_drv = {
70 .handler = scm_blk_irq,
73 int __init scm_drv_init(void)
75 return scm_driver_register(&scm_drv);
78 void scm_drv_cleanup(void)
80 scm_driver_unregister(&scm_drv);