aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/device.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-01-26 08:10:43 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-01-26 08:10:59 -0500
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 7bccca9684e5..30fe59cc28c9 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -28,6 +28,7 @@
28#include "css.h" 28#include "css.h"
29#include "device.h" 29#include "device.h"
30#include "ioasm.h" 30#include "ioasm.h"
31#include "io_sch.h"
31 32
32/******************* bus type handling ***********************/ 33/******************* bus type handling ***********************/
33 34
@@ -1143,6 +1144,11 @@ io_subchannel_probe (struct subchannel *sch)
1143 */ 1144 */
1144 dev_id.devno = sch->schib.pmcw.dev; 1145 dev_id.devno = sch->schib.pmcw.dev;
1145 dev_id.ssid = sch->schid.ssid; 1146 dev_id.ssid = sch->schid.ssid;
1147 /* Allocate I/O subchannel private data. */
1148 sch->private = kzalloc(sizeof(struct io_subchannel_private),
1149 GFP_KERNEL | GFP_DMA);
1150 if (!sch->private)
1151 return -ENOMEM;
1146 cdev = get_disc_ccwdev_by_dev_id(&dev_id, NULL); 1152 cdev = get_disc_ccwdev_by_dev_id(&dev_id, NULL);
1147 if (!cdev) 1153 if (!cdev)
1148 cdev = get_orphaned_ccwdev_by_dev_id(to_css(sch->dev.parent), 1154 cdev = get_orphaned_ccwdev_by_dev_id(to_css(sch->dev.parent),
@@ -1160,9 +1166,10 @@ io_subchannel_probe (struct subchannel *sch)
1160 return 0; 1166 return 0;
1161 } 1167 }
1162 cdev = io_subchannel_create_ccwdev(sch); 1168 cdev = io_subchannel_create_ccwdev(sch);
1163 if (IS_ERR(cdev)) 1169 if (IS_ERR(cdev)) {
1170 kfree(sch->private);
1164 return PTR_ERR(cdev); 1171 return PTR_ERR(cdev);
1165 1172 }
1166 rc = io_subchannel_recog(cdev, sch); 1173 rc = io_subchannel_recog(cdev, sch);
1167 if (rc) { 1174 if (rc) {
1168 spin_lock_irqsave(sch->lock, flags); 1175 spin_lock_irqsave(sch->lock, flags);
@@ -1170,6 +1177,7 @@ io_subchannel_probe (struct subchannel *sch)
1170 spin_unlock_irqrestore(sch->lock, flags); 1177 spin_unlock_irqrestore(sch->lock, flags);
1171 if (cdev->dev.release) 1178 if (cdev->dev.release)
1172 cdev->dev.release(&cdev->dev); 1179 cdev->dev.release(&cdev->dev);
1180 kfree(sch->private);
1173 } 1181 }
1174 1182
1175 return rc; 1183 return rc;
@@ -1191,6 +1199,7 @@ io_subchannel_remove (struct subchannel *sch)
1191 spin_unlock_irqrestore(cdev->ccwlock, flags); 1199 spin_unlock_irqrestore(cdev->ccwlock, flags);
1192 ccw_device_unregister(cdev); 1200 ccw_device_unregister(cdev);
1193 put_device(&cdev->dev); 1201 put_device(&cdev->dev);
1202 kfree(sch->private);
1194 return 0; 1203 return 0;
1195} 1204}
1196 1205
@@ -1279,6 +1288,9 @@ ccw_device_console_enable (struct ccw_device *cdev, struct subchannel *sch)
1279{ 1288{
1280 int rc; 1289 int rc;
1281 1290
1291 /* Attach subchannel private data. */
1292 sch->private = cio_get_console_priv();
1293 memset(sch->private, 0, sizeof(struct io_subchannel_private));
1282 /* Initialize the ccw_device structure. */ 1294 /* Initialize the ccw_device structure. */
1283 cdev->dev.parent= &sch->dev; 1295 cdev->dev.parent= &sch->dev;
1284 rc = io_subchannel_recog(cdev, sch); 1296 rc = io_subchannel_recog(cdev, sch);