diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2011-03-15 12:08:27 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2011-03-15 12:08:23 -0400 |
commit | f92519e83e3bd509cb861a946701a26f74cb77fa (patch) | |
tree | b6da7f33d563dc5f8932a8e32ef1add9c01b763d /drivers | |
parent | 97eb6bfcb942a59f5c8d273523d68c6a0f57a6f2 (diff) |
[S390] css: move io_private to drv_data
Use the subchannels drv_data to access io_subchannel_private
for io subchannels.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/s390/cio/device.c | 17 | ||||
-rw-r--r-- | drivers/s390/cio/io_sch.h | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index b7eaff9ca19e..7582a1e35eb8 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1030,6 +1030,7 @@ static void io_subchannel_init_fields(struct subchannel *sch) | |||
1030 | */ | 1030 | */ |
1031 | static int io_subchannel_probe(struct subchannel *sch) | 1031 | static int io_subchannel_probe(struct subchannel *sch) |
1032 | { | 1032 | { |
1033 | struct io_subchannel_private *io_priv; | ||
1033 | struct ccw_device *cdev; | 1034 | struct ccw_device *cdev; |
1034 | int rc; | 1035 | int rc; |
1035 | 1036 | ||
@@ -1073,10 +1074,11 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
1073 | if (rc) | 1074 | if (rc) |
1074 | goto out_schedule; | 1075 | goto out_schedule; |
1075 | /* Allocate I/O subchannel private data. */ | 1076 | /* Allocate I/O subchannel private data. */ |
1076 | sch->private = kzalloc(sizeof(struct io_subchannel_private), | 1077 | io_priv = kzalloc(sizeof(*io_priv), GFP_KERNEL | GFP_DMA); |
1077 | GFP_KERNEL | GFP_DMA); | 1078 | if (!io_priv) |
1078 | if (!sch->private) | ||
1079 | goto out_schedule; | 1079 | goto out_schedule; |
1080 | |||
1081 | set_io_private(sch, io_priv); | ||
1080 | css_schedule_eval(sch->schid); | 1082 | css_schedule_eval(sch->schid); |
1081 | return 0; | 1083 | return 0; |
1082 | 1084 | ||
@@ -1090,6 +1092,7 @@ out_schedule: | |||
1090 | static int | 1092 | static int |
1091 | io_subchannel_remove (struct subchannel *sch) | 1093 | io_subchannel_remove (struct subchannel *sch) |
1092 | { | 1094 | { |
1095 | struct io_subchannel_private *io_priv = to_io_private(sch); | ||
1093 | struct ccw_device *cdev; | 1096 | struct ccw_device *cdev; |
1094 | 1097 | ||
1095 | cdev = sch_get_cdev(sch); | 1098 | cdev = sch_get_cdev(sch); |
@@ -1099,11 +1102,12 @@ io_subchannel_remove (struct subchannel *sch) | |||
1099 | /* Set ccw device to not operational and drop reference. */ | 1102 | /* Set ccw device to not operational and drop reference. */ |
1100 | spin_lock_irq(cdev->ccwlock); | 1103 | spin_lock_irq(cdev->ccwlock); |
1101 | sch_set_cdev(sch, NULL); | 1104 | sch_set_cdev(sch, NULL); |
1105 | set_io_private(sch, NULL); | ||
1102 | cdev->private->state = DEV_STATE_NOT_OPER; | 1106 | cdev->private->state = DEV_STATE_NOT_OPER; |
1103 | spin_unlock_irq(cdev->ccwlock); | 1107 | spin_unlock_irq(cdev->ccwlock); |
1104 | ccw_device_unregister(cdev); | 1108 | ccw_device_unregister(cdev); |
1105 | out_free: | 1109 | out_free: |
1106 | kfree(sch->private); | 1110 | kfree(io_priv); |
1107 | sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); | 1111 | sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); |
1108 | return 0; | 1112 | return 0; |
1109 | } | 1113 | } |
@@ -1553,11 +1557,12 @@ spinlock_t * cio_get_console_lock(void) | |||
1553 | static int ccw_device_console_enable(struct ccw_device *cdev, | 1557 | static int ccw_device_console_enable(struct ccw_device *cdev, |
1554 | struct subchannel *sch) | 1558 | struct subchannel *sch) |
1555 | { | 1559 | { |
1560 | struct io_subchannel_private *io_priv = cio_get_console_priv(); | ||
1556 | int rc; | 1561 | int rc; |
1557 | 1562 | ||
1558 | /* Attach subchannel private data. */ | 1563 | /* Attach subchannel private data. */ |
1559 | sch->private = cio_get_console_priv(); | 1564 | memset(io_priv, 0, sizeof(*io_priv)); |
1560 | memset(sch->private, 0, sizeof(struct io_subchannel_private)); | 1565 | set_io_private(sch, io_priv); |
1561 | io_subchannel_init_fields(sch); | 1566 | io_subchannel_init_fields(sch); |
1562 | rc = cio_commit_config(sch); | 1567 | rc = cio_commit_config(sch); |
1563 | if (rc) | 1568 | if (rc) |
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h index 23f50ba50392..ba31ad88f4f7 100644 --- a/drivers/s390/cio/io_sch.h +++ b/drivers/s390/cio/io_sch.h | |||
@@ -18,7 +18,9 @@ struct io_subchannel_private { | |||
18 | } __packed options; | 18 | } __packed options; |
19 | } __aligned(8); | 19 | } __aligned(8); |
20 | 20 | ||
21 | #define to_io_private(n) ((struct io_subchannel_private *)n->private) | 21 | #define to_io_private(n) ((struct io_subchannel_private *) \ |
22 | dev_get_drvdata(&(n)->dev)) | ||
23 | #define set_io_private(n, p) (dev_set_drvdata(&(n)->dev, p)) | ||
22 | 24 | ||
23 | static inline struct ccw_device *sch_get_cdev(struct subchannel *sch) | 25 | static inline struct ccw_device *sch_get_cdev(struct subchannel *sch) |
24 | { | 26 | { |