aboutsummaryrefslogtreecommitdiff
path: root/drivers/s390/cio/device.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-01-26 14:10:43 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-01-26 14:10:59 +0100
commitcd6b4f27b9bb2a6a5ec82b96b87c85421257be6c (patch)
treebf5ac3d351242de6438ab1453a7f1b007f24c29f /drivers/s390/cio/device.c
parentbc698bcf8897363732226dc9ecba044771679996 (diff)
[S390] cio: Introduce subchannel->private.
Introduce a private pointer in struct subchannel to store per-subchannel type data (cannot use dev->priv since this is already used for something else). Create a new header io_sch.h for I/O subchannel specific structures and instructions. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/device.c')
-rw-r--r--drivers/s390/cio/device.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 7bccca9684e..30fe59cc28c 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -28,6 +28,7 @@
#include "css.h"
#include "device.h"
#include "ioasm.h"
+#include "io_sch.h"
/******************* bus type handling ***********************/
@@ -1143,6 +1144,11 @@ io_subchannel_probe (struct subchannel *sch)
*/
dev_id.devno = sch->schib.pmcw.dev;
dev_id.ssid = sch->schid.ssid;
+ /* Allocate I/O subchannel private data. */
+ sch->private = kzalloc(sizeof(struct io_subchannel_private),
+ GFP_KERNEL | GFP_DMA);
+ if (!sch->private)
+ return -ENOMEM;
cdev = get_disc_ccwdev_by_dev_id(&dev_id, NULL);
if (!cdev)
cdev = get_orphaned_ccwdev_by_dev_id(to_css(sch->dev.parent),
@@ -1160,9 +1166,10 @@ io_subchannel_probe (struct subchannel *sch)
return 0;
}
cdev = io_subchannel_create_ccwdev(sch);
- if (IS_ERR(cdev))
+ if (IS_ERR(cdev)) {
+ kfree(sch->private);
return PTR_ERR(cdev);
-
+ }
rc = io_subchannel_recog(cdev, sch);
if (rc) {
spin_lock_irqsave(sch->lock, flags);
@@ -1170,6 +1177,7 @@ io_subchannel_probe (struct subchannel *sch)
spin_unlock_irqrestore(sch->lock, flags);
if (cdev->dev.release)
cdev->dev.release(&cdev->dev);
+ kfree(sch->private);
}
return rc;
@@ -1191,6 +1199,7 @@ io_subchannel_remove (struct subchannel *sch)
spin_unlock_irqrestore(cdev->ccwlock, flags);
ccw_device_unregister(cdev);
put_device(&cdev->dev);
+ kfree(sch->private);
return 0;
}
@@ -1279,6 +1288,9 @@ ccw_device_console_enable (struct ccw_device *cdev, struct subchannel *sch)
{
int rc;
+ /* Attach subchannel private data. */
+ sch->private = cio_get_console_priv();
+ memset(sch->private, 0, sizeof(struct io_subchannel_private));
/* Initialize the ccw_device structure. */
cdev->dev.parent= &sch->dev;
rc = io_subchannel_recog(cdev, sch);